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

[client-v2] BinaryStreamReader does not use column scale for DateTime64 #1851

Closed
alniks opened this issue Oct 7, 2024 · 1 comment · Fixed by #1863
Closed

[client-v2] BinaryStreamReader does not use column scale for DateTime64 #1851

alniks opened this issue Oct 7, 2024 · 1 comment · Fixed by #1863

Comments

@alniks
Copy link

alniks commented Oct 7, 2024

Describe the bug

BinaryStreamReader does not use scale of a column when parsing DateTime64 value

Steps to reproduce

  1. create table with DateTime64 column
  2. read DateTime64 values

Expected behaviour

correct dates are read by client

Code example

            ClickHouseBinaryFormatReader reader = chDirectClient.newBinaryFormatReader(response);
            while (reader.hasNext()) {
                Map<String, Object> tuple = reader.next();
                assertEquals("2024-10-07 06:59:35.107361000", tuple.get("event_time"));
           }

Problematic code in BinaryStreamReader

constant 3 is used instead of column.getScale()

                case DateTime64:
                    return convertDateTime(readDateTime64(3, column.getTimeZone() == null ? timeZone :
                            column.getTimeZone()), typeHint);
@alniks alniks added the bug label Oct 7, 2024
@chernser
Copy link
Contributor

chernser commented Oct 7, 2024

@alniks Thank you for reporting!
Will fix.

@chernser chernser modified the milestones: Priority Backlog, 0.7.1 Oct 7, 2024
@chernser chernser changed the title BinaryStreamReader does not use column scale for DateTime64 [client-v2] BinaryStreamReader does not use column scale for DateTime64 Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants