Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

toDateTime64 accepts UInt32 with seconds, but jdbc-bridge offers UInt64 with millSeconds #162

Open
Raffaellorr opened this issue Nov 4, 2022 · 1 comment

Comments

@Raffaellorr
Copy link

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
Copy link
Author

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;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant