[#11841] fix ClickHouse partition expression round trip#11878
Open
hutiefang76 wants to merge 1 commit into
Open
[#11841] fix ClickHouse partition expression round trip#11878hutiefang76 wants to merge 1 commit into
hutiefang76 wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
Fix ClickHouse partition expression round-tripping for day transforms and nested date wrappers:
toYYYYMMDD(column)instead oftoDate(column)toYYYYMMDD(column)back to a day transformtoDate(...)wrapper when parsing expressions such astoYYYYMM(toDate(event_time))Why are the changes needed?
Fixes #11841.
Without this change, a ClickHouse partition expression like
toYYYYMM(toDate(event_time))is parsed withtoDate(event_time)as the field name. Also, day transforms are formatted astoDate(...), which does not round-trip cleanly with the ClickHouse day partition form described in the issue.Does this PR introduce any user-facing change?
Yes. ClickHouse day partition transforms are now generated as
toYYYYMMDD(column). ExistingtoDate(column)partition expressions are still accepted when reading metadata.How was this patch tested?
JAVA_HOME=$(/usr/libexec/java_home -v 17) ./gradlew :catalogs-contrib:catalog-jdbc-clickhouse:test --tests org.apache.gravitino.catalog.clickhouse.operations.TestClickHouseTableOperationsPartitioning -PskipITsJAVA_HOME=$(/usr/libexec/java_home -v 17) ./gradlew :catalogs-contrib:catalog-jdbc-clickhouse:spotlessCheck -PskipITsgit diff --check