-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
[Clickhouse] add DateTime64 type support #24344
[Clickhouse] add DateTime64 type support #24344
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You'll need to add some tests to verify the mapping works correctly.
Based on your PR description, it sounds like you may have been trying to create tables in clickhouse through presto? If so, you won't be able to use the same column type names that clickhouse uses. You'll need to use the mapped type. i.e. DateTime64 should map to timestamp. See TestClickhouseDistributedQueries
for example tests.
I’ve based myself on that file and timestamp has the same issue. Invalid column type after I try to do an assertUpdate with a create table. Date works fine. Datetime, datetime64, or timestamp don’t.
On 9 Jan 2025, at 23:33, Zac Blanco ***@***.***> wrote:
@ZacBlanco requested changes on this pull request.
You'll need to add some tests to verify the mapping works correctly.
Based on your PR description, it sounds like you may have been trying to create tables in clickhouse through presto? If so, you won't be able to use the same column type names that clickhouse uses. You'll need to use the mapped type. i.e. DateTime64 should map to timestamp. See TestClickhouseDistributedQueries for example tests.
—
Reply to this email directly, view it on GitHub<#24344 (review)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AA4MM4XPY3IFBUHSYFETN5D2J32LZAVCNFSM6AAAAABU4UGAZSVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDKNBRGA3TMMRQG4>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Thanks for the release note! Minor rephrasing suggestion.
|
Changed the release notes. Today im still trying to add the tests. And while i was able to get the create table and insert to kind of work, the data that appears on clickhouse side is different than when I do it through the UI on :8080. |
Somehow in the tests, this timestamp string ( |
You don't need to change the time zone in the tests - it should be left as is. I would recommend using the |
I'm trying to convert the hour I want in UTC to the test timezone and use that in the insert statement. I assumed it would transform it to the UTC counterpart, but it went back almost 24h. What am I missing?
|
af93218
to
3421111
Compare
Finally seems to be working. Can you tell me the process of creating the tar.gz prestodb file available for download, so that we can start using this version tomorrow? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a great improvement to the connector. Mostly just style nits. Mainly, I am concerned about the performance. I think it would be great to implement this without any string parsing. Have you attempted any other solutions?
Also, our clickhouse-jdbc client dependency is quite out of date. We might be able to upgrade it to the latest com.clickhouse:clickhouse-jdbc:0.7.2
which may provide more options for timestamps, though I haven't looked further into it.
...-clickhouse/src/test/java/com/facebook/presto/plugin/clickhouse/TestingClickHouseServer.java
Show resolved
Hide resolved
...lickhouse/src/main/java/com/facebook/presto/plugin/clickhouse/ClickHouseResultSetHelper.java
Outdated
Show resolved
Hide resolved
presto-clickhouse/src/main/java/com/facebook/presto/plugin/clickhouse/StandardReadMappings.java
Outdated
Show resolved
Hide resolved
presto-clickhouse/src/main/java/com/facebook/presto/plugin/clickhouse/StandardReadMappings.java
Outdated
Show resolved
Hide resolved
presto-clickhouse/src/main/java/com/facebook/presto/plugin/clickhouse/StandardReadMappings.java
Outdated
Show resolved
Hide resolved
presto-clickhouse/src/main/java/com/facebook/presto/plugin/clickhouse/StandardReadMappings.java
Show resolved
Hide resolved
...se/src/test/java/com/facebook/presto/plugin/clickhouse/TestClickHouseDistributedQueries.java
Outdated
Show resolved
Hide resolved
...se/src/test/java/com/facebook/presto/plugin/clickhouse/TestClickHouseDistributedQueries.java
Outdated
Show resolved
Hide resolved
...se/src/test/java/com/facebook/presto/plugin/clickhouse/TestClickHouseDistributedQueries.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the doc! Nit of formatting in the header, the table looks great!
Can you retrigger the CI? It seems one of the test suites timed out Edit: Thanks, it seems to be ok now |
presto-clickhouse/src/main/java/com/facebook/presto/plugin/clickhouse/TimestampUtil.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! (docs)
Pull updated branch, new local doc build, looks good. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code LGTM. two doc comments.
c640cde
to
a3437bc
Compare
Rebased and squashed commits |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One nit of phrasing. Thanks!
a3437bc
to
7a3feea
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! (docs)
Pull updated branch, new local doc build, looks good. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this great work!
Description
This adds support to the missing type DateTime64 from ClickHouse.
Motivation and Context
I noticed DateTime64 is not supported. As mentioned in #20958, DateTime64 supports milliseconds, whereas DateTime doesn't.
Impact
We are currently blocked from using prestodb because every entry we have in our tables has a column createdAt with the type DateTime64. Milliseconds make sense when we are dealing with user/system events.
Test Plan
Tests were added showing the creation of a table with a DateTime64 column (mapped from timestamp in prestodb), insertion of timestamps into a DateTime64 column with 0 or multiple millisecond digits, and finally the selection of them.
Release Notes