Skip to content

Commit c7fb19c

Browse files
zhaomin1423yaooqinn
authored andcommitted
[KYUUBI #3568] [Bug] [Doris Engine] Fix return decimal, date, timestamp using string
### _Why are the changes needed?_ close #3568 (comment) ### _How was this patch tested?_ - [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible - [ ] Add screenshots for manual tests if appropriate - [ ] [Run test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests) locally before make a pull request Closes #3569 from zhaomin1423/fix_doris_type. Closes #3568 f83cc48 [Min Zhao] fix style d044747 [Min Zhao] [KYUUBI #3568] [Bug] [Doris Engine] Fix return decimal, date, timestamp using string Authored-by: Min Zhao <zhaomin1423@163.com> Signed-off-by: Kent Yao <yao@apache.org> (cherry picked from commit 5ec0c86) Signed-off-by: Kent Yao <yao@apache.org>
1 parent 506ba10 commit c7fb19c

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

externals/kyuubi-jdbc-engine/src/main/scala/org/apache/kyuubi/engine/jdbc/doris/DorisSchemaHelper.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ class DorisSchemaHelper extends SchemaHelper {
4444
TTypeId.STRING_TYPE
4545

4646
case Types.DATE =>
47-
TTypeId.STRING_TYPE
47+
TTypeId.DATE_TYPE
4848

4949
case Types.TIMESTAMP =>
50-
TTypeId.STRING_TYPE
50+
TTypeId.TIMESTAMP_TYPE
5151

5252
case Types.DECIMAL =>
53-
TTypeId.STRING_TYPE
53+
TTypeId.DECIMAL_TYPE
5454

5555
// TODO add more type support
5656
case _ =>

externals/kyuubi-jdbc-engine/src/test/scala/org/apache/kyuubi/engine/jdbc/doris/StatementSuite.scala

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
*/
1717
package org.apache.kyuubi.engine.jdbc.doris
1818

19+
import java.sql.{Date, Timestamp}
20+
1921
import org.apache.kyuubi.operation.HiveJDBCTestHelper
2022

2123
class StatementSuite extends WithDorisEngine with HiveJDBCTestHelper {
@@ -77,9 +79,9 @@ class StatementSuite extends WithDorisEngine with HiveJDBCTestHelper {
7779
assert(resultSet1.getObject(4) == 4)
7880
assert(resultSet1.getObject(5) == 5)
7981
assert(resultSet1.getObject(6) == "6")
80-
assert(resultSet1.getObject(7) == "7.7")
81-
assert(resultSet1.getObject(8) == "2022-05-08")
82-
assert(resultSet1.getObject(9) == "2022-05-08 17:47:45")
82+
assert(resultSet1.getObject(7) == new java.math.BigDecimal("7.7"))
83+
assert(resultSet1.getObject(8) == Date.valueOf("2022-05-08"))
84+
assert(resultSet1.getObject(9) == Timestamp.valueOf("2022-05-08 17:47:45"))
8385
assert(resultSet1.getObject(10) == "a")
8486
assert(resultSet1.getObject(11) == "Hello")
8587
assert(resultSet1.getObject(12) == "Hello, Kyuubi")

0 commit comments

Comments
 (0)