You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by GitBox <gi...@apache.org> on 2020/09/24 13:00:57 UTC
[GitHub] [hudi] SteNicholas opened a new pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
SteNicholas opened a new pull request #2111:
URL: https://github.com/apache/hudi/pull/2111
## *Tips*
- *Thank you very much for contributing to Apache Hudi.*
- *Please review https://hudi.apache.org/contributing.html before opening a pull request.*
## What is the purpose of the pull request
*When setting different small file limit, if the limit is set to 0, the new inserts will not update the old records and write into a new file, otherwise the limit is set to other value such as 128M, the new inserts could update the old records lies in small file picked up the UpsertPartitioner. `UpsertPartitioner` should insert new records regardless of small file when using insert operation.*
## Brief change log
- *`assignInserts` of `UpsertPartitioner` add the check whether write operation type is is changing records or not for the case that using insert operation inserts new records regardless of small file.*
## Verify this pull request
- *Modify the creation of `WorkloadProfile` for `testUpsertPartitioner` and `testUpsertPartitionerWithSmallInsertHandling` of `TestUpsertPartitioner` to verify the test case with UPSERT write operation.*
## Committer checklist
- [x] Has a corresponding JIRA in PR title & commit
- [x] Commit message is descriptive of the change
- [x] CI is green
- [ ] Necessary doc changes done or have another open PR
- [ ] For large changes, please consider breaking it into sub-tasks under an umbrella JIRA.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] linshan-ma commented on pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
linshan-ma commented on pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#issuecomment-700471110
@leesf yes,it was updated.When we set hoodie.parquet.small.file.limit=0, it was inserted
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] SteNicholas commented on a change in pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
SteNicholas commented on a change in pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#discussion_r501777975
##########
File path: hudi-integ-test/src/test/java/org/apache/hudi/integ/command/ITTestHoodieSyncCommand.java
##########
@@ -52,7 +52,7 @@ public void testValidateSync() throws Exception {
executeCommandStringInDocker(ADHOC_1_CONTAINER, HUDI_CLI_TOOL + " --cmdfile " + SYNC_VALIDATE_COMMANDS, true);
String expected = String.format("Count difference now is (count(%s) - count(%s) == %d. Catch up count is %d",
- hiveTableName, hiveTableName2, 100, 200);
+ hiveTableName, hiveTableName2, 100, 100);
Review comment:
@leesf I don't think this should explain why change from 200 to 100, because this test case could use the insert operation based on inserting new records regardless of small file.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] leesf commented on a change in pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
leesf commented on a change in pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#discussion_r501675165
##########
File path: hudi-client/hudi-spark-client/src/test/java/org/apache/hudi/table/action/commit/TestUpsertPartitioner.java
##########
@@ -286,8 +303,48 @@ public void testUpsertPartitionerWithSmallInsertHandling() throws Exception {
"Bucket 3 is INSERT");
assertEquals(4, insertBuckets.size(), "Total of 4 insert buckets");
- weights = new Double[] { 0.08, 0.31, 0.31, 0.31};
- cumulativeWeights = new Double[] { 0.08, 0.39, 0.69, 1.0};
+ weights = new Double[] {0.08, 0.31, 0.31, 0.31};
+ cumulativeWeights = new Double[] {0.08, 0.39, 0.69, 1.0};
+ assertInsertBuckets(weights, cumulativeWeights, insertBuckets);
+ }
+
+ @Test
+ public void testInsertPartitionerWithSmallInsertHandling() throws Exception {
+ final String testPartitionPath = "2016/09/26";
+ // Inserts .. Check updates go together & inserts subsplit, after expanding smallest file
+ UpsertPartitioner partitioner = getInsertPartitioner(1000 * 1024, 400, 800 * 1024, testPartitionPath, false);
+ List<InsertBucketCumulativeWeightPair> insertBuckets = partitioner.getInsertBuckets(testPartitionPath);
+
+ assertEquals(3, partitioner.numPartitions(), "Should have 3 partitions");
Review comment:
it would be better if you would describe how to get `3` expected partitions.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] SteNicholas edited a comment on pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
SteNicholas edited a comment on pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#issuecomment-700524082
> According to this([https://github.com/apache/hudi/issues/2051)](https://github.com/apache/hudi/issues/2051%EF%BC%89) test。I can't get the results I want。When we set different value(hoodie.parquet.small.file.limit), the results are still different
@linshan-ma Could you please provide this test again? I couldn't visit the test you mentioned.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] nsivabalan commented on a change in pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
nsivabalan commented on a change in pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#discussion_r558486472
##########
File path: hudi-client/hudi-client-common/src/main/java/org/apache/hudi/io/storage/HoodieConcatHandle.java
##########
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hudi.io.storage;
+
+import org.apache.hudi.client.common.TaskContextSupplier;
+import org.apache.hudi.common.model.HoodieBaseFile;
+import org.apache.hudi.common.model.HoodieRecord;
+import org.apache.hudi.common.model.HoodieRecordPayload;
+import org.apache.hudi.config.HoodieWriteConfig;
+import org.apache.hudi.exception.HoodieUpsertException;
+import org.apache.hudi.io.HoodieMergeHandle;
+import org.apache.hudi.table.HoodieTable;
+
+import org.apache.avro.generic.GenericRecord;
+import org.apache.log4j.LogManager;
+import org.apache.log4j.Logger;
+
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * Handle to concatenate new records to old records w/o any merging. If Operation is set to Inserts, and if {{@link HoodieWriteConfig#isRouteInsertsToNewFiles()}}
+ * is set, this handle will be used instead of {@link HoodieMergeHandle}
+ */
+public class HoodieConcatHandle<T extends HoodieRecordPayload, I, K, O> extends HoodieMergeHandle<T, I, K, O> {
+
+ private static final Logger LOG = LogManager.getLogger(HoodieConcatHandle.class);
+
+ public HoodieConcatHandle(HoodieWriteConfig config, String instantTime, HoodieTable hoodieTable, Iterator recordItr,
+ String partitionPath, String fileId, TaskContextSupplier taskContextSupplier) {
+ super(config, instantTime, hoodieTable, recordItr, partitionPath, fileId, taskContextSupplier);
+ }
+
+ public HoodieConcatHandle(HoodieWriteConfig config, String instantTime, HoodieTable hoodieTable, Map keyToNewRecords, String partitionPath, String fileId,
+ HoodieBaseFile dataFileToBeMerged, TaskContextSupplier taskContextSupplier) {
+ super(config, instantTime, hoodieTable, keyToNewRecords, partitionPath, fileId, dataFileToBeMerged, taskContextSupplier);
+ }
+
+ /**
+ * Write old record as is w/o merging with incoming record.
+ */
+ @Override
+ public void write(GenericRecord oldRecord) {
Review comment:
@vinothchandar : Have added this new handle and tested that it works as expected. But would like to call out that any new records would just get appended. For instance, if records to be deleted (with "_hoodie_is_deleted" set to true) are sent via "Insert" operation, this handle will just append and may not recognize the deleted records as we don't do any combineAndUpdate.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] SteNicholas commented on a change in pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
SteNicholas commented on a change in pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#discussion_r501726744
##########
File path: hudi-client/hudi-spark-client/src/test/java/org/apache/hudi/table/action/commit/TestUpsertPartitioner.java
##########
@@ -286,8 +303,48 @@ public void testUpsertPartitionerWithSmallInsertHandling() throws Exception {
"Bucket 3 is INSERT");
assertEquals(4, insertBuckets.size(), "Total of 4 insert buckets");
- weights = new Double[] { 0.08, 0.31, 0.31, 0.31};
- cumulativeWeights = new Double[] { 0.08, 0.39, 0.69, 1.0};
+ weights = new Double[] {0.08, 0.31, 0.31, 0.31};
+ cumulativeWeights = new Double[] {0.08, 0.39, 0.69, 1.0};
+ assertInsertBuckets(weights, cumulativeWeights, insertBuckets);
+ }
+
+ @Test
+ public void testInsertPartitionerWithSmallInsertHandling() throws Exception {
+ final String testPartitionPath = "2016/09/26";
+ // Inserts .. Check updates go together & inserts subsplit, after expanding smallest file
+ UpsertPartitioner partitioner = getInsertPartitioner(1000 * 1024, 400, 800 * 1024, testPartitionPath, false);
+ List<InsertBucketCumulativeWeightPair> insertBuckets = partitioner.getInsertBuckets(testPartitionPath);
+
+ assertEquals(3, partitioner.numPartitions(), "Should have 3 partitions");
+ assertEquals(BucketType.INSERT, partitioner.getBucketInfo(0).bucketType,
+ "Bucket 0 is INSERT");
+ assertEquals(BucketType.INSERT, partitioner.getBucketInfo(1).bucketType,
+ "Bucket 1 is INSERT");
+ assertEquals(BucketType.INSERT, partitioner.getBucketInfo(2).bucketType,
+ "Bucket 2 is INSERT");
Review comment:
@leesf Yes, I would like to use `foreach` assertion 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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] SteNicholas removed a comment on pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
SteNicholas removed a comment on pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#issuecomment-700524082
> According to this([https://github.com/apache/hudi/issues/2051)](https://github.com/apache/hudi/issues/2051%EF%BC%89) test。I can't get the results I want。When we set different value(hoodie.parquet.small.file.limit), the results are still different
@linshan-ma Could you please provide this test again? I couldn't visit the test you mentioned.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] nsivabalan merged pull request #2111: [HUDI-1234] Insert new records to data files without merging for "Insert" operation.
Posted by GitBox <gi...@apache.org>.
nsivabalan merged pull request #2111:
URL: https://github.com/apache/hudi/pull/2111
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] leesf commented on pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
leesf commented on pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#issuecomment-698882595
@SteNicholas would you please also add some tests to the new changes?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] vinothchandar commented on a change in pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
vinothchandar commented on a change in pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#discussion_r553713192
##########
File path: hudi-client/hudi-client-common/src/main/java/org/apache/hudi/config/HoodieWriteConfig.java
##########
@@ -133,6 +133,10 @@
private static final String MERGE_DATA_VALIDATION_CHECK_ENABLED = "hoodie.merge.data.validation.enabled";
private static final String DEFAULT_MERGE_DATA_VALIDATION_CHECK_ENABLED = "false";
+ // Routes inserts to new files ignoring small file handling
+ private static final String ROUTE_INSERTS_TO_NEW_FILES = "hoodie.route.inserts.to.new.files";
Review comment:
rename `hoodie.merge.allow.duplicate.inserts`
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] leesf commented on a change in pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
leesf commented on a change in pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#discussion_r501676578
##########
File path: hudi-client/hudi-spark-client/src/test/java/org/apache/hudi/table/action/commit/TestUpsertPartitioner.java
##########
@@ -286,8 +303,48 @@ public void testUpsertPartitionerWithSmallInsertHandling() throws Exception {
"Bucket 3 is INSERT");
assertEquals(4, insertBuckets.size(), "Total of 4 insert buckets");
- weights = new Double[] { 0.08, 0.31, 0.31, 0.31};
- cumulativeWeights = new Double[] { 0.08, 0.39, 0.69, 1.0};
+ weights = new Double[] {0.08, 0.31, 0.31, 0.31};
+ cumulativeWeights = new Double[] {0.08, 0.39, 0.69, 1.0};
+ assertInsertBuckets(weights, cumulativeWeights, insertBuckets);
+ }
+
+ @Test
+ public void testInsertPartitionerWithSmallInsertHandling() throws Exception {
+ final String testPartitionPath = "2016/09/26";
+ // Inserts .. Check updates go together & inserts subsplit, after expanding smallest file
+ UpsertPartitioner partitioner = getInsertPartitioner(1000 * 1024, 400, 800 * 1024, testPartitionPath, false);
+ List<InsertBucketCumulativeWeightPair> insertBuckets = partitioner.getInsertBuckets(testPartitionPath);
+
+ assertEquals(3, partitioner.numPartitions(), "Should have 3 partitions");
+ assertEquals(BucketType.INSERT, partitioner.getBucketInfo(0).bucketType,
+ "Bucket 0 is INSERT");
+ assertEquals(BucketType.INSERT, partitioner.getBucketInfo(1).bucketType,
+ "Bucket 1 is INSERT");
+ assertEquals(BucketType.INSERT, partitioner.getBucketInfo(2).bucketType,
+ "Bucket 2 is INSERT");
+ assertEquals(3, insertBuckets.size(), "Total of 3 insert buckets");
+
+ Double[] weights = {0.5, 0.25, 0.25};
+ Double[] cumulativeWeights = {0.5, 0.75, 1.0};
+ assertInsertBuckets(weights, cumulativeWeights, insertBuckets);
+
+ // Now with insert split size auto tuned
+ partitioner = getInsertPartitioner(1000 * 1024, 2400, 800 * 1024, testPartitionPath, true);
+ insertBuckets = partitioner.getInsertBuckets(testPartitionPath);
+
+ assertEquals(4, partitioner.numPartitions(), "Should have 4 partitions");
+ assertEquals(BucketType.INSERT, partitioner.getBucketInfo(0).bucketType,
+ "Bucket 0 is INSERT");
+ assertEquals(BucketType.INSERT, partitioner.getBucketInfo(1).bucketType,
+ "Bucket 1 is INSERT");
+ assertEquals(BucketType.INSERT, partitioner.getBucketInfo(2).bucketType,
+ "Bucket 2 is INSERT");
+ assertEquals(BucketType.INSERT, partitioner.getBucketInfo(3).bucketType,
+ "Bucket 3 is INSERT");
Review comment:
ditto
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] SteNicholas commented on pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
SteNicholas commented on pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#issuecomment-716095388
> @SteNicholas Please ping me when this is ready again! If you can also update PR description withe new approach that would be great.
@vinothchandar I'm trying to allow duplicates through a separate IOHandle/flag.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] SteNicholas commented on pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
SteNicholas commented on pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#issuecomment-698658606
@leesf @bvaradar Could you please review this pull request?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] bvaradar commented on pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
bvaradar commented on pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#issuecomment-712564198
@SteNicholas @leesf : Does this essentially mean we no longer support small file handling for "inserts" ?
If user doesn't essentially care about duplicates, I agree that we need to have same behavior w/o small file handling. Instead of this approach, can we create a new type of Write Handle which looks like MergeHandle but does not merge but rather appends records and creates a new version of Parquet file. You can then use this Handle instead of UpdateHandle when pure insert operation type is used.
cc @vinothchandar
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] vinothchandar commented on pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
vinothchandar commented on pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#issuecomment-732326913
@SteNicholas still interested in driving this forward?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] leesf commented on a change in pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
leesf commented on a change in pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#discussion_r505541446
##########
File path: hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/table/action/commit/UpsertPartitioner.java
##########
@@ -129,6 +131,18 @@ private int addUpdateBucket(String partitionPath, String fileIdHint) {
return bucket;
}
+ private int addInsertBucket(String partitionPath, String fileIdHint) {
+ int bucket = totalBuckets;
+ updateLocationToBucket.put(fileIdHint, bucket);
+ BucketInfo bucketInfo = new BucketInfo();
+ bucketInfo.bucketType = BucketType.INSERT;
+ bucketInfo.fileIdPrefix = fileIdHint;
+ bucketInfo.partitionPath = partitionPath;
+ bucketInfoMap.put(totalBuckets, bucketInfo);
+ totalBuckets++;
+ return bucket;
Review comment:
would also merge
``` java
for (int b = 0; b < insertBuckets; b++) {
bucketNumbers.add(totalBuckets);
recordsPerBucket.add(totalUnassignedInserts / insertBuckets);
BucketInfo bucketInfo = new BucketInfo();
bucketInfo.bucketType = BucketType.INSERT;
bucketInfo.partitionPath = partitionPath;
bucketInfo.fileIdPrefix = FSUtils.createNewFileIdPfx();
bucketInfoMap.put(totalBuckets, bucketInfo);
totalBuckets++;
}
```
the logic to the 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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] SteNicholas commented on pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
SteNicholas commented on pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#issuecomment-712566489
> @SteNicholas @leesf : Does this essentially mean we no longer support small file handling for "inserts" ?
> If user doesn't essentially care about duplicates, I agree that we need to have same behavior w/o small file handling. Instead of this approach, can we create a new type of Write Handle which looks like MergeHandle but does not merge but rather appends records and creates a new version of Parquet file. You can then use this Handle instead of UpdateHandle when pure insert operation type is used.
>
> cc @vinothchandar
Yes, user doesn't essentially care about duplicates for small files and the same behavior w/o small file handling makes sense.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] leesf commented on a change in pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
leesf commented on a change in pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#discussion_r501659751
##########
File path: hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/table/action/commit/UpsertPartitioner.java
##########
@@ -112,16 +115,17 @@ private void assignUpdates(WorkloadProfile profile) {
for (Map.Entry<String, WorkloadStat> partitionStat : partitionStatEntries) {
for (Map.Entry<String, Pair<String, Long>> updateLocEntry :
partitionStat.getValue().getUpdateLocationToCount().entrySet()) {
- addUpdateBucket(partitionStat.getKey(), updateLocEntry.getKey());
+ addUpdateBucket(partitionStat.getKey(), updateLocEntry.getKey(), profile.getOperationType());
}
}
}
- private int addUpdateBucket(String partitionPath, String fileIdHint) {
+ private int addUpdateBucket(String partitionPath, String fileIdHint, WriteOperationType operationType) {
int bucket = totalBuckets;
updateLocationToBucket.put(fileIdHint, bucket);
BucketInfo bucketInfo = new BucketInfo();
- bucketInfo.bucketType = BucketType.UPDATE;
+ bucketInfo.bucketType = operationType == null || isChangingRecords(operationType)
Review comment:
The method called `addUpdateBucket`, but the BucketType would be `INSERT`, it is not very suitable, would we move the logic outside of the 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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] SteNicholas removed a comment on pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
SteNicholas removed a comment on pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#issuecomment-702550693
@linshan-ma You could use the current commit to check your test case again. IMO, the current commit has already resolved your problem.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] leesf commented on a change in pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
leesf commented on a change in pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#discussion_r501677026
##########
File path: hudi-integ-test/src/test/java/org/apache/hudi/integ/command/ITTestHoodieSyncCommand.java
##########
@@ -52,7 +52,7 @@ public void testValidateSync() throws Exception {
executeCommandStringInDocker(ADHOC_1_CONTAINER, HUDI_CLI_TOOL + " --cmdfile " + SYNC_VALIDATE_COMMANDS, true);
String expected = String.format("Count difference now is (count(%s) - count(%s) == %d. Catch up count is %d",
- hiveTableName, hiveTableName2, 100, 200);
+ hiveTableName, hiveTableName2, 100, 100);
Review comment:
would you please explain why change from `200` to `100` ?
##########
File path: hudi-spark/src/test/scala/org/apache/hudi/functional/TestMORDataSource.scala
##########
@@ -211,7 +211,7 @@ class TestMORDataSource extends HoodieClientTestBase {
val hudiSnapshotDF5 = spark.read.format("org.apache.hudi")
.option(DataSourceReadOptions.QUERY_TYPE_OPT_KEY, DataSourceReadOptions.QUERY_TYPE_SNAPSHOT_OPT_VAL)
.load(basePath + "/*/*/*/*")
- assertEquals(200, hudiSnapshotDF5.count())
+ assertEquals(300, hudiSnapshotDF5.count())
Review comment:
ditto
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] nsivabalan commented on a change in pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
nsivabalan commented on a change in pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#discussion_r553104712
##########
File path: hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/table/action/commit/UpsertPartitioner.java
##########
@@ -191,14 +201,29 @@ private void assignInserts(WorkloadProfile profile, HoodieEngineContext context)
long recordsToAppend = Math.min((config.getParquetMaxFileSize() - smallFile.sizeBytes) / averageRecordSize,
totalUnassignedInserts);
if (recordsToAppend > 0 && totalUnassignedInserts > 0) {
- // create a new bucket or re-use an existing bucket
int bucket;
- if (updateLocationToBucket.containsKey(smallFile.location.getFileId())) {
- bucket = updateLocationToBucket.get(smallFile.location.getFileId());
- LOG.info("Assigning " + recordsToAppend + " inserts to existing update bucket " + bucket);
- } else {
- bucket = addUpdateBucket(partitionPath, smallFile.location.getFileId());
- LOG.info("Assigning " + recordsToAppend + " inserts to new update bucket " + bucket);
+ if (config.isRouteInsertsToNewFiles()) {
+ // if insert operation, route inserts to new files regardless of small file handling.
Review comment:
I don't want to add config.isRouteInsertsToNewFiles() to all 3 if else conditions and hence, have added a bigger if else for older and new code path.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] SteNicholas commented on pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
SteNicholas commented on pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#issuecomment-708985867
> @SteNicholas Thanks for your contribution, left some comments.
Thanks for your comments. I have already followed up with your comments. Please feel free to review again.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] SteNicholas commented on pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
SteNicholas commented on pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#issuecomment-702550693
@linshan-ma You could use the current commit to check your test case again. IMO, the current commit has already resolved your problem.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] leesf commented on a change in pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
leesf commented on a change in pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#discussion_r501659751
##########
File path: hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/table/action/commit/UpsertPartitioner.java
##########
@@ -112,16 +115,17 @@ private void assignUpdates(WorkloadProfile profile) {
for (Map.Entry<String, WorkloadStat> partitionStat : partitionStatEntries) {
for (Map.Entry<String, Pair<String, Long>> updateLocEntry :
partitionStat.getValue().getUpdateLocationToCount().entrySet()) {
- addUpdateBucket(partitionStat.getKey(), updateLocEntry.getKey());
+ addUpdateBucket(partitionStat.getKey(), updateLocEntry.getKey(), profile.getOperationType());
}
}
}
- private int addUpdateBucket(String partitionPath, String fileIdHint) {
+ private int addUpdateBucket(String partitionPath, String fileIdHint, WriteOperationType operationType) {
int bucket = totalBuckets;
updateLocationToBucket.put(fileIdHint, bucket);
BucketInfo bucketInfo = new BucketInfo();
- bucketInfo.bucketType = BucketType.UPDATE;
+ bucketInfo.bucketType = operationType == null || isChangingRecords(operationType)
Review comment:
The method called `addUpdateBucket`, but the BucketType would be `INSERT`, it is not very suitable, would we move the logic outside of the method?
##########
File path: hudi-client/hudi-spark-client/src/test/java/org/apache/hudi/client/TestHoodieClientOnCopyOnWriteStorage.java
##########
@@ -743,47 +743,37 @@ public void testSmallInsertHandlingForUpserts() throws Exception {
*/
@Test
public void testSmallInsertHandlingForInserts() throws Exception {
-
final String testPartitionPath = "2016/09/26";
final int insertSplitLimit = 100;
// setup the small file handling params
HoodieWriteConfig config = getSmallInsertWriteConfig(insertSplitLimit); // hold upto 200 records max
dataGen = new HoodieTestDataGenerator(new String[] {testPartitionPath});
SparkRDDWriteClient client = getHoodieWriteClient(config, false);
- // Inserts => will write file1
String commitTime1 = "001";
client.startCommitWithTime(commitTime1);
List<HoodieRecord> inserts1 = dataGen.generateInserts(commitTime1, insertSplitLimit); // this writes ~500kb
Set<String> keys1 = recordsToRecordKeySet(inserts1);
JavaRDD<HoodieRecord> insertRecordsRDD1 = jsc.parallelize(inserts1, 1);
List<WriteStatus> statuses = client.insert(insertRecordsRDD1, commitTime1).collect();
-
assertNoWriteErrors(statuses);
- assertPartitionMetadata(new String[] {testPartitionPath}, fs);
-
+ assertPartitionMetadata(new String[]{testPartitionPath}, fs);
assertEquals(1, statuses.size(), "Just 1 file needs to be added.");
- String file1 = statuses.get(0).getFileId();
assertEquals(100,
readRowKeysFromParquet(hadoopConf, new Path(basePath, statuses.get(0).getStat().getPath()))
.size(), "file should contain 100 records");
- // Second, set of Inserts should just expand file1
String commitTime2 = "002";
client.startCommitWithTime(commitTime2);
List<HoodieRecord> inserts2 = dataGen.generateInserts(commitTime2, 40);
Set<String> keys2 = recordsToRecordKeySet(inserts2);
JavaRDD<HoodieRecord> insertRecordsRDD2 = jsc.parallelize(inserts2, 1);
statuses = client.insert(insertRecordsRDD2, commitTime2).collect();
assertNoWriteErrors(statuses);
-
- assertEquals(1, statuses.size(), "Just 1 file needs to be updated.");
- assertEquals(file1, statuses.get(0).getFileId(), "Existing file should be expanded");
- assertEquals(commitTime1, statuses.get(0).getStat().getPrevCommit(), "Existing file should be expanded");
Review comment:
must remove these asserts?
##########
File path: hudi-client/hudi-spark-client/src/test/java/org/apache/hudi/table/action/commit/TestUpsertPartitioner.java
##########
@@ -90,14 +88,33 @@ private UpsertPartitioner getUpsertPartitioner(int smallFileSize, int numInserts
List<HoodieRecord> records = new ArrayList<>();
records.addAll(insertRecords);
records.addAll(updateRecords);
- WorkloadProfile profile = new WorkloadProfile(buildProfile(jsc.parallelize(records)));
+ WorkloadProfile profile = new WorkloadProfile(buildProfile(jsc.parallelize(records)), WriteOperationType.UPSERT);
UpsertPartitioner partitioner = new UpsertPartitioner(profile, context, table, config);
assertEquals(0, partitioner.getPartition(
new Tuple2<>(updateRecords.get(0).getKey(), Option.ofNullable(updateRecords.get(0).getCurrentLocation()))),
"Update record should have gone to the 1 update partition");
return partitioner;
}
+ private UpsertPartitioner getInsertPartitioner(int smallFileSize, int numInserts, int fileSize, String testPartitionPath,
+ boolean autoSplitInserts) throws Exception {
+ HoodieWriteConfig config = makeHoodieClientConfigBuilder()
+ .withCompactionConfig(HoodieCompactionConfig.newBuilder().compactionSmallFileSize(smallFileSize)
+ .insertSplitSize(100).autoTuneInsertSplits(autoSplitInserts).build())
Review comment:
`100` should be passed via method parameter.
##########
File path: hudi-client/hudi-spark-client/src/test/java/org/apache/hudi/table/action/commit/TestUpsertPartitioner.java
##########
@@ -286,8 +303,48 @@ public void testUpsertPartitionerWithSmallInsertHandling() throws Exception {
"Bucket 3 is INSERT");
assertEquals(4, insertBuckets.size(), "Total of 4 insert buckets");
- weights = new Double[] { 0.08, 0.31, 0.31, 0.31};
- cumulativeWeights = new Double[] { 0.08, 0.39, 0.69, 1.0};
+ weights = new Double[] {0.08, 0.31, 0.31, 0.31};
+ cumulativeWeights = new Double[] {0.08, 0.39, 0.69, 1.0};
+ assertInsertBuckets(weights, cumulativeWeights, insertBuckets);
+ }
+
+ @Test
+ public void testInsertPartitionerWithSmallInsertHandling() throws Exception {
+ final String testPartitionPath = "2016/09/26";
+ // Inserts .. Check updates go together & inserts subsplit, after expanding smallest file
+ UpsertPartitioner partitioner = getInsertPartitioner(1000 * 1024, 400, 800 * 1024, testPartitionPath, false);
+ List<InsertBucketCumulativeWeightPair> insertBuckets = partitioner.getInsertBuckets(testPartitionPath);
+
+ assertEquals(3, partitioner.numPartitions(), "Should have 3 partitions");
Review comment:
it would be better if you would describe how to get `3` expected partitions.
##########
File path: hudi-client/hudi-spark-client/src/test/java/org/apache/hudi/table/action/commit/TestUpsertPartitioner.java
##########
@@ -286,8 +303,48 @@ public void testUpsertPartitionerWithSmallInsertHandling() throws Exception {
"Bucket 3 is INSERT");
assertEquals(4, insertBuckets.size(), "Total of 4 insert buckets");
- weights = new Double[] { 0.08, 0.31, 0.31, 0.31};
- cumulativeWeights = new Double[] { 0.08, 0.39, 0.69, 1.0};
+ weights = new Double[] {0.08, 0.31, 0.31, 0.31};
+ cumulativeWeights = new Double[] {0.08, 0.39, 0.69, 1.0};
+ assertInsertBuckets(weights, cumulativeWeights, insertBuckets);
+ }
+
+ @Test
+ public void testInsertPartitionerWithSmallInsertHandling() throws Exception {
+ final String testPartitionPath = "2016/09/26";
+ // Inserts .. Check updates go together & inserts subsplit, after expanding smallest file
+ UpsertPartitioner partitioner = getInsertPartitioner(1000 * 1024, 400, 800 * 1024, testPartitionPath, false);
+ List<InsertBucketCumulativeWeightPair> insertBuckets = partitioner.getInsertBuckets(testPartitionPath);
+
+ assertEquals(3, partitioner.numPartitions(), "Should have 3 partitions");
+ assertEquals(BucketType.INSERT, partitioner.getBucketInfo(0).bucketType,
+ "Bucket 0 is INSERT");
+ assertEquals(BucketType.INSERT, partitioner.getBucketInfo(1).bucketType,
+ "Bucket 1 is INSERT");
+ assertEquals(BucketType.INSERT, partitioner.getBucketInfo(2).bucketType,
+ "Bucket 2 is INSERT");
+ assertEquals(3, insertBuckets.size(), "Total of 3 insert buckets");
+
+ Double[] weights = {0.5, 0.25, 0.25};
+ Double[] cumulativeWeights = {0.5, 0.75, 1.0};
+ assertInsertBuckets(weights, cumulativeWeights, insertBuckets);
+
+ // Now with insert split size auto tuned
+ partitioner = getInsertPartitioner(1000 * 1024, 2400, 800 * 1024, testPartitionPath, true);
+ insertBuckets = partitioner.getInsertBuckets(testPartitionPath);
+
+ assertEquals(4, partitioner.numPartitions(), "Should have 4 partitions");
Review comment:
ditto
##########
File path: hudi-client/hudi-spark-client/src/test/java/org/apache/hudi/table/action/commit/TestUpsertPartitioner.java
##########
@@ -286,8 +303,48 @@ public void testUpsertPartitionerWithSmallInsertHandling() throws Exception {
"Bucket 3 is INSERT");
assertEquals(4, insertBuckets.size(), "Total of 4 insert buckets");
- weights = new Double[] { 0.08, 0.31, 0.31, 0.31};
- cumulativeWeights = new Double[] { 0.08, 0.39, 0.69, 1.0};
+ weights = new Double[] {0.08, 0.31, 0.31, 0.31};
+ cumulativeWeights = new Double[] {0.08, 0.39, 0.69, 1.0};
+ assertInsertBuckets(weights, cumulativeWeights, insertBuckets);
+ }
+
+ @Test
+ public void testInsertPartitionerWithSmallInsertHandling() throws Exception {
+ final String testPartitionPath = "2016/09/26";
+ // Inserts .. Check updates go together & inserts subsplit, after expanding smallest file
+ UpsertPartitioner partitioner = getInsertPartitioner(1000 * 1024, 400, 800 * 1024, testPartitionPath, false);
+ List<InsertBucketCumulativeWeightPair> insertBuckets = partitioner.getInsertBuckets(testPartitionPath);
+
+ assertEquals(3, partitioner.numPartitions(), "Should have 3 partitions");
+ assertEquals(BucketType.INSERT, partitioner.getBucketInfo(0).bucketType,
+ "Bucket 0 is INSERT");
+ assertEquals(BucketType.INSERT, partitioner.getBucketInfo(1).bucketType,
+ "Bucket 1 is INSERT");
+ assertEquals(BucketType.INSERT, partitioner.getBucketInfo(2).bucketType,
+ "Bucket 2 is INSERT");
Review comment:
would you please use `foreach` assertion instead of listing all buckets?
##########
File path: hudi-client/hudi-spark-client/src/test/java/org/apache/hudi/table/action/commit/TestUpsertPartitioner.java
##########
@@ -286,8 +303,48 @@ public void testUpsertPartitionerWithSmallInsertHandling() throws Exception {
"Bucket 3 is INSERT");
assertEquals(4, insertBuckets.size(), "Total of 4 insert buckets");
- weights = new Double[] { 0.08, 0.31, 0.31, 0.31};
- cumulativeWeights = new Double[] { 0.08, 0.39, 0.69, 1.0};
+ weights = new Double[] {0.08, 0.31, 0.31, 0.31};
+ cumulativeWeights = new Double[] {0.08, 0.39, 0.69, 1.0};
+ assertInsertBuckets(weights, cumulativeWeights, insertBuckets);
+ }
+
+ @Test
+ public void testInsertPartitionerWithSmallInsertHandling() throws Exception {
+ final String testPartitionPath = "2016/09/26";
+ // Inserts .. Check updates go together & inserts subsplit, after expanding smallest file
+ UpsertPartitioner partitioner = getInsertPartitioner(1000 * 1024, 400, 800 * 1024, testPartitionPath, false);
+ List<InsertBucketCumulativeWeightPair> insertBuckets = partitioner.getInsertBuckets(testPartitionPath);
+
+ assertEquals(3, partitioner.numPartitions(), "Should have 3 partitions");
+ assertEquals(BucketType.INSERT, partitioner.getBucketInfo(0).bucketType,
+ "Bucket 0 is INSERT");
+ assertEquals(BucketType.INSERT, partitioner.getBucketInfo(1).bucketType,
+ "Bucket 1 is INSERT");
+ assertEquals(BucketType.INSERT, partitioner.getBucketInfo(2).bucketType,
+ "Bucket 2 is INSERT");
+ assertEquals(3, insertBuckets.size(), "Total of 3 insert buckets");
+
+ Double[] weights = {0.5, 0.25, 0.25};
+ Double[] cumulativeWeights = {0.5, 0.75, 1.0};
+ assertInsertBuckets(weights, cumulativeWeights, insertBuckets);
+
+ // Now with insert split size auto tuned
+ partitioner = getInsertPartitioner(1000 * 1024, 2400, 800 * 1024, testPartitionPath, true);
+ insertBuckets = partitioner.getInsertBuckets(testPartitionPath);
+
+ assertEquals(4, partitioner.numPartitions(), "Should have 4 partitions");
+ assertEquals(BucketType.INSERT, partitioner.getBucketInfo(0).bucketType,
+ "Bucket 0 is INSERT");
+ assertEquals(BucketType.INSERT, partitioner.getBucketInfo(1).bucketType,
+ "Bucket 1 is INSERT");
+ assertEquals(BucketType.INSERT, partitioner.getBucketInfo(2).bucketType,
+ "Bucket 2 is INSERT");
+ assertEquals(BucketType.INSERT, partitioner.getBucketInfo(3).bucketType,
+ "Bucket 3 is INSERT");
Review comment:
ditto
##########
File path: hudi-integ-test/src/test/java/org/apache/hudi/integ/command/ITTestHoodieSyncCommand.java
##########
@@ -52,7 +52,7 @@ public void testValidateSync() throws Exception {
executeCommandStringInDocker(ADHOC_1_CONTAINER, HUDI_CLI_TOOL + " --cmdfile " + SYNC_VALIDATE_COMMANDS, true);
String expected = String.format("Count difference now is (count(%s) - count(%s) == %d. Catch up count is %d",
- hiveTableName, hiveTableName2, 100, 200);
+ hiveTableName, hiveTableName2, 100, 100);
Review comment:
would you please explain why change from `200` to `100` ?
##########
File path: hudi-spark/src/test/scala/org/apache/hudi/functional/TestMORDataSource.scala
##########
@@ -211,7 +211,7 @@ class TestMORDataSource extends HoodieClientTestBase {
val hudiSnapshotDF5 = spark.read.format("org.apache.hudi")
.option(DataSourceReadOptions.QUERY_TYPE_OPT_KEY, DataSourceReadOptions.QUERY_TYPE_SNAPSHOT_OPT_VAL)
.load(basePath + "/*/*/*/*")
- assertEquals(200, hudiSnapshotDF5.count())
+ assertEquals(300, hudiSnapshotDF5.count())
Review comment:
ditto
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] SteNicholas commented on a change in pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
SteNicholas commented on a change in pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#discussion_r501777975
##########
File path: hudi-integ-test/src/test/java/org/apache/hudi/integ/command/ITTestHoodieSyncCommand.java
##########
@@ -52,7 +52,7 @@ public void testValidateSync() throws Exception {
executeCommandStringInDocker(ADHOC_1_CONTAINER, HUDI_CLI_TOOL + " --cmdfile " + SYNC_VALIDATE_COMMANDS, true);
String expected = String.format("Count difference now is (count(%s) - count(%s) == %d. Catch up count is %d",
- hiveTableName, hiveTableName2, 100, 200);
+ hiveTableName, hiveTableName2, 100, 100);
Review comment:
@leesf I don't think this should explain why change from 200 to 100, because this test case could use the insert operation based on inserting new records regardless of small file.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] SteNicholas removed a comment on pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
SteNicholas removed a comment on pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#issuecomment-704795298
@bvaradar @vinothchandar Could you please help to review this pull request?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] vinothchandar commented on pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
vinothchandar commented on pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#issuecomment-713333465
>If user doesn't essentially care about duplicates, I agree that we need to have same behavior w/o small file handling.
I don't follow this actually. I understand that this fixes the issue that an insert be treated as an update, if the user generates the same key. (but I think of it more as a misuse of key i.e its the user's responsibility to generate unique keys and this wont happen). Nonetheless, this might be a valid mode to have for users who can't bother to create unique keys. but like said above, it would be nice to retain small file handling, while just allowing duplicates through a separate IOHandle/flag?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] nsivabalan commented on pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
nsivabalan commented on pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#issuecomment-756127108
@vinothchandar : have fixed tests as well. you are good to review.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] linshan-ma commented on pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
linshan-ma commented on pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#issuecomment-700597336
> > According to this([https://github.com/apache/hudi/issues/2051)](https://github.com/apache/hudi/issues/2051%EF%BC%89) test。I can't get the results I want。When we set different value(hoodie.parquet.small.file.limit), the results are still different
>
> @linshan-ma Could you please provide this test again? I couldn't visit the test you mentioned.
@SteNicholas hi,this issue.https://github.com/apache/hudi/issues/2051
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] linshan-ma commented on pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
linshan-ma commented on pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#issuecomment-699986102
According to this(https://github.com/apache/hudi/issues/2051) test。I can't get the results I want。When we set different value(hoodie.parquet.small.file.limit), the results are still different
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] nsivabalan commented on a change in pull request #2111: [HUDI-1234] Insert new records to data files without merging for "Insert" operation.
Posted by GitBox <gi...@apache.org>.
nsivabalan commented on a change in pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#discussion_r560681506
##########
File path: hudi-client/hudi-client-common/src/main/java/org/apache/hudi/config/HoodieWriteConfig.java
##########
@@ -133,6 +133,10 @@
private static final String MERGE_DATA_VALIDATION_CHECK_ENABLED = "hoodie.merge.data.validation.enabled";
private static final String DEFAULT_MERGE_DATA_VALIDATION_CHECK_ENABLED = "false";
+ // Concats inserts to data files without merging
+ private static final String MERGE_ALLOW_DUPLICATE_INSERTS = "hoodie.merge.allow.duplicate.inserts";
+ private static final String DEFAULT_MERGE_ALLOW_DUPLICATE_INSERTS = "false";
Review comment:
just following the convention we have been using in hoodie so far.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] SteNicholas commented on a change in pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
SteNicholas commented on a change in pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#discussion_r505682259
##########
File path: hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/table/action/commit/UpsertPartitioner.java
##########
@@ -160,11 +174,15 @@ private void assignInserts(WorkloadProfile profile, HoodieEngineContext context)
if (recordsToAppend > 0 && totalUnassignedInserts > 0) {
// create a new bucket or re-use an existing bucket
int bucket;
- if (updateLocationToBucket.containsKey(smallFile.location.getFileId())) {
+ // insert new records regardless of small file when using insert operation
+ if (isChangingRecords(profile.getOperationType())
+ && updateLocationToBucket.containsKey(smallFile.location.getFileId())) {
bucket = updateLocationToBucket.get(smallFile.location.getFileId());
LOG.info("Assigning " + recordsToAppend + " inserts to existing update bucket " + bucket);
} else {
- bucket = addUpdateBucket(partitionPath, smallFile.location.getFileId());
+ bucket = profile.getOperationType() == null || isChangingRecords(profile.getOperationType())
+ ? addUpdateBucket(partitionPath, smallFile.location.getFileId())
+ : addInsertBucket(partitionPath, smallFile.location.getFileId());
Review comment:
@bvaradar WDYT? I thought using existing small file id would be 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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] SteNicholas commented on pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
SteNicholas commented on pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#issuecomment-698658606
@leesf @bvaradar Could you please review this pull request?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] leesf commented on a change in pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
leesf commented on a change in pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#discussion_r494930532
##########
File path: hudi-client/src/main/java/org/apache/hudi/table/WorkloadProfile.java
##########
@@ -54,13 +55,23 @@
*/
private final WorkloadStat globalStat;
+ /**
+ * Write operation type.
+ */
+ private WriteOperationType operationType;
Review comment:
WriteOperationType should be Serializable?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] nsivabalan commented on pull request #2111: [HUDI-1234] Insert new records to data files without merging for "Insert" operation.
Posted by GitBox <gi...@apache.org>.
nsivabalan commented on pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#issuecomment-763713469
Fixed the config name. Once CI succeeds, will land this PR.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] SteNicholas commented on a change in pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
SteNicholas commented on a change in pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#discussion_r501739942
##########
File path: hudi-client/hudi-spark-client/src/test/java/org/apache/hudi/table/action/commit/TestUpsertPartitioner.java
##########
@@ -286,8 +303,48 @@ public void testUpsertPartitionerWithSmallInsertHandling() throws Exception {
"Bucket 3 is INSERT");
assertEquals(4, insertBuckets.size(), "Total of 4 insert buckets");
- weights = new Double[] { 0.08, 0.31, 0.31, 0.31};
- cumulativeWeights = new Double[] { 0.08, 0.39, 0.69, 1.0};
+ weights = new Double[] {0.08, 0.31, 0.31, 0.31};
+ cumulativeWeights = new Double[] {0.08, 0.39, 0.69, 1.0};
+ assertInsertBuckets(weights, cumulativeWeights, insertBuckets);
+ }
+
+ @Test
+ public void testInsertPartitionerWithSmallInsertHandling() throws Exception {
+ final String testPartitionPath = "2016/09/26";
+ // Inserts .. Check updates go together & inserts subsplit, after expanding smallest file
+ UpsertPartitioner partitioner = getInsertPartitioner(1000 * 1024, 400, 800 * 1024, testPartitionPath, false);
+ List<InsertBucketCumulativeWeightPair> insertBuckets = partitioner.getInsertBuckets(testPartitionPath);
+
+ assertEquals(3, partitioner.numPartitions(), "Should have 3 partitions");
Review comment:
@leesf I didn't get the point you mentioned. Do you mean that this should add comments to describe how to get 3 expected partitions?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] vinothchandar commented on pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
vinothchandar commented on pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#issuecomment-754141140
@nsivabalan this is also a good candidate for 0.7.0
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] SteNicholas commented on a change in pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
SteNicholas commented on a change in pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#discussion_r501739942
##########
File path: hudi-client/hudi-spark-client/src/test/java/org/apache/hudi/table/action/commit/TestUpsertPartitioner.java
##########
@@ -286,8 +303,48 @@ public void testUpsertPartitionerWithSmallInsertHandling() throws Exception {
"Bucket 3 is INSERT");
assertEquals(4, insertBuckets.size(), "Total of 4 insert buckets");
- weights = new Double[] { 0.08, 0.31, 0.31, 0.31};
- cumulativeWeights = new Double[] { 0.08, 0.39, 0.69, 1.0};
+ weights = new Double[] {0.08, 0.31, 0.31, 0.31};
+ cumulativeWeights = new Double[] {0.08, 0.39, 0.69, 1.0};
+ assertInsertBuckets(weights, cumulativeWeights, insertBuckets);
+ }
+
+ @Test
+ public void testInsertPartitionerWithSmallInsertHandling() throws Exception {
+ final String testPartitionPath = "2016/09/26";
+ // Inserts .. Check updates go together & inserts subsplit, after expanding smallest file
+ UpsertPartitioner partitioner = getInsertPartitioner(1000 * 1024, 400, 800 * 1024, testPartitionPath, false);
+ List<InsertBucketCumulativeWeightPair> insertBuckets = partitioner.getInsertBuckets(testPartitionPath);
+
+ assertEquals(3, partitioner.numPartitions(), "Should have 3 partitions");
Review comment:
@leesf I didn't get the point you mentioned. Do you mean that this should add comments to describe how to get 3 expected partitions?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] SteNicholas commented on a change in pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
SteNicholas commented on a change in pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#discussion_r501726744
##########
File path: hudi-client/hudi-spark-client/src/test/java/org/apache/hudi/table/action/commit/TestUpsertPartitioner.java
##########
@@ -286,8 +303,48 @@ public void testUpsertPartitionerWithSmallInsertHandling() throws Exception {
"Bucket 3 is INSERT");
assertEquals(4, insertBuckets.size(), "Total of 4 insert buckets");
- weights = new Double[] { 0.08, 0.31, 0.31, 0.31};
- cumulativeWeights = new Double[] { 0.08, 0.39, 0.69, 1.0};
+ weights = new Double[] {0.08, 0.31, 0.31, 0.31};
+ cumulativeWeights = new Double[] {0.08, 0.39, 0.69, 1.0};
+ assertInsertBuckets(weights, cumulativeWeights, insertBuckets);
+ }
+
+ @Test
+ public void testInsertPartitionerWithSmallInsertHandling() throws Exception {
+ final String testPartitionPath = "2016/09/26";
+ // Inserts .. Check updates go together & inserts subsplit, after expanding smallest file
+ UpsertPartitioner partitioner = getInsertPartitioner(1000 * 1024, 400, 800 * 1024, testPartitionPath, false);
+ List<InsertBucketCumulativeWeightPair> insertBuckets = partitioner.getInsertBuckets(testPartitionPath);
+
+ assertEquals(3, partitioner.numPartitions(), "Should have 3 partitions");
+ assertEquals(BucketType.INSERT, partitioner.getBucketInfo(0).bucketType,
+ "Bucket 0 is INSERT");
+ assertEquals(BucketType.INSERT, partitioner.getBucketInfo(1).bucketType,
+ "Bucket 1 is INSERT");
+ assertEquals(BucketType.INSERT, partitioner.getBucketInfo(2).bucketType,
+ "Bucket 2 is INSERT");
Review comment:
@leesf Yes, I would like to use `foreach` assertion instead.
##########
File path: hudi-client/hudi-spark-client/src/test/java/org/apache/hudi/client/TestHoodieClientOnCopyOnWriteStorage.java
##########
@@ -743,47 +743,37 @@ public void testSmallInsertHandlingForUpserts() throws Exception {
*/
@Test
public void testSmallInsertHandlingForInserts() throws Exception {
-
final String testPartitionPath = "2016/09/26";
final int insertSplitLimit = 100;
// setup the small file handling params
HoodieWriteConfig config = getSmallInsertWriteConfig(insertSplitLimit); // hold upto 200 records max
dataGen = new HoodieTestDataGenerator(new String[] {testPartitionPath});
SparkRDDWriteClient client = getHoodieWriteClient(config, false);
- // Inserts => will write file1
String commitTime1 = "001";
client.startCommitWithTime(commitTime1);
List<HoodieRecord> inserts1 = dataGen.generateInserts(commitTime1, insertSplitLimit); // this writes ~500kb
Set<String> keys1 = recordsToRecordKeySet(inserts1);
JavaRDD<HoodieRecord> insertRecordsRDD1 = jsc.parallelize(inserts1, 1);
List<WriteStatus> statuses = client.insert(insertRecordsRDD1, commitTime1).collect();
-
assertNoWriteErrors(statuses);
- assertPartitionMetadata(new String[] {testPartitionPath}, fs);
-
+ assertPartitionMetadata(new String[]{testPartitionPath}, fs);
assertEquals(1, statuses.size(), "Just 1 file needs to be added.");
- String file1 = statuses.get(0).getFileId();
assertEquals(100,
readRowKeysFromParquet(hadoopConf, new Path(basePath, statuses.get(0).getStat().getPath()))
.size(), "file should contain 100 records");
- // Second, set of Inserts should just expand file1
String commitTime2 = "002";
client.startCommitWithTime(commitTime2);
List<HoodieRecord> inserts2 = dataGen.generateInserts(commitTime2, 40);
Set<String> keys2 = recordsToRecordKeySet(inserts2);
JavaRDD<HoodieRecord> insertRecordsRDD2 = jsc.parallelize(inserts2, 1);
statuses = client.insert(insertRecordsRDD2, commitTime2).collect();
assertNoWriteErrors(statuses);
-
- assertEquals(1, statuses.size(), "Just 1 file needs to be updated.");
- assertEquals(file1, statuses.get(0).getFileId(), "Existing file should be expanded");
- assertEquals(commitTime1, statuses.get(0).getStat().getPrevCommit(), "Existing file should be expanded");
Review comment:
@leesf These asserts makes no sense, because statuses.get(0).getFileId() could be file1+"-0" and statuses.get(0).getStat().getPrevCommit() could be null.
##########
File path: hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/table/action/commit/UpsertPartitioner.java
##########
@@ -112,16 +115,17 @@ private void assignUpdates(WorkloadProfile profile) {
for (Map.Entry<String, WorkloadStat> partitionStat : partitionStatEntries) {
for (Map.Entry<String, Pair<String, Long>> updateLocEntry :
partitionStat.getValue().getUpdateLocationToCount().entrySet()) {
- addUpdateBucket(partitionStat.getKey(), updateLocEntry.getKey());
+ addUpdateBucket(partitionStat.getKey(), updateLocEntry.getKey(), profile.getOperationType());
}
}
}
- private int addUpdateBucket(String partitionPath, String fileIdHint) {
+ private int addUpdateBucket(String partitionPath, String fileIdHint, WriteOperationType operationType) {
int bucket = totalBuckets;
updateLocationToBucket.put(fileIdHint, bucket);
BucketInfo bucketInfo = new BucketInfo();
- bucketInfo.bucketType = BucketType.UPDATE;
+ bucketInfo.bucketType = operationType == null || isChangingRecords(operationType)
Review comment:
@leesf OK, I would move the logic outside of method `addUpdateBucket`.
##########
File path: hudi-client/hudi-spark-client/src/test/java/org/apache/hudi/table/action/commit/TestUpsertPartitioner.java
##########
@@ -90,14 +88,33 @@ private UpsertPartitioner getUpsertPartitioner(int smallFileSize, int numInserts
List<HoodieRecord> records = new ArrayList<>();
records.addAll(insertRecords);
records.addAll(updateRecords);
- WorkloadProfile profile = new WorkloadProfile(buildProfile(jsc.parallelize(records)));
+ WorkloadProfile profile = new WorkloadProfile(buildProfile(jsc.parallelize(records)), WriteOperationType.UPSERT);
UpsertPartitioner partitioner = new UpsertPartitioner(profile, context, table, config);
assertEquals(0, partitioner.getPartition(
new Tuple2<>(updateRecords.get(0).getKey(), Option.ofNullable(updateRecords.get(0).getCurrentLocation()))),
"Update record should have gone to the 1 update partition");
return partitioner;
}
+ private UpsertPartitioner getInsertPartitioner(int smallFileSize, int numInserts, int fileSize, String testPartitionPath,
+ boolean autoSplitInserts) throws Exception {
+ HoodieWriteConfig config = makeHoodieClientConfigBuilder()
+ .withCompactionConfig(HoodieCompactionConfig.newBuilder().compactionSmallFileSize(smallFileSize)
+ .insertSplitSize(100).autoTuneInsertSplits(autoSplitInserts).build())
Review comment:
@leesf I don't think `100` should be passed via method parameter. You could refer to the method `getUpsertPartitioner`.
##########
File path: hudi-client/hudi-spark-client/src/test/java/org/apache/hudi/table/action/commit/TestUpsertPartitioner.java
##########
@@ -286,8 +303,48 @@ public void testUpsertPartitionerWithSmallInsertHandling() throws Exception {
"Bucket 3 is INSERT");
assertEquals(4, insertBuckets.size(), "Total of 4 insert buckets");
- weights = new Double[] { 0.08, 0.31, 0.31, 0.31};
- cumulativeWeights = new Double[] { 0.08, 0.39, 0.69, 1.0};
+ weights = new Double[] {0.08, 0.31, 0.31, 0.31};
+ cumulativeWeights = new Double[] {0.08, 0.39, 0.69, 1.0};
+ assertInsertBuckets(weights, cumulativeWeights, insertBuckets);
+ }
+
+ @Test
+ public void testInsertPartitionerWithSmallInsertHandling() throws Exception {
+ final String testPartitionPath = "2016/09/26";
+ // Inserts .. Check updates go together & inserts subsplit, after expanding smallest file
+ UpsertPartitioner partitioner = getInsertPartitioner(1000 * 1024, 400, 800 * 1024, testPartitionPath, false);
+ List<InsertBucketCumulativeWeightPair> insertBuckets = partitioner.getInsertBuckets(testPartitionPath);
+
+ assertEquals(3, partitioner.numPartitions(), "Should have 3 partitions");
Review comment:
@leesf I didn't get the point you mentioned. Do you mean that this should add comments to describe how to get 3 expected partitions?
##########
File path: hudi-integ-test/src/test/java/org/apache/hudi/integ/command/ITTestHoodieSyncCommand.java
##########
@@ -52,7 +52,7 @@ public void testValidateSync() throws Exception {
executeCommandStringInDocker(ADHOC_1_CONTAINER, HUDI_CLI_TOOL + " --cmdfile " + SYNC_VALIDATE_COMMANDS, true);
String expected = String.format("Count difference now is (count(%s) - count(%s) == %d. Catch up count is %d",
- hiveTableName, hiveTableName2, 100, 200);
+ hiveTableName, hiveTableName2, 100, 100);
Review comment:
@leesf I don't think this should explain why change from 200 to 100, because this test case could use the insert operation based on inserting new records regardless of small file.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] SteNicholas commented on pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
SteNicholas commented on pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#issuecomment-756519212
@vinothchandar I didn't think the changes of @nsivabalan add different IOHandle to `HoodieMergeHandle`. We should add `HoodieInsertHandle` inherited from `HoodieIOHandle` to cover this case.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] SteNicholas commented on pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
SteNicholas commented on pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#issuecomment-713335563
> > If user doesn't essentially care about duplicates, I agree that we need to have same behavior w/o small file handling.
>
> I don't follow this actually. I understand that this fixes the issue that an insert be treated as an update, if the user generates the same key. (but I think of it more as a misuse of key i.e its the user's responsibility to generate unique keys and this wont happen). Nonetheless, this might be a valid mode to have for users who can't bother to create unique keys. but like said above, it would be nice to retain small file handling, while just allowing duplicates through a separate IOHandle/flag?
@vinothchandar I agree with the point that allowing duplicates through a separate IOHandle/flag. I would like to invoke a different IOHandle to HoodieMergeHandle to allow duplicates.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] SteNicholas commented on pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
SteNicholas commented on pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#issuecomment-700524082
> According to this([https://github.com/apache/hudi/issues/2051)](https://github.com/apache/hudi/issues/2051%EF%BC%89) test。I can't get the results I want。When we set different value(hoodie.parquet.small.file.limit), the results are still different
Could you please provide this test again? I couldn't visit the test you mentioned.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] SteNicholas edited a comment on pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
SteNicholas edited a comment on pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#issuecomment-712566489
> @SteNicholas @leesf : Does this essentially mean we no longer support small file handling for "inserts" ?
> If user doesn't essentially care about duplicates, I agree that we need to have same behavior w/o small file handling. Instead of this approach, can we create a new type of Write Handle which looks like MergeHandle but does not merge but rather appends records and creates a new version of Parquet file. You can then use this Handle instead of UpdateHandle when pure insert operation type is used.
>
> cc @vinothchandar
Yes, user doesn't essentially care about duplicates for small files and the same behavior w/o small file handling makes sense.
@vinothchandar What do you think about?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] leesf commented on a change in pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
leesf commented on a change in pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#discussion_r494930532
##########
File path: hudi-client/src/main/java/org/apache/hudi/table/WorkloadProfile.java
##########
@@ -54,13 +55,23 @@
*/
private final WorkloadStat globalStat;
+ /**
+ * Write operation type.
+ */
+ private WriteOperationType operationType;
Review comment:
WriteOperationType should be Serializable?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] SteNicholas commented on a change in pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
SteNicholas commented on a change in pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#discussion_r501728945
##########
File path: hudi-client/hudi-spark-client/src/test/java/org/apache/hudi/client/TestHoodieClientOnCopyOnWriteStorage.java
##########
@@ -743,47 +743,37 @@ public void testSmallInsertHandlingForUpserts() throws Exception {
*/
@Test
public void testSmallInsertHandlingForInserts() throws Exception {
-
final String testPartitionPath = "2016/09/26";
final int insertSplitLimit = 100;
// setup the small file handling params
HoodieWriteConfig config = getSmallInsertWriteConfig(insertSplitLimit); // hold upto 200 records max
dataGen = new HoodieTestDataGenerator(new String[] {testPartitionPath});
SparkRDDWriteClient client = getHoodieWriteClient(config, false);
- // Inserts => will write file1
String commitTime1 = "001";
client.startCommitWithTime(commitTime1);
List<HoodieRecord> inserts1 = dataGen.generateInserts(commitTime1, insertSplitLimit); // this writes ~500kb
Set<String> keys1 = recordsToRecordKeySet(inserts1);
JavaRDD<HoodieRecord> insertRecordsRDD1 = jsc.parallelize(inserts1, 1);
List<WriteStatus> statuses = client.insert(insertRecordsRDD1, commitTime1).collect();
-
assertNoWriteErrors(statuses);
- assertPartitionMetadata(new String[] {testPartitionPath}, fs);
-
+ assertPartitionMetadata(new String[]{testPartitionPath}, fs);
assertEquals(1, statuses.size(), "Just 1 file needs to be added.");
- String file1 = statuses.get(0).getFileId();
assertEquals(100,
readRowKeysFromParquet(hadoopConf, new Path(basePath, statuses.get(0).getStat().getPath()))
.size(), "file should contain 100 records");
- // Second, set of Inserts should just expand file1
String commitTime2 = "002";
client.startCommitWithTime(commitTime2);
List<HoodieRecord> inserts2 = dataGen.generateInserts(commitTime2, 40);
Set<String> keys2 = recordsToRecordKeySet(inserts2);
JavaRDD<HoodieRecord> insertRecordsRDD2 = jsc.parallelize(inserts2, 1);
statuses = client.insert(insertRecordsRDD2, commitTime2).collect();
assertNoWriteErrors(statuses);
-
- assertEquals(1, statuses.size(), "Just 1 file needs to be updated.");
- assertEquals(file1, statuses.get(0).getFileId(), "Existing file should be expanded");
- assertEquals(commitTime1, statuses.get(0).getStat().getPrevCommit(), "Existing file should be expanded");
Review comment:
@leesf These asserts makes no sense, because statuses.get(0).getFileId() could be file1+"-0" and statuses.get(0).getStat().getPrevCommit() could be null.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] codecov-io commented on pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
codecov-io commented on pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#issuecomment-708984716
# [Codecov](https://codecov.io/gh/apache/hudi/pull/2111?src=pr&el=h1) Report
> Merging [#2111](https://codecov.io/gh/apache/hudi/pull/2111?src=pr&el=desc) into [master](https://codecov.io/gh/apache/hudi/commit/1f7add92916c37b05be270d9c75a9042134ec506?el=desc) will **increase** coverage by `1.14%`.
> The diff coverage is `100.00%`.
[](https://codecov.io/gh/apache/hudi/pull/2111?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #2111 +/- ##
============================================
+ Coverage 52.47% 53.62% +1.14%
- Complexity 2748 2848 +100
============================================
Files 352 359 +7
Lines 16129 16553 +424
Branches 1752 1780 +28
============================================
+ Hits 8464 8876 +412
+ Misses 6937 6918 -19
- Partials 728 759 +31
```
| Flag | Coverage Δ | Complexity Δ | |
|---|---|---|---|
| #hudicli | `38.37% <ø> (ø)` | `193.00 <ø> (ø)` | |
| #hudiclient | `100.00% <ø> (ø)` | `0.00 <ø> (ø)` | |
| #hudicommon | `54.73% <100.00%> (-0.01%)` | `1795.00 <1.00> (+2.00)` | :arrow_down: |
| #hudihadoopmr | `33.05% <ø> (ø)` | `181.00 <ø> (ø)` | |
| #hudispark | `65.42% <ø> (-1.76%)` | `304.00 <ø> (-7.00)` | |
| #huditimelineservice | `62.29% <ø> (?)` | `50.00 <ø> (?)` | |
| #hudiutilities | `70.07% <ø> (+10.51%)` | `325.00 <ø> (+55.00)` | |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Impacted Files](https://codecov.io/gh/apache/hudi/pull/2111?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
|---|---|---|---|
| [...g/apache/hudi/common/model/WriteOperationType.java](https://codecov.io/gh/apache/hudi/pull/2111/diff?src=pr&el=tree#diff-aHVkaS1jb21tb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2h1ZGkvY29tbW9uL21vZGVsL1dyaXRlT3BlcmF0aW9uVHlwZS5qYXZh) | `53.84% <100.00%> (ø)` | `2.00 <1.00> (ø)` | |
| [...n/java/org/apache/hudi/internal/DefaultSource.java](https://codecov.io/gh/apache/hudi/pull/2111/diff?src=pr&el=tree#diff-aHVkaS1zcGFyay9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvaHVkaS9pbnRlcm5hbC9EZWZhdWx0U291cmNlLmphdmE=) | `0.00% <0.00%> (-80.00%)` | `0.00% <0.00%> (-6.00%)` | |
| [...pache/hudi/internal/HoodieWriterCommitMessage.java](https://codecov.io/gh/apache/hudi/pull/2111/diff?src=pr&el=tree#diff-aHVkaS1zcGFyay9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvaHVkaS9pbnRlcm5hbC9Ib29kaWVXcml0ZXJDb21taXRNZXNzYWdlLmphdmE=) | `83.33% <0.00%> (-16.67%)` | `2.00% <0.00%> (-1.00%)` | |
| [.../hudi/internal/HoodieDataSourceInternalWriter.java](https://codecov.io/gh/apache/hudi/pull/2111/diff?src=pr&el=tree#diff-aHVkaS1zcGFyay9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvaHVkaS9pbnRlcm5hbC9Ib29kaWVEYXRhU291cmNlSW50ZXJuYWxXcml0ZXIuamF2YQ==) | `78.12% <0.00%> (-9.38%)` | `6.00% <0.00%> (-2.00%)` | |
| [...n/scala/org/apache/hudi/HoodieSparkSqlWriter.scala](https://codecov.io/gh/apache/hudi/pull/2111/diff?src=pr&el=tree#diff-aHVkaS1zcGFyay9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2h1ZGkvSG9vZGllU3BhcmtTcWxXcml0ZXIuc2NhbGE=) | `50.95% <0.00%> (-5.26%)` | `0.00% <0.00%> (ø%)` | |
| [.../main/java/org/apache/hudi/common/util/Option.java](https://codecov.io/gh/apache/hudi/pull/2111/diff?src=pr&el=tree#diff-aHVkaS1jb21tb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2h1ZGkvY29tbW9uL3V0aWwvT3B0aW9uLmphdmE=) | `66.66% <0.00%> (-3.61%)` | `23.00% <0.00%> (+1.00%)` | :arrow_down: |
| [...in/scala/org/apache/hudi/IncrementalRelation.scala](https://codecov.io/gh/apache/hudi/pull/2111/diff?src=pr&el=tree#diff-aHVkaS1zcGFyay9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2h1ZGkvSW5jcmVtZW50YWxSZWxhdGlvbi5zY2FsYQ==) | `76.19% <0.00%> (-2.30%)` | `20.00% <0.00%> (+1.00%)` | :arrow_down: |
| [...udi/utilities/sources/helpers/DFSPathSelector.java](https://codecov.io/gh/apache/hudi/pull/2111/diff?src=pr&el=tree#diff-aHVkaS11dGlsaXRpZXMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2h1ZGkvdXRpbGl0aWVzL3NvdXJjZXMvaGVscGVycy9ERlNQYXRoU2VsZWN0b3IuamF2YQ==) | `82.05% <0.00%> (-2.16%)` | `12.00% <0.00%> (ø%)` | |
| [...mmon/table/log/AbstractHoodieLogRecordScanner.java](https://codecov.io/gh/apache/hudi/pull/2111/diff?src=pr&el=tree#diff-aHVkaS1jb21tb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2h1ZGkvY29tbW9uL3RhYmxlL2xvZy9BYnN0cmFjdEhvb2RpZUxvZ1JlY29yZFNjYW5uZXIuamF2YQ==) | `79.68% <0.00%> (-1.92%)` | `29.00% <0.00%> (ø%)` | |
| [...src/main/java/org/apache/hudi/DataSourceUtils.java](https://codecov.io/gh/apache/hudi/pull/2111/diff?src=pr&el=tree#diff-aHVkaS1zcGFyay9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvaHVkaS9EYXRhU291cmNlVXRpbHMuamF2YQ==) | `44.76% <0.00%> (-0.60%)` | `22.00% <0.00%> (+1.00%)` | :arrow_down: |
| ... and [27 more](https://codecov.io/gh/apache/hudi/pull/2111/diff?src=pr&el=tree-more) | |
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] nsivabalan commented on pull request #2111: [HUDI-1234] Insert new records to data files without merging for "Insert" operation.
Posted by GitBox <gi...@apache.org>.
nsivabalan commented on pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#issuecomment-767566159
yeah, for some reason integration test was failing in CI and we had some flakiness or long queuing time w/ travis. So, I put this in my backlog and missed to get it in. Will check it out in a day or two.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] vinothchandar commented on pull request #2111: [HUDI-1234] Insert new records to data files without merging for "Insert" operation.
Posted by GitBox <gi...@apache.org>.
vinothchandar commented on pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#issuecomment-767103157
@nsivabalan I thought we were going to get this in to 0.7.0? checked back again, to see why this was missing
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] nsivabalan commented on a change in pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
nsivabalan commented on a change in pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#discussion_r553104712
##########
File path: hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/table/action/commit/UpsertPartitioner.java
##########
@@ -191,14 +201,29 @@ private void assignInserts(WorkloadProfile profile, HoodieEngineContext context)
long recordsToAppend = Math.min((config.getParquetMaxFileSize() - smallFile.sizeBytes) / averageRecordSize,
totalUnassignedInserts);
if (recordsToAppend > 0 && totalUnassignedInserts > 0) {
- // create a new bucket or re-use an existing bucket
int bucket;
- if (updateLocationToBucket.containsKey(smallFile.location.getFileId())) {
- bucket = updateLocationToBucket.get(smallFile.location.getFileId());
- LOG.info("Assigning " + recordsToAppend + " inserts to existing update bucket " + bucket);
- } else {
- bucket = addUpdateBucket(partitionPath, smallFile.location.getFileId());
- LOG.info("Assigning " + recordsToAppend + " inserts to new update bucket " + bucket);
+ if (config.isRouteInsertsToNewFiles()) {
+ // if insert operation, route inserts to new files regardless of small file handling.
Review comment:
I don't want to add config.isRouteInsertsToNewFiles() to 3 if else conditions and hence, have added a bigger if else for older and new code path.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] leesf commented on pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
leesf commented on pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#issuecomment-698882595
@SteNicholas would you please also add some tests to the new changes?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] leesf commented on a change in pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
leesf commented on a change in pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#discussion_r501661275
##########
File path: hudi-client/hudi-spark-client/src/test/java/org/apache/hudi/client/TestHoodieClientOnCopyOnWriteStorage.java
##########
@@ -743,47 +743,37 @@ public void testSmallInsertHandlingForUpserts() throws Exception {
*/
@Test
public void testSmallInsertHandlingForInserts() throws Exception {
-
final String testPartitionPath = "2016/09/26";
final int insertSplitLimit = 100;
// setup the small file handling params
HoodieWriteConfig config = getSmallInsertWriteConfig(insertSplitLimit); // hold upto 200 records max
dataGen = new HoodieTestDataGenerator(new String[] {testPartitionPath});
SparkRDDWriteClient client = getHoodieWriteClient(config, false);
- // Inserts => will write file1
String commitTime1 = "001";
client.startCommitWithTime(commitTime1);
List<HoodieRecord> inserts1 = dataGen.generateInserts(commitTime1, insertSplitLimit); // this writes ~500kb
Set<String> keys1 = recordsToRecordKeySet(inserts1);
JavaRDD<HoodieRecord> insertRecordsRDD1 = jsc.parallelize(inserts1, 1);
List<WriteStatus> statuses = client.insert(insertRecordsRDD1, commitTime1).collect();
-
assertNoWriteErrors(statuses);
- assertPartitionMetadata(new String[] {testPartitionPath}, fs);
-
+ assertPartitionMetadata(new String[]{testPartitionPath}, fs);
assertEquals(1, statuses.size(), "Just 1 file needs to be added.");
- String file1 = statuses.get(0).getFileId();
assertEquals(100,
readRowKeysFromParquet(hadoopConf, new Path(basePath, statuses.get(0).getStat().getPath()))
.size(), "file should contain 100 records");
- // Second, set of Inserts should just expand file1
String commitTime2 = "002";
client.startCommitWithTime(commitTime2);
List<HoodieRecord> inserts2 = dataGen.generateInserts(commitTime2, 40);
Set<String> keys2 = recordsToRecordKeySet(inserts2);
JavaRDD<HoodieRecord> insertRecordsRDD2 = jsc.parallelize(inserts2, 1);
statuses = client.insert(insertRecordsRDD2, commitTime2).collect();
assertNoWriteErrors(statuses);
-
- assertEquals(1, statuses.size(), "Just 1 file needs to be updated.");
- assertEquals(file1, statuses.get(0).getFileId(), "Existing file should be expanded");
- assertEquals(commitTime1, statuses.get(0).getStat().getPrevCommit(), "Existing file should be expanded");
Review comment:
must remove these asserts?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] vinothchandar edited a comment on pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
vinothchandar edited a comment on pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#issuecomment-713333465
>If user doesn't essentially care about duplicates, I agree that we need to have same behavior w/o small file handling.
I don't follow this actually. I understand that this fixes the issue that an insert be treated as an update, if the user generates the same key. (but I think of it more as a misuse of key i.e its the user's responsibility to generate unique keys and this wont happen). Nonetheless, this might be a valid mode to have for users who can't bother to create unique keys. but like said above, it would be nice to retain small file handling, while just allowing duplicates through a separate IOHandle/flag?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] nsivabalan commented on a change in pull request #2111: [HUDI-1234] Insert new records to data files without merging for "Insert" operation.
Posted by GitBox <gi...@apache.org>.
nsivabalan commented on a change in pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#discussion_r560681016
##########
File path: hudi-client/hudi-client-common/src/main/java/org/apache/hudi/config/HoodieWriteConfig.java
##########
@@ -133,6 +133,10 @@
private static final String MERGE_DATA_VALIDATION_CHECK_ENABLED = "hoodie.merge.data.validation.enabled";
private static final String DEFAULT_MERGE_DATA_VALIDATION_CHECK_ENABLED = "false";
+ // Concats inserts to data files without merging
+ private static final String MERGE_ALLOW_DUPLICATE_INSERTS = "hoodie.merge.allow.duplicate.inserts";
Review comment:
@vinothchandar : does the config name looks ok? somehow I feel it does not exactly convey the actual intent, but talks about the effect. For instance,
something like "hoodie.concat.inserts.without.merge.on.insert" or "hoodie.concat.records.on.insert" etc.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] nsivabalan commented on pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
nsivabalan commented on pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#issuecomment-761115228
my bad. had to fix the config naming. do not do line by line review for now.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] codecov-io edited a comment on pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#issuecomment-708984716
# [Codecov](https://codecov.io/gh/apache/hudi/pull/2111?src=pr&el=h1) Report
> Merging [#2111](https://codecov.io/gh/apache/hudi/pull/2111?src=pr&el=desc) into [master](https://codecov.io/gh/apache/hudi/commit/1f7add92916c37b05be270d9c75a9042134ec506?el=desc) will **increase** coverage by `1.14%`.
> The diff coverage is `100.00%`.
[](https://codecov.io/gh/apache/hudi/pull/2111?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #2111 +/- ##
============================================
+ Coverage 52.47% 53.62% +1.14%
- Complexity 2748 2848 +100
============================================
Files 352 359 +7
Lines 16129 16553 +424
Branches 1752 1780 +28
============================================
+ Hits 8464 8876 +412
+ Misses 6937 6918 -19
- Partials 728 759 +31
```
| Flag | Coverage Δ | Complexity Δ | |
|---|---|---|---|
| #hudicli | `38.37% <ø> (ø)` | `193.00 <ø> (ø)` | |
| #hudiclient | `100.00% <ø> (ø)` | `0.00 <ø> (ø)` | |
| #hudicommon | `54.73% <100.00%> (-0.01%)` | `1795.00 <1.00> (+2.00)` | :arrow_down: |
| #hudihadoopmr | `33.05% <ø> (ø)` | `181.00 <ø> (ø)` | |
| #hudispark | `65.42% <ø> (-1.76%)` | `304.00 <ø> (-7.00)` | |
| #huditimelineservice | `62.29% <ø> (?)` | `50.00 <ø> (?)` | |
| #hudiutilities | `70.07% <ø> (+10.51%)` | `325.00 <ø> (+55.00)` | |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Impacted Files](https://codecov.io/gh/apache/hudi/pull/2111?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
|---|---|---|---|
| [...g/apache/hudi/common/model/WriteOperationType.java](https://codecov.io/gh/apache/hudi/pull/2111/diff?src=pr&el=tree#diff-aHVkaS1jb21tb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2h1ZGkvY29tbW9uL21vZGVsL1dyaXRlT3BlcmF0aW9uVHlwZS5qYXZh) | `53.84% <100.00%> (ø)` | `2.00 <1.00> (ø)` | |
| [...n/java/org/apache/hudi/internal/DefaultSource.java](https://codecov.io/gh/apache/hudi/pull/2111/diff?src=pr&el=tree#diff-aHVkaS1zcGFyay9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvaHVkaS9pbnRlcm5hbC9EZWZhdWx0U291cmNlLmphdmE=) | `0.00% <0.00%> (-80.00%)` | `0.00% <0.00%> (-6.00%)` | |
| [...pache/hudi/internal/HoodieWriterCommitMessage.java](https://codecov.io/gh/apache/hudi/pull/2111/diff?src=pr&el=tree#diff-aHVkaS1zcGFyay9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvaHVkaS9pbnRlcm5hbC9Ib29kaWVXcml0ZXJDb21taXRNZXNzYWdlLmphdmE=) | `83.33% <0.00%> (-16.67%)` | `2.00% <0.00%> (-1.00%)` | |
| [.../hudi/internal/HoodieDataSourceInternalWriter.java](https://codecov.io/gh/apache/hudi/pull/2111/diff?src=pr&el=tree#diff-aHVkaS1zcGFyay9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvaHVkaS9pbnRlcm5hbC9Ib29kaWVEYXRhU291cmNlSW50ZXJuYWxXcml0ZXIuamF2YQ==) | `78.12% <0.00%> (-9.38%)` | `6.00% <0.00%> (-2.00%)` | |
| [...n/scala/org/apache/hudi/HoodieSparkSqlWriter.scala](https://codecov.io/gh/apache/hudi/pull/2111/diff?src=pr&el=tree#diff-aHVkaS1zcGFyay9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2h1ZGkvSG9vZGllU3BhcmtTcWxXcml0ZXIuc2NhbGE=) | `50.95% <0.00%> (-5.26%)` | `0.00% <0.00%> (ø%)` | |
| [.../main/java/org/apache/hudi/common/util/Option.java](https://codecov.io/gh/apache/hudi/pull/2111/diff?src=pr&el=tree#diff-aHVkaS1jb21tb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2h1ZGkvY29tbW9uL3V0aWwvT3B0aW9uLmphdmE=) | `66.66% <0.00%> (-3.61%)` | `23.00% <0.00%> (+1.00%)` | :arrow_down: |
| [...in/scala/org/apache/hudi/IncrementalRelation.scala](https://codecov.io/gh/apache/hudi/pull/2111/diff?src=pr&el=tree#diff-aHVkaS1zcGFyay9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2h1ZGkvSW5jcmVtZW50YWxSZWxhdGlvbi5zY2FsYQ==) | `76.19% <0.00%> (-2.30%)` | `20.00% <0.00%> (+1.00%)` | :arrow_down: |
| [...udi/utilities/sources/helpers/DFSPathSelector.java](https://codecov.io/gh/apache/hudi/pull/2111/diff?src=pr&el=tree#diff-aHVkaS11dGlsaXRpZXMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2h1ZGkvdXRpbGl0aWVzL3NvdXJjZXMvaGVscGVycy9ERlNQYXRoU2VsZWN0b3IuamF2YQ==) | `82.05% <0.00%> (-2.16%)` | `12.00% <0.00%> (ø%)` | |
| [...mmon/table/log/AbstractHoodieLogRecordScanner.java](https://codecov.io/gh/apache/hudi/pull/2111/diff?src=pr&el=tree#diff-aHVkaS1jb21tb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2h1ZGkvY29tbW9uL3RhYmxlL2xvZy9BYnN0cmFjdEhvb2RpZUxvZ1JlY29yZFNjYW5uZXIuamF2YQ==) | `79.68% <0.00%> (-1.92%)` | `29.00% <0.00%> (ø%)` | |
| [...src/main/java/org/apache/hudi/DataSourceUtils.java](https://codecov.io/gh/apache/hudi/pull/2111/diff?src=pr&el=tree#diff-aHVkaS1zcGFyay9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvaHVkaS9EYXRhU291cmNlVXRpbHMuamF2YQ==) | `44.76% <0.00%> (-0.60%)` | `22.00% <0.00%> (+1.00%)` | :arrow_down: |
| ... and [27 more](https://codecov.io/gh/apache/hudi/pull/2111/diff?src=pr&el=tree-more) | |
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] vinothchandar commented on a change in pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
vinothchandar commented on a change in pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#discussion_r560578367
##########
File path: hudi-client/hudi-client-common/src/main/java/org/apache/hudi/config/HoodieWriteConfig.java
##########
@@ -330,6 +334,10 @@ public boolean isMergeDataValidationCheckEnabled() {
return Boolean.parseBoolean(props.getProperty(MERGE_DATA_VALIDATION_CHECK_ENABLED));
}
+ public boolean isMergeAllowDuplicateInserts() {
Review comment:
`allowDuplicateInserts()`
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] vinothchandar commented on a change in pull request #2111: [HUDI-1234] Insert new records to data files without merging for "Insert" operation.
Posted by GitBox <gi...@apache.org>.
vinothchandar commented on a change in pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#discussion_r560686629
##########
File path: hudi-client/hudi-client-common/src/main/java/org/apache/hudi/config/HoodieWriteConfig.java
##########
@@ -133,6 +133,10 @@
private static final String MERGE_DATA_VALIDATION_CHECK_ENABLED = "hoodie.merge.data.validation.enabled";
private static final String DEFAULT_MERGE_DATA_VALIDATION_CHECK_ENABLED = "false";
+ // Concats inserts to data files without merging
+ private static final String MERGE_ALLOW_DUPLICATE_INSERTS = "hoodie.merge.allow.duplicate.inserts";
Review comment:
first one is too long IMO. I think `hoodie.merge.allow.duplicates.on.insert` is a better name (I added the `.on`) given it explains to the user what the impact is. Whether we concat or prepend in implementation, thats not very useful for the end user
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] SteNicholas commented on pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
SteNicholas commented on pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#issuecomment-701890658
> > > According to this([https://github.com/apache/hudi/issues/2051)](https://github.com/apache/hudi/issues/2051%EF%BC%89) test。I can't get the results I want。When we set different value(hoodie.parquet.small.file.limit), the results are still different
> >
> >
> > @linshan-ma Could you please provide this test again? I couldn't visit the test you mentioned.
>
> @SteNicholas hi,this issue.#2051
@linshan-ma You could use the latest commit to check your test case. IMO, the latest commit has already solved your problem.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] SteNicholas commented on pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
SteNicholas commented on pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#issuecomment-704795298
@bvaradar @vinothchandar Could you please help to review this pull request?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] SteNicholas commented on pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
SteNicholas commented on pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#issuecomment-733426822
> @SteNicholas still interested in driving this forward?
@vinothchandar , yes, I have discussed with @leesf offline. This week would be completed.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] leesf commented on a change in pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
leesf commented on a change in pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#discussion_r501674516
##########
File path: hudi-client/hudi-spark-client/src/test/java/org/apache/hudi/table/action/commit/TestUpsertPartitioner.java
##########
@@ -90,14 +88,33 @@ private UpsertPartitioner getUpsertPartitioner(int smallFileSize, int numInserts
List<HoodieRecord> records = new ArrayList<>();
records.addAll(insertRecords);
records.addAll(updateRecords);
- WorkloadProfile profile = new WorkloadProfile(buildProfile(jsc.parallelize(records)));
+ WorkloadProfile profile = new WorkloadProfile(buildProfile(jsc.parallelize(records)), WriteOperationType.UPSERT);
UpsertPartitioner partitioner = new UpsertPartitioner(profile, context, table, config);
assertEquals(0, partitioner.getPartition(
new Tuple2<>(updateRecords.get(0).getKey(), Option.ofNullable(updateRecords.get(0).getCurrentLocation()))),
"Update record should have gone to the 1 update partition");
return partitioner;
}
+ private UpsertPartitioner getInsertPartitioner(int smallFileSize, int numInserts, int fileSize, String testPartitionPath,
+ boolean autoSplitInserts) throws Exception {
+ HoodieWriteConfig config = makeHoodieClientConfigBuilder()
+ .withCompactionConfig(HoodieCompactionConfig.newBuilder().compactionSmallFileSize(smallFileSize)
+ .insertSplitSize(100).autoTuneInsertSplits(autoSplitInserts).build())
Review comment:
`100` should be passed via method parameter.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] nsivabalan commented on pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
nsivabalan commented on pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#issuecomment-755879362
@vinothchandar : I have updated the patch as requested. Mid way in fixing tests(fixed some and ensured that both old and new code path works as expected though). But in the mean time, if you can review source code, would appreciate.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] SteNicholas commented on pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
SteNicholas commented on pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#issuecomment-711103785
@vinothchandar @bvaradar Any concern?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] SteNicholas commented on a change in pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
SteNicholas commented on a change in pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#discussion_r560105197
##########
File path: hudi-client/hudi-client-common/src/main/java/org/apache/hudi/config/HoodieWriteConfig.java
##########
@@ -133,6 +133,10 @@
private static final String MERGE_DATA_VALIDATION_CHECK_ENABLED = "hoodie.merge.data.validation.enabled";
private static final String DEFAULT_MERGE_DATA_VALIDATION_CHECK_ENABLED = "false";
+ // Concats inserts to data files without merging
+ private static final String MERGE_ALLOW_DUPLICATE_INSERTS = "hoodie.merge.allow.duplicate.inserts";
+ private static final String DEFAULT_MERGE_ALLOW_DUPLICATE_INSERTS = "false";
Review comment:
IMO, this could be defined as boolean type.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] vinothchandar commented on pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
vinothchandar commented on pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#issuecomment-756515101
@nsivabalan can you please check the tests?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] SteNicholas removed a comment on pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
SteNicholas removed a comment on pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#issuecomment-704795298
@bvaradar @vinothchandar Could you please help to review this pull request?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] leesf commented on a change in pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
leesf commented on a change in pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#discussion_r505542832
##########
File path: hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/table/action/commit/UpsertPartitioner.java
##########
@@ -160,11 +174,15 @@ private void assignInserts(WorkloadProfile profile, HoodieEngineContext context)
if (recordsToAppend > 0 && totalUnassignedInserts > 0) {
// create a new bucket or re-use an existing bucket
int bucket;
- if (updateLocationToBucket.containsKey(smallFile.location.getFileId())) {
+ // insert new records regardless of small file when using insert operation
+ if (isChangingRecords(profile.getOperationType())
+ && updateLocationToBucket.containsKey(smallFile.location.getFileId())) {
bucket = updateLocationToBucket.get(smallFile.location.getFileId());
LOG.info("Assigning " + recordsToAppend + " inserts to existing update bucket " + bucket);
} else {
- bucket = addUpdateBucket(partitionPath, smallFile.location.getFileId());
+ bucket = profile.getOperationType() == null || isChangingRecords(profile.getOperationType())
+ ? addUpdateBucket(partitionPath, smallFile.location.getFileId())
+ : addInsertBucket(partitionPath, smallFile.location.getFileId());
Review comment:
maybe we would create a new FileID instead of using exist small file id @bvaradar WDYT?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] SteNicholas commented on a change in pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
SteNicholas commented on a change in pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#discussion_r501739210
##########
File path: hudi-client/hudi-spark-client/src/test/java/org/apache/hudi/table/action/commit/TestUpsertPartitioner.java
##########
@@ -90,14 +88,33 @@ private UpsertPartitioner getUpsertPartitioner(int smallFileSize, int numInserts
List<HoodieRecord> records = new ArrayList<>();
records.addAll(insertRecords);
records.addAll(updateRecords);
- WorkloadProfile profile = new WorkloadProfile(buildProfile(jsc.parallelize(records)));
+ WorkloadProfile profile = new WorkloadProfile(buildProfile(jsc.parallelize(records)), WriteOperationType.UPSERT);
UpsertPartitioner partitioner = new UpsertPartitioner(profile, context, table, config);
assertEquals(0, partitioner.getPartition(
new Tuple2<>(updateRecords.get(0).getKey(), Option.ofNullable(updateRecords.get(0).getCurrentLocation()))),
"Update record should have gone to the 1 update partition");
return partitioner;
}
+ private UpsertPartitioner getInsertPartitioner(int smallFileSize, int numInserts, int fileSize, String testPartitionPath,
+ boolean autoSplitInserts) throws Exception {
+ HoodieWriteConfig config = makeHoodieClientConfigBuilder()
+ .withCompactionConfig(HoodieCompactionConfig.newBuilder().compactionSmallFileSize(smallFileSize)
+ .insertSplitSize(100).autoTuneInsertSplits(autoSplitInserts).build())
Review comment:
@leesf I don't think `100` should be passed via method parameter. You could refer to the method `getUpsertPartitioner`.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] SteNicholas commented on a change in pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
SteNicholas commented on a change in pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#discussion_r494938396
##########
File path: hudi-client/src/main/java/org/apache/hudi/table/WorkloadProfile.java
##########
@@ -54,13 +55,23 @@
*/
private final WorkloadStat globalStat;
+ /**
+ * Write operation type.
+ */
+ private WriteOperationType operationType;
Review comment:
@leesf Yes, WriteOperationType should be Serializable, forget to check this. I would like to add `implements Serializable`.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] leesf commented on pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
leesf commented on pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#issuecomment-700418522
> According to this([https://github.com/apache/hudi/issues/2051)](https://github.com/apache/hudi/issues/2051%EF%BC%89) test。I can't get the results I want。When we set different value(hoodie.parquet.small.file.limit), the results are still different
@linshan-ma hi, you mean that after you apply this PR and insert records again, the results written before get updated, instead of inserting new records?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] vinothchandar commented on pull request #2111: [HUDI-1234] Insert new records to data files without merging for "Insert" operation.
Posted by GitBox <gi...@apache.org>.
vinothchandar commented on pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#issuecomment-767103157
@nsivabalan I thought we were going to get this in to 0.7.0? checked back again, to see why this was missing
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] SteNicholas removed a comment on pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
SteNicholas removed a comment on pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#issuecomment-701890658
> > > According to this([https://github.com/apache/hudi/issues/2051)](https://github.com/apache/hudi/issues/2051%EF%BC%89) test。I can't get the results I want。When we set different value(hoodie.parquet.small.file.limit), the results are still different
> >
> >
> > @linshan-ma Could you please provide this test again? I couldn't visit the test you mentioned.
>
> @SteNicholas hi,this issue.#2051
@linshan-ma You could use the latest commit to check your test case. IMO, the latest commit has already solved your problem.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] vinothchandar commented on pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
vinothchandar commented on pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#issuecomment-716063130
@SteNicholas Please ping me when this is ready again! If you can also update PR description withe new approach that would be great.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] SteNicholas commented on pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
SteNicholas commented on pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#issuecomment-703243458
> > > According to this([https://github.com/apache/hudi/issues/2051)](https://github.com/apache/hudi/issues/2051%EF%BC%89) test。I can't get the results I want。When we set different value(hoodie.parquet.small.file.limit), the results are still different
> >
> >
> > @linshan-ma Could you please provide this test again? I couldn't visit the test you mentioned.
>
> @SteNicholas hi,this issue.#2051
@linshan-ma You could use the latest change to verify the test case you provide.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] vinothchandar commented on a change in pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
vinothchandar commented on a change in pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#discussion_r509002518
##########
File path: hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/table/action/commit/UpsertPartitioner.java
##########
@@ -54,6 +54,8 @@
import scala.Tuple2;
+import static org.apache.hudi.common.model.WriteOperationType.isChangingRecords;
Review comment:
would really prefer a non -static import here. makes it easier on the eyes.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] leesf commented on a change in pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
leesf commented on a change in pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#discussion_r501676468
##########
File path: hudi-client/hudi-spark-client/src/test/java/org/apache/hudi/table/action/commit/TestUpsertPartitioner.java
##########
@@ -286,8 +303,48 @@ public void testUpsertPartitionerWithSmallInsertHandling() throws Exception {
"Bucket 3 is INSERT");
assertEquals(4, insertBuckets.size(), "Total of 4 insert buckets");
- weights = new Double[] { 0.08, 0.31, 0.31, 0.31};
- cumulativeWeights = new Double[] { 0.08, 0.39, 0.69, 1.0};
+ weights = new Double[] {0.08, 0.31, 0.31, 0.31};
+ cumulativeWeights = new Double[] {0.08, 0.39, 0.69, 1.0};
+ assertInsertBuckets(weights, cumulativeWeights, insertBuckets);
+ }
+
+ @Test
+ public void testInsertPartitionerWithSmallInsertHandling() throws Exception {
+ final String testPartitionPath = "2016/09/26";
+ // Inserts .. Check updates go together & inserts subsplit, after expanding smallest file
+ UpsertPartitioner partitioner = getInsertPartitioner(1000 * 1024, 400, 800 * 1024, testPartitionPath, false);
+ List<InsertBucketCumulativeWeightPair> insertBuckets = partitioner.getInsertBuckets(testPartitionPath);
+
+ assertEquals(3, partitioner.numPartitions(), "Should have 3 partitions");
+ assertEquals(BucketType.INSERT, partitioner.getBucketInfo(0).bucketType,
+ "Bucket 0 is INSERT");
+ assertEquals(BucketType.INSERT, partitioner.getBucketInfo(1).bucketType,
+ "Bucket 1 is INSERT");
+ assertEquals(BucketType.INSERT, partitioner.getBucketInfo(2).bucketType,
+ "Bucket 2 is INSERT");
Review comment:
would you please use `foreach` assertion instead of listing all buckets?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] SteNicholas commented on a change in pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
SteNicholas commented on a change in pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#discussion_r505682259
##########
File path: hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/table/action/commit/UpsertPartitioner.java
##########
@@ -160,11 +174,15 @@ private void assignInserts(WorkloadProfile profile, HoodieEngineContext context)
if (recordsToAppend > 0 && totalUnassignedInserts > 0) {
// create a new bucket or re-use an existing bucket
int bucket;
- if (updateLocationToBucket.containsKey(smallFile.location.getFileId())) {
+ // insert new records regardless of small file when using insert operation
+ if (isChangingRecords(profile.getOperationType())
+ && updateLocationToBucket.containsKey(smallFile.location.getFileId())) {
bucket = updateLocationToBucket.get(smallFile.location.getFileId());
LOG.info("Assigning " + recordsToAppend + " inserts to existing update bucket " + bucket);
} else {
- bucket = addUpdateBucket(partitionPath, smallFile.location.getFileId());
+ bucket = profile.getOperationType() == null || isChangingRecords(profile.getOperationType())
+ ? addUpdateBucket(partitionPath, smallFile.location.getFileId())
+ : addInsertBucket(partitionPath, smallFile.location.getFileId());
Review comment:
@bvaradar @vinothchandar WDYT? I thought using existing small file id would be 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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] nsivabalan commented on pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
nsivabalan commented on pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#issuecomment-762613728
@vinothchandar @SteNicholas : Patch is ready to be reviewed.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] SteNicholas commented on a change in pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
SteNicholas commented on a change in pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#discussion_r494938396
##########
File path: hudi-client/src/main/java/org/apache/hudi/table/WorkloadProfile.java
##########
@@ -54,13 +55,23 @@
*/
private final WorkloadStat globalStat;
+ /**
+ * Write operation type.
+ */
+ private WriteOperationType operationType;
Review comment:
@leesf Yes, WriteOperationType should be Serializable, forget to check this. I would like to add `implements Serializable`.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] SteNicholas commented on a change in pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
SteNicholas commented on a change in pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#discussion_r501735976
##########
File path: hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/table/action/commit/UpsertPartitioner.java
##########
@@ -112,16 +115,17 @@ private void assignUpdates(WorkloadProfile profile) {
for (Map.Entry<String, WorkloadStat> partitionStat : partitionStatEntries) {
for (Map.Entry<String, Pair<String, Long>> updateLocEntry :
partitionStat.getValue().getUpdateLocationToCount().entrySet()) {
- addUpdateBucket(partitionStat.getKey(), updateLocEntry.getKey());
+ addUpdateBucket(partitionStat.getKey(), updateLocEntry.getKey(), profile.getOperationType());
}
}
}
- private int addUpdateBucket(String partitionPath, String fileIdHint) {
+ private int addUpdateBucket(String partitionPath, String fileIdHint, WriteOperationType operationType) {
int bucket = totalBuckets;
updateLocationToBucket.put(fileIdHint, bucket);
BucketInfo bucketInfo = new BucketInfo();
- bucketInfo.bucketType = BucketType.UPDATE;
+ bucketInfo.bucketType = operationType == null || isChangingRecords(operationType)
Review comment:
@leesf OK, I would move the logic outside of method `addUpdateBucket`.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] SteNicholas commented on pull request #2111: [HUDI-1234] Insert new records to data files without merging for "Insert" operation.
Posted by GitBox <gi...@apache.org>.
SteNicholas commented on pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#issuecomment-763716544
> Fixed the config name. Once CI succeeds, will land this PR.
Thanks for @nsivabalan updates. I'm sorry for the delay for this pull request because of busy work. Thanks again.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] leesf commented on a change in pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
leesf commented on a change in pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#discussion_r501675500
##########
File path: hudi-client/hudi-spark-client/src/test/java/org/apache/hudi/table/action/commit/TestUpsertPartitioner.java
##########
@@ -286,8 +303,48 @@ public void testUpsertPartitionerWithSmallInsertHandling() throws Exception {
"Bucket 3 is INSERT");
assertEquals(4, insertBuckets.size(), "Total of 4 insert buckets");
- weights = new Double[] { 0.08, 0.31, 0.31, 0.31};
- cumulativeWeights = new Double[] { 0.08, 0.39, 0.69, 1.0};
+ weights = new Double[] {0.08, 0.31, 0.31, 0.31};
+ cumulativeWeights = new Double[] {0.08, 0.39, 0.69, 1.0};
+ assertInsertBuckets(weights, cumulativeWeights, insertBuckets);
+ }
+
+ @Test
+ public void testInsertPartitionerWithSmallInsertHandling() throws Exception {
+ final String testPartitionPath = "2016/09/26";
+ // Inserts .. Check updates go together & inserts subsplit, after expanding smallest file
+ UpsertPartitioner partitioner = getInsertPartitioner(1000 * 1024, 400, 800 * 1024, testPartitionPath, false);
+ List<InsertBucketCumulativeWeightPair> insertBuckets = partitioner.getInsertBuckets(testPartitionPath);
+
+ assertEquals(3, partitioner.numPartitions(), "Should have 3 partitions");
+ assertEquals(BucketType.INSERT, partitioner.getBucketInfo(0).bucketType,
+ "Bucket 0 is INSERT");
+ assertEquals(BucketType.INSERT, partitioner.getBucketInfo(1).bucketType,
+ "Bucket 1 is INSERT");
+ assertEquals(BucketType.INSERT, partitioner.getBucketInfo(2).bucketType,
+ "Bucket 2 is INSERT");
+ assertEquals(3, insertBuckets.size(), "Total of 3 insert buckets");
+
+ Double[] weights = {0.5, 0.25, 0.25};
+ Double[] cumulativeWeights = {0.5, 0.75, 1.0};
+ assertInsertBuckets(weights, cumulativeWeights, insertBuckets);
+
+ // Now with insert split size auto tuned
+ partitioner = getInsertPartitioner(1000 * 1024, 2400, 800 * 1024, testPartitionPath, true);
+ insertBuckets = partitioner.getInsertBuckets(testPartitionPath);
+
+ assertEquals(4, partitioner.numPartitions(), "Should have 4 partitions");
Review comment:
ditto
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [hudi] codecov-io edited a comment on pull request #2111: [HUDI-1234] Insert new records regardless of small file when using insert operation
Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #2111:
URL: https://github.com/apache/hudi/pull/2111#issuecomment-708984716
# [Codecov](https://codecov.io/gh/apache/hudi/pull/2111?src=pr&el=h1) Report
> Merging [#2111](https://codecov.io/gh/apache/hudi/pull/2111?src=pr&el=desc) into [master](https://codecov.io/gh/apache/hudi/commit/1f7add92916c37b05be270d9c75a9042134ec506?el=desc) will **increase** coverage by `1.14%`.
> The diff coverage is `100.00%`.
[](https://codecov.io/gh/apache/hudi/pull/2111?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #2111 +/- ##
============================================
+ Coverage 52.47% 53.62% +1.14%
- Complexity 2748 2848 +100
============================================
Files 352 359 +7
Lines 16129 16553 +424
Branches 1752 1780 +28
============================================
+ Hits 8464 8876 +412
+ Misses 6937 6918 -19
- Partials 728 759 +31
```
| Flag | Coverage Δ | Complexity Δ | |
|---|---|---|---|
| #hudicli | `38.37% <ø> (ø)` | `193.00 <ø> (ø)` | |
| #hudiclient | `100.00% <ø> (ø)` | `0.00 <ø> (ø)` | |
| #hudicommon | `54.73% <100.00%> (-0.01%)` | `1795.00 <1.00> (+2.00)` | :arrow_down: |
| #hudihadoopmr | `33.05% <ø> (ø)` | `181.00 <ø> (ø)` | |
| #hudispark | `65.42% <ø> (-1.76%)` | `304.00 <ø> (-7.00)` | |
| #huditimelineservice | `62.29% <ø> (?)` | `50.00 <ø> (?)` | |
| #hudiutilities | `70.07% <ø> (+10.51%)` | `325.00 <ø> (+55.00)` | |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Impacted Files](https://codecov.io/gh/apache/hudi/pull/2111?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
|---|---|---|---|
| [...g/apache/hudi/common/model/WriteOperationType.java](https://codecov.io/gh/apache/hudi/pull/2111/diff?src=pr&el=tree#diff-aHVkaS1jb21tb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2h1ZGkvY29tbW9uL21vZGVsL1dyaXRlT3BlcmF0aW9uVHlwZS5qYXZh) | `53.84% <100.00%> (ø)` | `2.00 <1.00> (ø)` | |
| [...n/java/org/apache/hudi/internal/DefaultSource.java](https://codecov.io/gh/apache/hudi/pull/2111/diff?src=pr&el=tree#diff-aHVkaS1zcGFyay9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvaHVkaS9pbnRlcm5hbC9EZWZhdWx0U291cmNlLmphdmE=) | `0.00% <0.00%> (-80.00%)` | `0.00% <0.00%> (-6.00%)` | |
| [...pache/hudi/internal/HoodieWriterCommitMessage.java](https://codecov.io/gh/apache/hudi/pull/2111/diff?src=pr&el=tree#diff-aHVkaS1zcGFyay9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvaHVkaS9pbnRlcm5hbC9Ib29kaWVXcml0ZXJDb21taXRNZXNzYWdlLmphdmE=) | `83.33% <0.00%> (-16.67%)` | `2.00% <0.00%> (-1.00%)` | |
| [.../hudi/internal/HoodieDataSourceInternalWriter.java](https://codecov.io/gh/apache/hudi/pull/2111/diff?src=pr&el=tree#diff-aHVkaS1zcGFyay9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvaHVkaS9pbnRlcm5hbC9Ib29kaWVEYXRhU291cmNlSW50ZXJuYWxXcml0ZXIuamF2YQ==) | `78.12% <0.00%> (-9.38%)` | `6.00% <0.00%> (-2.00%)` | |
| [...n/scala/org/apache/hudi/HoodieSparkSqlWriter.scala](https://codecov.io/gh/apache/hudi/pull/2111/diff?src=pr&el=tree#diff-aHVkaS1zcGFyay9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2h1ZGkvSG9vZGllU3BhcmtTcWxXcml0ZXIuc2NhbGE=) | `50.95% <0.00%> (-5.26%)` | `0.00% <0.00%> (ø%)` | |
| [.../main/java/org/apache/hudi/common/util/Option.java](https://codecov.io/gh/apache/hudi/pull/2111/diff?src=pr&el=tree#diff-aHVkaS1jb21tb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2h1ZGkvY29tbW9uL3V0aWwvT3B0aW9uLmphdmE=) | `66.66% <0.00%> (-3.61%)` | `23.00% <0.00%> (+1.00%)` | :arrow_down: |
| [...in/scala/org/apache/hudi/IncrementalRelation.scala](https://codecov.io/gh/apache/hudi/pull/2111/diff?src=pr&el=tree#diff-aHVkaS1zcGFyay9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2h1ZGkvSW5jcmVtZW50YWxSZWxhdGlvbi5zY2FsYQ==) | `76.19% <0.00%> (-2.30%)` | `20.00% <0.00%> (+1.00%)` | :arrow_down: |
| [...udi/utilities/sources/helpers/DFSPathSelector.java](https://codecov.io/gh/apache/hudi/pull/2111/diff?src=pr&el=tree#diff-aHVkaS11dGlsaXRpZXMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2h1ZGkvdXRpbGl0aWVzL3NvdXJjZXMvaGVscGVycy9ERlNQYXRoU2VsZWN0b3IuamF2YQ==) | `82.05% <0.00%> (-2.16%)` | `12.00% <0.00%> (ø%)` | |
| [...mmon/table/log/AbstractHoodieLogRecordScanner.java](https://codecov.io/gh/apache/hudi/pull/2111/diff?src=pr&el=tree#diff-aHVkaS1jb21tb24vc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2h1ZGkvY29tbW9uL3RhYmxlL2xvZy9BYnN0cmFjdEhvb2RpZUxvZ1JlY29yZFNjYW5uZXIuamF2YQ==) | `79.68% <0.00%> (-1.92%)` | `29.00% <0.00%> (ø%)` | |
| [...src/main/java/org/apache/hudi/DataSourceUtils.java](https://codecov.io/gh/apache/hudi/pull/2111/diff?src=pr&el=tree#diff-aHVkaS1zcGFyay9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvaHVkaS9EYXRhU291cmNlVXRpbHMuamF2YQ==) | `44.76% <0.00%> (-0.60%)` | `22.00% <0.00%> (+1.00%)` | :arrow_down: |
| ... and [27 more](https://codecov.io/gh/apache/hudi/pull/2111/diff?src=pr&el=tree-more) | |
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org