fix(redshift): transpile TIMESTAMPDIFF to DATEDIFF [CLAUDE]#7902
Closed
chuenchen309 wants to merge 1 commit into
Closed
fix(redshift): transpile TIMESTAMPDIFF to DATEDIFF [CLAUDE]#7902chuenchen309 wants to merge 1 commit into
chuenchen309 wants to merge 1 commit into
Conversation
Redshift has no TIMESTAMPDIFF function, so transpiling MySQL's
TIMESTAMPDIFF(unit, a, b) to Redshift emitted an invalid call with the
arguments in raw AST order, TIMESTAMPDIFF(b, a, unit). Redshift already
renders the sibling exp.DateDiff via date_delta_sql("DATEDIFF"); wire
exp.TimestampDiff to the same handler so it becomes DATEDIFF(unit, a, b).
Co-authored-by AI: Claude (Claude Code). [CLAUDE]
Collaborator
|
Given the previous PRs, I don't trust that this has been tested against the engines for semantic equivalency. Therefore, I'm closing this. @chuenchen309 some of the other PRs were easy/quick to review and we thank you for them. But, given our team's bandwidth, we won't be spending time reviewing these Claude-generated PRs moving forward, because the quality is not up to expectations. |
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.
Problem
TIMESTAMPDIFFtranspiled from MySQL to Redshift produces invalid SQL:Redshift has no
TIMESTAMPDIFFfunction, and the arguments come out in raw AST order (the unit last), so the statement fails to run.Cause
MySQL's
TIMESTAMPDIFFparses toexp.TimestampDiff, butRedshiftGenerator.TRANSFORMShad no entry for it, so it fell back to the default function rendering.Fix
Redshift already renders the sibling
exp.DateDiffwithdate_delta_sql("DATEDIFF"). Wiringexp.TimestampDiffto the same handler producesDATEDIFF(unit, start, end), which matches Redshift's builtin and preserves theend - startsemantics.# -> SELECT DATEDIFF(SECOND, start_ts, end_ts)Testing
Added a read-direction case in
test_redshift.py(fails onmain, passes here).tests/dialects/full suite: 748 passed, no regressions.ruff check/ruff formatclean.Disclosure: authored by an AI coding agent (Claude Code) on my account — it found the bug, ran the repro, wrote the test and this description. I review every change and am accountable for it; the verification is real and re-runnable from the diff.