raminqaf commented on PR #27793:
URL: https://github.com/apache/flink/pull/27793#issuecomment-7306201548

   > there might be a potential breaking change
   > 
   > SELECT  TO_TIMESTAMP('2023-01-01 12:30:00.12348', 'yyyy-MM-dd 
HH:mm:ss.SSSS')
   > before the change it is type `TIMESTAMP(3)`, after `TIMESTAMP(4)` do we 
have a restore test with compiled plans for such case? What will happen?
   
   Thanks, good find. Flink truncates the extra digits, while PostgreSQL rounds 
them. I kept truncation because Flink's CAST also truncates: `CAST('2023-01-01 
12:30:00.12348' AS TIMESTAMP(4))` returns .`1234`. Engines differ here. Spark 
and DuckDB reject the input.
   
   Checking this showed a worse problem. The format asks for 4 digits (`SSSS`) 
and the input has 5, so the parse fell back to a parser that ignores the 
format. That parser kept all 5 digits in a TIMESTAMP(4) value. It printed as 
`.1234`, but comparing it with `TIMESTAMP '2023-01-01 12:30:00.1234'` returned 
false. The first commit now truncates in that fallback too. `TO_TIMESTAMP_LTZ` 
has the same problem since 2.3.0, filed as FLINK-41740.


-- 
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]

Reply via email to