yihua commented on code in PR #13208:
URL: https://github.com/apache/hudi/pull/13208#discussion_r2055500913
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/action/compact/HoodieCompactor.java:
##########
@@ -145,7 +145,7 @@ public HoodieData<WriteStatus> compact(
if (useFileGroupReaderBasedCompaction) {
ReaderContextFactory<T> readerContextFactory =
context.getReaderContextFactory(metaClient);
return context.parallelize(operations).map(
- operation -> compact(compactionHandler, config, operation,
compactionInstantTime, readerContextFactory.getContext()))
+ operation -> compact(compactionHandler, config, operation,
compactionInstantTime,
readerContextFactory.getContext(metaClient.getTableConfig())))
Review Comment:
When instantiating the `readerContextFactory` the meta client is passed in.
Should the reader context factory keep the table config and reuse that when
`readerContextFactory.getContext` is invoked so there is no need to pass in
`metaClient.getTableConfig()` again?
##########
hudi-common/src/main/java/org/apache/hudi/common/engine/HoodieReaderContext.java:
##########
@@ -243,10 +263,7 @@ public boolean castToBoolean(Object value) {
* @param schema The Avro schema of the record.
* @return The record key in String.
*/
- public String getRecordKey(T record, Schema schema) {
- Object val = getValue(record, schema, RECORD_KEY_METADATA_FIELD);
- return val.toString();
- }
+ public abstract String getRecordKey(T record, Schema schema);
Review Comment:
Should a new API be added `getVirtualRecordKey` and keep `getRecordKey` as
below so new reader context implementation does not accidentally ignore the
record key meta field:
```
public String getRecordKey(T record, Schema schema) {
if (metaFieldsPopulated) {
return getValue(record, schema, RECORD_KEY_METADATA_FIELD).toString();
}
return getVirtualRecordKey(record, schema);
}
```
##########
hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/client/common/SparkReaderContextFactory.java:
##########
@@ -107,7 +108,8 @@ public HoodieReaderContext<InternalRow> getContext() {
sparkParquetReader,
JavaConverters.asScalaBufferConverter(filters).asScala().toSeq(),
JavaConverters.asScalaBufferConverter(filters).asScala().toSeq(),
- new
HadoopStorageConfiguration(configurationBroadcast.getValue().value()));
+ new
HadoopStorageConfiguration(configurationBroadcast.getValue().value()),
+ tableConfig);
Review Comment:
`tableConfig` can be fetched in the constructor by
`metaClient.getTableConfig()` for consistency and the method argument can be
removed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]