sgrebnov opened a new pull request, #21103:
URL: https://github.com/apache/datafusion/pull/21103

   ## Which issue does this PR close?
   
   The default `Dialect::timestamp_with_tz_to_string` uses `dt.to_string()` 
which produces timestamps with a space before the TimeZone offset. This causes 
filter pushdown to fail when unparsing timestamp predicates for BigQuery.
   
   >2016-08-06 20:05:00 +00:00 <- invalid for BigQuery: 
   invalid timestamp: '2016-08-06 20:05:00 +00:00'; while executing the filter 
on column 'startTime' (query) (sqlstate: [0, 0, 0, 0, 0], vendor_code: 
-2147483648)
   
   BigQuery rejects this format. Per the [BigQuery timestamp 
docs](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#timestamp_type),
 the offset must be attached directly to the time:
   
   >2016-08-06 20:05:00+00:00 <- valid
   
   ## What changes are included in this PR?
   
   Following similar to [DuckDB pattern/fix 
](https://github.com/apache/datafusion/pull/17653) override 
`timestamp_with_tz_to_string` for `` to produce valid timestamp format
   
   **Before (default `dt.to_string()`):**
   
   ```sql
   CAST('2016-08-06 20:05:00 +00:00' AS TIMESTAMP)  -- BigQuery error
   ```
   After (%:z format):
   
   ```sql
   CAST('2016-08-06 20:05:00+00:00' AS TIMESTAMP)  -- valid BigQuery timestamp
   ```
   
   
   ## Are these changes tested?
   
   Added unit test and manual e2e test with Google BigQuery instance.
   
   ## Are there any user-facing changes?
   
   No


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to