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

More upload test changes for clickhouse #42531

Merged
merged 1 commit into from May 14, 2024

Conversation

calherries
Copy link
Contributor

@calherries calherries commented May 10, 2024

This PR contains a bunch of changes needed for the planned support of CSV uploads for clickhouse.

Most notably, it allows clickhouse to not support ::upload/offset-datetime types. Instead driver/upload-type->database-type will return nil for this type, and we'll default to use the varchar-255 database-type by default.

@calherries calherries requested a review from camsaul as a code owner May 10, 2024 18:41
@metabase-bot metabase-bot bot added the .Team/BackendComponents also known as BEC label May 10, 2024
Copy link

replay-io bot commented May 10, 2024

Status Complete ↗︎
Commit e6f4795
Results
2374 Passed

@calherries calherries requested a review from a team May 10, 2024 19:44
[["Obi-Wan Kenobi" "No one really knows me"]
["Puke Nightstalker" "Nothing - you can't prove it"]])
(rows-for-table table))))
(is (= (set (rows-with-auto-pk
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we need to add this casting to a set, does Clickhouse not provide a stable order?

Not important for this PR, but I think it would be good to test that order is preserved for all the drivers that support that. This probably doesn't warrant a feature or method, but perhaps there's another way to opt out of the stronger test?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without an order by clause, Clickhouse queries will return the last rows inserted first, while other drivers return the first rows appended first. I don't see how we can change this without adding an auto-incrementing PK and ordering the results by that column. We don't document any guarantees about the order so I think this is okay for now while we allow drivers to not have auto-incrementing PKs.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah thanks for clarifying its semantics. Not that it's crucial, if we wanted to make the tests "tighter" in the short term we could only cast to a set if :upload-with-auto-pk is false. It would be easy enough to strengthen or relax that internal coupling if things change.

:valid #t "2000-01-01T00:00:00"
:invalid "2023-01-01T00:00:00+01"
:msg "'2023-01-01T00:00:00+01' is not a recognizable datetime"}]
(driver/upload-type->database-type driver/*driver* ::upload/offset-datetime)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice solution

@calherries calherries merged commit e8857a2 into release-x.49.x May 14, 2024
108 checks passed
@calherries calherries deleted the clickhouse-upload-test-changes branch May 14, 2024 17:58
@WiNloSt WiNloSt added this to the 0.49.11 milestone May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
.Team/BackendComponents also known as BEC
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants