Skip to content

Commit 63362ad

Browse files
TheR1sing3unyihua
andauthored
[HUDI-9125] Pass compaction/merge related props to HoodieBaseFileGroupRecordBuffer (#12925)
* feat: pass compaction/merge related props to HoodieBaseFileGroupRecordBuffer 1. pass compaction/merge related props to HoodieBaseFileGroupRecordBuffer Signed-off-by: TheR1sing3un <[email protected]> * fix: resolve multiple precombine-related configuration conflicts 1. resolve multiple precombine-related configuration conflicts 2. assume that precombine is based on table config Signed-off-by: TheR1sing3un <[email protected]> * style: simplify lambda expression 1. simplify lambda expression Signed-off-by: TheR1sing3un <[email protected]> * fix: fix the `record_key` and `_hoodie_record_key` are not mapped when the record is created in SparkDatasetTestUtils 1. fix the `record_key` and `_hoodie_record_key` are not mapped when the record is created in SparkDatasetTestUtils Signed-off-by: TheR1sing3un <[email protected]> * rerun * feat: Remove the default value for PAYLOAD_ORDERING_FIELD_PROP_KEY to avoid taking the default value from props as a valid configuration 1. Remove the default value for PAYLOAD_ORDERING_FIELD_PROP_KEY to avoid taking the default value from props as a valid configuration优化排序字段获取逻辑,移除默认值配置。 Signed-off-by: TheR1sing3un <[email protected]> * Update hudi-common/src/main/java/org/apache/hudi/common/util/collection/ExternalSpillableMap.java --------- Signed-off-by: TheR1sing3un <[email protected]> Co-authored-by: Y Ethan Guo <[email protected]>
1 parent f0b7383 commit 63362ad

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

hudi-client/hudi-client-common/src/main/java/org/apache/hudi/config/HoodiePayloadConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public class HoodiePayloadConfig extends HoodieConfig {
6060
@Deprecated
6161
public static final ConfigProperty<String> ORDERING_FIELD = ConfigProperty
6262
.key(PAYLOAD_ORDERING_FIELD_PROP_KEY)
63-
.defaultValue("ts")
63+
.noDefaultValue()
6464
.markAdvanced()
6565
.withDocumentation("Table column/field name to order records that have the same key, before "
6666
+ "merging and writing to storage.");

hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/io/HoodieSparkFileGroupReaderBasedMergeHandle.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
import org.apache.hudi.AvroConversionUtils;
2323
import org.apache.hudi.client.WriteStatus;
24+
import org.apache.hudi.common.config.TypedProperties;
2425
import org.apache.hudi.common.engine.HoodieReaderContext;
2526
import org.apache.hudi.common.engine.TaskContextSupplier;
2627
import org.apache.hudi.common.fs.FSUtils;
@@ -180,6 +181,9 @@ public void write() {
180181
if (!StringUtils.isNullOrEmpty(config.getInternalSchema())) {
181182
internalSchemaOption = SerDeHelper.fromJson(config.getInternalSchema());
182183
}
184+
TypedProperties props = new TypedProperties();
185+
hoodieTable.getMetaClient().getTableConfig().getProps().forEach(props::putIfAbsent);
186+
config.getProps().forEach(props::putIfAbsent);
183187
// Initializes file group reader
184188
try (HoodieFileGroupReader<T> fileGroupReader = new HoodieFileGroupReader<>(
185189
readerContext,
@@ -191,7 +195,7 @@ public void write() {
191195
writeSchemaWithMetaFields,
192196
internalSchemaOption,
193197
hoodieTable.getMetaClient(),
194-
hoodieTable.getMetaClient().getTableConfig().getProps(),
198+
props,
195199
0,
196200
Long.MAX_VALUE,
197201
usePosition)) {

hudi-common/src/main/java/org/apache/hudi/common/util/collection/ExternalSpillableMap.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ public ExternalSpillableMap(long maxInMemorySizeInBytes, String baseFilePath, Si
102102
this.isCompressionEnabled = isCompressionEnabled;
103103
this.valueSerializer = valueSerializer;
104104
this.loggingContext = loggingContext;
105+
LOG.debug("Initializing ExternalSpillableMap with baseFilePath = {}, maxInMemorySizeInBytes = {}, diskMapType = {}", maxInMemorySizeInBytes, baseFilePath, diskMapType);
105106
}
106107

107108
private void initDiskBasedMap() {

hudi-spark-datasource/hudi-spark-common/src/test/java/org/apache/hudi/testutils/SparkDatasetTestUtils.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,17 +141,18 @@ public static Dataset<Row> getRandomRowsWithKeys(SQLContext sqlContext,
141141
*/
142142
public static Row getRandomValue(String partitionPath, boolean isError, String commitTime) {
143143
// order commit time, seq no, record key, partition path, file name
144+
String recordKey = UUID.randomUUID().toString();
144145
Object[] values = new Object[9];
145146
values[0] = commitTime; //commit time
146147
if (!isError) {
147148
values[1] = ""; // commit seq no
148149
} else {
149150
values[1] = RANDOM.nextLong();
150151
}
151-
values[2] = UUID.randomUUID().toString();
152+
values[2] = recordKey;
152153
values[3] = partitionPath;
153154
values[4] = ""; // filename
154-
values[5] = UUID.randomUUID().toString();
155+
values[5] = recordKey;
155156
values[6] = partitionPath;
156157
values[7] = RANDOM.nextInt();
157158
if (!isError) {
@@ -180,7 +181,7 @@ public static Row getRandomValue(HoodieKey key, boolean isError, String commitTi
180181
values[2] = key.getRecordKey();
181182
values[3] = key.getPartitionPath();
182183
values[4] = ""; // filename
183-
values[5] = UUID.randomUUID().toString();
184+
values[5] = key.getRecordKey();
184185
values[6] = key.getPartitionPath();
185186
values[7] = RANDOM.nextInt();
186187
if (!isError) {

0 commit comments

Comments
 (0)