-
Notifications
You must be signed in to change notification settings - Fork 2.5k
[HUDI-2550] Expand File-Group candidates list for appending for MOR tables #3986
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
902a028
99ef339
6e36337
45ba124
91b69cb
9619151
1e675d3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -56,6 +56,7 @@ | |
| import java.io.IOException; | ||
| import java.nio.charset.StandardCharsets; | ||
| import java.util.ArrayList; | ||
| import java.util.Arrays; | ||
| import java.util.Collections; | ||
| import java.util.HashMap; | ||
| import java.util.LinkedList; | ||
|
|
@@ -336,7 +337,6 @@ public void testUpsertPartitionerWithSmallFileHandlingWithInflightCompactionWith | |
| HoodieCompactionPlan plan = CompactionTestUtils.createCompactionPlan(metaClient, "001", "002", 1, true, false); | ||
| FileCreateUtils.createRequestedCompactionCommit(basePath, "002", plan); | ||
| // Simulate one more commit so that inflight compaction is considered when building file groups in file system view | ||
| // | ||
| FileCreateUtils.createBaseFile(basePath, testPartitionPath, "003", "2", 1); | ||
| FileCreateUtils.createCommit(basePath, "003"); | ||
|
|
||
|
|
@@ -434,6 +434,49 @@ public void testUpsertPartitionerWithSmallFileHandlingWithCanIndexLogFiles() thr | |
| "Insert should be assigned to fg1"); | ||
| } | ||
|
|
||
| @Test | ||
| public void testUpsertPartitionerWithSmallFileHandlingPickingMultipleCandidates() throws Exception { | ||
| final String partitionPath = DEFAULT_PARTITION_PATHS[0]; | ||
|
|
||
| HoodieWriteConfig config = | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will land this for now. But when you get a chance, can you make this test configurable w/ diff values for the config that we just added. Just to make sure the config is honored for diff values. just 2 diff values would suffice.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @alexeykudinkin let's keep the code styling more consistent with whats there already? instead of |
||
| makeHoodieClientConfigBuilder() | ||
| .withMergeSmallFileGroupCandidatesLimit(3) | ||
| .withStorageConfig( | ||
| HoodieStorageConfig.newBuilder() | ||
| .parquetMaxFileSize(2048) | ||
| .build() | ||
| ) | ||
| .build(); | ||
|
|
||
| // Bootstrap base files ("small-file targets") | ||
| FileCreateUtils.createBaseFile(basePath, partitionPath, "002", "fg-1", 1024); | ||
| FileCreateUtils.createBaseFile(basePath, partitionPath, "002", "fg-2", 1024); | ||
| FileCreateUtils.createBaseFile(basePath, partitionPath, "002", "fg-3", 1024); | ||
|
|
||
| FileCreateUtils.createCommit(basePath, "002"); | ||
|
|
||
| HoodieTestDataGenerator dataGenerator = new HoodieTestDataGenerator(new String[] {partitionPath}); | ||
| // Default estimated record size will be 1024 based on last file group created. | ||
| // Only 1 record can be added to small file | ||
| WorkloadProfile profile = | ||
| new WorkloadProfile(buildProfile(jsc.parallelize(dataGenerator.generateInserts("003", 3)))); | ||
|
|
||
| HoodieTableMetaClient reloadedMetaClient = HoodieTableMetaClient.reload(this.metaClient); | ||
|
|
||
| HoodieSparkTable<?> table = HoodieSparkTable.create(config, context, reloadedMetaClient); | ||
|
|
||
| SparkUpsertDeltaCommitPartitioner<?> partitioner = new SparkUpsertDeltaCommitPartitioner<>(profile, context, table, config); | ||
|
|
||
| assertEquals(3, partitioner.numPartitions()); | ||
| assertEquals( | ||
| Arrays.asList( | ||
| new BucketInfo(BucketType.UPDATE, "fg-1", partitionPath), | ||
| new BucketInfo(BucketType.UPDATE, "fg-2", partitionPath), | ||
| new BucketInfo(BucketType.UPDATE, "fg-3", partitionPath) | ||
| ), | ||
| partitioner.getBucketInfos()); | ||
| } | ||
|
|
||
| private HoodieWriteConfig.Builder makeHoodieClientConfigBuilder() { | ||
| // Prepare the AvroParquetIO | ||
| return HoodieWriteConfig.newBuilder().withPath(basePath).withSchema(SCHEMA.toString()); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.