yihua commented on code in PR #17772:
URL: https://github.com/apache/hudi/pull/17772#discussion_r2670928952
##########
hudi-client/hudi-client-common/src/test/java/org/apache/hudi/testutils/HoodieWriteableTestTable.java:
##########
@@ -125,7 +126,8 @@ public StoragePath withInserts(String partition, String
fileId, List<HoodieRecor
contextSupplier, populateMetaFields)) {
int seqId = 1;
for (HoodieRecord record : records) {
- GenericRecord avroRecord = (GenericRecord)
record.rewriteRecordWithNewSchema(schema, CollectionUtils.emptyProps(),
schema).getData();
+ GenericRecord avroRecord = (GenericRecord)
record.rewriteRecordWithNewSchema(HoodieSchema.fromAvroSchema(schema),
Review Comment:
nit: The Avro schema can be converted beforehand once, instead of conversion
per record.
##########
hudi-client/hudi-flink-client/src/main/java/org/apache/hudi/client/model/HoodieFlinkRecord.java:
##########
@@ -139,9 +139,9 @@ public String getRecordKey(Schema recordSchema,
Option<BaseKeyGenerator> keyGene
}
@Override
- public String getRecordKey(Schema recordSchema, String keyFieldName) {
+ public String getRecordKey(HoodieSchema recordSchema, String keyFieldName) {
if (key == null) {
- String recordKey =
Objects.toString(RowDataAvroQueryContexts.fromAvroSchema(recordSchema).getFieldQueryContext(keyFieldName).getFieldGetter().getFieldOrNull(data));
+ String recordKey =
Objects.toString(RowDataAvroQueryContexts.fromAvroSchema(recordSchema.toAvroSchema()).getFieldQueryContext(keyFieldName).getFieldGetter().getFieldOrNull(data));
Review Comment:
The reason I ask is that there's still back and forth conversion to Avro
Schema for `RowDataAvroQueryContexts` to use.
##########
hudi-client/hudi-client-common/src/test/java/org/apache/hudi/testutils/HoodieWriteableTestTable.java:
##########
@@ -148,7 +150,7 @@ public StoragePath withInserts(String partition, String
fileId, List<HoodieRecor
config, schema, contextSupplier)) {
int seqId = 1;
for (HoodieRecord record : records) {
- GenericRecord avroRecord = (GenericRecord)
record.toIndexedRecord(schema, CollectionUtils.emptyProps()).get().getData();
+ GenericRecord avroRecord = (GenericRecord)
record.toIndexedRecord(HoodieSchema.fromAvroSchema(schema),
CollectionUtils.emptyProps()).get().getData();
Review Comment:
nit: similar
--
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]