diff --git a/distribution/lib/Standard/Table/0.2.32-SNAPSHOT/src/Error.enso b/distribution/lib/Standard/Table/0.2.32-SNAPSHOT/src/Error.enso index f8b981d1c8f50..64266a0b12b0f 100644 --- a/distribution/lib/Standard/Table/0.2.32-SNAPSHOT/src/Error.enso +++ b/distribution/lib/Standard/Table/0.2.32-SNAPSHOT/src/Error.enso @@ -8,7 +8,7 @@ Missing_Input_Columns.to_display_text = ## One or more column indexes were invalid on the input table. Can occur when using By_Index. -type Column_Indexes_Out_Of_Range (indexes : [Number]) +type Column_Indexes_Out_Of_Range (indexes : [Integer]) Column_Indexes_Out_Of_Range.to_display_text : Text Column_Indexes_Out_Of_Range.to_display_text = case this.indexes.length of diff --git a/distribution/lib/Standard/Table/0.2.32-SNAPSHOT/src/Internal/Table_Helpers.enso b/distribution/lib/Standard/Table/0.2.32-SNAPSHOT/src/Internal/Table_Helpers.enso index a950a30f66735..87e223536b27a 100644 --- a/distribution/lib/Standard/Table/0.2.32-SNAPSHOT/src/Internal/Table_Helpers.enso +++ b/distribution/lib/Standard/Table/0.2.32-SNAPSHOT/src/Internal/Table_Helpers.enso @@ -47,20 +47,24 @@ select_columns internal_columns selector reorder on_problems warnings = result = Matching.match_criteria internal_columns names reorder=reorder name_mapper=(_.name) matching_strategy=matching_strategy on_problems=on_problems warnings=warnings Warnings.map_warnings_and_errors promote_no_matches_to_missing_columns result By_Index indices -> - # TODO partition indices into valid and invalid ones, so that we can report a warning or error + partitioned_indices = indices.partition (is_index_valid internal_columns) + good_indices = partitioned_indices.first + bad_indices = partitioned_indices.second + issues = if bad_indices.is_empty then [] else + [Column_Indexes_Out_Of_Range bad_indices] result = case reorder of True -> here.select_indices_reordering internal_columns indices False -> here.select_indices_preserving_order internal_columns indices - # TODO warn if there are any non-unique columns in result? - result.distinct on=_.name + # TODO warn if there are any non-unique columns in result? TODO test cases to illustrate + Problem_Behavior_Module.attach_issues_as_needed (result.distinct on=_.name) on_problems issues warnings=warnings By_Column columns -> names = columns.map .name result = Matching.match_criteria internal_columns names reorder=reorder name_mapper=(_.name) matching_strategy=(Matching.Exact case_sensitivity=True) on_problems=on_problems warnings=warnings Warnings.map_warnings_and_errors promote_no_matches_to_missing_columns result - issues = if result.is_empty then [] else [No_Output_Columns] + issues = if result.is_empty then [No_Output_Columns] else [] Problem_Behavior_Module.attach_issues_as_needed result on_problems issues warnings=warnings ## PRIVATE