-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
[HUDI-8844] Support secondary and expression index creation through async indexer and write configs #12653
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.
Thanks @codope for working on this! Please find my comments below.
Can we also add tests for creation of expression index with write configs?
Couple of cases we can cover:-
- Creation of two or more expression index using write configs.
- Further upserts without removing the expression index configs should not recreate the index
- Failure scenarios with incomplete configs
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/index/HoodieIndexUtils.java
Show resolved
Hide resolved
...di-client-common/src/main/java/org/apache/hudi/metadata/HoodieBackedTableMetadataWriter.java
Outdated
Show resolved
Hide resolved
...di-client-common/src/main/java/org/apache/hudi/metadata/HoodieBackedTableMetadataWriter.java
Outdated
Show resolved
Hide resolved
...di-client-common/src/main/java/org/apache/hudi/metadata/HoodieBackedTableMetadataWriter.java
Outdated
Show resolved
Hide resolved
...di-client-common/src/main/java/org/apache/hudi/metadata/HoodieBackedTableMetadataWriter.java
Outdated
Show resolved
Hide resolved
...park-datasource/hudi-spark/src/test/scala/org/apache/hudi/functional/TestMORDataSource.scala
Show resolved
Hide resolved
...park-datasource/hudi-spark/src/test/scala/org/apache/hudi/functional/TestMORDataSource.scala
Outdated
Show resolved
Hide resolved
hudi-utilities/src/main/java/org/apache/hudi/utilities/HoodieIndexer.java
Outdated
Show resolved
Hide resolved
hudi-utilities/src/test/java/org/apache/hudi/utilities/TestHoodieIndexer.java
Outdated
Show resolved
Hide resolved
hudi-common/src/main/java/org/apache/hudi/metadata/MetadataPartitionType.java
Show resolved
Hide resolved
8021eba
to
7baa38c
Compare
@codope We would also need to look into indempotency of the index creation using dataframe. |
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/index/HoodieIndexUtils.java
Show resolved
Hide resolved
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/index/HoodieIndexUtils.java
Outdated
Show resolved
Hide resolved
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/index/HoodieIndexUtils.java
Show resolved
Hide resolved
...di-client-common/src/main/java/org/apache/hudi/metadata/HoodieBackedTableMetadataWriter.java
Outdated
Show resolved
Hide resolved
@@ -133,6 +133,7 @@ public Option<HoodieIndexPlan> execute() { | |||
|
|||
private HoodieIndexPartitionInfo buildIndexPartitionInfo(MetadataPartitionType partitionType, HoodieInstant indexUptoInstant) { | |||
// for expression index, we need to pass the index name as the partition name | |||
// TODO: see the index partition info is built correctly. Should we register the index here? |
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.
can we remove the comment then?
hudi-common/src/main/java/org/apache/hudi/metadata/HoodieTableMetadataUtil.java
Outdated
Show resolved
Hide resolved
hudi-common/src/main/java/org/apache/hudi/metadata/HoodieTableMetadataUtil.java
Outdated
Show resolved
Hide resolved
hudi-common/src/main/java/org/apache/hudi/metadata/HoodieTableMetadataUtil.java
Outdated
Show resolved
Hide resolved
hudi-common/src/main/java/org/apache/hudi/metadata/MetadataPartitionType.java
Show resolved
Hide resolved
...park-datasource/hudi-spark/src/test/scala/org/apache/hudi/functional/TestMORDataSource.scala
Show resolved
Hide resolved
7baa38c
to
4864f44
Compare
* For the second time, the index definition file will be updated if exists. | ||
* Table Config is updated if necessary. | ||
*/ | ||
public static void register(HoodieTableMetaClient metaClient, HoodieIndexDefinition indexDefinition) { |
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.
note to reviewer: this is not new logic. Just moved the util method from HoodieSparkIndexClient
to this util class.
} | ||
} | ||
|
||
public static HoodieIndexDefinition getSecondaryOrExpressionIndexDefinition(HoodieTableMetaClient metaClient, String userIndexName, String indexType, Map<String, Map<String, String>> columns, |
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.
note to reviewer: this is not new logic. Just moved the util method from HoodieSparkIndexClient
to this util class.
return metaClient.getTableConfig().getMetadataPartitions().stream().anyMatch(partition -> partition.equals(indexName)); | ||
} | ||
|
||
private static boolean isEligibleForSecondaryOrExpressionIndex(HoodieTableMetaClient metaClient, String indexType, Map<String, String> options, Map<String, Map<String, String>> columns) throws Exception { |
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.
note to reviewer: this is not new logic. Just moved the util method from HoodieSparkIndexClient
to this util class.
4864f44
to
af9db02
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.
few minor comments
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/index/HoodieIndexUtils.java
Outdated
Show resolved
Hide resolved
hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/HoodieSparkIndexClient.java
Show resolved
Hide resolved
hudi-common/src/main/java/org/apache/hudi/common/table/HoodieTableMetaClient.java
Show resolved
Hide resolved
4118634
to
d1caff0
Compare
d1caff0
to
137a2d1
Compare
Add SI detection
137a2d1
to
3c71355
Compare
@hudi-bot run azure |
Change Logs
Impact
Support secondary and expression index creation through async indexer and write configs.
Risk level (write none, low medium or high below)
medium
Documentation Update
Describe any necessary documentation update if there is any new feature, config, or user-facing change. If not, put "none".
ticket number here and follow the instruction to make
changes to the website.
Contributor's checklist