jason810496 commented on code in PR #69454:
URL: https://github.com/apache/airflow/pull/69454#discussion_r3533491287
##########
airflow-core/src/airflow/cli/commands/partition_command.py:
##########
@@ -64,8 +66,12 @@ def clear(args, *, session: Session = NEW_SESSION) -> None:
args.end_date = parsedate(parts[1].strip())
except ValueError:
raise SystemExit("--date sides must be parseable as a date or
datetime.")
+ has_start = has_end = True
- has_date_window = args.start_date is not None or args.end_date is not None
+ if has_start and has_end and args.start_date > args.end_date:
+ raise SystemExit("--start-date must be on or before --end-date.")
Review Comment:
When the inverted window comes from `--date a~b`, the error still says
"--start-date must be on or before --end-date", naming flags the user did not
type. Harmless but slightly confusing.
##########
airflow-core/src/airflow/cli/commands/partition_command.py:
##########
@@ -44,7 +44,9 @@ def clear(args, *, session: Session = NEW_SESSION) -> None:
the matching partitions; a date-only value (no time) is treated as local
midnight.
"""
- has_range = args.start_date is not None or args.end_date is not None or
args.date is not None
+ has_start = args.start_date is not None
+ has_end = args.end_date is not None
+ has_range = has_start or has_end or args.date is not None
Review Comment:
Perhaps we can pre-validate the given date is `yyyy-mm-dd` format or not to
avoid the following issue (thought it likely _not_ happned):
window that is validly ordered in wall-clock terms but supplied with two
*different* explicit UTC offsets (e.g. `--start-date 2026-01-01T23:00:00-10:00
--end-date 2026-01-02T00:00:00+14:00`) would be rejected by this guard even
though the query would accept it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]