toDateTime64 accepts UInt32 with seconds, but jdbc-bridge offers UInt64 with millSeconds
Raffaellorr opened this issue · 1 comments
Raffaellorr commented
When I transfrom Oracle's timestamp
type, the result is error. The root cause is that ClickHouse toDateTime64()
function requires UInt32 type with seconds, but jdbc-bridge offers UInt64 with millSeconds.
Example
Oracle
CREATE TABLE system.t1 ( a timestamp );
INSERT INTO system.t1 values(to_timestamp('2022-11-03 19:36:00', 'YYYY-MM-DD HH24:MI:SS'));
SELECT * FROM system.t1;
A |
---|
2022-11-03 19:36:00.000 |
ClickHouse
select * from jdbc('oracle', 'select * from system.t1');
A |
---|
2299-12-31 23:00:00 |
Raffaellorr commented
I debugged the source code, found that it's because the ColumnDefinition
's scale filed is set to 0. But it should be 6.
I suggest that the source code should be:
ColumnDefinition.java:479
old
recommendedPrecision = precision < 0 ? DEFAULT_DATETIME64_PRECISION : precision;
new
recommendedPrecision = precision <= 0 ? DEFAULT_DATETIME64_PRECISION : precision;