This is an automated email from the ASF dual-hosted git repository. zclll pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push: new 64608924066 [fix](regression-framework) fix time type compatibility in regression framework(#52692) 64608924066 is described below commit 6460892406699ece8c354f796d6c2d6f91a074a4 Author: shuke <sh...@selectdb.com> AuthorDate: Fri Jul 4 16:22:54 2025 +0800 [fix](regression-framework) fix time type compatibility in regression framework(#52692) When handling the time type returned by Doris using the regression test framework, precision will be lost. This PR fixes the issue. when processing: `select cast("10:10:10.123" as time(6))`, result will be 10:10:10. with this pr, result will be 10:10:10.123000 --- regression-test/data/cast_p0/cast_to_time.out | Bin 1986 -> 2164 bytes .../data/correctness/test_cast_as_time.out | Bin 409 -> 410 bytes .../data/nereids_p0/datatype/test_cast.out | Bin 1346 -> 1350 bytes .../datetime_functions/test_func_time.out | Bin 793 -> 887 bytes .../org/apache/doris/regression/util/JdbcUtils.groovy | 18 +++++++++++++++++- 5 files changed, 17 insertions(+), 1 deletion(-) diff --git a/regression-test/data/cast_p0/cast_to_time.out b/regression-test/data/cast_p0/cast_to_time.out index 4ba5b9c4d41..8e696388444 100644 Binary files a/regression-test/data/cast_p0/cast_to_time.out and b/regression-test/data/cast_p0/cast_to_time.out differ diff --git a/regression-test/data/correctness/test_cast_as_time.out b/regression-test/data/correctness/test_cast_as_time.out index 3d3a976fa07..fad9a67a182 100644 Binary files a/regression-test/data/correctness/test_cast_as_time.out and b/regression-test/data/correctness/test_cast_as_time.out differ diff --git a/regression-test/data/nereids_p0/datatype/test_cast.out b/regression-test/data/nereids_p0/datatype/test_cast.out index dae046fdcc4..372f2c2be54 100644 Binary files a/regression-test/data/nereids_p0/datatype/test_cast.out and b/regression-test/data/nereids_p0/datatype/test_cast.out differ diff --git a/regression-test/data/query_p0/sql_functions/datetime_functions/test_func_time.out b/regression-test/data/query_p0/sql_functions/datetime_functions/test_func_time.out index 0682f819436..a18e033afef 100644 Binary files a/regression-test/data/query_p0/sql_functions/datetime_functions/test_func_time.out and b/regression-test/data/query_p0/sql_functions/datetime_functions/test_func_time.out differ diff --git a/regression-test/framework/src/main/groovy/org/apache/doris/regression/util/JdbcUtils.groovy b/regression-test/framework/src/main/groovy/org/apache/doris/regression/util/JdbcUtils.groovy index 670f6ad4e91..251036ea03b 100644 --- a/regression-test/framework/src/main/groovy/org/apache/doris/regression/util/JdbcUtils.groovy +++ b/regression-test/framework/src/main/groovy/org/apache/doris/regression/util/JdbcUtils.groovy @@ -24,6 +24,7 @@ import java.sql.Connection import java.sql.PreparedStatement import java.sql.ResultSet import java.sql.ResultSetMetaData +import java.sql.Types; class JdbcUtils { static String replaceHostUrl(String originUri, String newHost) { @@ -136,7 +137,22 @@ class JdbcUtils { def row = new ArrayList<>() for (int i = 1; i <= columnCount; ++i) { try { - row.add(resultSet.getObject(i)) + if (resultSet.metaData.getColumnType(i) == Types.TIME) { + /* + * For time types, there are three ways to save the results returned by Doris: + * 1. Default behavior: row.add(resultSet.getObject(i)) + * which will return a Time object. + * Use the Time type will lose the fractional precision of the time. + * 2. Use LocalTime: row.add(resultSet.getColumn(i, LocalTime.class)) + * which will lose the padding zeros of the fractional precision. + * For example, 0:0:0.123000 can only retain 0:0:0.123. + * 3. Use a string: row.add(new String(resultSet.getBytes(i))) + * This can preserve the full precision, so the third solution is preferred. + */ + row.add(new String(resultSet.getBytes(i))) + } else { + row.add(resultSet.getObject(i)) + } } catch (Throwable t) { if(resultSet.getBytes(i) != null){ row.add(new String(resultSet.getBytes(i))) --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org