Repository navigation
fix: datetime_diff transpilation bigquery to duckdb - #6126
Merged
Merged
Conversation
georgesittas
approved these changes
Oct 16, 2025
georgesittas
left a comment
Collaborator
There was a problem hiding this comment.
Should be good to go after removing that line in bigquery.py.
fresioAS
pushed a commit
to fresioAS/sqlglot
that referenced
this pull request
May 3, 2026
georgesittas
added a commit
that referenced
this pull request
Jul 20, 2026
…no [CLAUDE] (#7895) * Fix TIMESTAMP_DIFF/DATETIME_DIFF transpilation to Presto/Trino [CLAUDE] Presto and Trino only have date_diff(unit, ts1, ts2); they have no TIMESTAMPDIFF, DATETIME_DIFF or TIMESTAMP_DIFF. sqlglot maps exp.DateDiff to DATE_DIFF for Presto, but exp.TimestampDiff and exp.DatetimeDiff (produced by e.g. BigQuery TIMESTAMP_DIFF/DATETIME_DIFF) had no Presto/Trino handler and fell through to the generic function fallback, emitting the node name verbatim with the unit-last arg order - invalid, unparseable SQL. Route all three diff nodes through DATE_DIFF(unit, expression, this) for Presto (Trino inherits it). date_diff(unit, ts1, ts2) = ts2 - ts1, so (expression, this) preserves the source's a - b semantics, matching what DATE_DIFF and DuckDB already produce (cf. merged #6126, #4334). * Update tests/dialects/test_bigquery.py --------- Co-authored-by: Jo <[email protected]>
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.
fixes: #6107