Skip to content

Commit

Permalink
filter/subsample: Put an error message closer to where the logic is
Browse files Browse the repository at this point in the history
  • Loading branch information
victorlin committed Jun 20, 2023
1 parent babaae6 commit 3c8b5b4
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions augur/filter/subsample.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@ def get_valid_group_by_columns(metadata_columns: Set[str], group_by: List[str])
raise AugurError(f"{constants.DATE_MONTH_COLUMN!r} and {constants.DATE_WEEK_COLUMN!r} grouping cannot be used together.")

if generated_columns_requested:

for col in sorted(generated_columns_requested):
if col in metadata_columns:
print_err(f"WARNING: `--group-by {col}` uses a generated {col} value from the {METADATA_DATE_COLUMN!r} column. The custom '{col}' column in the metadata is ignored for grouping purposes.")

if METADATA_DATE_COLUMN not in metadata_columns:
print_err(f"WARNING: A {METADATA_DATE_COLUMN!r} column could not be found to group-by {sorted(generated_columns_requested)}.")
print_err(f"Filtering by group may behave differently than expected!")
Expand Down Expand Up @@ -375,6 +370,10 @@ def create_grouping_table(group_by_columns: List[str], metadata_columns: Set[str
# Add an extra comma for valid SQL.
+ ',')

for column in sorted(generated_group_by_columns):
if column in metadata_columns:
print_err(f"WARNING: `--group-by {column}` uses a generated {column} value from the {METADATA_DATE_COLUMN!r} column. The custom '{column}' column in the metadata is ignored for grouping purposes.")

metadata_group_by_columns = group_by_columns_set - generated_group_by_columns

if metadata_group_by_columns:
Expand Down

0 comments on commit 3c8b5b4

Please sign in to comment.