Skip to content

Commit

Permalink
checkpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
radeusgd committed Jan 25, 2022
1 parent c937d11 commit 46aaaaa
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ 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
result = case reorder of
True ->
here.select_indices_reordering internal_columns indices
Expand Down Expand Up @@ -75,4 +76,11 @@ select_indices_reordering vector indices =
The elements are returned in the same order as they appeared in the original vector.
select_indices_preserving_order vector indices =
indices_to_keep = Map.from_vector (indices.map i-> [i, True])
vector.map_with_index
vector.filter_with_index ix-> elem->
indices_to_keep.get_or_else ix False

## PRIVATE
Checks if the given index is in the valid range for the provided vector.
is_index_valid vector ix =
actual_ix = if ix < 0 then vector.length+ix else ix
ix>=0 && ix<vector.length

0 comments on commit 46aaaaa

Please sign in to comment.