You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by "codope (via GitHub)" <gi...@apache.org> on 2024/05/03 16:54:30 UTC
[PR] [HUDI-7146][WIP] Implement secondary index update and delete [hudi]
codope opened a new pull request, #11146:
URL: https://github.com/apache/hudi/pull/11146
### Change Logs
This PR is stacked on https://github.com/apache/hudi/pull/11077 and https://github.com/apache/hudi/pull/11129
### Impact
Support secondary index update and delete
### 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"._
- _The config description must be updated if new configs are added or the default value of the configs are changed_
- _Any new feature or user-facing change requires updating the Hudi website. Please create a Jira ticket, attach the
ticket number here and follow the [instruction](https://hudi.apache.org/contribute/developer-setup#website) to make
changes to the website._
### Contributor's checklist
- [ ] Read through [contributor's guide](https://hudi.apache.org/contribute/how-to-contribute)
- [ ] Change Logs and Impact were stated clearly
- [ ] Adequate tests were added if applicable
- [ ] CI passed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "codope (via GitHub)" <gi...@apache.org>.
codope commented on code in PR #11146:
URL: https://github.com/apache/hudi/pull/11146#discussion_r1618690737
##########
hudi-common/src/main/java/org/apache/hudi/common/model/HoodieIndexDefinition.java:
##########
@@ -45,14 +48,14 @@ public class HoodieFunctionalIndexDefinition implements Serializable {
// Any other configuration or properties specific to the index
private Map<String, String> indexOptions;
- public HoodieFunctionalIndexDefinition() {
+ public HoodieIndexDefinition() {
}
- public HoodieFunctionalIndexDefinition(String indexName, String indexType, String indexFunction, List<String> sourceFields,
- Map<String, String> indexOptions) {
+ public HoodieIndexDefinition(String indexName, String indexType, String indexFunction, List<String> sourceFields,
Review Comment:
functional index is there.. `HoodieIndexDefinition` will contain the index definitions for both functional and secondary index.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "codope (via GitHub)" <gi...@apache.org>.
codope merged PR #11146:
URL: https://github.com/apache/hudi/pull/11146
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #11146:
URL: https://github.com/apache/hudi/pull/11146#issuecomment-2120351007
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23710",
"triggerID" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"triggerType" : "PUSH"
}, {
"hash" : "1468a9a72c2cfdda7dae6bb62ac14551f600d8df",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23711",
"triggerID" : "1468a9a72c2cfdda7dae6bb62ac14551f600d8df",
"triggerType" : "PUSH"
}, {
"hash" : "f232b46fcd23d960efc587a624c2e9d69d3d7e9e",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23728",
"triggerID" : "f232b46fcd23d960efc587a624c2e9d69d3d7e9e",
"triggerType" : "PUSH"
}, {
"hash" : "8a6a98e1a8f0f65df59dddf663b0ef231f4c01ee",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23964",
"triggerID" : "8a6a98e1a8f0f65df59dddf663b0ef231f4c01ee",
"triggerType" : "PUSH"
}, {
"hash" : "420b19219080b2935b3a37442db7ed22816466af",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23999",
"triggerID" : "420b19219080b2935b3a37442db7ed22816466af",
"triggerType" : "PUSH"
}, {
"hash" : "4c02510ba3b23cb7d7feffbb2c6850c038d6103a",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24005",
"triggerID" : "4c02510ba3b23cb7d7feffbb2c6850c038d6103a",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 4c02510ba3b23cb7d7feffbb2c6850c038d6103a Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24005)
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #11146:
URL: https://github.com/apache/hudi/pull/11146#issuecomment-2097476674
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23710",
"triggerID" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"triggerType" : "PUSH"
}, {
"hash" : "1468a9a72c2cfdda7dae6bb62ac14551f600d8df",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23711",
"triggerID" : "1468a9a72c2cfdda7dae6bb62ac14551f600d8df",
"triggerType" : "PUSH"
}, {
"hash" : "f232b46fcd23d960efc587a624c2e9d69d3d7e9e",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "f232b46fcd23d960efc587a624c2e9d69d3d7e9e",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 1468a9a72c2cfdda7dae6bb62ac14551f600d8df Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23711)
* f232b46fcd23d960efc587a624c2e9d69d3d7e9e UNKNOWN
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "codope (via GitHub)" <gi...@apache.org>.
codope commented on code in PR #11146:
URL: https://github.com/apache/hudi/pull/11146#discussion_r1610294310
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/metadata/HoodieBackedTableMetadataWriter.java:
##########
@@ -540,6 +547,51 @@ private HoodieFunctionalIndexDefinition getFunctionalIndexDefinition(String inde
}
}
+ private Set<String> getSecondaryIndexPartitionsToInit() {
+ Set<String> secondaryIndexPartitions = dataMetaClient.getFunctionalIndexMetadata().get().getIndexDefinitions().values().stream()
+ .map(HoodieFunctionalIndexDefinition::getIndexName)
+ .filter(indexName -> indexName.startsWith(HoodieTableMetadataUtil.PARTITION_NAME_SECONDARY_INDEX_PREFIX))
Review Comment:
actually, i should rename `HoodieFunctionalIndexDefinition` to `HoodieIndexDefinition` as it will contain the definition for both functional index and secondary index, and any future record level index.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "danny0405 (via GitHub)" <gi...@apache.org>.
danny0405 commented on code in PR #11146:
URL: https://github.com/apache/hudi/pull/11146#discussion_r1610824721
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/metadata/HoodieBackedTableMetadataWriter.java:
##########
@@ -437,9 +448,7 @@ private boolean initializeFromFilesystem(String initializationTime, List<Metadat
HoodieData<HoodieRecord> records = fileGroupCountAndRecordsPair.getValue();
bulkCommit(commitTimeForPartition, partitionType, records, fileGroupCount);
metadataMetaClient.reloadActiveTimeline();
- String partitionPath = partitionType == FUNCTIONAL_INDEX
- ? dataWriteConfig.getFunctionalIndexConfig().getIndexName()
- : partitionType.getPartitionPath();
+ String partitionPath = (partitionType == FUNCTIONAL_INDEX || partitionType == SECONDARY_INDEX) ? dataWriteConfig.getFunctionalIndexConfig().getIndexName() : partitionType.getPartitionPath();
Review Comment:
Yeah, probably we can add some method like `MetadataPartitionType.getPartitionPath` to simplify the code.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "codope (via GitHub)" <gi...@apache.org>.
codope commented on code in PR #11146:
URL: https://github.com/apache/hudi/pull/11146#discussion_r1616260176
##########
hudi-common/src/main/java/org/apache/hudi/common/model/HoodieFunctionalIndexDefinition.java:
##########
@@ -52,7 +55,7 @@ public HoodieFunctionalIndexDefinition(String indexName, String indexType, Strin
Map<String, String> indexOptions) {
this.indexName = indexName;
this.indexType = indexType;
- this.indexFunction = indexFunction;
+ this.indexFunction = nonEmpty(indexFunction) ? indexFunction : SPARK_IDENTITY;
Review Comment:
if someone creates func index without specificying the function then we pick the identity function to be default. The identity function is like f(x) = x, so it just builds the index over x. It is like iceberg's identity transform - https://iceberg.apache.org/spec/#partition-transforms
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "codope (via GitHub)" <gi...@apache.org>.
codope commented on code in PR #11146:
URL: https://github.com/apache/hudi/pull/11146#discussion_r1618694958
##########
hudi-common/src/main/java/org/apache/hudi/metadata/HoodieTableMetadataUtil.java:
##########
@@ -1833,12 +1838,146 @@ public static HoodieData<HoodieRecord> readRecordKeysFromFileSlices(HoodieEngine
});
}
- public static Schema getProjectedSchemaForFunctionalIndex(HoodieFunctionalIndexDefinition indexDefinition, HoodieTableMetaClient metaClient) throws Exception {
+ public static Schema getProjectedSchemaForFunctionalIndex(HoodieIndexDefinition indexDefinition, HoodieTableMetaClient metaClient) throws Exception {
TableSchemaResolver schemaResolver = new TableSchemaResolver(metaClient);
Schema tableSchema = schemaResolver.getTableAvroSchema();
return addMetadataFields(getSchemaForFields(tableSchema, indexDefinition.getSourceFields()));
}
+ public static HoodieData<HoodieRecord> readSecondaryKeysFromBaseFiles(HoodieEngineContext engineContext,
+ List<Pair<String, Pair<String, List<String>>>> partitionFiles,
+ int recordIndexMaxParallelism,
+ String activeModule, HoodieTableMetaClient metaClient, EngineType engineType,
+ HoodieIndexDefinition indexDefinition) {
+ if (partitionFiles.isEmpty()) {
+ return engineContext.emptyHoodieData();
+ }
+
+ engineContext.setJobStatus(activeModule, "Secondary Index: reading secondary keys from " + partitionFiles.size() + " partitions");
+ final int parallelism = Math.min(partitionFiles.size(), recordIndexMaxParallelism);
+ final String basePath = metaClient.getBasePathV2().toString();
+ return engineContext.parallelize(partitionFiles, parallelism).flatMap(partitionAndBaseFile -> {
+ final String partition = partitionAndBaseFile.getKey();
+ final Pair<String, List<String>> baseAndLogFiles = partitionAndBaseFile.getValue();
+ List<String> logFilePaths = new ArrayList<>();
+ baseAndLogFiles.getValue().forEach(logFile -> {
+ logFilePaths.add(basePath + StoragePath.SEPARATOR + partition + StoragePath.SEPARATOR + logFile);
+ });
+ String filePath = baseAndLogFiles.getKey();
+
+ Option<StoragePath> dataFilePath = Option.empty();
+ Schema tableSchema;
+
+ if (!filePath.isEmpty()) {
+ dataFilePath = Option.of(filePath(basePath, "", filePath));
+ tableSchema = HoodieIOFactory.getIOFactory(metaClient.getStorage()).getFileFormatUtils(HoodieFileFormat.PARQUET).readAvroSchema(metaClient.getStorage(), dataFilePath.get());
+ } else {
+ TableSchemaResolver schemaResolver = new TableSchemaResolver(metaClient);
Review Comment:
Good point! I have moved out.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #11146:
URL: https://github.com/apache/hudi/pull/11146#issuecomment-2138810132
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23710",
"triggerID" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"triggerType" : "PUSH"
}, {
"hash" : "1468a9a72c2cfdda7dae6bb62ac14551f600d8df",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23711",
"triggerID" : "1468a9a72c2cfdda7dae6bb62ac14551f600d8df",
"triggerType" : "PUSH"
}, {
"hash" : "f232b46fcd23d960efc587a624c2e9d69d3d7e9e",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23728",
"triggerID" : "f232b46fcd23d960efc587a624c2e9d69d3d7e9e",
"triggerType" : "PUSH"
}, {
"hash" : "8a6a98e1a8f0f65df59dddf663b0ef231f4c01ee",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23964",
"triggerID" : "8a6a98e1a8f0f65df59dddf663b0ef231f4c01ee",
"triggerType" : "PUSH"
}, {
"hash" : "420b19219080b2935b3a37442db7ed22816466af",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23999",
"triggerID" : "420b19219080b2935b3a37442db7ed22816466af",
"triggerType" : "PUSH"
}, {
"hash" : "4c02510ba3b23cb7d7feffbb2c6850c038d6103a",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24005",
"triggerID" : "4c02510ba3b23cb7d7feffbb2c6850c038d6103a",
"triggerType" : "PUSH"
}, {
"hash" : "9c3c82dde2fd4fcf1c2babe2c1a0345fe87af0c7",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24016",
"triggerID" : "9c3c82dde2fd4fcf1c2babe2c1a0345fe87af0c7",
"triggerType" : "PUSH"
}, {
"hash" : "98d96be857a9e87e74a4dee99cb31b162ade5aa3",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24091",
"triggerID" : "98d96be857a9e87e74a4dee99cb31b162ade5aa3",
"triggerType" : "PUSH"
}, {
"hash" : "76cb6530775bdfd9415bab25c48f23fd84777182",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24117",
"triggerID" : "76cb6530775bdfd9415bab25c48f23fd84777182",
"triggerType" : "PUSH"
}, {
"hash" : "470bc5f44e7a6658a8717ef1b77e92afcdd90087",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "470bc5f44e7a6658a8717ef1b77e92afcdd90087",
"triggerType" : "PUSH"
}, {
"hash" : "3d9b55d5f226698abf7339dc604f0e02d8fc8133",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24120",
"triggerID" : "3d9b55d5f226698abf7339dc604f0e02d8fc8133",
"triggerType" : "PUSH"
}, {
"hash" : "e8a4507886bc97b1819ea39788f2abd7385b8cf2",
"status" : "SUCCESS",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24139",
"triggerID" : "e8a4507886bc97b1819ea39788f2abd7385b8cf2",
"triggerType" : "PUSH"
}, {
"hash" : "43f73661f79eb87ac52d29fa153b996a15f29b99",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "43f73661f79eb87ac52d29fa153b996a15f29b99",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 470bc5f44e7a6658a8717ef1b77e92afcdd90087 UNKNOWN
* e8a4507886bc97b1819ea39788f2abd7385b8cf2 Azure: [SUCCESS](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24139)
* 43f73661f79eb87ac52d29fa153b996a15f29b99 UNKNOWN
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #11146:
URL: https://github.com/apache/hudi/pull/11146#issuecomment-2120241948
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23710",
"triggerID" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"triggerType" : "PUSH"
}, {
"hash" : "1468a9a72c2cfdda7dae6bb62ac14551f600d8df",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23711",
"triggerID" : "1468a9a72c2cfdda7dae6bb62ac14551f600d8df",
"triggerType" : "PUSH"
}, {
"hash" : "f232b46fcd23d960efc587a624c2e9d69d3d7e9e",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23728",
"triggerID" : "f232b46fcd23d960efc587a624c2e9d69d3d7e9e",
"triggerType" : "PUSH"
}, {
"hash" : "8a6a98e1a8f0f65df59dddf663b0ef231f4c01ee",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23964",
"triggerID" : "8a6a98e1a8f0f65df59dddf663b0ef231f4c01ee",
"triggerType" : "PUSH"
}, {
"hash" : "420b19219080b2935b3a37442db7ed22816466af",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23999",
"triggerID" : "420b19219080b2935b3a37442db7ed22816466af",
"triggerType" : "PUSH"
}, {
"hash" : "4c02510ba3b23cb7d7feffbb2c6850c038d6103a",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "4c02510ba3b23cb7d7feffbb2c6850c038d6103a",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 420b19219080b2935b3a37442db7ed22816466af Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23999)
* 4c02510ba3b23cb7d7feffbb2c6850c038d6103a UNKNOWN
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "codope (via GitHub)" <gi...@apache.org>.
codope commented on code in PR #11146:
URL: https://github.com/apache/hudi/pull/11146#discussion_r1616260176
##########
hudi-common/src/main/java/org/apache/hudi/common/model/HoodieFunctionalIndexDefinition.java:
##########
@@ -52,7 +55,7 @@ public HoodieFunctionalIndexDefinition(String indexName, String indexType, Strin
Map<String, String> indexOptions) {
this.indexName = indexName;
this.indexType = indexType;
- this.indexFunction = indexFunction;
+ this.indexFunction = nonEmpty(indexFunction) ? indexFunction : SPARK_IDENTITY;
Review Comment:
if someone creates func index without specificying the function then we pick the identity function to be default.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "danny0405 (via GitHub)" <gi...@apache.org>.
danny0405 commented on code in PR #11146:
URL: https://github.com/apache/hudi/pull/11146#discussion_r1610823837
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/metadata/HoodieBackedTableMetadataWriter.java:
##########
@@ -410,6 +413,14 @@ private boolean initializeFromFilesystem(String initializationTime, List<Metadat
}
fileGroupCountAndRecordsPair = initializePartitionStatsIndex(partitionInfoList);
break;
+ case SECONDARY_INDEX:
+ Set<String> secondaryIndexPartitionsToInit = getSecondaryIndexPartitionsToInit();
+ if (secondaryIndexPartitionsToInit.isEmpty()) {
+ continue;
+ }
+ ValidationUtils.checkState(secondaryIndexPartitionsToInit.size() == 1, "Only one secondary index at a time is supported for now");
Review Comment:
> but can only create one at a time using sql due to limitation of sql grammar.
Reasonable, but it also looks like we only allow one index for MDT bootstrap, is this expected?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #11146:
URL: https://github.com/apache/hudi/pull/11146#issuecomment-2137483142
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23710",
"triggerID" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"triggerType" : "PUSH"
}, {
"hash" : "1468a9a72c2cfdda7dae6bb62ac14551f600d8df",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23711",
"triggerID" : "1468a9a72c2cfdda7dae6bb62ac14551f600d8df",
"triggerType" : "PUSH"
}, {
"hash" : "f232b46fcd23d960efc587a624c2e9d69d3d7e9e",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23728",
"triggerID" : "f232b46fcd23d960efc587a624c2e9d69d3d7e9e",
"triggerType" : "PUSH"
}, {
"hash" : "8a6a98e1a8f0f65df59dddf663b0ef231f4c01ee",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23964",
"triggerID" : "8a6a98e1a8f0f65df59dddf663b0ef231f4c01ee",
"triggerType" : "PUSH"
}, {
"hash" : "420b19219080b2935b3a37442db7ed22816466af",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23999",
"triggerID" : "420b19219080b2935b3a37442db7ed22816466af",
"triggerType" : "PUSH"
}, {
"hash" : "4c02510ba3b23cb7d7feffbb2c6850c038d6103a",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24005",
"triggerID" : "4c02510ba3b23cb7d7feffbb2c6850c038d6103a",
"triggerType" : "PUSH"
}, {
"hash" : "9c3c82dde2fd4fcf1c2babe2c1a0345fe87af0c7",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24016",
"triggerID" : "9c3c82dde2fd4fcf1c2babe2c1a0345fe87af0c7",
"triggerType" : "PUSH"
}, {
"hash" : "98d96be857a9e87e74a4dee99cb31b162ade5aa3",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24091",
"triggerID" : "98d96be857a9e87e74a4dee99cb31b162ade5aa3",
"triggerType" : "PUSH"
}, {
"hash" : "76cb6530775bdfd9415bab25c48f23fd84777182",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24117",
"triggerID" : "76cb6530775bdfd9415bab25c48f23fd84777182",
"triggerType" : "PUSH"
}, {
"hash" : "470bc5f44e7a6658a8717ef1b77e92afcdd90087",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "470bc5f44e7a6658a8717ef1b77e92afcdd90087",
"triggerType" : "PUSH"
}, {
"hash" : "3d9b55d5f226698abf7339dc604f0e02d8fc8133",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "3d9b55d5f226698abf7339dc604f0e02d8fc8133",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 76cb6530775bdfd9415bab25c48f23fd84777182 Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24117)
* 470bc5f44e7a6658a8717ef1b77e92afcdd90087 UNKNOWN
* 3d9b55d5f226698abf7339dc604f0e02d8fc8133 UNKNOWN
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #11146:
URL: https://github.com/apache/hudi/pull/11146#issuecomment-2096530500
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23710",
"triggerID" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"triggerType" : "PUSH"
}, {
"hash" : "1468a9a72c2cfdda7dae6bb62ac14551f600d8df",
"status" : "PENDING",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23711",
"triggerID" : "1468a9a72c2cfdda7dae6bb62ac14551f600d8df",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 7f99a0085a6d85388b2dc7d606265f7f63b01d1b Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23710)
* 1468a9a72c2cfdda7dae6bb62ac14551f600d8df Azure: [PENDING](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23711)
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #11146:
URL: https://github.com/apache/hudi/pull/11146#issuecomment-2097554344
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23710",
"triggerID" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"triggerType" : "PUSH"
}, {
"hash" : "1468a9a72c2cfdda7dae6bb62ac14551f600d8df",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23711",
"triggerID" : "1468a9a72c2cfdda7dae6bb62ac14551f600d8df",
"triggerType" : "PUSH"
}, {
"hash" : "f232b46fcd23d960efc587a624c2e9d69d3d7e9e",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23728",
"triggerID" : "f232b46fcd23d960efc587a624c2e9d69d3d7e9e",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* f232b46fcd23d960efc587a624c2e9d69d3d7e9e Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23728)
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #11146:
URL: https://github.com/apache/hudi/pull/11146#issuecomment-2113981548
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23710",
"triggerID" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"triggerType" : "PUSH"
}, {
"hash" : "1468a9a72c2cfdda7dae6bb62ac14551f600d8df",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23711",
"triggerID" : "1468a9a72c2cfdda7dae6bb62ac14551f600d8df",
"triggerType" : "PUSH"
}, {
"hash" : "f232b46fcd23d960efc587a624c2e9d69d3d7e9e",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23728",
"triggerID" : "f232b46fcd23d960efc587a624c2e9d69d3d7e9e",
"triggerType" : "PUSH"
}, {
"hash" : "8a6a98e1a8f0f65df59dddf663b0ef231f4c01ee",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "8a6a98e1a8f0f65df59dddf663b0ef231f4c01ee",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* f232b46fcd23d960efc587a624c2e9d69d3d7e9e Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23728)
* 8a6a98e1a8f0f65df59dddf663b0ef231f4c01ee UNKNOWN
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #11146:
URL: https://github.com/apache/hudi/pull/11146#issuecomment-2113987490
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23710",
"triggerID" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"triggerType" : "PUSH"
}, {
"hash" : "1468a9a72c2cfdda7dae6bb62ac14551f600d8df",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23711",
"triggerID" : "1468a9a72c2cfdda7dae6bb62ac14551f600d8df",
"triggerType" : "PUSH"
}, {
"hash" : "f232b46fcd23d960efc587a624c2e9d69d3d7e9e",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23728",
"triggerID" : "f232b46fcd23d960efc587a624c2e9d69d3d7e9e",
"triggerType" : "PUSH"
}, {
"hash" : "8a6a98e1a8f0f65df59dddf663b0ef231f4c01ee",
"status" : "PENDING",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23964",
"triggerID" : "8a6a98e1a8f0f65df59dddf663b0ef231f4c01ee",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* f232b46fcd23d960efc587a624c2e9d69d3d7e9e Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23728)
* 8a6a98e1a8f0f65df59dddf663b0ef231f4c01ee Azure: [PENDING](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23964)
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "codope (via GitHub)" <gi...@apache.org>.
codope commented on code in PR #11146:
URL: https://github.com/apache/hudi/pull/11146#discussion_r1619691280
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/metadata/HoodieBackedTableMetadataWriter.java:
##########
@@ -525,21 +534,66 @@ private Pair<Integer, HoodieData<HoodieRecord>> initializeFunctionalIndexPartiti
}
private Set<String> getFunctionalIndexPartitionsToInit() {
- Set<String> functionalIndexPartitions = dataMetaClient.getFunctionalIndexMetadata().get().getIndexDefinitions().keySet();
+ Set<String> functionalIndexPartitions = dataMetaClient.getIndexMetadata().get().getIndexDefinitions().keySet();
Set<String> completedMetadataPartitions = dataMetaClient.getTableConfig().getMetadataPartitions();
functionalIndexPartitions.removeAll(completedMetadataPartitions);
return functionalIndexPartitions;
}
- private HoodieFunctionalIndexDefinition getFunctionalIndexDefinition(String indexName) {
- Option<HoodieFunctionalIndexMetadata> functionalIndexMetadata = dataMetaClient.getFunctionalIndexMetadata();
+ private HoodieIndexDefinition getFunctionalIndexDefinition(String indexName) {
+ Option<HoodieIndexMetadata> functionalIndexMetadata = dataMetaClient.getIndexMetadata();
if (functionalIndexMetadata.isPresent()) {
return functionalIndexMetadata.get().getIndexDefinitions().get(indexName);
} else {
throw new HoodieIndexException("Functional Index definition is not present");
}
}
+ private Set<String> getSecondaryIndexPartitionsToInit() {
+ Set<String> secondaryIndexPartitions = dataMetaClient.getIndexMetadata().get().getIndexDefinitions().values().stream()
+ .map(HoodieIndexDefinition::getIndexName)
+ .filter(indexName -> indexName.startsWith(HoodieTableMetadataUtil.PARTITION_NAME_SECONDARY_INDEX_PREFIX))
+ .collect(Collectors.toSet());
+ Set<String> completedMetadataPartitions = dataMetaClient.getTableConfig().getMetadataPartitions();
+ secondaryIndexPartitions.removeAll(completedMetadataPartitions);
+ return secondaryIndexPartitions;
+ }
+
+ private Pair<Integer, HoodieData<HoodieRecord>> initializeSecondaryIndexPartition(String indexName) throws IOException {
+ HoodieIndexDefinition indexDefinition = getFunctionalIndexDefinition(indexName);
+ ValidationUtils.checkState(indexDefinition != null, "Secondary Index definition is not present for index " + indexName);
+ List<Pair<String, FileSlice>> partitionFileSlicePairs = getPartitionFileSlicePairs();
+
+ // Reuse record index parallelism config to build secondary index
Review Comment:
done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #11146:
URL: https://github.com/apache/hudi/pull/11146#issuecomment-2120260006
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23710",
"triggerID" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"triggerType" : "PUSH"
}, {
"hash" : "1468a9a72c2cfdda7dae6bb62ac14551f600d8df",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23711",
"triggerID" : "1468a9a72c2cfdda7dae6bb62ac14551f600d8df",
"triggerType" : "PUSH"
}, {
"hash" : "f232b46fcd23d960efc587a624c2e9d69d3d7e9e",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23728",
"triggerID" : "f232b46fcd23d960efc587a624c2e9d69d3d7e9e",
"triggerType" : "PUSH"
}, {
"hash" : "8a6a98e1a8f0f65df59dddf663b0ef231f4c01ee",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23964",
"triggerID" : "8a6a98e1a8f0f65df59dddf663b0ef231f4c01ee",
"triggerType" : "PUSH"
}, {
"hash" : "420b19219080b2935b3a37442db7ed22816466af",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23999",
"triggerID" : "420b19219080b2935b3a37442db7ed22816466af",
"triggerType" : "PUSH"
}, {
"hash" : "4c02510ba3b23cb7d7feffbb2c6850c038d6103a",
"status" : "PENDING",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24005",
"triggerID" : "4c02510ba3b23cb7d7feffbb2c6850c038d6103a",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 420b19219080b2935b3a37442db7ed22816466af Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23999)
* 4c02510ba3b23cb7d7feffbb2c6850c038d6103a Azure: [PENDING](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24005)
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "codope (via GitHub)" <gi...@apache.org>.
codope commented on code in PR #11146:
URL: https://github.com/apache/hudi/pull/11146#discussion_r1618692490
##########
hudi-common/src/main/java/org/apache/hudi/metadata/HoodieTableMetadata.java:
##########
@@ -112,6 +113,14 @@ static boolean isMetadataTable(String basePath) {
return basePath.endsWith(HoodieTableMetaClient.METADATA_TABLE_FOLDER_PATH);
}
+ static boolean isMetadataTableSecondaryIndexPartition(String basePath, Option<String> partitionName) {
+ if (!isMetadataTable(basePath) || !partitionName.isPresent()) {
Review Comment:
removed.. this method is not required after i added `MetadataPartitionType#fromPartitionPath`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "codope (via GitHub)" <gi...@apache.org>.
codope commented on code in PR #11146:
URL: https://github.com/apache/hudi/pull/11146#discussion_r1618696983
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/metadata/HoodieBackedTableMetadataWriter.java:
##########
@@ -1054,6 +1086,71 @@ private HoodieData<HoodieRecord> getFunctionalIndexUpdates(HoodieCommitMetadata
return getFunctionalIndexRecords(partitionFileSlicePairs, indexDefinition, dataMetaClient, parallelism, readerSchema, storageConf);
}
+ private void updateSecondaryIndexIfPresent(HoodieCommitMetadata commitMetadata, Map<MetadataPartitionType, HoodieData<HoodieRecord>> partitionToRecordMap, HoodieData<WriteStatus> writeStatus) {
+ dataMetaClient.getTableConfig().getMetadataPartitions()
+ .stream()
+ .filter(partition -> partition.startsWith(HoodieTableMetadataUtil.PARTITION_NAME_SECONDARY_INDEX_PREFIX))
+ .forEach(partition -> {
+ HoodieData<HoodieRecord> secondaryIndexRecords;
+ try {
+ secondaryIndexRecords = getSecondaryIndexUpdates(commitMetadata, partition, writeStatus);
+ } catch (Exception e) {
+ throw new HoodieMetadataException("Failed to get secondary index updates for partition " + partition, e);
+ }
+ partitionToRecordMap.put(SECONDARY_INDEX, secondaryIndexRecords);
+ });
+ }
+
+ private HoodieData<HoodieRecord> getSecondaryIndexUpdates(HoodieCommitMetadata commitMetadata, String indexPartition, HoodieData<WriteStatus> writeStatus) throws Exception {
+ List<Pair<String, Pair<String, List<String>>>> partitionFilePairs = getPartitionFilePairs(commitMetadata);
+ // Build a list of keys that need to be removed. A 'delete' record will be emitted into the respective FileGroup of
+ // the secondary index partition for each of these keys. For a commit which is deleting/updating a lot of records, this
+ // operation is going to be expensive (in CPU, memory and IO)
+ List<String> keysToRemove = new ArrayList<>();
+ writeStatus.collectAsList().forEach(status -> {
+ status.getWrittenRecordDelegates().forEach(recordDelegate -> {
+ // Consider those keys which were either updated or deleted in this commit
+ if (!recordDelegate.getNewLocation().isPresent() || (recordDelegate.getCurrentLocation().isPresent() && recordDelegate.getNewLocation().isPresent())) {
+ keysToRemove.add(recordDelegate.getRecordKey());
+ }
+ });
+ });
+ HoodieIndexDefinition indexDefinition = getFunctionalIndexDefinition(indexPartition);
Review Comment:
No, it is not removed. Both secondary and functional index denition are now part of HoodieIndexDefinition.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #11146:
URL: https://github.com/apache/hudi/pull/11146#issuecomment-2138821957
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23710",
"triggerID" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"triggerType" : "PUSH"
}, {
"hash" : "1468a9a72c2cfdda7dae6bb62ac14551f600d8df",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23711",
"triggerID" : "1468a9a72c2cfdda7dae6bb62ac14551f600d8df",
"triggerType" : "PUSH"
}, {
"hash" : "f232b46fcd23d960efc587a624c2e9d69d3d7e9e",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23728",
"triggerID" : "f232b46fcd23d960efc587a624c2e9d69d3d7e9e",
"triggerType" : "PUSH"
}, {
"hash" : "8a6a98e1a8f0f65df59dddf663b0ef231f4c01ee",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23964",
"triggerID" : "8a6a98e1a8f0f65df59dddf663b0ef231f4c01ee",
"triggerType" : "PUSH"
}, {
"hash" : "420b19219080b2935b3a37442db7ed22816466af",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23999",
"triggerID" : "420b19219080b2935b3a37442db7ed22816466af",
"triggerType" : "PUSH"
}, {
"hash" : "4c02510ba3b23cb7d7feffbb2c6850c038d6103a",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24005",
"triggerID" : "4c02510ba3b23cb7d7feffbb2c6850c038d6103a",
"triggerType" : "PUSH"
}, {
"hash" : "9c3c82dde2fd4fcf1c2babe2c1a0345fe87af0c7",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24016",
"triggerID" : "9c3c82dde2fd4fcf1c2babe2c1a0345fe87af0c7",
"triggerType" : "PUSH"
}, {
"hash" : "98d96be857a9e87e74a4dee99cb31b162ade5aa3",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24091",
"triggerID" : "98d96be857a9e87e74a4dee99cb31b162ade5aa3",
"triggerType" : "PUSH"
}, {
"hash" : "76cb6530775bdfd9415bab25c48f23fd84777182",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24117",
"triggerID" : "76cb6530775bdfd9415bab25c48f23fd84777182",
"triggerType" : "PUSH"
}, {
"hash" : "470bc5f44e7a6658a8717ef1b77e92afcdd90087",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "470bc5f44e7a6658a8717ef1b77e92afcdd90087",
"triggerType" : "PUSH"
}, {
"hash" : "3d9b55d5f226698abf7339dc604f0e02d8fc8133",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24120",
"triggerID" : "3d9b55d5f226698abf7339dc604f0e02d8fc8133",
"triggerType" : "PUSH"
}, {
"hash" : "e8a4507886bc97b1819ea39788f2abd7385b8cf2",
"status" : "SUCCESS",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24139",
"triggerID" : "e8a4507886bc97b1819ea39788f2abd7385b8cf2",
"triggerType" : "PUSH"
}, {
"hash" : "43f73661f79eb87ac52d29fa153b996a15f29b99",
"status" : "PENDING",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24141",
"triggerID" : "43f73661f79eb87ac52d29fa153b996a15f29b99",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 470bc5f44e7a6658a8717ef1b77e92afcdd90087 UNKNOWN
* e8a4507886bc97b1819ea39788f2abd7385b8cf2 Azure: [SUCCESS](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24139)
* 43f73661f79eb87ac52d29fa153b996a15f29b99 Azure: [PENDING](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24141)
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #11146:
URL: https://github.com/apache/hudi/pull/11146#issuecomment-2096634352
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23710",
"triggerID" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"triggerType" : "PUSH"
}, {
"hash" : "1468a9a72c2cfdda7dae6bb62ac14551f600d8df",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23711",
"triggerID" : "1468a9a72c2cfdda7dae6bb62ac14551f600d8df",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 1468a9a72c2cfdda7dae6bb62ac14551f600d8df Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23711)
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "danny0405 (via GitHub)" <gi...@apache.org>.
danny0405 commented on code in PR #11146:
URL: https://github.com/apache/hudi/pull/11146#discussion_r1609596497
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/metadata/HoodieBackedTableMetadataWriter.java:
##########
@@ -540,6 +547,51 @@ private HoodieFunctionalIndexDefinition getFunctionalIndexDefinition(String inde
}
}
+ private Set<String> getSecondaryIndexPartitionsToInit() {
+ Set<String> secondaryIndexPartitions = dataMetaClient.getFunctionalIndexMetadata().get().getIndexDefinitions().values().stream()
+ .map(HoodieFunctionalIndexDefinition::getIndexName)
+ .filter(indexName -> indexName.startsWith(HoodieTableMetadataUtil.PARTITION_NAME_SECONDARY_INDEX_PREFIX))
Review Comment:
So secondary index belongs to functional index?
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/metadata/HoodieBackedTableMetadataWriter.java:
##########
@@ -410,6 +413,14 @@ private boolean initializeFromFilesystem(String initializationTime, List<Metadat
}
fileGroupCountAndRecordsPair = initializePartitionStatsIndex(partitionInfoList);
break;
+ case SECONDARY_INDEX:
+ Set<String> secondaryIndexPartitionsToInit = getSecondaryIndexPartitionsToInit();
+ if (secondaryIndexPartitionsToInit.isEmpty()) {
+ continue;
+ }
+ ValidationUtils.checkState(secondaryIndexPartitionsToInit.size() == 1, "Only one secondary index at a time is supported for now");
Review Comment:
not sure why we have the number limit.
##########
hudi-common/src/main/java/org/apache/hudi/common/model/HoodieFunctionalIndexDefinition.java:
##########
@@ -52,7 +55,7 @@ public HoodieFunctionalIndexDefinition(String indexName, String indexType, Strin
Map<String, String> indexOptions) {
this.indexName = indexName;
this.indexType = indexType;
- this.indexFunction = indexFunction;
+ this.indexFunction = nonEmpty(indexFunction) ? indexFunction : SPARK_IDENTITY;
Review Comment:
Can you elaborate the semantics for empty index function?
##########
hudi-common/src/main/java/org/apache/hudi/metadata/HoodieBackedTableMetadata.java:
##########
@@ -783,4 +784,101 @@ public int getNumFileGroupsForPartition(MetadataPartitionType partition) {
metadataFileSystemView, partition.getPartitionPath()));
return partitionFileSliceMap.get(partition.getPartitionPath()).size();
}
+
+ @Override
+ protected Map<String, String> getSecondaryKeysForRecordKeys(List<String> recordKeys, String partitionName) {
+ if (recordKeys.isEmpty()) {
+ return Collections.emptyMap();
+ }
+
+ // Load the file slices for the partition. Each file slice is a shard which saves a portion of the keys.
+ List<FileSlice> partitionFileSlices = partitionFileSliceMap.computeIfAbsent(partitionName,
+ k -> HoodieTableMetadataUtil.getPartitionLatestMergedFileSlices(metadataMetaClient, metadataFileSystemView, partitionName));
+ final int numFileSlices = partitionFileSlices.size();
+ ValidationUtils.checkState(numFileSlices > 0, "Number of file slices for partition " + partitionName + " should be > 0");
Review Comment:
Can we just return empty instead of throwing.
##########
hudi-common/src/main/java/org/apache/hudi/metadata/HoodieTableMetadata.java:
##########
@@ -111,6 +111,14 @@ static boolean isMetadataTable(String basePath) {
return basePath.endsWith(HoodieTableMetaClient.METADATA_TABLE_FOLDER_PATH);
}
+ static boolean isMetadataTableSecondaryIndexPartition(String basePath, Option<String> partitionName) {
+ if (!isMetadataTable(basePath) || !partitionName.isPresent()) {
+ return false;
+ }
+
+ return partitionName.get().startsWith("secondary_index_");
Review Comment:
It's greate if we can avoid the hard code string.
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/metadata/HoodieBackedTableMetadataWriter.java:
##########
@@ -977,16 +1014,17 @@ public void updateFromWriteStatuses(HoodieCommitMetadata commitMetadata, HoodieD
Map<MetadataPartitionType, HoodieData<HoodieRecord>> partitionToRecordMap =
HoodieTableMetadataUtil.convertMetadataToRecords(
engineContext, dataWriteConfig, commitMetadata, instantTime, dataMetaClient,
- enabledPartitionTypes, dataWriteConfig.getBloomFilterType(),
- dataWriteConfig.getBloomIndexParallelism(), dataWriteConfig.isMetadataColumnStatsIndexEnabled(),
- dataWriteConfig.getColumnStatsIndexParallelism(), dataWriteConfig.getColumnsEnabledForColumnStatsIndex(), dataWriteConfig.getMetadataConfig());
+ enabledPartitionTypes, dataWriteConfig.getBloomFilterType(),
+ dataWriteConfig.getBloomIndexParallelism(), dataWriteConfig.isMetadataColumnStatsIndexEnabled(),
+ dataWriteConfig.getColumnStatsIndexParallelism(), dataWriteConfig.getColumnsEnabledForColumnStatsIndex(), dataWriteConfig.getMetadataConfig());
// Updates for record index are created by parsing the WriteStatus which is a hudi-client object. Hence, we cannot yet move this code
// to the HoodieTableMetadataUtil class in hudi-common.
HoodieData<HoodieRecord> updatesFromWriteStatuses = getRecordIndexUpserts(writeStatus);
HoodieData<HoodieRecord> additionalUpdates = getRecordIndexAdditionalUpserts(updatesFromWriteStatuses, commitMetadata);
partitionToRecordMap.put(RECORD_INDEX, updatesFromWriteStatuses.union(additionalUpdates));
updateFunctionalIndexIfPresent(commitMetadata, instantTime, partitionToRecordMap);
+ updateSecondaryIndexIfPresent(commitMetadata, partitionToRecordMap, writeStatus);
Review Comment:
Hmm, I see it in the bottom.
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/metadata/HoodieBackedTableMetadataWriter.java:
##########
@@ -948,9 +985,9 @@ public void buildMetadataPartitions(HoodieEngineContext engineContext, List<Hood
relativePartitionPath, metadataWriteConfig.getBasePath(), indexUptoInstantTime);
// return early and populate enabledPartitionTypes correctly (check in initialCommit)
- MetadataPartitionType partitionType = relativePartitionPath.startsWith(HoodieTableMetadataUtil.PARTITION_NAME_FUNCTIONAL_INDEX_PREFIX)
- ? FUNCTIONAL_INDEX
- : MetadataPartitionType.valueOf(relativePartitionPath.toUpperCase(Locale.ROOT));
+ MetadataPartitionType partitionType = relativePartitionPath.startsWith(HoodieTableMetadataUtil.PARTITION_NAME_FUNCTIONAL_INDEX_PREFIX) ? FUNCTIONAL_INDEX :
+ relativePartitionPath.startsWith(HoodieTableMetadataUtil.PARTITION_NAME_SECONDARY_INDEX_PREFIX) ? SECONDARY_INDEX :
Review Comment:
ditto, holding some variables in partition type may simplify the code.
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/metadata/HoodieBackedTableMetadataWriter.java:
##########
@@ -1054,6 +1092,75 @@ private HoodieData<HoodieRecord> getFunctionalIndexUpdates(HoodieCommitMetadata
return getFunctionalIndexRecords(partitionFileSlicePairs, indexDefinition, dataMetaClient, parallelism, readerSchema, storageConf);
}
+ private void updateSecondaryIndexIfPresent(HoodieCommitMetadata commitMetadata, Map<MetadataPartitionType, HoodieData<HoodieRecord>> partitionToRecordMap, HoodieData<WriteStatus> writeStatus) {
+ dataMetaClient.getTableConfig().getMetadataPartitions()
Review Comment:
Maybe we can share code with RLI.
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/metadata/HoodieBackedTableMetadataWriter.java:
##########
@@ -1054,6 +1092,75 @@ private HoodieData<HoodieRecord> getFunctionalIndexUpdates(HoodieCommitMetadata
return getFunctionalIndexRecords(partitionFileSlicePairs, indexDefinition, dataMetaClient, parallelism, readerSchema, storageConf);
}
+ private void updateSecondaryIndexIfPresent(HoodieCommitMetadata commitMetadata, Map<MetadataPartitionType, HoodieData<HoodieRecord>> partitionToRecordMap, HoodieData<WriteStatus> writeStatus) {
+ dataMetaClient.getTableConfig().getMetadataPartitions()
+ .stream()
+ .filter(partition -> partition.startsWith(HoodieTableMetadataUtil.PARTITION_NAME_SECONDARY_INDEX_PREFIX))
+ .forEach(partition -> {
+ HoodieData<HoodieRecord> secondaryIndexRecords;
+ try {
+ secondaryIndexRecords = getSecondaryIndexUpdates(commitMetadata, partition, writeStatus);
+ } catch (Exception e) {
+ throw new HoodieMetadataException("Failed to get secondary index updates for partition " + partition, e);
+ }
+ partitionToRecordMap.put(SECONDARY_INDEX, secondaryIndexRecords);
+ });
+ }
+
+ private HoodieData<HoodieRecord> getSecondaryIndexUpdates(HoodieCommitMetadata commitMetadata, String indexPartition, HoodieData<WriteStatus> writeStatus) throws Exception {
+ // Build a list of basefiles+delta-log-files for every partition that this commit touches
+ // {
+ // {
+ // "partition1", { {"baseFile11", {"logFile11", "logFile12"}}, {"baseFile12", {"logFile11"} } },
+ // },
+ // {
+ // "partition2", { {"baseFile21", {"logFile21", "logFile22"}}, {"baseFile22", {"logFile21"} } }
+ // }
+ // }
+ List<Pair<String, Pair<String, List<String>>>> partitionFilePairs = new ArrayList<>();
+ commitMetadata.getPartitionToWriteStats().forEach((dataPartition, writeStats) -> {
+ writeStats.forEach(writeStat -> {
+ if (writeStat instanceof HoodieDeltaWriteStat) {
+ partitionFilePairs.add(Pair.of(dataPartition, Pair.of(((HoodieDeltaWriteStat) writeStat).getBaseFile(), ((HoodieDeltaWriteStat) writeStat).getLogFiles())));
+ } else {
+ partitionFilePairs.add(Pair.of(dataPartition, Pair.of(writeStat.getPath(), new ArrayList<>())));
Review Comment:
`Collections.emptyList()` is always better.
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/metadata/HoodieBackedTableMetadataWriter.java:
##########
@@ -437,9 +448,7 @@ private boolean initializeFromFilesystem(String initializationTime, List<Metadat
HoodieData<HoodieRecord> records = fileGroupCountAndRecordsPair.getValue();
bulkCommit(commitTimeForPartition, partitionType, records, fileGroupCount);
metadataMetaClient.reloadActiveTimeline();
- String partitionPath = partitionType == FUNCTIONAL_INDEX
- ? dataWriteConfig.getFunctionalIndexConfig().getIndexName()
- : partitionType.getPartitionPath();
+ String partitionPath = (partitionType == FUNCTIONAL_INDEX || partitionType == SECONDARY_INDEX) ? dataWriteConfig.getFunctionalIndexConfig().getIndexName() : partitionType.getPartitionPath();
Review Comment:
Maybe we can extend the partition type to hold some variable flags inside.
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/metadata/HoodieBackedTableMetadataWriter.java:
##########
@@ -977,16 +1014,17 @@ public void updateFromWriteStatuses(HoodieCommitMetadata commitMetadata, HoodieD
Map<MetadataPartitionType, HoodieData<HoodieRecord>> partitionToRecordMap =
HoodieTableMetadataUtil.convertMetadataToRecords(
engineContext, dataWriteConfig, commitMetadata, instantTime, dataMetaClient,
- enabledPartitionTypes, dataWriteConfig.getBloomFilterType(),
- dataWriteConfig.getBloomIndexParallelism(), dataWriteConfig.isMetadataColumnStatsIndexEnabled(),
- dataWriteConfig.getColumnStatsIndexParallelism(), dataWriteConfig.getColumnsEnabledForColumnStatsIndex(), dataWriteConfig.getMetadataConfig());
+ enabledPartitionTypes, dataWriteConfig.getBloomFilterType(),
+ dataWriteConfig.getBloomIndexParallelism(), dataWriteConfig.isMetadataColumnStatsIndexEnabled(),
+ dataWriteConfig.getColumnStatsIndexParallelism(), dataWriteConfig.getColumnsEnabledForColumnStatsIndex(), dataWriteConfig.getMetadataConfig());
// Updates for record index are created by parsing the WriteStatus which is a hudi-client object. Hence, we cannot yet move this code
// to the HoodieTableMetadataUtil class in hudi-common.
HoodieData<HoodieRecord> updatesFromWriteStatuses = getRecordIndexUpserts(writeStatus);
HoodieData<HoodieRecord> additionalUpdates = getRecordIndexAdditionalUpserts(updatesFromWriteStatuses, commitMetadata);
partitionToRecordMap.put(RECORD_INDEX, updatesFromWriteStatuses.union(additionalUpdates));
updateFunctionalIndexIfPresent(commitMetadata, instantTime, partitionToRecordMap);
+ updateSecondaryIndexIfPresent(commitMetadata, partitionToRecordMap, writeStatus);
Review Comment:
Do we have the similiar retraction issue like RLI, should we union the retracted records too.
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/metadata/HoodieBackedTableMetadataWriter.java:
##########
@@ -540,6 +547,51 @@ private HoodieFunctionalIndexDefinition getFunctionalIndexDefinition(String inde
}
}
+ private Set<String> getSecondaryIndexPartitionsToInit() {
+ Set<String> secondaryIndexPartitions = dataMetaClient.getFunctionalIndexMetadata().get().getIndexDefinitions().values().stream()
+ .map(HoodieFunctionalIndexDefinition::getIndexName)
+ .filter(indexName -> indexName.startsWith(HoodieTableMetadataUtil.PARTITION_NAME_SECONDARY_INDEX_PREFIX))
+ .collect(Collectors.toSet());
+ Set<String> completedMetadataPartitions = dataMetaClient.getTableConfig().getMetadataPartitions();
+ secondaryIndexPartitions.removeAll(completedMetadataPartitions);
+ return secondaryIndexPartitions;
+ }
+
+ private Pair<Integer, HoodieData<HoodieRecord>> initializeSecondaryIndexPartition(String indexName) throws IOException {
+ HoodieFunctionalIndexDefinition indexDefinition = getFunctionalIndexDefinition(indexName);
+ ValidationUtils.checkState(indexDefinition != null, "Secondary Index definition is not present for index " + indexName);
+ List<Pair<String, FileSlice>> partitionFileSlicePairs = getPartitionFileSlicePairs();
+
+ // Reuse record index parallelism config to build secondary index
+ int parallelism = Math.min(partitionFileSlicePairs.size(), dataWriteConfig.getMetadataConfig().getRecordIndexMaxParallelism());
+ HoodieData<HoodieRecord> records = readSecondaryKeysFromFileSlices(
+ engineContext,
+ partitionFileSlicePairs,
+ parallelism,
+ this.getClass().getSimpleName(),
+ dataMetaClient,
+ EngineType.SPARK,
Review Comment:
don't think we should declare the engine type in abstract class.
##########
hudi-common/src/main/java/org/apache/hudi/common/config/HoodieMetadataConfig.java:
##########
@@ -351,6 +351,25 @@ public final class HoodieMetadataConfig extends HoodieConfig {
.sinceVersion("1.0.0")
.withDocumentation("Parallelism to use, when generating partition stats index.");
+ public static final ConfigProperty<Boolean> SECONDARY_INDEX_ENABLE_PROP = ConfigProperty
+ .key(METADATA_PREFIX + ".index.secondary.enable")
+ .defaultValue(false)
+ .sinceVersion("1.0.0")
+ .withDocumentation("Enable secondary index within the Metadata Table.");
+
+ public static final ConfigProperty<String> SECONDARY_INDEX_COLUMN = ConfigProperty
+ .key(METADATA_PREFIX + ".index.secondary.column")
+ .noDefaultValue()
+ .sinceVersion("1.0.0")
+ .withDocumentation("Enable secondary index within the Metadata Table.");
Review Comment:
Fix the doc.
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/metadata/HoodieBackedTableMetadataWriter.java:
##########
@@ -1054,6 +1092,75 @@ private HoodieData<HoodieRecord> getFunctionalIndexUpdates(HoodieCommitMetadata
return getFunctionalIndexRecords(partitionFileSlicePairs, indexDefinition, dataMetaClient, parallelism, readerSchema, storageConf);
}
+ private void updateSecondaryIndexIfPresent(HoodieCommitMetadata commitMetadata, Map<MetadataPartitionType, HoodieData<HoodieRecord>> partitionToRecordMap, HoodieData<WriteStatus> writeStatus) {
+ dataMetaClient.getTableConfig().getMetadataPartitions()
+ .stream()
+ .filter(partition -> partition.startsWith(HoodieTableMetadataUtil.PARTITION_NAME_SECONDARY_INDEX_PREFIX))
+ .forEach(partition -> {
+ HoodieData<HoodieRecord> secondaryIndexRecords;
+ try {
+ secondaryIndexRecords = getSecondaryIndexUpdates(commitMetadata, partition, writeStatus);
+ } catch (Exception e) {
+ throw new HoodieMetadataException("Failed to get secondary index updates for partition " + partition, e);
+ }
+ partitionToRecordMap.put(SECONDARY_INDEX, secondaryIndexRecords);
+ });
+ }
+
+ private HoodieData<HoodieRecord> getSecondaryIndexUpdates(HoodieCommitMetadata commitMetadata, String indexPartition, HoodieData<WriteStatus> writeStatus) throws Exception {
+ // Build a list of basefiles+delta-log-files for every partition that this commit touches
+ // {
+ // {
+ // "partition1", { {"baseFile11", {"logFile11", "logFile12"}}, {"baseFile12", {"logFile11"} } },
+ // },
+ // {
+ // "partition2", { {"baseFile21", {"logFile21", "logFile22"}}, {"baseFile22", {"logFile21"} } }
+ // }
+ // }
+ List<Pair<String, Pair<String, List<String>>>> partitionFilePairs = new ArrayList<>();
+ commitMetadata.getPartitionToWriteStats().forEach((dataPartition, writeStats) -> {
+ writeStats.forEach(writeStat -> {
+ if (writeStat instanceof HoodieDeltaWriteStat) {
+ partitionFilePairs.add(Pair.of(dataPartition, Pair.of(((HoodieDeltaWriteStat) writeStat).getBaseFile(), ((HoodieDeltaWriteStat) writeStat).getLogFiles())));
+ } else {
+ partitionFilePairs.add(Pair.of(dataPartition, Pair.of(writeStat.getPath(), new ArrayList<>())));
+ }
+ });
+ });
+
+ // Build a list of keys that need to be removed. A 'delete' record will be emitted into the respective FileGroup of
+ // the secondary index partition for each of these keys. For a commit which is deleting/updating a lot of records, this
+ // operation is going to be expensive (in CPU, memory and IO)
+ List<String> keysToRemove = new ArrayList<>();
+ writeStatus.collectAsList().forEach(status -> {
+ status.getWrittenRecordDelegates().forEach(recordDelegate -> {
+ // Consider those keys which were either updated or deleted in this commit
+ if (!recordDelegate.getNewLocation().isPresent() || (recordDelegate.getCurrentLocation().isPresent() && recordDelegate.getNewLocation().isPresent())) {
+ keysToRemove.add(recordDelegate.getRecordKey());
+ }
+ });
+ });
+ HoodieFunctionalIndexDefinition indexDefinition = getFunctionalIndexDefinition(indexPartition);
+
+ // Fetch the secondary keys that each of the record keys ('keysToRemove') maps to
+ // This is obtained by scanning the entire secondary index partition in the metadata table
+ // This could be an expensive operation for a large commit (updating/deleting millions of rows)
+ Map<String, String> recordKeySecondaryKeyMap = metadata.getSecondaryKeys(keysToRemove);
+ HoodieData<HoodieRecord> deletedRecords = getDeletedSecondaryRecordMapping(engineContext, recordKeySecondaryKeyMap, indexDefinition);
+
+ // Reuse record index parallelism config to build secondary index
+ int parallelism = Math.min(partitionFilePairs.size(), dataWriteConfig.getMetadataConfig().getRecordIndexMaxParallelism());
Review Comment:
We better introduce a new config for the secondary index, it looks like the secondary index is 1 exponent larger than the RLI index.
##########
hudi-common/src/main/java/org/apache/hudi/metadata/HoodieMetadataPayload.java:
##########
@@ -295,6 +311,11 @@ protected HoodieMetadataPayload(String key, int type,
this.recordIndexMetadata = recordIndexMetadata;
}
+ public HoodieMetadataPayload(String key, HoodieSecondaryIndexInfo secondaryIndexMetadata) {
Review Comment:
should it be public scope or private, move it to line 301 seems better.
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/metadata/HoodieBackedTableMetadataWriter.java:
##########
@@ -540,6 +547,51 @@ private HoodieFunctionalIndexDefinition getFunctionalIndexDefinition(String inde
}
}
+ private Set<String> getSecondaryIndexPartitionsToInit() {
+ Set<String> secondaryIndexPartitions = dataMetaClient.getFunctionalIndexMetadata().get().getIndexDefinitions().values().stream()
+ .map(HoodieFunctionalIndexDefinition::getIndexName)
+ .filter(indexName -> indexName.startsWith(HoodieTableMetadataUtil.PARTITION_NAME_SECONDARY_INDEX_PREFIX))
Review Comment:
Looks like we have some code that can share with functional index.
##########
hudi-common/src/main/java/org/apache/hudi/metadata/HoodieBackedTableMetadata.java:
##########
@@ -783,4 +784,101 @@ public int getNumFileGroupsForPartition(MetadataPartitionType partition) {
metadataFileSystemView, partition.getPartitionPath()));
return partitionFileSliceMap.get(partition.getPartitionPath()).size();
}
+
+ @Override
+ protected Map<String, String> getSecondaryKeysForRecordKeys(List<String> recordKeys, String partitionName) {
+ if (recordKeys.isEmpty()) {
+ return Collections.emptyMap();
+ }
+
+ // Load the file slices for the partition. Each file slice is a shard which saves a portion of the keys.
+ List<FileSlice> partitionFileSlices = partitionFileSliceMap.computeIfAbsent(partitionName,
+ k -> HoodieTableMetadataUtil.getPartitionLatestMergedFileSlices(metadataMetaClient, metadataFileSystemView, partitionName));
+ final int numFileSlices = partitionFileSlices.size();
+ ValidationUtils.checkState(numFileSlices > 0, "Number of file slices for partition " + partitionName + " should be > 0");
+
+ // Lookup keys from each file slice
+ // TODO: parallelize this loop
+ Map<String, String> reverseSecondaryKeyMap = new HashMap<>();
+ for (FileSlice partition : partitionFileSlices) {
+ reverseLookupSecondaryKeys(partitionName, recordKeys, partition, reverseSecondaryKeyMap);
+ }
+
+ return reverseSecondaryKeyMap;
+ }
+
+ private void reverseLookupSecondaryKeys(String partitionName, List<String> recordKeys, FileSlice fileSlice, Map<String, String> recordKeyMap) {
+ Set<String> keySet = new HashSet<>(recordKeys.size());
+ Map<String, HoodieRecord<HoodieMetadataPayload>> logRecordsMap = new HashMap<>();
Review Comment:
Looks like we have many duplicate codes with RLI.
##########
hudi-common/src/main/java/org/apache/hudi/metadata/HoodieBackedTableMetadata.java:
##########
@@ -783,4 +784,101 @@ public int getNumFileGroupsForPartition(MetadataPartitionType partition) {
metadataFileSystemView, partition.getPartitionPath()));
return partitionFileSliceMap.get(partition.getPartitionPath()).size();
}
+
+ @Override
+ protected Map<String, String> getSecondaryKeysForRecordKeys(List<String> recordKeys, String partitionName) {
+ if (recordKeys.isEmpty()) {
+ return Collections.emptyMap();
+ }
+
+ // Load the file slices for the partition. Each file slice is a shard which saves a portion of the keys.
+ List<FileSlice> partitionFileSlices = partitionFileSliceMap.computeIfAbsent(partitionName,
+ k -> HoodieTableMetadataUtil.getPartitionLatestMergedFileSlices(metadataMetaClient, metadataFileSystemView, partitionName));
+ final int numFileSlices = partitionFileSlices.size();
+ ValidationUtils.checkState(numFileSlices > 0, "Number of file slices for partition " + partitionName + " should be > 0");
+
+ // Lookup keys from each file slice
+ // TODO: parallelize this loop
+ Map<String, String> reverseSecondaryKeyMap = new HashMap<>();
+ for (FileSlice partition : partitionFileSlices) {
+ reverseLookupSecondaryKeys(partitionName, recordKeys, partition, reverseSecondaryKeyMap);
+ }
+
+ return reverseSecondaryKeyMap;
+ }
+
+ private void reverseLookupSecondaryKeys(String partitionName, List<String> recordKeys, FileSlice fileSlice, Map<String, String> recordKeyMap) {
+ Set<String> keySet = new HashSet<>(recordKeys.size());
+ Map<String, HoodieRecord<HoodieMetadataPayload>> logRecordsMap = new HashMap<>();
+ Pair<HoodieSeekingFileReader<?>, HoodieMetadataLogRecordReader> readers = getOrCreateReaders(partitionName, fileSlice);
+ try {
+ HoodieSeekingFileReader<?> baseFileReader = readers.getKey();
+ HoodieMetadataLogRecordReader logRecordScanner = readers.getRight();
+ if (baseFileReader == null && logRecordScanner == null) {
+ return;
+ }
+
+ // Sort it here once so that we don't need to sort individually for base file and for each individual log files.
+ List<String> sortedKeys = new ArrayList<>(recordKeys);
+ Collections.sort(sortedKeys);
+ keySet.addAll(sortedKeys);
+
+ logRecordScanner.getRecords().forEach(record -> {
+ HoodieMetadataPayload payload = record.getData();
+ String recordKey = payload.getRecordKeyFromSecondaryIndex();
+ if (keySet.contains(recordKey)) {
+ logRecordsMap.put(recordKey, record);
+ }
+ });
+
+ // Map of (record-key, secondary-index-record)
+ Map<String, HoodieRecord<HoodieMetadataPayload>> baseFileRecords = fetchBaseFileAllRecordsByPayload(baseFileReader, keySet, partitionName);
+
+ // Iterate over all provided log-records, merging them into existing records
+ logRecordsMap.forEach((key1, value1) -> baseFileRecords.merge(
+ key1,
+ value1,
+ (oldRecord, newRecord) -> {
+ Option<HoodieRecord<HoodieMetadataPayload>> mergedRecord =
+ HoodieMetadataPayload.combineSecondaryIndexRecord(oldRecord, newRecord);
+ return mergedRecord.orElseGet(null);
+ }
+ ));
+
+ baseFileRecords.forEach((key, value) -> {
+ recordKeyMap.put(key, value.getRecordKey());
+ });
+ } catch (IOException ioe) {
+ throw new HoodieIOException("Error merging records from metadata table for " + recordKeys.size() + " key : ", ioe);
+ } finally {
+ if (!reuse) {
+ closeReader(readers);
+ }
+ }
+ }
+
+ private Map<String, HoodieRecord<HoodieMetadataPayload>> fetchBaseFileAllRecordsByPayload(HoodieSeekingFileReader reader,
+ Set<String> keySet,
+ String partitionName) throws IOException {
+ if (reader == null) {
+ // No base file at all
+ return new HashMap<>();
Review Comment:
`Collections.emptyMap` is always better.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "codope (via GitHub)" <gi...@apache.org>.
codope commented on code in PR #11146:
URL: https://github.com/apache/hudi/pull/11146#discussion_r1610397009
##########
hudi-common/src/main/java/org/apache/hudi/metadata/HoodieBackedTableMetadata.java:
##########
@@ -783,4 +784,101 @@ public int getNumFileGroupsForPartition(MetadataPartitionType partition) {
metadataFileSystemView, partition.getPartitionPath()));
return partitionFileSliceMap.get(partition.getPartitionPath()).size();
}
+
+ @Override
+ protected Map<String, String> getSecondaryKeysForRecordKeys(List<String> recordKeys, String partitionName) {
+ if (recordKeys.isEmpty()) {
+ return Collections.emptyMap();
+ }
+
+ // Load the file slices for the partition. Each file slice is a shard which saves a portion of the keys.
+ List<FileSlice> partitionFileSlices = partitionFileSliceMap.computeIfAbsent(partitionName,
+ k -> HoodieTableMetadataUtil.getPartitionLatestMergedFileSlices(metadataMetaClient, metadataFileSystemView, partitionName));
+ final int numFileSlices = partitionFileSlices.size();
+ ValidationUtils.checkState(numFileSlices > 0, "Number of file slices for partition " + partitionName + " should be > 0");
+
+ // Lookup keys from each file slice
+ // TODO: parallelize this loop
+ Map<String, String> reverseSecondaryKeyMap = new HashMap<>();
+ for (FileSlice partition : partitionFileSlices) {
+ reverseLookupSecondaryKeys(partitionName, recordKeys, partition, reverseSecondaryKeyMap);
+ }
+
+ return reverseSecondaryKeyMap;
+ }
+
+ private void reverseLookupSecondaryKeys(String partitionName, List<String> recordKeys, FileSlice fileSlice, Map<String, String> recordKeyMap) {
+ Set<String> keySet = new HashSet<>(recordKeys.size());
+ Map<String, HoodieRecord<HoodieMetadataPayload>> logRecordsMap = new HashMap<>();
Review Comment:
IDE suggests some duplicate blocks in previously written code but none in the new code. However, I think you are talking about few lines below where we get the readers and return early if they are null. I will refactor and reuse as much as possible.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "codope (via GitHub)" <gi...@apache.org>.
codope commented on code in PR #11146:
URL: https://github.com/apache/hudi/pull/11146#discussion_r1616258543
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/metadata/HoodieBackedTableMetadataWriter.java:
##########
@@ -437,9 +448,7 @@ private boolean initializeFromFilesystem(String initializationTime, List<Metadat
HoodieData<HoodieRecord> records = fileGroupCountAndRecordsPair.getValue();
bulkCommit(commitTimeForPartition, partitionType, records, fileGroupCount);
metadataMetaClient.reloadActiveTimeline();
- String partitionPath = partitionType == FUNCTIONAL_INDEX
- ? dataWriteConfig.getFunctionalIndexConfig().getIndexName()
- : partitionType.getPartitionPath();
+ String partitionPath = (partitionType == FUNCTIONAL_INDEX || partitionType == SECONDARY_INDEX) ? dataWriteConfig.getFunctionalIndexConfig().getIndexName() : partitionType.getPartitionPath();
Review Comment:
Sure, will do it as part of HUDI-7691
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "codope (via GitHub)" <gi...@apache.org>.
codope commented on code in PR #11146:
URL: https://github.com/apache/hudi/pull/11146#discussion_r1618691471
##########
hudi-common/src/main/java/org/apache/hudi/keygen/constant/KeyGeneratorOptions.java:
##########
@@ -54,6 +54,13 @@ public class KeyGeneratorOptions extends HoodieConfig {
+ "Actual value will be obtained by invoking .toString() on the field value. Nested fields can be specified using\n"
+ "the dot notation eg: `a.b.c`");
+ public static final ConfigProperty<String> SECONDARYKEY_FIELD_NAME = ConfigProperty
+ .key("hoodie.datasource.write.secondarykey.field")
Review Comment:
made it `.column` to keep consistent with HoodieMetadataConfig.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #11146:
URL: https://github.com/apache/hudi/pull/11146#issuecomment-2138531108
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23710",
"triggerID" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"triggerType" : "PUSH"
}, {
"hash" : "1468a9a72c2cfdda7dae6bb62ac14551f600d8df",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23711",
"triggerID" : "1468a9a72c2cfdda7dae6bb62ac14551f600d8df",
"triggerType" : "PUSH"
}, {
"hash" : "f232b46fcd23d960efc587a624c2e9d69d3d7e9e",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23728",
"triggerID" : "f232b46fcd23d960efc587a624c2e9d69d3d7e9e",
"triggerType" : "PUSH"
}, {
"hash" : "8a6a98e1a8f0f65df59dddf663b0ef231f4c01ee",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23964",
"triggerID" : "8a6a98e1a8f0f65df59dddf663b0ef231f4c01ee",
"triggerType" : "PUSH"
}, {
"hash" : "420b19219080b2935b3a37442db7ed22816466af",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23999",
"triggerID" : "420b19219080b2935b3a37442db7ed22816466af",
"triggerType" : "PUSH"
}, {
"hash" : "4c02510ba3b23cb7d7feffbb2c6850c038d6103a",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24005",
"triggerID" : "4c02510ba3b23cb7d7feffbb2c6850c038d6103a",
"triggerType" : "PUSH"
}, {
"hash" : "9c3c82dde2fd4fcf1c2babe2c1a0345fe87af0c7",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24016",
"triggerID" : "9c3c82dde2fd4fcf1c2babe2c1a0345fe87af0c7",
"triggerType" : "PUSH"
}, {
"hash" : "98d96be857a9e87e74a4dee99cb31b162ade5aa3",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24091",
"triggerID" : "98d96be857a9e87e74a4dee99cb31b162ade5aa3",
"triggerType" : "PUSH"
}, {
"hash" : "76cb6530775bdfd9415bab25c48f23fd84777182",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24117",
"triggerID" : "76cb6530775bdfd9415bab25c48f23fd84777182",
"triggerType" : "PUSH"
}, {
"hash" : "470bc5f44e7a6658a8717ef1b77e92afcdd90087",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "470bc5f44e7a6658a8717ef1b77e92afcdd90087",
"triggerType" : "PUSH"
}, {
"hash" : "3d9b55d5f226698abf7339dc604f0e02d8fc8133",
"status" : "SUCCESS",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24120",
"triggerID" : "3d9b55d5f226698abf7339dc604f0e02d8fc8133",
"triggerType" : "PUSH"
}, {
"hash" : "e8a4507886bc97b1819ea39788f2abd7385b8cf2",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "e8a4507886bc97b1819ea39788f2abd7385b8cf2",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 470bc5f44e7a6658a8717ef1b77e92afcdd90087 UNKNOWN
* 3d9b55d5f226698abf7339dc604f0e02d8fc8133 Azure: [SUCCESS](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24120)
* e8a4507886bc97b1819ea39788f2abd7385b8cf2 UNKNOWN
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "codope (via GitHub)" <gi...@apache.org>.
codope commented on code in PR #11146:
URL: https://github.com/apache/hudi/pull/11146#discussion_r1618694958
##########
hudi-common/src/main/java/org/apache/hudi/metadata/HoodieTableMetadataUtil.java:
##########
@@ -1833,12 +1838,146 @@ public static HoodieData<HoodieRecord> readRecordKeysFromFileSlices(HoodieEngine
});
}
- public static Schema getProjectedSchemaForFunctionalIndex(HoodieFunctionalIndexDefinition indexDefinition, HoodieTableMetaClient metaClient) throws Exception {
+ public static Schema getProjectedSchemaForFunctionalIndex(HoodieIndexDefinition indexDefinition, HoodieTableMetaClient metaClient) throws Exception {
TableSchemaResolver schemaResolver = new TableSchemaResolver(metaClient);
Schema tableSchema = schemaResolver.getTableAvroSchema();
return addMetadataFields(getSchemaForFields(tableSchema, indexDefinition.getSourceFields()));
}
+ public static HoodieData<HoodieRecord> readSecondaryKeysFromBaseFiles(HoodieEngineContext engineContext,
+ List<Pair<String, Pair<String, List<String>>>> partitionFiles,
+ int recordIndexMaxParallelism,
+ String activeModule, HoodieTableMetaClient metaClient, EngineType engineType,
+ HoodieIndexDefinition indexDefinition) {
+ if (partitionFiles.isEmpty()) {
+ return engineContext.emptyHoodieData();
+ }
+
+ engineContext.setJobStatus(activeModule, "Secondary Index: reading secondary keys from " + partitionFiles.size() + " partitions");
+ final int parallelism = Math.min(partitionFiles.size(), recordIndexMaxParallelism);
+ final String basePath = metaClient.getBasePathV2().toString();
+ return engineContext.parallelize(partitionFiles, parallelism).flatMap(partitionAndBaseFile -> {
+ final String partition = partitionAndBaseFile.getKey();
+ final Pair<String, List<String>> baseAndLogFiles = partitionAndBaseFile.getValue();
+ List<String> logFilePaths = new ArrayList<>();
+ baseAndLogFiles.getValue().forEach(logFile -> {
+ logFilePaths.add(basePath + StoragePath.SEPARATOR + partition + StoragePath.SEPARATOR + logFile);
+ });
+ String filePath = baseAndLogFiles.getKey();
+
+ Option<StoragePath> dataFilePath = Option.empty();
+ Schema tableSchema;
+
+ if (!filePath.isEmpty()) {
+ dataFilePath = Option.of(filePath(basePath, "", filePath));
+ tableSchema = HoodieIOFactory.getIOFactory(metaClient.getStorage()).getFileFormatUtils(HoodieFileFormat.PARQUET).readAvroSchema(metaClient.getStorage(), dataFilePath.get());
+ } else {
+ TableSchemaResolver schemaResolver = new TableSchemaResolver(metaClient);
Review Comment:
Good point! I have moved out but still lazily instantiating only in the case when there is no base file in the file slice. In most case we will have some base file, so `TableSchemaResolver` won't be instantiated. Only when inserts can go to log files and compaction has not taken place, then we need the schema resolver. This is not very common I belive.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "codope (via GitHub)" <gi...@apache.org>.
codope commented on code in PR #11146:
URL: https://github.com/apache/hudi/pull/11146#discussion_r1616259478
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/metadata/HoodieBackedTableMetadataWriter.java:
##########
@@ -1054,6 +1092,75 @@ private HoodieData<HoodieRecord> getFunctionalIndexUpdates(HoodieCommitMetadata
return getFunctionalIndexRecords(partitionFileSlicePairs, indexDefinition, dataMetaClient, parallelism, readerSchema, storageConf);
}
+ private void updateSecondaryIndexIfPresent(HoodieCommitMetadata commitMetadata, Map<MetadataPartitionType, HoodieData<HoodieRecord>> partitionToRecordMap, HoodieData<WriteStatus> writeStatus) {
+ dataMetaClient.getTableConfig().getMetadataPartitions()
+ .stream()
+ .filter(partition -> partition.startsWith(HoodieTableMetadataUtil.PARTITION_NAME_SECONDARY_INDEX_PREFIX))
+ .forEach(partition -> {
+ HoodieData<HoodieRecord> secondaryIndexRecords;
+ try {
+ secondaryIndexRecords = getSecondaryIndexUpdates(commitMetadata, partition, writeStatus);
+ } catch (Exception e) {
+ throw new HoodieMetadataException("Failed to get secondary index updates for partition " + partition, e);
+ }
+ partitionToRecordMap.put(SECONDARY_INDEX, secondaryIndexRecords);
+ });
+ }
+
+ private HoodieData<HoodieRecord> getSecondaryIndexUpdates(HoodieCommitMetadata commitMetadata, String indexPartition, HoodieData<WriteStatus> writeStatus) throws Exception {
+ // Build a list of basefiles+delta-log-files for every partition that this commit touches
+ // {
+ // {
+ // "partition1", { {"baseFile11", {"logFile11", "logFile12"}}, {"baseFile12", {"logFile11"} } },
+ // },
+ // {
+ // "partition2", { {"baseFile21", {"logFile21", "logFile22"}}, {"baseFile22", {"logFile21"} } }
+ // }
+ // }
+ List<Pair<String, Pair<String, List<String>>>> partitionFilePairs = new ArrayList<>();
+ commitMetadata.getPartitionToWriteStats().forEach((dataPartition, writeStats) -> {
+ writeStats.forEach(writeStat -> {
+ if (writeStat instanceof HoodieDeltaWriteStat) {
+ partitionFilePairs.add(Pair.of(dataPartition, Pair.of(((HoodieDeltaWriteStat) writeStat).getBaseFile(), ((HoodieDeltaWriteStat) writeStat).getLogFiles())));
+ } else {
+ partitionFilePairs.add(Pair.of(dataPartition, Pair.of(writeStat.getPath(), new ArrayList<>())));
+ }
+ });
+ });
+
+ // Build a list of keys that need to be removed. A 'delete' record will be emitted into the respective FileGroup of
+ // the secondary index partition for each of these keys. For a commit which is deleting/updating a lot of records, this
+ // operation is going to be expensive (in CPU, memory and IO)
+ List<String> keysToRemove = new ArrayList<>();
+ writeStatus.collectAsList().forEach(status -> {
+ status.getWrittenRecordDelegates().forEach(recordDelegate -> {
+ // Consider those keys which were either updated or deleted in this commit
+ if (!recordDelegate.getNewLocation().isPresent() || (recordDelegate.getCurrentLocation().isPresent() && recordDelegate.getNewLocation().isPresent())) {
+ keysToRemove.add(recordDelegate.getRecordKey());
+ }
+ });
+ });
+ HoodieFunctionalIndexDefinition indexDefinition = getFunctionalIndexDefinition(indexPartition);
+
+ // Fetch the secondary keys that each of the record keys ('keysToRemove') maps to
+ // This is obtained by scanning the entire secondary index partition in the metadata table
+ // This could be an expensive operation for a large commit (updating/deleting millions of rows)
+ Map<String, String> recordKeySecondaryKeyMap = metadata.getSecondaryKeys(keysToRemove);
+ HoodieData<HoodieRecord> deletedRecords = getDeletedSecondaryRecordMapping(engineContext, recordKeySecondaryKeyMap, indexDefinition);
+
+ // Reuse record index parallelism config to build secondary index
+ int parallelism = Math.min(partitionFilePairs.size(), dataWriteConfig.getMetadataConfig().getRecordIndexMaxParallelism());
Review Comment:
done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #11146:
URL: https://github.com/apache/hudi/pull/11146#issuecomment-2097485263
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23710",
"triggerID" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"triggerType" : "PUSH"
}, {
"hash" : "1468a9a72c2cfdda7dae6bb62ac14551f600d8df",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23711",
"triggerID" : "1468a9a72c2cfdda7dae6bb62ac14551f600d8df",
"triggerType" : "PUSH"
}, {
"hash" : "f232b46fcd23d960efc587a624c2e9d69d3d7e9e",
"status" : "PENDING",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23728",
"triggerID" : "f232b46fcd23d960efc587a624c2e9d69d3d7e9e",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 1468a9a72c2cfdda7dae6bb62ac14551f600d8df Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23711)
* f232b46fcd23d960efc587a624c2e9d69d3d7e9e Azure: [PENDING](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23728)
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #11146:
URL: https://github.com/apache/hudi/pull/11146#issuecomment-2114089178
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23710",
"triggerID" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"triggerType" : "PUSH"
}, {
"hash" : "1468a9a72c2cfdda7dae6bb62ac14551f600d8df",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23711",
"triggerID" : "1468a9a72c2cfdda7dae6bb62ac14551f600d8df",
"triggerType" : "PUSH"
}, {
"hash" : "f232b46fcd23d960efc587a624c2e9d69d3d7e9e",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23728",
"triggerID" : "f232b46fcd23d960efc587a624c2e9d69d3d7e9e",
"triggerType" : "PUSH"
}, {
"hash" : "8a6a98e1a8f0f65df59dddf663b0ef231f4c01ee",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23964",
"triggerID" : "8a6a98e1a8f0f65df59dddf663b0ef231f4c01ee",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 8a6a98e1a8f0f65df59dddf663b0ef231f4c01ee Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23964)
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "codope (via GitHub)" <gi...@apache.org>.
codope commented on code in PR #11146:
URL: https://github.com/apache/hudi/pull/11146#discussion_r1610329349
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/metadata/HoodieBackedTableMetadataWriter.java:
##########
@@ -437,9 +448,7 @@ private boolean initializeFromFilesystem(String initializationTime, List<Metadat
HoodieData<HoodieRecord> records = fileGroupCountAndRecordsPair.getValue();
bulkCommit(commitTimeForPartition, partitionType, records, fileGroupCount);
metadataMetaClient.reloadActiveTimeline();
- String partitionPath = partitionType == FUNCTIONAL_INDEX
- ? dataWriteConfig.getFunctionalIndexConfig().getIndexName()
- : partitionType.getPartitionPath();
+ String partitionPath = (partitionType == FUNCTIONAL_INDEX || partitionType == SECONDARY_INDEX) ? dataWriteConfig.getFunctionalIndexConfig().getIndexName() : partitionType.getPartitionPath();
Review Comment:
Will have to supply indexing config to `MetadataPartitionType#getPartitionPath` to do so beacuse unlike functional or secondary index, all other indexes in metadata have same name as well as partition path. Functional or secondary index name are defined by user and that is why need to fetch them from functional index config.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "codope (via GitHub)" <gi...@apache.org>.
codope commented on code in PR #11146:
URL: https://github.com/apache/hudi/pull/11146#discussion_r1610379136
##########
hudi-common/src/main/java/org/apache/hudi/metadata/HoodieMetadataPayload.java:
##########
@@ -295,6 +311,11 @@ protected HoodieMetadataPayload(String key, int type,
this.recordIndexMetadata = recordIndexMetadata;
}
+ public HoodieMetadataPayload(String key, HoodieSecondaryIndexInfo secondaryIndexMetadata) {
Review Comment:
Should be private. Refactored as suggested.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "danny0405 (via GitHub)" <gi...@apache.org>.
danny0405 commented on code in PR #11146:
URL: https://github.com/apache/hudi/pull/11146#discussion_r1610825092
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/metadata/HoodieBackedTableMetadataWriter.java:
##########
@@ -540,6 +547,51 @@ private HoodieFunctionalIndexDefinition getFunctionalIndexDefinition(String inde
}
}
+ private Set<String> getSecondaryIndexPartitionsToInit() {
+ Set<String> secondaryIndexPartitions = dataMetaClient.getFunctionalIndexMetadata().get().getIndexDefinitions().values().stream()
+ .map(HoodieFunctionalIndexDefinition::getIndexName)
+ .filter(indexName -> indexName.startsWith(HoodieTableMetadataUtil.PARTITION_NAME_SECONDARY_INDEX_PREFIX))
Review Comment:
+1 for `HoodieIndexDefinition` which is more general.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #11146:
URL: https://github.com/apache/hudi/pull/11146#issuecomment-2137462467
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23710",
"triggerID" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"triggerType" : "PUSH"
}, {
"hash" : "1468a9a72c2cfdda7dae6bb62ac14551f600d8df",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23711",
"triggerID" : "1468a9a72c2cfdda7dae6bb62ac14551f600d8df",
"triggerType" : "PUSH"
}, {
"hash" : "f232b46fcd23d960efc587a624c2e9d69d3d7e9e",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23728",
"triggerID" : "f232b46fcd23d960efc587a624c2e9d69d3d7e9e",
"triggerType" : "PUSH"
}, {
"hash" : "8a6a98e1a8f0f65df59dddf663b0ef231f4c01ee",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23964",
"triggerID" : "8a6a98e1a8f0f65df59dddf663b0ef231f4c01ee",
"triggerType" : "PUSH"
}, {
"hash" : "420b19219080b2935b3a37442db7ed22816466af",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23999",
"triggerID" : "420b19219080b2935b3a37442db7ed22816466af",
"triggerType" : "PUSH"
}, {
"hash" : "4c02510ba3b23cb7d7feffbb2c6850c038d6103a",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24005",
"triggerID" : "4c02510ba3b23cb7d7feffbb2c6850c038d6103a",
"triggerType" : "PUSH"
}, {
"hash" : "9c3c82dde2fd4fcf1c2babe2c1a0345fe87af0c7",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24016",
"triggerID" : "9c3c82dde2fd4fcf1c2babe2c1a0345fe87af0c7",
"triggerType" : "PUSH"
}, {
"hash" : "98d96be857a9e87e74a4dee99cb31b162ade5aa3",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24091",
"triggerID" : "98d96be857a9e87e74a4dee99cb31b162ade5aa3",
"triggerType" : "PUSH"
}, {
"hash" : "76cb6530775bdfd9415bab25c48f23fd84777182",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24117",
"triggerID" : "76cb6530775bdfd9415bab25c48f23fd84777182",
"triggerType" : "PUSH"
}, {
"hash" : "470bc5f44e7a6658a8717ef1b77e92afcdd90087",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "470bc5f44e7a6658a8717ef1b77e92afcdd90087",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 76cb6530775bdfd9415bab25c48f23fd84777182 Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24117)
* 470bc5f44e7a6658a8717ef1b77e92afcdd90087 UNKNOWN
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #11146:
URL: https://github.com/apache/hudi/pull/11146#issuecomment-2138536999
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23710",
"triggerID" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"triggerType" : "PUSH"
}, {
"hash" : "1468a9a72c2cfdda7dae6bb62ac14551f600d8df",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23711",
"triggerID" : "1468a9a72c2cfdda7dae6bb62ac14551f600d8df",
"triggerType" : "PUSH"
}, {
"hash" : "f232b46fcd23d960efc587a624c2e9d69d3d7e9e",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23728",
"triggerID" : "f232b46fcd23d960efc587a624c2e9d69d3d7e9e",
"triggerType" : "PUSH"
}, {
"hash" : "8a6a98e1a8f0f65df59dddf663b0ef231f4c01ee",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23964",
"triggerID" : "8a6a98e1a8f0f65df59dddf663b0ef231f4c01ee",
"triggerType" : "PUSH"
}, {
"hash" : "420b19219080b2935b3a37442db7ed22816466af",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23999",
"triggerID" : "420b19219080b2935b3a37442db7ed22816466af",
"triggerType" : "PUSH"
}, {
"hash" : "4c02510ba3b23cb7d7feffbb2c6850c038d6103a",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24005",
"triggerID" : "4c02510ba3b23cb7d7feffbb2c6850c038d6103a",
"triggerType" : "PUSH"
}, {
"hash" : "9c3c82dde2fd4fcf1c2babe2c1a0345fe87af0c7",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24016",
"triggerID" : "9c3c82dde2fd4fcf1c2babe2c1a0345fe87af0c7",
"triggerType" : "PUSH"
}, {
"hash" : "98d96be857a9e87e74a4dee99cb31b162ade5aa3",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24091",
"triggerID" : "98d96be857a9e87e74a4dee99cb31b162ade5aa3",
"triggerType" : "PUSH"
}, {
"hash" : "76cb6530775bdfd9415bab25c48f23fd84777182",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24117",
"triggerID" : "76cb6530775bdfd9415bab25c48f23fd84777182",
"triggerType" : "PUSH"
}, {
"hash" : "470bc5f44e7a6658a8717ef1b77e92afcdd90087",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "470bc5f44e7a6658a8717ef1b77e92afcdd90087",
"triggerType" : "PUSH"
}, {
"hash" : "3d9b55d5f226698abf7339dc604f0e02d8fc8133",
"status" : "SUCCESS",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24120",
"triggerID" : "3d9b55d5f226698abf7339dc604f0e02d8fc8133",
"triggerType" : "PUSH"
}, {
"hash" : "e8a4507886bc97b1819ea39788f2abd7385b8cf2",
"status" : "PENDING",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24139",
"triggerID" : "e8a4507886bc97b1819ea39788f2abd7385b8cf2",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 470bc5f44e7a6658a8717ef1b77e92afcdd90087 UNKNOWN
* 3d9b55d5f226698abf7339dc604f0e02d8fc8133 Azure: [SUCCESS](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24120)
* e8a4507886bc97b1819ea39788f2abd7385b8cf2 Azure: [PENDING](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24139)
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #11146:
URL: https://github.com/apache/hudi/pull/11146#issuecomment-2138926167
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23710",
"triggerID" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"triggerType" : "PUSH"
}, {
"hash" : "1468a9a72c2cfdda7dae6bb62ac14551f600d8df",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23711",
"triggerID" : "1468a9a72c2cfdda7dae6bb62ac14551f600d8df",
"triggerType" : "PUSH"
}, {
"hash" : "f232b46fcd23d960efc587a624c2e9d69d3d7e9e",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23728",
"triggerID" : "f232b46fcd23d960efc587a624c2e9d69d3d7e9e",
"triggerType" : "PUSH"
}, {
"hash" : "8a6a98e1a8f0f65df59dddf663b0ef231f4c01ee",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23964",
"triggerID" : "8a6a98e1a8f0f65df59dddf663b0ef231f4c01ee",
"triggerType" : "PUSH"
}, {
"hash" : "420b19219080b2935b3a37442db7ed22816466af",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23999",
"triggerID" : "420b19219080b2935b3a37442db7ed22816466af",
"triggerType" : "PUSH"
}, {
"hash" : "4c02510ba3b23cb7d7feffbb2c6850c038d6103a",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24005",
"triggerID" : "4c02510ba3b23cb7d7feffbb2c6850c038d6103a",
"triggerType" : "PUSH"
}, {
"hash" : "9c3c82dde2fd4fcf1c2babe2c1a0345fe87af0c7",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24016",
"triggerID" : "9c3c82dde2fd4fcf1c2babe2c1a0345fe87af0c7",
"triggerType" : "PUSH"
}, {
"hash" : "98d96be857a9e87e74a4dee99cb31b162ade5aa3",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24091",
"triggerID" : "98d96be857a9e87e74a4dee99cb31b162ade5aa3",
"triggerType" : "PUSH"
}, {
"hash" : "76cb6530775bdfd9415bab25c48f23fd84777182",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24117",
"triggerID" : "76cb6530775bdfd9415bab25c48f23fd84777182",
"triggerType" : "PUSH"
}, {
"hash" : "470bc5f44e7a6658a8717ef1b77e92afcdd90087",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "470bc5f44e7a6658a8717ef1b77e92afcdd90087",
"triggerType" : "PUSH"
}, {
"hash" : "3d9b55d5f226698abf7339dc604f0e02d8fc8133",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24120",
"triggerID" : "3d9b55d5f226698abf7339dc604f0e02d8fc8133",
"triggerType" : "PUSH"
}, {
"hash" : "e8a4507886bc97b1819ea39788f2abd7385b8cf2",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24139",
"triggerID" : "e8a4507886bc97b1819ea39788f2abd7385b8cf2",
"triggerType" : "PUSH"
}, {
"hash" : "43f73661f79eb87ac52d29fa153b996a15f29b99",
"status" : "SUCCESS",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24141",
"triggerID" : "43f73661f79eb87ac52d29fa153b996a15f29b99",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 470bc5f44e7a6658a8717ef1b77e92afcdd90087 UNKNOWN
* 43f73661f79eb87ac52d29fa153b996a15f29b99 Azure: [SUCCESS](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24141)
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "codope (via GitHub)" <gi...@apache.org>.
codope commented on code in PR #11146:
URL: https://github.com/apache/hudi/pull/11146#discussion_r1620002871
##########
hudi-common/src/main/java/org/apache/hudi/common/config/HoodieMetadataConfig.java:
##########
@@ -351,6 +351,25 @@ public final class HoodieMetadataConfig extends HoodieConfig {
.sinceVersion("1.0.0")
.withDocumentation("Parallelism to use, when generating partition stats index.");
+ public static final ConfigProperty<Boolean> SECONDARY_INDEX_ENABLE_PROP = ConfigProperty
+ .key(METADATA_PREFIX + ".index.secondary.enable")
Review Comment:
`enable` is consistent with other configs such as `hoodie.metadata.enable` or `hoodie.metadata.record.index.enable`
##########
hudi-common/src/main/java/org/apache/hudi/metadata/HoodieTableMetadataUtil.java:
##########
@@ -1833,12 +1837,153 @@ public static HoodieData<HoodieRecord> readRecordKeysFromFileSlices(HoodieEngine
});
}
- public static Schema getProjectedSchemaForFunctionalIndex(HoodieFunctionalIndexDefinition indexDefinition, HoodieTableMetaClient metaClient) throws Exception {
+ public static Schema getProjectedSchemaForFunctionalIndex(HoodieIndexDefinition indexDefinition, HoodieTableMetaClient metaClient) throws Exception {
TableSchemaResolver schemaResolver = new TableSchemaResolver(metaClient);
Schema tableSchema = schemaResolver.getTableAvroSchema();
return addMetadataFields(getSchemaForFields(tableSchema, indexDefinition.getSourceFields()));
}
+ public static HoodieData<HoodieRecord> readSecondaryKeysFromBaseFiles(HoodieEngineContext engineContext,
+ List<Pair<String, Pair<String, List<String>>>> partitionFiles,
+ int secondaryIndexMaxParallelism,
+ String activeModule, HoodieTableMetaClient metaClient, EngineType engineType,
+ HoodieIndexDefinition indexDefinition) {
+ if (partitionFiles.isEmpty()) {
+ return engineContext.emptyHoodieData();
+ }
+ final int parallelism = Math.min(partitionFiles.size(), secondaryIndexMaxParallelism);
+ final String basePath = metaClient.getBasePathV2().toString();
+ Schema tableSchema;
+ try {
+ tableSchema = new TableSchemaResolver(metaClient).getTableAvroSchema();
+ } catch (Exception e) {
+ throw new HoodieException("Failed to get latest schema for " + metaClient.getBasePathV2(), e);
+ }
+
+ engineContext.setJobStatus(activeModule, "Secondary Index: reading secondary keys from " + partitionFiles.size() + " partitions");
+ return engineContext.parallelize(partitionFiles, parallelism).flatMap(partitionAndBaseFile -> {
+ final String partition = partitionAndBaseFile.getKey();
+ final Pair<String, List<String>> baseAndLogFiles = partitionAndBaseFile.getValue();
+ List<String> logFilePaths = new ArrayList<>();
+ baseAndLogFiles.getValue().forEach(logFile -> logFilePaths.add(basePath + StoragePath.SEPARATOR + partition + StoragePath.SEPARATOR + logFile));
+ String filePath = baseAndLogFiles.getKey();
+ Option<StoragePath> dataFilePath = filePath.isEmpty() ? Option.empty() : Option.of(filePath(basePath, partition, filePath));
+ Schema readerSchema;
+ if (dataFilePath.isPresent()) {
+ readerSchema = HoodieIOFactory.getIOFactory(metaClient.getStorage())
+ .getFileFormatUtils(metaClient.getTableConfig().getBaseFileFormat())
+ .readAvroSchema(metaClient.getStorage(), dataFilePath.get());
+ } else {
+ readerSchema = tableSchema;
+ }
+ return createSecondaryIndexGenerator(metaClient, engineType, logFilePaths, readerSchema, partition, dataFilePath, indexDefinition);
+ });
+ }
+
+ public static HoodieData<HoodieRecord> readSecondaryKeysFromFileSlices(HoodieEngineContext engineContext,
+ List<Pair<String, FileSlice>> partitionFileSlicePairs,
+ int secondaryIndexMaxParallelism,
+ String activeModule, HoodieTableMetaClient metaClient, EngineType engineType,
+ HoodieIndexDefinition indexDefinition) {
+ if (partitionFileSlicePairs.isEmpty()) {
+ return engineContext.emptyHoodieData();
+ }
+ final int parallelism = Math.min(partitionFileSlicePairs.size(), secondaryIndexMaxParallelism);
+ final String basePath = metaClient.getBasePathV2().toString();
+ Schema tableSchema;
+ try {
+ tableSchema = new TableSchemaResolver(metaClient).getTableAvroSchema();
+ } catch (Exception e) {
+ throw new HoodieException("Failed to get latest schema for " + metaClient.getBasePathV2(), e);
+ }
+
+ engineContext.setJobStatus(activeModule, "Secondary Index: reading secondary keys from " + partitionFileSlicePairs.size() + " file slices");
+ return engineContext.parallelize(partitionFileSlicePairs, parallelism).flatMap(partitionAndBaseFile -> {
+ final String partition = partitionAndBaseFile.getKey();
+ final FileSlice fileSlice = partitionAndBaseFile.getValue();
+ List<String> logFilePaths = fileSlice.getLogFiles().sorted(HoodieLogFile.getLogFileComparator()).map(l -> l.getPath().toString()).collect(toList());
+ Option<StoragePath> dataFilePath = Option.ofNullable(fileSlice.getBaseFile().map(baseFile -> filePath(basePath, partition, baseFile.getFileName())).orElseGet(null));
+ Schema readerSchema;
+ if (dataFilePath.isPresent()) {
+ readerSchema = HoodieIOFactory.getIOFactory(metaClient.getStorage())
+ .getFileFormatUtils(metaClient.getTableConfig().getBaseFileFormat())
+ .readAvroSchema(metaClient.getStorage(), dataFilePath.get());
+ } else {
+ readerSchema = tableSchema;
+ }
+ return createSecondaryIndexGenerator(metaClient, engineType, logFilePaths, readerSchema, partition, dataFilePath, indexDefinition);
+ });
+ }
+
+ private static ClosableIterator<HoodieRecord> createSecondaryIndexGenerator(HoodieTableMetaClient metaClient,
+ EngineType engineType, List<String> logFilePaths,
+ Schema tableSchema, String partition,
+ Option<StoragePath> dataFilePath,
+ HoodieIndexDefinition indexDefinition) throws Exception {
+ final String basePath = metaClient.getBasePathV2().toString();
+ final StorageConfiguration<?> storageConf = metaClient.getStorageConf();
+
+ HoodieRecordMerger recordMerger = HoodieRecordUtils.createRecordMerger(
+ basePath,
+ engineType,
+ Collections.emptyList(),
+ metaClient.getTableConfig().getRecordMergerStrategy());
+
+ HoodieMergedLogRecordScanner mergedLogRecordScanner = HoodieMergedLogRecordScanner.newBuilder()
+ .withStorage(metaClient.getStorage())
+ .withBasePath(basePath)
+ .withLogFilePaths(logFilePaths)
+ .withReaderSchema(tableSchema)
+ .withLatestInstantTime(metaClient.getActiveTimeline().filterCompletedInstants().lastInstant().map(HoodieInstant::getTimestamp).orElse(""))
+ .withReverseReader(false)
+ .withMaxMemorySizeInBytes(storageConf.getLong(MAX_MEMORY_FOR_COMPACTION.key(), DEFAULT_MAX_MEMORY_FOR_SPILLABLE_MAP_IN_BYTES))
+ .withBufferSize(HoodieMetadataConfig.MAX_READER_BUFFER_SIZE_PROP.defaultValue())
+ .withSpillableMapBasePath(FileIOUtils.getDefaultSpillableMapBasePath())
+ .withPartition(partition)
+ .withOptimizedLogBlocksScan(storageConf.getBoolean("hoodie" + HoodieMetadataConfig.OPTIMIZED_LOG_BLOCKS_SCAN, false))
Review Comment:
Actually it is same as `HoodieReaderConfig.ENABLE_OPTIMIZED_LOG_BLOCKS_SCAN`. Using the reader config makes more sense. I'll change it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "codope (via GitHub)" <gi...@apache.org>.
codope commented on code in PR #11146:
URL: https://github.com/apache/hudi/pull/11146#discussion_r1616260403
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/metadata/HoodieBackedTableMetadataWriter.java:
##########
@@ -1054,6 +1092,75 @@ private HoodieData<HoodieRecord> getFunctionalIndexUpdates(HoodieCommitMetadata
return getFunctionalIndexRecords(partitionFileSlicePairs, indexDefinition, dataMetaClient, parallelism, readerSchema, storageConf);
}
+ private void updateSecondaryIndexIfPresent(HoodieCommitMetadata commitMetadata, Map<MetadataPartitionType, HoodieData<HoodieRecord>> partitionToRecordMap, HoodieData<WriteStatus> writeStatus) {
+ dataMetaClient.getTableConfig().getMetadataPartitions()
Review Comment:
Have refactored some duplicate code but there is not much
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #11146:
URL: https://github.com/apache/hudi/pull/11146#issuecomment-2119682878
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23710",
"triggerID" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"triggerType" : "PUSH"
}, {
"hash" : "1468a9a72c2cfdda7dae6bb62ac14551f600d8df",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23711",
"triggerID" : "1468a9a72c2cfdda7dae6bb62ac14551f600d8df",
"triggerType" : "PUSH"
}, {
"hash" : "f232b46fcd23d960efc587a624c2e9d69d3d7e9e",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23728",
"triggerID" : "f232b46fcd23d960efc587a624c2e9d69d3d7e9e",
"triggerType" : "PUSH"
}, {
"hash" : "8a6a98e1a8f0f65df59dddf663b0ef231f4c01ee",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23964",
"triggerID" : "8a6a98e1a8f0f65df59dddf663b0ef231f4c01ee",
"triggerType" : "PUSH"
}, {
"hash" : "420b19219080b2935b3a37442db7ed22816466af",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "420b19219080b2935b3a37442db7ed22816466af",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 8a6a98e1a8f0f65df59dddf663b0ef231f4c01ee Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23964)
* 420b19219080b2935b3a37442db7ed22816466af UNKNOWN
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #11146:
URL: https://github.com/apache/hudi/pull/11146#issuecomment-2119759825
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23710",
"triggerID" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"triggerType" : "PUSH"
}, {
"hash" : "1468a9a72c2cfdda7dae6bb62ac14551f600d8df",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23711",
"triggerID" : "1468a9a72c2cfdda7dae6bb62ac14551f600d8df",
"triggerType" : "PUSH"
}, {
"hash" : "f232b46fcd23d960efc587a624c2e9d69d3d7e9e",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23728",
"triggerID" : "f232b46fcd23d960efc587a624c2e9d69d3d7e9e",
"triggerType" : "PUSH"
}, {
"hash" : "8a6a98e1a8f0f65df59dddf663b0ef231f4c01ee",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23964",
"triggerID" : "8a6a98e1a8f0f65df59dddf663b0ef231f4c01ee",
"triggerType" : "PUSH"
}, {
"hash" : "420b19219080b2935b3a37442db7ed22816466af",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23999",
"triggerID" : "420b19219080b2935b3a37442db7ed22816466af",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 420b19219080b2935b3a37442db7ed22816466af Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23999)
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #11146:
URL: https://github.com/apache/hudi/pull/11146#issuecomment-2122424376
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23710",
"triggerID" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"triggerType" : "PUSH"
}, {
"hash" : "1468a9a72c2cfdda7dae6bb62ac14551f600d8df",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23711",
"triggerID" : "1468a9a72c2cfdda7dae6bb62ac14551f600d8df",
"triggerType" : "PUSH"
}, {
"hash" : "f232b46fcd23d960efc587a624c2e9d69d3d7e9e",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23728",
"triggerID" : "f232b46fcd23d960efc587a624c2e9d69d3d7e9e",
"triggerType" : "PUSH"
}, {
"hash" : "8a6a98e1a8f0f65df59dddf663b0ef231f4c01ee",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23964",
"triggerID" : "8a6a98e1a8f0f65df59dddf663b0ef231f4c01ee",
"triggerType" : "PUSH"
}, {
"hash" : "420b19219080b2935b3a37442db7ed22816466af",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23999",
"triggerID" : "420b19219080b2935b3a37442db7ed22816466af",
"triggerType" : "PUSH"
}, {
"hash" : "4c02510ba3b23cb7d7feffbb2c6850c038d6103a",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24005",
"triggerID" : "4c02510ba3b23cb7d7feffbb2c6850c038d6103a",
"triggerType" : "PUSH"
}, {
"hash" : "9c3c82dde2fd4fcf1c2babe2c1a0345fe87af0c7",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "9c3c82dde2fd4fcf1c2babe2c1a0345fe87af0c7",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 4c02510ba3b23cb7d7feffbb2c6850c038d6103a Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24005)
* 9c3c82dde2fd4fcf1c2babe2c1a0345fe87af0c7 UNKNOWN
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "codope (via GitHub)" <gi...@apache.org>.
codope commented on code in PR #11146:
URL: https://github.com/apache/hudi/pull/11146#discussion_r1616257842
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/metadata/HoodieBackedTableMetadataWriter.java:
##########
@@ -410,6 +413,14 @@ private boolean initializeFromFilesystem(String initializationTime, List<Metadat
}
fileGroupCountAndRecordsPair = initializePartitionStatsIndex(partitionInfoList);
break;
+ case SECONDARY_INDEX:
+ Set<String> secondaryIndexPartitionsToInit = getSecondaryIndexPartitionsToInit();
+ if (secondaryIndexPartitionsToInit.isEmpty()) {
+ continue;
+ }
+ ValidationUtils.checkState(secondaryIndexPartitionsToInit.size() == 1, "Only one secondary index at a time is supported for now");
Review Comment:
We can bootstrap multiple index types at a time but for secondary index, only one at a time.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #11146:
URL: https://github.com/apache/hudi/pull/11146#issuecomment-2136163343
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23710",
"triggerID" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"triggerType" : "PUSH"
}, {
"hash" : "1468a9a72c2cfdda7dae6bb62ac14551f600d8df",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23711",
"triggerID" : "1468a9a72c2cfdda7dae6bb62ac14551f600d8df",
"triggerType" : "PUSH"
}, {
"hash" : "f232b46fcd23d960efc587a624c2e9d69d3d7e9e",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23728",
"triggerID" : "f232b46fcd23d960efc587a624c2e9d69d3d7e9e",
"triggerType" : "PUSH"
}, {
"hash" : "8a6a98e1a8f0f65df59dddf663b0ef231f4c01ee",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23964",
"triggerID" : "8a6a98e1a8f0f65df59dddf663b0ef231f4c01ee",
"triggerType" : "PUSH"
}, {
"hash" : "420b19219080b2935b3a37442db7ed22816466af",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23999",
"triggerID" : "420b19219080b2935b3a37442db7ed22816466af",
"triggerType" : "PUSH"
}, {
"hash" : "4c02510ba3b23cb7d7feffbb2c6850c038d6103a",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24005",
"triggerID" : "4c02510ba3b23cb7d7feffbb2c6850c038d6103a",
"triggerType" : "PUSH"
}, {
"hash" : "9c3c82dde2fd4fcf1c2babe2c1a0345fe87af0c7",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24016",
"triggerID" : "9c3c82dde2fd4fcf1c2babe2c1a0345fe87af0c7",
"triggerType" : "PUSH"
}, {
"hash" : "98d96be857a9e87e74a4dee99cb31b162ade5aa3",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24091",
"triggerID" : "98d96be857a9e87e74a4dee99cb31b162ade5aa3",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 98d96be857a9e87e74a4dee99cb31b162ade5aa3 Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24091)
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "danny0405 (via GitHub)" <gi...@apache.org>.
danny0405 commented on code in PR #11146:
URL: https://github.com/apache/hudi/pull/11146#discussion_r1616449812
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/index/HoodieIndexUtils.java:
##########
@@ -396,8 +396,8 @@ public static <R> HoodieRecord<R> createNewTaggedHoodieRecord(HoodieRecord<R> ol
*/
public static String getPartitionNameFromPartitionType(MetadataPartitionType partitionType, HoodieTableMetaClient metaClient, String indexName) {
if (MetadataPartitionType.FUNCTIONAL_INDEX.equals(partitionType)) {
- checkArgument(metaClient.getFunctionalIndexMetadata().isPresent(), "Index definition is not present");
- return metaClient.getFunctionalIndexMetadata().get().getIndexDefinitions().get(indexName).getIndexName();
+ checkArgument(metaClient.getIndexesMetadata().isPresent(), "Index definition is not present");
Review Comment:
`getIndeciesMetadata` or just `getIndexMetadata`
##########
hudi-common/src/main/java/org/apache/hudi/common/model/HoodieIndexesMetadata.java:
##########
@@ -76,19 +76,19 @@ public String toJson() throws JsonProcessingException {
* Deserialize from JSON string to create an instance of this class.
*
* @param json Input JSON string.
- * @return Deserialized instance of HoodieFunctionalIndexMetadata.
+ * @return Deserialized instance of HoodieIndexesMetadata.
* @throws IOException If any deserialization errors occur.
*/
- public static HoodieFunctionalIndexMetadata fromJson(String json) throws IOException {
+ public static HoodieIndexesMetadata fromJson(String json) throws IOException {
if (json == null || json.isEmpty()) {
- return new HoodieFunctionalIndexMetadata();
+ return new HoodieIndexesMetadata();
}
- return JsonUtils.getObjectMapper().readValue(json, HoodieFunctionalIndexMetadata.class);
+ return JsonUtils.getObjectMapper().readValue(json, HoodieIndexesMetadata.class);
}
@Override
public String toString() {
- return "HoodieFunctionalIndexMetadata{"
+ return "HoodieIndexesMetadata{"
Review Comment:
Let's avoid the hard code of the class name, we can fetch it through `getClass.getSimpleName`
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/metadata/HoodieBackedTableMetadataWriter.java:
##########
@@ -410,6 +413,14 @@ private boolean initializeFromFilesystem(String initializationTime, List<Metadat
}
fileGroupCountAndRecordsPair = initializePartitionStatsIndex(partitionInfoList);
break;
+ case SECONDARY_INDEX:
+ Set<String> secondaryIndexPartitionsToInit = getSecondaryIndexPartitionsToInit();
+ if (secondaryIndexPartitionsToInit.isEmpty()) {
+ continue;
+ }
+ ValidationUtils.checkState(secondaryIndexPartitionsToInit.size() == 1, "Only one secondary index at a time is supported for now");
Review Comment:
Then what about the other ones, they would never got a chance to bootstrap right
##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/FunctionalIndexSupport.scala:
##########
@@ -77,7 +77,7 @@ class FunctionalIndexSupport(spark: SparkSession,
* Return true if metadata table is enabled and functional index metadata partition is available.
*/
def isIndexAvailable: Boolean = {
- metadataConfig.isEnabled && metaClient.getFunctionalIndexMetadata.isPresent && !metaClient.getFunctionalIndexMetadata.get().getIndexDefinitions.isEmpty
+ metadataConfig.isEnabled && metaClient.getIndexesMetadata.isPresent && !metaClient.getIndexesMetadata.get().getIndexDefinitions.isEmpty
Review Comment:
`getIndexMetadata`
##########
hudi-common/src/main/java/org/apache/hudi/metadata/HoodieTableMetadata.java:
##########
@@ -112,6 +113,14 @@ static boolean isMetadataTable(String basePath) {
return basePath.endsWith(HoodieTableMetaClient.METADATA_TABLE_FOLDER_PATH);
}
+ static boolean isMetadataTableSecondaryIndexPartition(String basePath, Option<String> partitionName) {
+ if (!isMetadataTable(basePath) || !partitionName.isPresent()) {
Review Comment:
Maybe we can move this utility to `HoodieTableMetadataUtil`.
##########
hudi-common/src/main/java/org/apache/hudi/common/model/HoodieIndexesMetadata.java:
##########
@@ -32,29 +32,29 @@
import java.util.Map;
/**
- * Represents the metadata for all functional indexes in Hudi.
+ * Represents the metadata for all functional and secondary indexes in Hudi.
*/
@JsonIgnoreProperties(ignoreUnknown = true)
-public class HoodieFunctionalIndexMetadata implements Serializable {
+public class HoodieIndexesMetadata implements Serializable {
Review Comment:
`HoodieIndexMetadata` should be fine.
##########
hudi-common/src/main/java/org/apache/hudi/keygen/constant/KeyGeneratorOptions.java:
##########
@@ -54,6 +54,13 @@ public class KeyGeneratorOptions extends HoodieConfig {
+ "Actual value will be obtained by invoking .toString() on the field value. Nested fields can be specified using\n"
+ "the dot notation eg: `a.b.c`");
+ public static final ConfigProperty<String> SECONDARYKEY_FIELD_NAME = ConfigProperty
+ .key("hoodie.datasource.write.secondarykey.field")
Review Comment:
column or field, because in `HoodieMetadataConfig`, we have `*.index.secondary.column`.
##########
hudi-common/src/main/java/org/apache/hudi/metadata/HoodieTableMetadataUtil.java:
##########
@@ -1833,12 +1838,146 @@ public static HoodieData<HoodieRecord> readRecordKeysFromFileSlices(HoodieEngine
});
}
- public static Schema getProjectedSchemaForFunctionalIndex(HoodieFunctionalIndexDefinition indexDefinition, HoodieTableMetaClient metaClient) throws Exception {
+ public static Schema getProjectedSchemaForFunctionalIndex(HoodieIndexDefinition indexDefinition, HoodieTableMetaClient metaClient) throws Exception {
TableSchemaResolver schemaResolver = new TableSchemaResolver(metaClient);
Schema tableSchema = schemaResolver.getTableAvroSchema();
return addMetadataFields(getSchemaForFields(tableSchema, indexDefinition.getSourceFields()));
}
+ public static HoodieData<HoodieRecord> readSecondaryKeysFromBaseFiles(HoodieEngineContext engineContext,
+ List<Pair<String, Pair<String, List<String>>>> partitionFiles,
+ int recordIndexMaxParallelism,
+ String activeModule, HoodieTableMetaClient metaClient, EngineType engineType,
+ HoodieIndexDefinition indexDefinition) {
+ if (partitionFiles.isEmpty()) {
+ return engineContext.emptyHoodieData();
+ }
+
+ engineContext.setJobStatus(activeModule, "Secondary Index: reading secondary keys from " + partitionFiles.size() + " partitions");
+ final int parallelism = Math.min(partitionFiles.size(), recordIndexMaxParallelism);
+ final String basePath = metaClient.getBasePathV2().toString();
+ return engineContext.parallelize(partitionFiles, parallelism).flatMap(partitionAndBaseFile -> {
+ final String partition = partitionAndBaseFile.getKey();
+ final Pair<String, List<String>> baseAndLogFiles = partitionAndBaseFile.getValue();
+ List<String> logFilePaths = new ArrayList<>();
+ baseAndLogFiles.getValue().forEach(logFile -> {
+ logFilePaths.add(basePath + StoragePath.SEPARATOR + partition + StoragePath.SEPARATOR + logFile);
+ });
+ String filePath = baseAndLogFiles.getKey();
+
+ Option<StoragePath> dataFilePath = Option.empty();
+ Schema tableSchema;
+
+ if (!filePath.isEmpty()) {
+ dataFilePath = Option.of(filePath(basePath, "", filePath));
+ tableSchema = HoodieIOFactory.getIOFactory(metaClient.getStorage()).getFileFormatUtils(HoodieFileFormat.PARQUET).readAvroSchema(metaClient.getStorage(), dataFilePath.get());
+ } else {
+ TableSchemaResolver schemaResolver = new TableSchemaResolver(metaClient);
Review Comment:
Can we fetch the table schema out of the `flatMap` loop, i.e. on the Spark driver, the table schema resolver is a little colstly and it has to list the metadata files each time.
##########
hudi-common/src/main/java/org/apache/hudi/common/model/HoodieIndexDefinition.java:
##########
@@ -45,14 +48,14 @@ public class HoodieFunctionalIndexDefinition implements Serializable {
// Any other configuration or properties specific to the index
private Map<String, String> indexOptions;
- public HoodieFunctionalIndexDefinition() {
+ public HoodieIndexDefinition() {
}
- public HoodieFunctionalIndexDefinition(String indexName, String indexType, String indexFunction, List<String> sourceFields,
- Map<String, String> indexOptions) {
+ public HoodieIndexDefinition(String indexName, String indexType, String indexFunction, List<String> sourceFields,
Review Comment:
So after this change, we only have secondary index and the notion of functional index is removed.
##########
hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/metadata/SparkHoodieBackedTableMetadataWriter.java:
##########
@@ -222,4 +227,48 @@ protected HoodieTable getHoodieTable(HoodieWriteConfig writeConfig, HoodieTableM
public BaseHoodieWriteClient<?, JavaRDD<HoodieRecord>, ?, ?> initializeWriteClient() {
return new SparkRDDWriteClient(engineContext, metadataWriteConfig, true);
}
+
+ @Override
+ protected HoodieData<HoodieRecord> getSecondaryIndexRecordsFromFileSlices(List<Pair<String, FileSlice>> partitionFileSlicePairs,
+ HoodieIndexDefinition indexDefinition,
+ int parallelism) throws IOException {
Review Comment:
Another choice is we add a `getEngineContext` abstract method for sub-classes, and these methods impl can move to the base class.
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/metadata/HoodieBackedTableMetadataWriter.java:
##########
@@ -1054,6 +1086,71 @@ private HoodieData<HoodieRecord> getFunctionalIndexUpdates(HoodieCommitMetadata
return getFunctionalIndexRecords(partitionFileSlicePairs, indexDefinition, dataMetaClient, parallelism, readerSchema, storageConf);
}
+ private void updateSecondaryIndexIfPresent(HoodieCommitMetadata commitMetadata, Map<MetadataPartitionType, HoodieData<HoodieRecord>> partitionToRecordMap, HoodieData<WriteStatus> writeStatus) {
+ dataMetaClient.getTableConfig().getMetadataPartitions()
+ .stream()
+ .filter(partition -> partition.startsWith(HoodieTableMetadataUtil.PARTITION_NAME_SECONDARY_INDEX_PREFIX))
+ .forEach(partition -> {
+ HoodieData<HoodieRecord> secondaryIndexRecords;
+ try {
+ secondaryIndexRecords = getSecondaryIndexUpdates(commitMetadata, partition, writeStatus);
+ } catch (Exception e) {
+ throw new HoodieMetadataException("Failed to get secondary index updates for partition " + partition, e);
+ }
+ partitionToRecordMap.put(SECONDARY_INDEX, secondaryIndexRecords);
+ });
+ }
+
+ private HoodieData<HoodieRecord> getSecondaryIndexUpdates(HoodieCommitMetadata commitMetadata, String indexPartition, HoodieData<WriteStatus> writeStatus) throws Exception {
+ List<Pair<String, Pair<String, List<String>>>> partitionFilePairs = getPartitionFilePairs(commitMetadata);
+ // Build a list of keys that need to be removed. A 'delete' record will be emitted into the respective FileGroup of
+ // the secondary index partition for each of these keys. For a commit which is deleting/updating a lot of records, this
+ // operation is going to be expensive (in CPU, memory and IO)
+ List<String> keysToRemove = new ArrayList<>();
+ writeStatus.collectAsList().forEach(status -> {
+ status.getWrittenRecordDelegates().forEach(recordDelegate -> {
+ // Consider those keys which were either updated or deleted in this commit
+ if (!recordDelegate.getNewLocation().isPresent() || (recordDelegate.getCurrentLocation().isPresent() && recordDelegate.getNewLocation().isPresent())) {
+ keysToRemove.add(recordDelegate.getRecordKey());
+ }
+ });
+ });
+ HoodieIndexDefinition indexDefinition = getFunctionalIndexDefinition(indexPartition);
Review Comment:
is the functional index notion already removed?
##########
hudi-common/src/main/java/org/apache/hudi/metadata/HoodieTableMetadataUtil.java:
##########
@@ -1833,12 +1838,146 @@ public static HoodieData<HoodieRecord> readRecordKeysFromFileSlices(HoodieEngine
});
}
- public static Schema getProjectedSchemaForFunctionalIndex(HoodieFunctionalIndexDefinition indexDefinition, HoodieTableMetaClient metaClient) throws Exception {
+ public static Schema getProjectedSchemaForFunctionalIndex(HoodieIndexDefinition indexDefinition, HoodieTableMetaClient metaClient) throws Exception {
TableSchemaResolver schemaResolver = new TableSchemaResolver(metaClient);
Schema tableSchema = schemaResolver.getTableAvroSchema();
return addMetadataFields(getSchemaForFields(tableSchema, indexDefinition.getSourceFields()));
}
+ public static HoodieData<HoodieRecord> readSecondaryKeysFromBaseFiles(HoodieEngineContext engineContext,
+ List<Pair<String, Pair<String, List<String>>>> partitionFiles,
+ int recordIndexMaxParallelism,
+ String activeModule, HoodieTableMetaClient metaClient, EngineType engineType,
+ HoodieIndexDefinition indexDefinition) {
+ if (partitionFiles.isEmpty()) {
+ return engineContext.emptyHoodieData();
+ }
+
+ engineContext.setJobStatus(activeModule, "Secondary Index: reading secondary keys from " + partitionFiles.size() + " partitions");
+ final int parallelism = Math.min(partitionFiles.size(), recordIndexMaxParallelism);
+ final String basePath = metaClient.getBasePathV2().toString();
+ return engineContext.parallelize(partitionFiles, parallelism).flatMap(partitionAndBaseFile -> {
+ final String partition = partitionAndBaseFile.getKey();
+ final Pair<String, List<String>> baseAndLogFiles = partitionAndBaseFile.getValue();
+ List<String> logFilePaths = new ArrayList<>();
+ baseAndLogFiles.getValue().forEach(logFile -> {
+ logFilePaths.add(basePath + StoragePath.SEPARATOR + partition + StoragePath.SEPARATOR + logFile);
+ });
+ String filePath = baseAndLogFiles.getKey();
+
+ Option<StoragePath> dataFilePath = Option.empty();
+ Schema tableSchema;
+
+ if (!filePath.isEmpty()) {
+ dataFilePath = Option.of(filePath(basePath, "", filePath));
+ tableSchema = HoodieIOFactory.getIOFactory(metaClient.getStorage()).getFileFormatUtils(HoodieFileFormat.PARQUET).readAvroSchema(metaClient.getStorage(), dataFilePath.get());
+ } else {
+ TableSchemaResolver schemaResolver = new TableSchemaResolver(metaClient);
+ tableSchema = schemaResolver.getTableAvroSchema();
+ }
+
+ return createSecondaryIndexGenerator(metaClient, engineType, logFilePaths, tableSchema, partition, dataFilePath, indexDefinition);
+ });
+ }
+
+ public static HoodieData<HoodieRecord> readSecondaryKeysFromFileSlices(HoodieEngineContext engineContext,
+ List<Pair<String, FileSlice>> partitionFileSlicePairs,
+ int recordIndexMaxParallelism,
+ String activeModule, HoodieTableMetaClient metaClient, EngineType engineType,
+ HoodieIndexDefinition indexDefinition) throws IOException {
+ if (partitionFileSlicePairs.isEmpty()) {
+ return engineContext.emptyHoodieData();
+ }
+
+ engineContext.setJobStatus(activeModule, "Secondary Index: reading secondary keys from " + partitionFileSlicePairs.size() + " file slices");
+ final int parallelism = Math.min(partitionFileSlicePairs.size(), recordIndexMaxParallelism);
+ final String basePath = metaClient.getBasePathV2().toString();
+ return engineContext.parallelize(partitionFileSlicePairs, parallelism).flatMap(partitionAndBaseFile -> {
+ final String partition = partitionAndBaseFile.getKey();
+ final FileSlice fileSlice = partitionAndBaseFile.getValue();
+
+ final HoodieBaseFile baseFile = fileSlice.getBaseFile().get();
+ final String filename = baseFile.getFileName();
+ StoragePath dataFilePath = filePath(basePath, partition, filename);
+ TableSchemaResolver schemaResolver = new TableSchemaResolver(metaClient);
+ Schema tableSchema = schemaResolver.getTableAvroSchema();
Review Comment:
ditto
##########
hudi-common/src/main/java/org/apache/hudi/metadata/HoodieTableMetadataUtil.java:
##########
@@ -1833,12 +1838,146 @@ public static HoodieData<HoodieRecord> readRecordKeysFromFileSlices(HoodieEngine
});
}
- public static Schema getProjectedSchemaForFunctionalIndex(HoodieFunctionalIndexDefinition indexDefinition, HoodieTableMetaClient metaClient) throws Exception {
+ public static Schema getProjectedSchemaForFunctionalIndex(HoodieIndexDefinition indexDefinition, HoodieTableMetaClient metaClient) throws Exception {
TableSchemaResolver schemaResolver = new TableSchemaResolver(metaClient);
Schema tableSchema = schemaResolver.getTableAvroSchema();
return addMetadataFields(getSchemaForFields(tableSchema, indexDefinition.getSourceFields()));
}
+ public static HoodieData<HoodieRecord> readSecondaryKeysFromBaseFiles(HoodieEngineContext engineContext,
+ List<Pair<String, Pair<String, List<String>>>> partitionFiles,
+ int recordIndexMaxParallelism,
+ String activeModule, HoodieTableMetaClient metaClient, EngineType engineType,
+ HoodieIndexDefinition indexDefinition) {
+ if (partitionFiles.isEmpty()) {
+ return engineContext.emptyHoodieData();
+ }
+
+ engineContext.setJobStatus(activeModule, "Secondary Index: reading secondary keys from " + partitionFiles.size() + " partitions");
+ final int parallelism = Math.min(partitionFiles.size(), recordIndexMaxParallelism);
+ final String basePath = metaClient.getBasePathV2().toString();
+ return engineContext.parallelize(partitionFiles, parallelism).flatMap(partitionAndBaseFile -> {
+ final String partition = partitionAndBaseFile.getKey();
+ final Pair<String, List<String>> baseAndLogFiles = partitionAndBaseFile.getValue();
+ List<String> logFilePaths = new ArrayList<>();
+ baseAndLogFiles.getValue().forEach(logFile -> {
+ logFilePaths.add(basePath + StoragePath.SEPARATOR + partition + StoragePath.SEPARATOR + logFile);
+ });
+ String filePath = baseAndLogFiles.getKey();
+
+ Option<StoragePath> dataFilePath = Option.empty();
+ Schema tableSchema;
+
+ if (!filePath.isEmpty()) {
+ dataFilePath = Option.of(filePath(basePath, "", filePath));
+ tableSchema = HoodieIOFactory.getIOFactory(metaClient.getStorage()).getFileFormatUtils(HoodieFileFormat.PARQUET).readAvroSchema(metaClient.getStorage(), dataFilePath.get());
+ } else {
+ TableSchemaResolver schemaResolver = new TableSchemaResolver(metaClient);
+ tableSchema = schemaResolver.getTableAvroSchema();
+ }
+
+ return createSecondaryIndexGenerator(metaClient, engineType, logFilePaths, tableSchema, partition, dataFilePath, indexDefinition);
+ });
+ }
+
+ public static HoodieData<HoodieRecord> readSecondaryKeysFromFileSlices(HoodieEngineContext engineContext,
+ List<Pair<String, FileSlice>> partitionFileSlicePairs,
+ int recordIndexMaxParallelism,
+ String activeModule, HoodieTableMetaClient metaClient, EngineType engineType,
+ HoodieIndexDefinition indexDefinition) throws IOException {
+ if (partitionFileSlicePairs.isEmpty()) {
+ return engineContext.emptyHoodieData();
+ }
+
+ engineContext.setJobStatus(activeModule, "Secondary Index: reading secondary keys from " + partitionFileSlicePairs.size() + " file slices");
+ final int parallelism = Math.min(partitionFileSlicePairs.size(), recordIndexMaxParallelism);
+ final String basePath = metaClient.getBasePathV2().toString();
+ return engineContext.parallelize(partitionFileSlicePairs, parallelism).flatMap(partitionAndBaseFile -> {
+ final String partition = partitionAndBaseFile.getKey();
+ final FileSlice fileSlice = partitionAndBaseFile.getValue();
+
+ final HoodieBaseFile baseFile = fileSlice.getBaseFile().get();
+ final String filename = baseFile.getFileName();
+ StoragePath dataFilePath = filePath(basePath, partition, filename);
+ TableSchemaResolver schemaResolver = new TableSchemaResolver(metaClient);
+ Schema tableSchema = schemaResolver.getTableAvroSchema();
+
+ List<String> logFilePaths = fileSlice.getLogFiles().sorted(HoodieLogFile.getLogFileComparator())
+ .map(l -> l.getPath().toString()).collect(toList());
+
+ return createSecondaryIndexGenerator(metaClient, engineType, logFilePaths, tableSchema, partition, Option.of(dataFilePath), indexDefinition);
+ });
+ }
+
+ private static ClosableIterator<HoodieRecord> createSecondaryIndexGenerator(HoodieTableMetaClient metaClient,
+ EngineType engineType, List<String> logFilePaths,
+ Schema tableSchema, String partition,
+ Option<StoragePath> dataFilePath,
+ HoodieIndexDefinition indexDefinition) throws Exception {
+ final String basePath = metaClient.getBasePathV2().toString();
+ final StorageConfiguration<?> storageConf = metaClient.getStorageConf();
+
+ HoodieRecordMerger recordMerger = HoodieRecordUtils.createRecordMerger(
+ basePath,
+ engineType,
+ Collections.emptyList(),
+ metaClient.getTableConfig().getRecordMergerStrategy());
+
+ HoodieMergedLogRecordScanner mergedLogRecordScanner = HoodieMergedLogRecordScanner.newBuilder()
+ .withStorage(metaClient.getStorage())
+ .withBasePath(basePath)
+ .withLogFilePaths(logFilePaths)
+ .withReaderSchema(tableSchema)
+ .withLatestInstantTime(metaClient.getActiveTimeline().filterCompletedInstants().lastInstant().map(HoodieInstant::getTimestamp).orElse(""))
+ .withReverseReader(false)
+ .withMaxMemorySizeInBytes(storageConf.getLong(MAX_MEMORY_FOR_COMPACTION.key(), DEFAULT_MAX_MEMORY_FOR_SPILLABLE_MAP_IN_BYTES))
+ .withBufferSize(HoodieMetadataConfig.MAX_READER_BUFFER_SIZE_PROP.defaultValue())
+ .withSpillableMapBasePath(FileIOUtils.getDefaultSpillableMapBasePath())
+ .withPartition(partition)
+ .withOptimizedLogBlocksScan(storageConf.getBoolean("hoodie" + HoodieMetadataConfig.OPTIMIZED_LOG_BLOCKS_SCAN, false))
+ .withDiskMapType(storageConf.getEnum(SPILLABLE_DISK_MAP_TYPE.key(), SPILLABLE_DISK_MAP_TYPE.defaultValue()))
+ .withBitCaskDiskMapCompressionEnabled(storageConf.getBoolean(DISK_MAP_BITCASK_COMPRESSION_ENABLED.key(), DISK_MAP_BITCASK_COMPRESSION_ENABLED.defaultValue()))
+ .withRecordMerger(recordMerger)
+ .withTableMetaClient(metaClient)
+ .build();
+
+ Option<HoodieFileReader> baseFileReader = Option.empty();
+ if (dataFilePath.isPresent()) {
+ baseFileReader = Option.of(HoodieIOFactory.getIOFactory(metaClient.getStorage()).getReaderFactory(recordMerger.getRecordType()).getFileReader(getReaderConfigs(storageConf), dataFilePath.get()));
+ }
+ HoodieFileSliceReader fileSliceReader = new HoodieFileSliceReader(baseFileReader, mergedLogRecordScanner, tableSchema, metaClient.getTableConfig().getPreCombineField(), recordMerger,
+ metaClient.getTableConfig().getProps(),
+ Option.empty());
+ ClosableIterator<HoodieRecord> fileSliceIterator = ClosableIterator.wrap(fileSliceReader);
+ return new ClosableIterator<HoodieRecord>() {
+ @Override
+ public void close() {
+ fileSliceIterator.close();
+ }
+
+ @Override
+ public boolean hasNext() {
+ return fileSliceIterator.hasNext();
+ }
+
+ @Override
+ public HoodieRecord next() {
+ HoodieRecord record = fileSliceIterator.next();
+ String recordKey = record.getRecordKey(tableSchema, HoodieRecord.RECORD_KEY_METADATA_FIELD);
+ String secondaryKeyFields = String.join(".", indexDefinition.getSourceFields());
+ String secondaryKey;
+ try {
+ GenericRecord genericRecord = (GenericRecord) (record.toIndexedRecord(tableSchema, new Properties()).get()).getData();
Review Comment:
You can use `CollectionUtils.EMPTY_PROPERTIES` instead.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #11146:
URL: https://github.com/apache/hudi/pull/11146#issuecomment-2137015763
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23710",
"triggerID" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"triggerType" : "PUSH"
}, {
"hash" : "1468a9a72c2cfdda7dae6bb62ac14551f600d8df",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23711",
"triggerID" : "1468a9a72c2cfdda7dae6bb62ac14551f600d8df",
"triggerType" : "PUSH"
}, {
"hash" : "f232b46fcd23d960efc587a624c2e9d69d3d7e9e",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23728",
"triggerID" : "f232b46fcd23d960efc587a624c2e9d69d3d7e9e",
"triggerType" : "PUSH"
}, {
"hash" : "8a6a98e1a8f0f65df59dddf663b0ef231f4c01ee",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23964",
"triggerID" : "8a6a98e1a8f0f65df59dddf663b0ef231f4c01ee",
"triggerType" : "PUSH"
}, {
"hash" : "420b19219080b2935b3a37442db7ed22816466af",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23999",
"triggerID" : "420b19219080b2935b3a37442db7ed22816466af",
"triggerType" : "PUSH"
}, {
"hash" : "4c02510ba3b23cb7d7feffbb2c6850c038d6103a",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24005",
"triggerID" : "4c02510ba3b23cb7d7feffbb2c6850c038d6103a",
"triggerType" : "PUSH"
}, {
"hash" : "9c3c82dde2fd4fcf1c2babe2c1a0345fe87af0c7",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24016",
"triggerID" : "9c3c82dde2fd4fcf1c2babe2c1a0345fe87af0c7",
"triggerType" : "PUSH"
}, {
"hash" : "98d96be857a9e87e74a4dee99cb31b162ade5aa3",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24091",
"triggerID" : "98d96be857a9e87e74a4dee99cb31b162ade5aa3",
"triggerType" : "PUSH"
}, {
"hash" : "76cb6530775bdfd9415bab25c48f23fd84777182",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "76cb6530775bdfd9415bab25c48f23fd84777182",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 98d96be857a9e87e74a4dee99cb31b162ade5aa3 Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24091)
* 76cb6530775bdfd9415bab25c48f23fd84777182 UNKNOWN
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #11146:
URL: https://github.com/apache/hudi/pull/11146#issuecomment-2137142107
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23710",
"triggerID" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"triggerType" : "PUSH"
}, {
"hash" : "1468a9a72c2cfdda7dae6bb62ac14551f600d8df",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23711",
"triggerID" : "1468a9a72c2cfdda7dae6bb62ac14551f600d8df",
"triggerType" : "PUSH"
}, {
"hash" : "f232b46fcd23d960efc587a624c2e9d69d3d7e9e",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23728",
"triggerID" : "f232b46fcd23d960efc587a624c2e9d69d3d7e9e",
"triggerType" : "PUSH"
}, {
"hash" : "8a6a98e1a8f0f65df59dddf663b0ef231f4c01ee",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23964",
"triggerID" : "8a6a98e1a8f0f65df59dddf663b0ef231f4c01ee",
"triggerType" : "PUSH"
}, {
"hash" : "420b19219080b2935b3a37442db7ed22816466af",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23999",
"triggerID" : "420b19219080b2935b3a37442db7ed22816466af",
"triggerType" : "PUSH"
}, {
"hash" : "4c02510ba3b23cb7d7feffbb2c6850c038d6103a",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24005",
"triggerID" : "4c02510ba3b23cb7d7feffbb2c6850c038d6103a",
"triggerType" : "PUSH"
}, {
"hash" : "9c3c82dde2fd4fcf1c2babe2c1a0345fe87af0c7",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24016",
"triggerID" : "9c3c82dde2fd4fcf1c2babe2c1a0345fe87af0c7",
"triggerType" : "PUSH"
}, {
"hash" : "98d96be857a9e87e74a4dee99cb31b162ade5aa3",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24091",
"triggerID" : "98d96be857a9e87e74a4dee99cb31b162ade5aa3",
"triggerType" : "PUSH"
}, {
"hash" : "76cb6530775bdfd9415bab25c48f23fd84777182",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24117",
"triggerID" : "76cb6530775bdfd9415bab25c48f23fd84777182",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 76cb6530775bdfd9415bab25c48f23fd84777182 Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24117)
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "codope (via GitHub)" <gi...@apache.org>.
codope commented on code in PR #11146:
URL: https://github.com/apache/hudi/pull/11146#discussion_r1610368740
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/metadata/HoodieBackedTableMetadataWriter.java:
##########
@@ -540,6 +547,51 @@ private HoodieFunctionalIndexDefinition getFunctionalIndexDefinition(String inde
}
}
+ private Set<String> getSecondaryIndexPartitionsToInit() {
+ Set<String> secondaryIndexPartitions = dataMetaClient.getFunctionalIndexMetadata().get().getIndexDefinitions().values().stream()
+ .map(HoodieFunctionalIndexDefinition::getIndexName)
+ .filter(indexName -> indexName.startsWith(HoodieTableMetadataUtil.PARTITION_NAME_SECONDARY_INDEX_PREFIX))
+ .collect(Collectors.toSet());
+ Set<String> completedMetadataPartitions = dataMetaClient.getTableConfig().getMetadataPartitions();
+ secondaryIndexPartitions.removeAll(completedMetadataPartitions);
+ return secondaryIndexPartitions;
+ }
+
+ private Pair<Integer, HoodieData<HoodieRecord>> initializeSecondaryIndexPartition(String indexName) throws IOException {
+ HoodieFunctionalIndexDefinition indexDefinition = getFunctionalIndexDefinition(indexName);
+ ValidationUtils.checkState(indexDefinition != null, "Secondary Index definition is not present for index " + indexName);
+ List<Pair<String, FileSlice>> partitionFileSlicePairs = getPartitionFileSlicePairs();
+
+ // Reuse record index parallelism config to build secondary index
+ int parallelism = Math.min(partitionFileSlicePairs.size(), dataWriteConfig.getMetadataConfig().getRecordIndexMaxParallelism());
+ HoodieData<HoodieRecord> records = readSecondaryKeysFromFileSlices(
+ engineContext,
+ partitionFileSlicePairs,
+ parallelism,
+ this.getClass().getSimpleName(),
+ dataMetaClient,
+ EngineType.SPARK,
Review Comment:
makes sense.. have added abstract methods which is implemented by engine-specific metadata writer.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "codope (via GitHub)" <gi...@apache.org>.
codope commented on code in PR #11146:
URL: https://github.com/apache/hudi/pull/11146#discussion_r1610214658
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/metadata/HoodieBackedTableMetadataWriter.java:
##########
@@ -410,6 +413,14 @@ private boolean initializeFromFilesystem(String initializationTime, List<Metadat
}
fileGroupCountAndRecordsPair = initializePartitionStatsIndex(partitionInfoList);
break;
+ case SECONDARY_INDEX:
+ Set<String> secondaryIndexPartitionsToInit = getSecondaryIndexPartitionsToInit();
+ if (secondaryIndexPartitionsToInit.isEmpty()) {
+ continue;
+ }
+ ValidationUtils.checkState(secondaryIndexPartitionsToInit.size() == 1, "Only one secondary index at a time is supported for now");
Review Comment:
While we can create multiple secondary indexes using configs, but can only create one at a time using sql due to limitation of sql grammar. To keep the user experience consistent, I have added this validation. This will be removed later on after we enahcne the sql grammar and parser to support creating multiples indexes at a time.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #11146:
URL: https://github.com/apache/hudi/pull/11146#issuecomment-2136080248
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23710",
"triggerID" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"triggerType" : "PUSH"
}, {
"hash" : "1468a9a72c2cfdda7dae6bb62ac14551f600d8df",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23711",
"triggerID" : "1468a9a72c2cfdda7dae6bb62ac14551f600d8df",
"triggerType" : "PUSH"
}, {
"hash" : "f232b46fcd23d960efc587a624c2e9d69d3d7e9e",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23728",
"triggerID" : "f232b46fcd23d960efc587a624c2e9d69d3d7e9e",
"triggerType" : "PUSH"
}, {
"hash" : "8a6a98e1a8f0f65df59dddf663b0ef231f4c01ee",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23964",
"triggerID" : "8a6a98e1a8f0f65df59dddf663b0ef231f4c01ee",
"triggerType" : "PUSH"
}, {
"hash" : "420b19219080b2935b3a37442db7ed22816466af",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23999",
"triggerID" : "420b19219080b2935b3a37442db7ed22816466af",
"triggerType" : "PUSH"
}, {
"hash" : "4c02510ba3b23cb7d7feffbb2c6850c038d6103a",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24005",
"triggerID" : "4c02510ba3b23cb7d7feffbb2c6850c038d6103a",
"triggerType" : "PUSH"
}, {
"hash" : "9c3c82dde2fd4fcf1c2babe2c1a0345fe87af0c7",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24016",
"triggerID" : "9c3c82dde2fd4fcf1c2babe2c1a0345fe87af0c7",
"triggerType" : "PUSH"
}, {
"hash" : "98d96be857a9e87e74a4dee99cb31b162ade5aa3",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "98d96be857a9e87e74a4dee99cb31b162ade5aa3",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 9c3c82dde2fd4fcf1c2babe2c1a0345fe87af0c7 Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24016)
* 98d96be857a9e87e74a4dee99cb31b162ade5aa3 UNKNOWN
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #11146:
URL: https://github.com/apache/hudi/pull/11146#issuecomment-2136101611
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23710",
"triggerID" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"triggerType" : "PUSH"
}, {
"hash" : "1468a9a72c2cfdda7dae6bb62ac14551f600d8df",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23711",
"triggerID" : "1468a9a72c2cfdda7dae6bb62ac14551f600d8df",
"triggerType" : "PUSH"
}, {
"hash" : "f232b46fcd23d960efc587a624c2e9d69d3d7e9e",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23728",
"triggerID" : "f232b46fcd23d960efc587a624c2e9d69d3d7e9e",
"triggerType" : "PUSH"
}, {
"hash" : "8a6a98e1a8f0f65df59dddf663b0ef231f4c01ee",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23964",
"triggerID" : "8a6a98e1a8f0f65df59dddf663b0ef231f4c01ee",
"triggerType" : "PUSH"
}, {
"hash" : "420b19219080b2935b3a37442db7ed22816466af",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23999",
"triggerID" : "420b19219080b2935b3a37442db7ed22816466af",
"triggerType" : "PUSH"
}, {
"hash" : "4c02510ba3b23cb7d7feffbb2c6850c038d6103a",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24005",
"triggerID" : "4c02510ba3b23cb7d7feffbb2c6850c038d6103a",
"triggerType" : "PUSH"
}, {
"hash" : "9c3c82dde2fd4fcf1c2babe2c1a0345fe87af0c7",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24016",
"triggerID" : "9c3c82dde2fd4fcf1c2babe2c1a0345fe87af0c7",
"triggerType" : "PUSH"
}, {
"hash" : "98d96be857a9e87e74a4dee99cb31b162ade5aa3",
"status" : "PENDING",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24091",
"triggerID" : "98d96be857a9e87e74a4dee99cb31b162ade5aa3",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 9c3c82dde2fd4fcf1c2babe2c1a0345fe87af0c7 Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24016)
* 98d96be857a9e87e74a4dee99cb31b162ade5aa3 Azure: [PENDING](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24091)
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "codope (via GitHub)" <gi...@apache.org>.
codope commented on code in PR #11146:
URL: https://github.com/apache/hudi/pull/11146#discussion_r1620048869
##########
hudi-common/src/main/java/org/apache/hudi/common/model/HoodieIndexDefinition.java:
##########
@@ -45,14 +49,14 @@ public class HoodieFunctionalIndexDefinition implements Serializable {
// Any other configuration or properties specific to the index
private Map<String, String> indexOptions;
- public HoodieFunctionalIndexDefinition() {
+ public HoodieIndexDefinition() {
}
- public HoodieFunctionalIndexDefinition(String indexName, String indexType, String indexFunction, List<String> sourceFields,
- Map<String, String> indexOptions) {
+ public HoodieIndexDefinition(String indexName, String indexType, String indexFunction, List<String> sourceFields,
+ Map<String, String> indexOptions) {
this.indexName = indexName;
this.indexType = indexType;
- this.indexFunction = indexFunction;
+ this.indexFunction = nonEmpty(indexFunction) ? indexFunction : SPARK_IDENTITY;
Review Comment:
On second thought, it should not bind to spark function. I will correct it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #11146:
URL: https://github.com/apache/hudi/pull/11146#issuecomment-2137502975
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23710",
"triggerID" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"triggerType" : "PUSH"
}, {
"hash" : "1468a9a72c2cfdda7dae6bb62ac14551f600d8df",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23711",
"triggerID" : "1468a9a72c2cfdda7dae6bb62ac14551f600d8df",
"triggerType" : "PUSH"
}, {
"hash" : "f232b46fcd23d960efc587a624c2e9d69d3d7e9e",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23728",
"triggerID" : "f232b46fcd23d960efc587a624c2e9d69d3d7e9e",
"triggerType" : "PUSH"
}, {
"hash" : "8a6a98e1a8f0f65df59dddf663b0ef231f4c01ee",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23964",
"triggerID" : "8a6a98e1a8f0f65df59dddf663b0ef231f4c01ee",
"triggerType" : "PUSH"
}, {
"hash" : "420b19219080b2935b3a37442db7ed22816466af",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23999",
"triggerID" : "420b19219080b2935b3a37442db7ed22816466af",
"triggerType" : "PUSH"
}, {
"hash" : "4c02510ba3b23cb7d7feffbb2c6850c038d6103a",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24005",
"triggerID" : "4c02510ba3b23cb7d7feffbb2c6850c038d6103a",
"triggerType" : "PUSH"
}, {
"hash" : "9c3c82dde2fd4fcf1c2babe2c1a0345fe87af0c7",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24016",
"triggerID" : "9c3c82dde2fd4fcf1c2babe2c1a0345fe87af0c7",
"triggerType" : "PUSH"
}, {
"hash" : "98d96be857a9e87e74a4dee99cb31b162ade5aa3",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24091",
"triggerID" : "98d96be857a9e87e74a4dee99cb31b162ade5aa3",
"triggerType" : "PUSH"
}, {
"hash" : "76cb6530775bdfd9415bab25c48f23fd84777182",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24117",
"triggerID" : "76cb6530775bdfd9415bab25c48f23fd84777182",
"triggerType" : "PUSH"
}, {
"hash" : "470bc5f44e7a6658a8717ef1b77e92afcdd90087",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "470bc5f44e7a6658a8717ef1b77e92afcdd90087",
"triggerType" : "PUSH"
}, {
"hash" : "3d9b55d5f226698abf7339dc604f0e02d8fc8133",
"status" : "PENDING",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24120",
"triggerID" : "3d9b55d5f226698abf7339dc604f0e02d8fc8133",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 76cb6530775bdfd9415bab25c48f23fd84777182 Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24117)
* 470bc5f44e7a6658a8717ef1b77e92afcdd90087 UNKNOWN
* 3d9b55d5f226698abf7339dc604f0e02d8fc8133 Azure: [PENDING](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24120)
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "danny0405 (via GitHub)" <gi...@apache.org>.
danny0405 commented on code in PR #11146:
URL: https://github.com/apache/hudi/pull/11146#discussion_r1619526480
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/metadata/HoodieBackedTableMetadataWriter.java:
##########
@@ -525,21 +534,66 @@ private Pair<Integer, HoodieData<HoodieRecord>> initializeFunctionalIndexPartiti
}
private Set<String> getFunctionalIndexPartitionsToInit() {
- Set<String> functionalIndexPartitions = dataMetaClient.getFunctionalIndexMetadata().get().getIndexDefinitions().keySet();
+ Set<String> functionalIndexPartitions = dataMetaClient.getIndexMetadata().get().getIndexDefinitions().keySet();
Set<String> completedMetadataPartitions = dataMetaClient.getTableConfig().getMetadataPartitions();
functionalIndexPartitions.removeAll(completedMetadataPartitions);
return functionalIndexPartitions;
}
- private HoodieFunctionalIndexDefinition getFunctionalIndexDefinition(String indexName) {
- Option<HoodieFunctionalIndexMetadata> functionalIndexMetadata = dataMetaClient.getFunctionalIndexMetadata();
+ private HoodieIndexDefinition getFunctionalIndexDefinition(String indexName) {
+ Option<HoodieIndexMetadata> functionalIndexMetadata = dataMetaClient.getIndexMetadata();
if (functionalIndexMetadata.isPresent()) {
return functionalIndexMetadata.get().getIndexDefinitions().get(indexName);
} else {
throw new HoodieIndexException("Functional Index definition is not present");
}
}
+ private Set<String> getSecondaryIndexPartitionsToInit() {
+ Set<String> secondaryIndexPartitions = dataMetaClient.getIndexMetadata().get().getIndexDefinitions().values().stream()
+ .map(HoodieIndexDefinition::getIndexName)
+ .filter(indexName -> indexName.startsWith(HoodieTableMetadataUtil.PARTITION_NAME_SECONDARY_INDEX_PREFIX))
+ .collect(Collectors.toSet());
+ Set<String> completedMetadataPartitions = dataMetaClient.getTableConfig().getMetadataPartitions();
+ secondaryIndexPartitions.removeAll(completedMetadataPartitions);
+ return secondaryIndexPartitions;
+ }
+
+ private Pair<Integer, HoodieData<HoodieRecord>> initializeSecondaryIndexPartition(String indexName) throws IOException {
+ HoodieIndexDefinition indexDefinition = getFunctionalIndexDefinition(indexName);
+ ValidationUtils.checkState(indexDefinition != null, "Secondary Index definition is not present for index " + indexName);
+ List<Pair<String, FileSlice>> partitionFileSlicePairs = getPartitionFileSlicePairs();
+
+ // Reuse record index parallelism config to build secondary index
Review Comment:
Remove this line.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "codope (via GitHub)" <gi...@apache.org>.
codope commented on code in PR #11146:
URL: https://github.com/apache/hudi/pull/11146#discussion_r1618689186
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/metadata/HoodieBackedTableMetadataWriter.java:
##########
@@ -540,6 +547,51 @@ private HoodieFunctionalIndexDefinition getFunctionalIndexDefinition(String inde
}
}
+ private Set<String> getSecondaryIndexPartitionsToInit() {
+ Set<String> secondaryIndexPartitions = dataMetaClient.getFunctionalIndexMetadata().get().getIndexDefinitions().values().stream()
+ .map(HoodieFunctionalIndexDefinition::getIndexName)
+ .filter(indexName -> indexName.startsWith(HoodieTableMetadataUtil.PARTITION_NAME_SECONDARY_INDEX_PREFIX))
+ .collect(Collectors.toSet());
+ Set<String> completedMetadataPartitions = dataMetaClient.getTableConfig().getMetadataPartitions();
+ secondaryIndexPartitions.removeAll(completedMetadataPartitions);
+ return secondaryIndexPartitions;
+ }
+
+ private Pair<Integer, HoodieData<HoodieRecord>> initializeSecondaryIndexPartition(String indexName) throws IOException {
+ HoodieFunctionalIndexDefinition indexDefinition = getFunctionalIndexDefinition(indexName);
+ ValidationUtils.checkState(indexDefinition != null, "Secondary Index definition is not present for index " + indexName);
+ List<Pair<String, FileSlice>> partitionFileSlicePairs = getPartitionFileSlicePairs();
+
+ // Reuse record index parallelism config to build secondary index
+ int parallelism = Math.min(partitionFileSlicePairs.size(), dataWriteConfig.getMetadataConfig().getRecordIndexMaxParallelism());
+ HoodieData<HoodieRecord> records = readSecondaryKeysFromFileSlices(
+ engineContext,
+ partitionFileSlicePairs,
+ parallelism,
+ this.getClass().getSimpleName(),
+ dataMetaClient,
+ EngineType.SPARK,
Review Comment:
added a `getEngineType` abstact method.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #11146:
URL: https://github.com/apache/hudi/pull/11146#issuecomment-2096293863
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 7f99a0085a6d85388b2dc7d606265f7f63b01d1b UNKNOWN
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #11146:
URL: https://github.com/apache/hudi/pull/11146#issuecomment-2096446691
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"status" : "PENDING",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23710",
"triggerID" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"triggerType" : "PUSH"
}, {
"hash" : "1468a9a72c2cfdda7dae6bb62ac14551f600d8df",
"status" : "PENDING",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23711",
"triggerID" : "1468a9a72c2cfdda7dae6bb62ac14551f600d8df",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 7f99a0085a6d85388b2dc7d606265f7f63b01d1b Azure: [PENDING](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23710)
* 1468a9a72c2cfdda7dae6bb62ac14551f600d8df Azure: [PENDING](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23711)
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #11146:
URL: https://github.com/apache/hudi/pull/11146#issuecomment-2096434419
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"status" : "PENDING",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23710",
"triggerID" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"triggerType" : "PUSH"
}, {
"hash" : "1468a9a72c2cfdda7dae6bb62ac14551f600d8df",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "1468a9a72c2cfdda7dae6bb62ac14551f600d8df",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 7f99a0085a6d85388b2dc7d606265f7f63b01d1b Azure: [PENDING](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23710)
* 1468a9a72c2cfdda7dae6bb62ac14551f600d8df UNKNOWN
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #11146:
URL: https://github.com/apache/hudi/pull/11146#issuecomment-2096308751
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"status" : "PENDING",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23710",
"triggerID" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 7f99a0085a6d85388b2dc7d606265f7f63b01d1b Azure: [PENDING](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23710)
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #11146:
URL: https://github.com/apache/hudi/pull/11146#issuecomment-2119690380
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23710",
"triggerID" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"triggerType" : "PUSH"
}, {
"hash" : "1468a9a72c2cfdda7dae6bb62ac14551f600d8df",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23711",
"triggerID" : "1468a9a72c2cfdda7dae6bb62ac14551f600d8df",
"triggerType" : "PUSH"
}, {
"hash" : "f232b46fcd23d960efc587a624c2e9d69d3d7e9e",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23728",
"triggerID" : "f232b46fcd23d960efc587a624c2e9d69d3d7e9e",
"triggerType" : "PUSH"
}, {
"hash" : "8a6a98e1a8f0f65df59dddf663b0ef231f4c01ee",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23964",
"triggerID" : "8a6a98e1a8f0f65df59dddf663b0ef231f4c01ee",
"triggerType" : "PUSH"
}, {
"hash" : "420b19219080b2935b3a37442db7ed22816466af",
"status" : "PENDING",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23999",
"triggerID" : "420b19219080b2935b3a37442db7ed22816466af",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 8a6a98e1a8f0f65df59dddf663b0ef231f4c01ee Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23964)
* 420b19219080b2935b3a37442db7ed22816466af Azure: [PENDING](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23999)
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "codope (via GitHub)" <gi...@apache.org>.
codope commented on code in PR #11146:
URL: https://github.com/apache/hudi/pull/11146#discussion_r1618200904
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/metadata/HoodieBackedTableMetadataWriter.java:
##########
@@ -410,6 +413,14 @@ private boolean initializeFromFilesystem(String initializationTime, List<Metadat
}
fileGroupCountAndRecordsPair = initializePartitionStatsIndex(partitionInfoList);
break;
+ case SECONDARY_INDEX:
+ Set<String> secondaryIndexPartitionsToInit = getSecondaryIndexPartitionsToInit();
+ if (secondaryIndexPartitionsToInit.isEmpty()) {
+ continue;
+ }
+ ValidationUtils.checkState(secondaryIndexPartitionsToInit.size() == 1, "Only one secondary index at a time is supported for now");
Review Comment:
I see your point. Instead of failing, we should still continue to bootstrap other index types. I will change the logic a bit.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "codope (via GitHub)" <gi...@apache.org>.
codope commented on code in PR #11146:
URL: https://github.com/apache/hudi/pull/11146#discussion_r1618690006
##########
hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/metadata/SparkHoodieBackedTableMetadataWriter.java:
##########
@@ -222,4 +227,48 @@ protected HoodieTable getHoodieTable(HoodieWriteConfig writeConfig, HoodieTableM
public BaseHoodieWriteClient<?, JavaRDD<HoodieRecord>, ?, ?> initializeWriteClient() {
return new SparkRDDWriteClient(engineContext, metadataWriteConfig, true);
}
+
+ @Override
+ protected HoodieData<HoodieRecord> getSecondaryIndexRecordsFromFileSlices(List<Pair<String, FileSlice>> partitionFileSlicePairs,
+ HoodieIndexDefinition indexDefinition,
+ int parallelism) throws IOException {
Review Comment:
Done.. added a `getEngineType` abstract method.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "danny0405 (via GitHub)" <gi...@apache.org>.
danny0405 commented on code in PR #11146:
URL: https://github.com/apache/hudi/pull/11146#discussion_r1619761496
##########
hudi-common/src/main/java/org/apache/hudi/common/model/HoodieIndexDefinition.java:
##########
@@ -45,14 +49,14 @@ public class HoodieFunctionalIndexDefinition implements Serializable {
// Any other configuration or properties specific to the index
private Map<String, String> indexOptions;
- public HoodieFunctionalIndexDefinition() {
+ public HoodieIndexDefinition() {
}
- public HoodieFunctionalIndexDefinition(String indexName, String indexType, String indexFunction, List<String> sourceFields,
- Map<String, String> indexOptions) {
+ public HoodieIndexDefinition(String indexName, String indexType, String indexFunction, List<String> sourceFields,
+ Map<String, String> indexOptions) {
this.indexName = indexName;
this.indexType = indexType;
- this.indexFunction = indexFunction;
+ this.indexFunction = nonEmpty(indexFunction) ? indexFunction : SPARK_IDENTITY;
Review Comment:
Not sure why the empty string binds to spark.
##########
hudi-common/src/main/java/org/apache/hudi/keygen/constant/KeyGeneratorOptions.java:
##########
@@ -54,6 +54,13 @@ public class KeyGeneratorOptions extends HoodieConfig {
+ "Actual value will be obtained by invoking .toString() on the field value. Nested fields can be specified using\n"
+ "the dot notation eg: `a.b.c`");
+ public static final ConfigProperty<String> SECONDARYKEY_FIELD_NAME = ConfigProperty
Review Comment:
SECONDARYKEY_COLUMN_NAME
##########
hudi-common/src/main/java/org/apache/hudi/metadata/HoodieTableMetadataUtil.java:
##########
@@ -1833,12 +1837,153 @@ public static HoodieData<HoodieRecord> readRecordKeysFromFileSlices(HoodieEngine
});
}
- public static Schema getProjectedSchemaForFunctionalIndex(HoodieFunctionalIndexDefinition indexDefinition, HoodieTableMetaClient metaClient) throws Exception {
+ public static Schema getProjectedSchemaForFunctionalIndex(HoodieIndexDefinition indexDefinition, HoodieTableMetaClient metaClient) throws Exception {
TableSchemaResolver schemaResolver = new TableSchemaResolver(metaClient);
Schema tableSchema = schemaResolver.getTableAvroSchema();
return addMetadataFields(getSchemaForFields(tableSchema, indexDefinition.getSourceFields()));
}
+ public static HoodieData<HoodieRecord> readSecondaryKeysFromBaseFiles(HoodieEngineContext engineContext,
+ List<Pair<String, Pair<String, List<String>>>> partitionFiles,
+ int secondaryIndexMaxParallelism,
+ String activeModule, HoodieTableMetaClient metaClient, EngineType engineType,
+ HoodieIndexDefinition indexDefinition) {
+ if (partitionFiles.isEmpty()) {
+ return engineContext.emptyHoodieData();
+ }
+ final int parallelism = Math.min(partitionFiles.size(), secondaryIndexMaxParallelism);
+ final String basePath = metaClient.getBasePathV2().toString();
+ Schema tableSchema;
+ try {
+ tableSchema = new TableSchemaResolver(metaClient).getTableAvroSchema();
+ } catch (Exception e) {
+ throw new HoodieException("Failed to get latest schema for " + metaClient.getBasePathV2(), e);
+ }
+
+ engineContext.setJobStatus(activeModule, "Secondary Index: reading secondary keys from " + partitionFiles.size() + " partitions");
+ return engineContext.parallelize(partitionFiles, parallelism).flatMap(partitionAndBaseFile -> {
+ final String partition = partitionAndBaseFile.getKey();
+ final Pair<String, List<String>> baseAndLogFiles = partitionAndBaseFile.getValue();
+ List<String> logFilePaths = new ArrayList<>();
+ baseAndLogFiles.getValue().forEach(logFile -> logFilePaths.add(basePath + StoragePath.SEPARATOR + partition + StoragePath.SEPARATOR + logFile));
+ String filePath = baseAndLogFiles.getKey();
+ Option<StoragePath> dataFilePath = filePath.isEmpty() ? Option.empty() : Option.of(filePath(basePath, partition, filePath));
+ Schema readerSchema;
+ if (dataFilePath.isPresent()) {
+ readerSchema = HoodieIOFactory.getIOFactory(metaClient.getStorage())
+ .getFileFormatUtils(metaClient.getTableConfig().getBaseFileFormat())
+ .readAvroSchema(metaClient.getStorage(), dataFilePath.get());
+ } else {
+ readerSchema = tableSchema;
+ }
+ return createSecondaryIndexGenerator(metaClient, engineType, logFilePaths, readerSchema, partition, dataFilePath, indexDefinition);
+ });
+ }
+
+ public static HoodieData<HoodieRecord> readSecondaryKeysFromFileSlices(HoodieEngineContext engineContext,
+ List<Pair<String, FileSlice>> partitionFileSlicePairs,
+ int secondaryIndexMaxParallelism,
+ String activeModule, HoodieTableMetaClient metaClient, EngineType engineType,
+ HoodieIndexDefinition indexDefinition) {
+ if (partitionFileSlicePairs.isEmpty()) {
+ return engineContext.emptyHoodieData();
+ }
+ final int parallelism = Math.min(partitionFileSlicePairs.size(), secondaryIndexMaxParallelism);
+ final String basePath = metaClient.getBasePathV2().toString();
+ Schema tableSchema;
+ try {
+ tableSchema = new TableSchemaResolver(metaClient).getTableAvroSchema();
+ } catch (Exception e) {
+ throw new HoodieException("Failed to get latest schema for " + metaClient.getBasePathV2(), e);
+ }
+
+ engineContext.setJobStatus(activeModule, "Secondary Index: reading secondary keys from " + partitionFileSlicePairs.size() + " file slices");
+ return engineContext.parallelize(partitionFileSlicePairs, parallelism).flatMap(partitionAndBaseFile -> {
+ final String partition = partitionAndBaseFile.getKey();
+ final FileSlice fileSlice = partitionAndBaseFile.getValue();
+ List<String> logFilePaths = fileSlice.getLogFiles().sorted(HoodieLogFile.getLogFileComparator()).map(l -> l.getPath().toString()).collect(toList());
+ Option<StoragePath> dataFilePath = Option.ofNullable(fileSlice.getBaseFile().map(baseFile -> filePath(basePath, partition, baseFile.getFileName())).orElseGet(null));
+ Schema readerSchema;
+ if (dataFilePath.isPresent()) {
+ readerSchema = HoodieIOFactory.getIOFactory(metaClient.getStorage())
+ .getFileFormatUtils(metaClient.getTableConfig().getBaseFileFormat())
+ .readAvroSchema(metaClient.getStorage(), dataFilePath.get());
+ } else {
+ readerSchema = tableSchema;
+ }
+ return createSecondaryIndexGenerator(metaClient, engineType, logFilePaths, readerSchema, partition, dataFilePath, indexDefinition);
+ });
+ }
+
+ private static ClosableIterator<HoodieRecord> createSecondaryIndexGenerator(HoodieTableMetaClient metaClient,
+ EngineType engineType, List<String> logFilePaths,
+ Schema tableSchema, String partition,
+ Option<StoragePath> dataFilePath,
+ HoodieIndexDefinition indexDefinition) throws Exception {
+ final String basePath = metaClient.getBasePathV2().toString();
+ final StorageConfiguration<?> storageConf = metaClient.getStorageConf();
+
+ HoodieRecordMerger recordMerger = HoodieRecordUtils.createRecordMerger(
+ basePath,
+ engineType,
+ Collections.emptyList(),
+ metaClient.getTableConfig().getRecordMergerStrategy());
+
+ HoodieMergedLogRecordScanner mergedLogRecordScanner = HoodieMergedLogRecordScanner.newBuilder()
+ .withStorage(metaClient.getStorage())
+ .withBasePath(basePath)
+ .withLogFilePaths(logFilePaths)
+ .withReaderSchema(tableSchema)
+ .withLatestInstantTime(metaClient.getActiveTimeline().filterCompletedInstants().lastInstant().map(HoodieInstant::getTimestamp).orElse(""))
+ .withReverseReader(false)
+ .withMaxMemorySizeInBytes(storageConf.getLong(MAX_MEMORY_FOR_COMPACTION.key(), DEFAULT_MAX_MEMORY_FOR_SPILLABLE_MAP_IN_BYTES))
+ .withBufferSize(HoodieMetadataConfig.MAX_READER_BUFFER_SIZE_PROP.defaultValue())
+ .withSpillableMapBasePath(FileIOUtils.getDefaultSpillableMapBasePath())
+ .withPartition(partition)
+ .withOptimizedLogBlocksScan(storageConf.getBoolean("hoodie" + HoodieMetadataConfig.OPTIMIZED_LOG_BLOCKS_SCAN, false))
Review Comment:
`"hoodie" + HoodieMetadataConfig.OPTIMIZED_LOG_BLOCKS_SCAN` the code looks weird.
##########
hudi-common/src/main/java/org/apache/hudi/common/config/HoodieMetadataConfig.java:
##########
@@ -351,6 +351,25 @@ public final class HoodieMetadataConfig extends HoodieConfig {
.sinceVersion("1.0.0")
.withDocumentation("Parallelism to use, when generating partition stats index.");
+ public static final ConfigProperty<Boolean> SECONDARY_INDEX_ENABLE_PROP = ConfigProperty
+ .key(METADATA_PREFIX + ".index.secondary.enable")
Review Comment:
enable or enabled?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #11146:
URL: https://github.com/apache/hudi/pull/11146#issuecomment-2138579384
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23710",
"triggerID" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"triggerType" : "PUSH"
}, {
"hash" : "1468a9a72c2cfdda7dae6bb62ac14551f600d8df",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23711",
"triggerID" : "1468a9a72c2cfdda7dae6bb62ac14551f600d8df",
"triggerType" : "PUSH"
}, {
"hash" : "f232b46fcd23d960efc587a624c2e9d69d3d7e9e",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23728",
"triggerID" : "f232b46fcd23d960efc587a624c2e9d69d3d7e9e",
"triggerType" : "PUSH"
}, {
"hash" : "8a6a98e1a8f0f65df59dddf663b0ef231f4c01ee",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23964",
"triggerID" : "8a6a98e1a8f0f65df59dddf663b0ef231f4c01ee",
"triggerType" : "PUSH"
}, {
"hash" : "420b19219080b2935b3a37442db7ed22816466af",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23999",
"triggerID" : "420b19219080b2935b3a37442db7ed22816466af",
"triggerType" : "PUSH"
}, {
"hash" : "4c02510ba3b23cb7d7feffbb2c6850c038d6103a",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24005",
"triggerID" : "4c02510ba3b23cb7d7feffbb2c6850c038d6103a",
"triggerType" : "PUSH"
}, {
"hash" : "9c3c82dde2fd4fcf1c2babe2c1a0345fe87af0c7",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24016",
"triggerID" : "9c3c82dde2fd4fcf1c2babe2c1a0345fe87af0c7",
"triggerType" : "PUSH"
}, {
"hash" : "98d96be857a9e87e74a4dee99cb31b162ade5aa3",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24091",
"triggerID" : "98d96be857a9e87e74a4dee99cb31b162ade5aa3",
"triggerType" : "PUSH"
}, {
"hash" : "76cb6530775bdfd9415bab25c48f23fd84777182",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24117",
"triggerID" : "76cb6530775bdfd9415bab25c48f23fd84777182",
"triggerType" : "PUSH"
}, {
"hash" : "470bc5f44e7a6658a8717ef1b77e92afcdd90087",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "470bc5f44e7a6658a8717ef1b77e92afcdd90087",
"triggerType" : "PUSH"
}, {
"hash" : "3d9b55d5f226698abf7339dc604f0e02d8fc8133",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24120",
"triggerID" : "3d9b55d5f226698abf7339dc604f0e02d8fc8133",
"triggerType" : "PUSH"
}, {
"hash" : "e8a4507886bc97b1819ea39788f2abd7385b8cf2",
"status" : "SUCCESS",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24139",
"triggerID" : "e8a4507886bc97b1819ea39788f2abd7385b8cf2",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 470bc5f44e7a6658a8717ef1b77e92afcdd90087 UNKNOWN
* e8a4507886bc97b1819ea39788f2abd7385b8cf2 Azure: [SUCCESS](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24139)
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #11146:
URL: https://github.com/apache/hudi/pull/11146#issuecomment-2137034663
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23710",
"triggerID" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"triggerType" : "PUSH"
}, {
"hash" : "1468a9a72c2cfdda7dae6bb62ac14551f600d8df",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23711",
"triggerID" : "1468a9a72c2cfdda7dae6bb62ac14551f600d8df",
"triggerType" : "PUSH"
}, {
"hash" : "f232b46fcd23d960efc587a624c2e9d69d3d7e9e",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23728",
"triggerID" : "f232b46fcd23d960efc587a624c2e9d69d3d7e9e",
"triggerType" : "PUSH"
}, {
"hash" : "8a6a98e1a8f0f65df59dddf663b0ef231f4c01ee",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23964",
"triggerID" : "8a6a98e1a8f0f65df59dddf663b0ef231f4c01ee",
"triggerType" : "PUSH"
}, {
"hash" : "420b19219080b2935b3a37442db7ed22816466af",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23999",
"triggerID" : "420b19219080b2935b3a37442db7ed22816466af",
"triggerType" : "PUSH"
}, {
"hash" : "4c02510ba3b23cb7d7feffbb2c6850c038d6103a",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24005",
"triggerID" : "4c02510ba3b23cb7d7feffbb2c6850c038d6103a",
"triggerType" : "PUSH"
}, {
"hash" : "9c3c82dde2fd4fcf1c2babe2c1a0345fe87af0c7",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24016",
"triggerID" : "9c3c82dde2fd4fcf1c2babe2c1a0345fe87af0c7",
"triggerType" : "PUSH"
}, {
"hash" : "98d96be857a9e87e74a4dee99cb31b162ade5aa3",
"status" : "FAILURE",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24091",
"triggerID" : "98d96be857a9e87e74a4dee99cb31b162ade5aa3",
"triggerType" : "PUSH"
}, {
"hash" : "76cb6530775bdfd9415bab25c48f23fd84777182",
"status" : "PENDING",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24117",
"triggerID" : "76cb6530775bdfd9415bab25c48f23fd84777182",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 98d96be857a9e87e74a4dee99cb31b162ade5aa3 Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24091)
* 76cb6530775bdfd9415bab25c48f23fd84777182 Azure: [PENDING](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24117)
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [HUDI-7146] Implement secondary index write path [hudi]
Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #11146:
URL: https://github.com/apache/hudi/pull/11146#issuecomment-2137625560
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23710",
"triggerID" : "7f99a0085a6d85388b2dc7d606265f7f63b01d1b",
"triggerType" : "PUSH"
}, {
"hash" : "1468a9a72c2cfdda7dae6bb62ac14551f600d8df",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23711",
"triggerID" : "1468a9a72c2cfdda7dae6bb62ac14551f600d8df",
"triggerType" : "PUSH"
}, {
"hash" : "f232b46fcd23d960efc587a624c2e9d69d3d7e9e",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23728",
"triggerID" : "f232b46fcd23d960efc587a624c2e9d69d3d7e9e",
"triggerType" : "PUSH"
}, {
"hash" : "8a6a98e1a8f0f65df59dddf663b0ef231f4c01ee",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23964",
"triggerID" : "8a6a98e1a8f0f65df59dddf663b0ef231f4c01ee",
"triggerType" : "PUSH"
}, {
"hash" : "420b19219080b2935b3a37442db7ed22816466af",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=23999",
"triggerID" : "420b19219080b2935b3a37442db7ed22816466af",
"triggerType" : "PUSH"
}, {
"hash" : "4c02510ba3b23cb7d7feffbb2c6850c038d6103a",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24005",
"triggerID" : "4c02510ba3b23cb7d7feffbb2c6850c038d6103a",
"triggerType" : "PUSH"
}, {
"hash" : "9c3c82dde2fd4fcf1c2babe2c1a0345fe87af0c7",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24016",
"triggerID" : "9c3c82dde2fd4fcf1c2babe2c1a0345fe87af0c7",
"triggerType" : "PUSH"
}, {
"hash" : "98d96be857a9e87e74a4dee99cb31b162ade5aa3",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24091",
"triggerID" : "98d96be857a9e87e74a4dee99cb31b162ade5aa3",
"triggerType" : "PUSH"
}, {
"hash" : "76cb6530775bdfd9415bab25c48f23fd84777182",
"status" : "DELETED",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24117",
"triggerID" : "76cb6530775bdfd9415bab25c48f23fd84777182",
"triggerType" : "PUSH"
}, {
"hash" : "470bc5f44e7a6658a8717ef1b77e92afcdd90087",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "470bc5f44e7a6658a8717ef1b77e92afcdd90087",
"triggerType" : "PUSH"
}, {
"hash" : "3d9b55d5f226698abf7339dc604f0e02d8fc8133",
"status" : "SUCCESS",
"url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24120",
"triggerID" : "3d9b55d5f226698abf7339dc604f0e02d8fc8133",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 470bc5f44e7a6658a8717ef1b77e92afcdd90087 UNKNOWN
* 3d9b55d5f226698abf7339dc604f0e02d8fc8133 Azure: [SUCCESS](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=24120)
<details>
<summary>Bot commands</summary>
@hudi-bot supports the following commands:
- `@hudi-bot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org