Skip to content

fix(validation): read the unit of Redshift's PGDATE_PART as a unit - #677

Merged
christianeu-db merged 1 commit into
apache:mainfrom
jbonofre:redshift-pgdate-part
Nov 5, 2026
Merged

christianeu-db merged 1 commit into
apache:mainfrom
jbonofre:redshift-pgdate-part

Conversation

@jbonofre

@jbonofre jbonofre commented Nov 1, 2026

Copy link
Copy Markdown
Member

Summary

Follow-up to #598, covering the two non-blocking notes from its review.

  • PGDATE_PART unit read as a column. PGDATE_PART is Redshift's name for DATE_PART. The redshift reader keeps it as an untyped function, so the reference check read its first argument as a column: a REDSHIFT metric MAX(PGDATE_PART(day, orders.ordered)) warned that day is not qualified. It is now in DATE_PART_FUNCTIONS, next to DATE_PART and DATEADD, so the unit is read as a unit.
  • Stricter ANSI_SQL control. test_the_regex_match_is_invalid_under_ansi_sql asserted != [], which the unchecked-dialect warning also satisfies. It now uses _is_error_not_warning, like the unparseable-body tests.

The new test fails without the validate.py change and passes with it.

Related Issues

Follow-up to #598.

Checklist

Validation

  • New validation cases are covered by tests

Tests

  • All existing tests pass (pytest / CI green): validation/test_validate.py, validation/tests/ (523 passed, 1 skipped on macOS), python/tests/ (269 passed), and the example validations

Compliance

  • No third-party dependencies are added

Follow-up to apache#598, from its review.

PGDATE_PART is Redshift's name for DATE_PART. The redshift reader keeps
it as an untyped function, so the reference check read its unit as a
column: `MAX(PGDATE_PART(day, orders.ordered))` warned that `day` is not
qualified. Adding it to DATE_PART_FUNCTIONS reads the first argument as
the unit, the way DATE_PART and DATEADD already are.

The ANSI_SQL control for the `~` regex-match tests asserted only that
validate_sql returned something, which the unchecked-dialect warning
also satisfies. It now asserts an error, like the unparseable-body
tests.

@christianeu-db christianeu-db left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@christianeu-db
christianeu-db merged commit 172a3e5 into apache:main Nov 5, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants