apilloud commented on a change in pull request #12054: URL: https://github.com/apache/beam/pull/12054#discussion_r445769159
########## File path: sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/logicaltypes/SqlTypes.java ########## @@ -27,4 +28,7 @@ private SqlTypes() {} /** Beam LogicalType corresponding to ZetaSQL/CalciteSQL DATE type. */ public static final LogicalType<LocalDate, Long> DATE = new Date(); + + /** Beam LogicalType corresponding to ZetaSQL/CalciteSQL TIME type. */ + public static final LogicalType<LocalTime, Long> TIME = new Time(); Review comment: It looks like one or more of the conversions (at very least `LocalTime` to `Long`) is not lossless, it corrupts leap seconds. Here is a set of trivial identity test cases that needs to pass any type conversion: ``` SELECT CAST(CAST(TIME "00:00:00" as STRING) as TIME), CAST(CAST(TIME "23:59:59.999999" as STRING) as TIME), CAST(CAST(TIME "01:02:03.123456" as STRING) as TIME), CAST(CAST(TIME "01:02:03.12345" as STRING) as TIME), CAST(CAST(TIME "01:02:03.120000" as STRING) as TIME), CAST(CAST(TIME "01:02:3" as STRING) as TIME), CAST(CAST(TIME "01:2:03" as STRING) as TIME), CAST(CAST(TIME "1:02:03" as STRING) as TIME), #Leap second cases CAST(CAST(TIME "23:59:60" as STRING) as TIME), CAST(CAST(TIME "12:59:60" as STRING) as TIME), CAST(CAST(TIME "12:59:60.123456" as STRING) as TIME), CAST(CAST("00:00:00" as TIME) as STRING), CAST(CAST("23:59:59.999999" as TIME) as STRING), CAST(CAST("01:02:03.123456" as TIME) as STRING), CAST(CAST("01:02:03.12345" as TIME) as STRING), CAST(CAST("01:02:03.120000" as TIME) as STRING), CAST(CAST("01:02:3" as TIME) as STRING), CAST(CAST("01:2:03" as TIME) as STRING), CAST(CAST("1:02:03" as TIME) as STRING), #Leap second cases CAST(CAST("23:59:60" as TIME) as STRING), CAST(CAST("12:59:60" as TIME) as STRING), CAST(CAST("12:59:60.123456" as TIME) as STRING) ``` ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org