File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed
gateway-ha/src/test/java/io/trino/gateway/ha/router Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change 2424import org .junit .jupiter .api .TestInstance .Lifecycle ;
2525import org .testcontainers .containers .JdbcDatabaseContainer ;
2626
27+ import java .math .BigDecimal ;
2728import java .util .List ;
2829import java .util .Optional ;
2930
@@ -117,16 +118,17 @@ void testFindDistribution()
117118 @ Test
118119 void testTimestampParsing ()
119120 {
120- long result = 30338640 ;
121+ // This ensures odd-minute values remain precision when converted from different formats.
122+ long result = 30338641 ;
121123
122- // postgres: minute -> {Double@9333} 3.033864E7
123- String postgresTimestamp = "3.033864E7 " ;
124- long parsedLongTimestamp = ( long ) Float . parseFloat ( postgresTimestamp );
124+ // postgres: minute -> {Double@9333} 3.0338641E7
125+ String postgresTimestamp = "3.0338641E7 " ;
126+ long parsedLongTimestamp = new BigDecimal ( postgresTimestamp ). longValue ( );
125127 assertThat (parsedLongTimestamp ).isEqualTo (result );
126128
127- // mysql: minute -> {BigDecimal@9775} "30338640 "
128- String mysqlTimestamp = "30338640 " ;
129- long parsedLongTimestamp2 = ( long ) Float . parseFloat ( mysqlTimestamp );
129+ // mysql: minute -> {BigDecimal@9775} "30338641 "
130+ String mysqlTimestamp = "30338641 " ;
131+ long parsedLongTimestamp2 = new BigDecimal ( mysqlTimestamp ). longValue ( );
130132 assertThat (parsedLongTimestamp2 ).isEqualTo (result );
131133 }
132134}
You can’t perform that action at this time.
0 commit comments