fix(unparser): Fix BigQuery timestamp literal format in SQL unparsing#21103
fix(unparser): Fix BigQuery timestamp literal format in SQL unparsing#21103sgrebnov wants to merge 3 commits intoapache:mainfrom
Conversation
nuno-faria
left a comment
There was a problem hiding this comment.
LGTM, thanks @sgrebnov.
I wonder if timestamp_with_tz_to_string should use the version without the space as the default, since I think according to ISO 8601 it shouldn't be there.
I tested with PostgreSQL/SQLite/MySQL and they all support the version without the space as well.
@nuno-faria - that is a great point, I think we should be using |
Sounds good to me. Should we do on this PR or leave as a follow up? |
Which issue does this PR close?
The default
Dialect::timestamp_with_tz_to_stringusesdt.to_string()which produces timestamps with a space before the TimeZone offset. This causes filter pushdown to fail when unparsing timestamp predicates for BigQuery.BigQuery rejects this format. Per the BigQuery timestamp docs, the offset must be attached directly to the time:
What changes are included in this PR?
Following similar to DuckDB pattern/fix override
timestamp_with_tz_to_stringforBigQueryDialectto produce valid timestamp formatBefore (default
dt.to_string()):After (%:z format):
Are these changes tested?
Added unit test and manual e2e test with Google BigQuery instance.
Are there any user-facing changes?
No