[Kernel][Clustering #4] add withClusteringColumn api - #4327
Conversation
5078c57 to
992276f
Compare
| createTxn( | ||
| engine, | ||
| tablePath, | ||
| isNewTable = true, | ||
| testPartitionSchema, | ||
| clusteringCols = List(new Column("PART1"), new Column("part3"))) |
There was a problem hiding this comment.
can we use the createEmptyTable utility?
| verifyWrittenContent(tablePath, testPartitionSchema, expData) | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
negative cases where data files with no stats for the clustering columns are added?
There was a problem hiding this comment.
case where invalid clustering column is provided?
5ae3e47 to
0c62a1b
Compare
b70e55e to
9223241
Compare
|
|
||
| /** | ||
| * Get the domain metadata for the clustering columns. If column mapping is enabled, pass the list | ||
| * of physical names assigned; otherwise, use the logical column names. |
There was a problem hiding this comment.
is this comment still relevant?
`If column mapping is enabled, pass the list
- of physical names assigned; otherwise, use the logical column names.`
There was a problem hiding this comment.
Yes, different type of column name passed dependent on column mapping is enabled or not.
raveeram-db
left a comment
There was a problem hiding this comment.
LGTM except for a few nits!
vkorukanti
left a comment
There was a problem hiding this comment.
LGTM. Schema changes PR just went it, once rebased please check if we need to add any validations on schema changes on clsutering columns. To merge this, we could make a change in this PR to block schema changes when the table has clsutering columns. And followup with a new PR to support the schema change with clustering columns.
| throw new KernelException( | ||
| format( | ||
| "Cannot update schema for table with clustering columns %s", | ||
| clusteringColumns.get())); |
There was a problem hiding this comment.
just say not yet supported
| .add("c", StringType.STRING, true, currentSchema.get("c").getMetadata) | ||
| .add("a", StringType.STRING, true, currentSchema.get("a").getMetadata) | ||
|
|
||
| assertSchemaEvolutionFails[IllegalArgumentException]( |
There was a problem hiding this comment.
we are throwing KernelException here, how come we are expecting illegal argument exception?
allisonport-db
left a comment
There was a problem hiding this comment.
Looks good 1 comment for clarity
| } | ||
|
|
||
| /** | ||
| * Verify the clustering columns exists in the table schema. |
There was a problem hiding this comment.
Can you update these docs that it converts to physical name please? At least I think that's what's happening right?
<!-- Thanks for sending a pull request! Here are some tips for you: 1. If this is your first time, please read our contributor guidelines: https://github.com/delta-io/delta/blob/master/CONTRIBUTING.md 2. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP] Your PR title ...'. 3. Be sure to keep the PR description updated to reflect all changes. 4. Please write your PR title to summarize what this PR proposes. 5. If possible, provide a concise example to reproduce the issue for a faster review. 6. If applicable, include the corresponding issue number in the PR title and link it in the body. --> #### Which Delta project/connector is this regarding? <!-- Please add the component selected below to the beginning of the pull request title For example: [Spark] Title of my pull request --> - [ ] Spark - [ ] Standalone - [ ] Flink - [x] Kernel - [ ] Other (fill in here) ## Description <!-- - Describe what this PR changes. - Describe why we need the change. If this PR resolves an issue be sure to include "Resolves #XXX" to correctly link and close the issue upon merge. --> Split the main PR delta-io#4265 for faster review This PR implement the `withClusteringColumn` API in kernel to support table creation as a clustered table. It contains steps below, 1. withClusteringColumn takes logicalColumns as input 2. validation (column exist and cannot present together with partitionColumns) 3. Update the protocol to include `clustering` writer feature 4. convert the logical column name to physical column names to create a metadataDomain 5. Add the domainMetadata to domainMetadatasAdded. ## How was this patch tested? <!-- If tests were added, say they were added here. Please make sure to test the changes thoroughly including negative and positive cases if possible. If the changes were tested in any way other than unit tests, please clarify how you tested step by step (ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future). If the changes were not tested, please explain why. --> ## Does this PR introduce _any_ user-facing changes? <!-- If yes, please clarify the previous behavior and the change this PR proposes - provide the console output, description and/or an example to show the behavior difference if possible. If possible, please also clarify if this is a user-facing change compared to the released Delta Lake versions or within the unreleased branches such as master. If no, write 'No'. -->
Which Delta project/connector is this regarding?
Description
Split the main PR #4265 for faster review
This PR implement the
withClusteringColumnAPI in kernel to support table creation as a clustered table.It contains steps below,
clusteringwriter featureHow was this patch tested?
Does this PR introduce any user-facing changes?