Repository navigation
fix(validation): read the unit of Redshift's PGDATE_PART as a unit - #677
Merged
Merged
Conversation
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.
ayushtkn
approved these changes
Nov 1, 2026
16 of 17 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #598, covering the two non-blocking notes from its review.
PGDATE_PARTunit read as a column.PGDATE_PARTis Redshift's name forDATE_PART. The redshift reader keeps it as an untyped function, so the reference check read its first argument as a column: a REDSHIFT metricMAX(PGDATE_PART(day, orders.ordered))warned thatdayis not qualified. It is now inDATE_PART_FUNCTIONS, next toDATE_PARTandDATEADD, so the unit is read as a unit.test_the_regex_match_is_invalid_under_ansi_sqlasserted!= [], 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.pychange and passes with it.Related Issues
Follow-up to #598.
Checklist
Validation
Tests
pytest/ CI green):validation/test_validate.py,validation/tests/(523 passed, 1 skipped on macOS),python/tests/(269 passed), and the example validationsCompliance