Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -279,4 +279,13 @@ CREATE TABLE doris_test.ts
ts UInt64
)
ENGINE = MergeTree
ORDER BY id;

CREATE TABLE doris_test.dt_with_tz
(
id Int64,
dt1 DateTime('Asia/Shanghai'),
dt2 DateTime64(6, 'Asia/Shanghai')
)
ENGINE = MergeTree
ORDER BY id;
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ INSERT INTO doris_test.final_test Values (1, 'second');

INSERT INTO doris_test.ts values (1,1694438743);


INSERT INTO doris_test.dt_with_tz values(1, '2022-01-02 00:00:00','2022-01-02 00:00:00.000000');
Original file line number Diff line number Diff line change
Expand Up @@ -73,20 +73,14 @@ protected Type jdbcTypeToDoris(JdbcFieldSchema fieldSchema) {
if (ckType.startsWith("DateTime(") || ckType.equals("DateTime")) {
return ScalarType.createDatetimeV2Type(0);
} else {
int indexStart = ckType.indexOf('(');
int indexEnd = ckType.indexOf(')');
if (indexStart != -1 && indexEnd != -1) {
String scaleStr = ckType.substring(indexStart + 1, indexEnd);
int scale = Integer.parseInt(scaleStr);
if (scale > JDBC_DATETIME_SCALE) {
scale = JDBC_DATETIME_SCALE;
}
// return with the actual scale
return ScalarType.createDatetimeV2Type(scale);
} else {
// default precision if not specified
return ScalarType.createDatetimeV2Type(JDBC_DATETIME_SCALE);
// DateTime64 with millisecond precision
// Datetime64(6) / DateTime64(6, 'Asia/Shanghai')
String[] accuracy = ckType.substring(11, ckType.length() - 1).split(", ");
int precision = Integer.parseInt(accuracy[0]);
if (precision > 6) {
precision = JDBC_DATETIME_SCALE;
}
return ScalarType.createDatetimeV2Type(precision);
}
}

Expand Down
8 changes: 4 additions & 4 deletions regression-test/conf/regression-conf.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ defaultDb = "regression_test"
// init cmd like: select @@session.tx_read_only
// at each time we connect.
// add allowLoadLocalInfile so that the jdbc can execute mysql load data from client.
jdbcUrl = "jdbc:mysql://127.0.0.1:9632/?useLocalSessionState=true&allowLoadLocalInfile=true"
targetJdbcUrl = "jdbc:mysql://127.0.0.1:9632/?useLocalSessionState=true&allowLoadLocalInfile=true"
jdbcUrl = "jdbc:mysql://127.0.0.1:9030/?useLocalSessionState=true&allowLoadLocalInfile=true"
targetJdbcUrl = "jdbc:mysql://127.0.0.1:9030/?useLocalSessionState=true&allowLoadLocalInfile=true"
jdbcUser = "root"
jdbcPassword = ""

Expand All @@ -35,7 +35,7 @@ syncerAddress = "127.0.0.1:9190"
feSyncerUser = "root"
feSyncerPassword = ""

feHttpAddress = "127.0.0.1:8632"
feHttpAddress = "127.0.0.1:8030"
feHttpUser = "root"
feHttpPassword = ""

Expand Down Expand Up @@ -86,7 +86,7 @@ sk=""
// jdbc connector test config
// To enable jdbc test, you need first start mysql/pg container.
// See `docker/thirdparties/start-thirdparties-docker.sh`
enableJdbcTest=true
enableJdbcTest=false
mysql_57_port=3316
pg_14_port=5442
oracle_11_port=1521
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ suite("test_clickhouse_jdbc_catalog", "p0,external,clickhouse,external_docker,ex
contains """QUERY: SELECT "id", "ts" FROM "doris_test"."ts" WHERE ("ts" <= toUnixTimestamp(FROM_UNIXTIME(ts, '%Y-%m-%d')))"""
}

order_qt_dt_with_tz """ select * from dt_with_tz order by id; """

sql """ drop catalog if exists ${catalog_name} """
}
}