You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by "cshuo (via GitHub)" <gi...@apache.org> on 2025/04/26 02:57:40 UTC

[PR] [HUDI-9318] Refactor the log records presentation in FileGroupRecordBuffer [hudi]

cshuo opened a new pull request, #13225:
URL: https://github.com/apache/hudi/pull/13225

   ### Change Logs
   
   Refactor the log records presentation in FileGroupRecordBuffer
   
   cache ordering value for HoodieRecord to avoid dup calculating.
   introduce a pojo BufferedRecord to substitute Pair<Option<T>, Map<String, Object>> for record buffer in file group reader.
   convert the buffered record into binary-format before put into spillable map to save space, and reduce spilling.
   
   ### Impact
   
   Reduce heap size of record to make ExternalSpillableMap less prone to spill.
   
   ### Risk level (write none, low medium or high below)
   
   medium
   
   ### Documentation Update
   
   _Describe any necessary documentation update if there is any new feature, config, or user-facing change. If not, put "none"._
   
   - _The config description must be updated if new configs are added or the default value of the configs are changed_
   - _Any new feature or user-facing change requires updating the Hudi website. Please create a Jira ticket, attach the
     ticket number here and follow the [instruction](https://hudi.apache.org/contribute/developer-setup#website) to make
     changes to the website._
   
   ### Contributor's checklist
   
   - [ ] Read through [contributor's guide](https://hudi.apache.org/contribute/how-to-contribute)
   - [ ] Change Logs and Impact were stated clearly
   - [ ] Adequate tests were added if applicable
   - [ ] CI passed
   


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [HUDI-9318] Refactor the log records presentation in FileGroupRecordBuffer [hudi]

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #13225:
URL: https://github.com/apache/hudi/pull/13225#issuecomment-2833906744

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "cea90417b10a3f7834eef28dcd1ff47e8e09b8e4",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5162",
       "triggerID" : "cea90417b10a3f7834eef28dcd1ff47e8e09b8e4",
       "triggerType" : "PUSH"
     }, {
       "hash" : "a66eb0f382ef9312dddc8b20a2fc3e3722919846",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5169",
       "triggerID" : "a66eb0f382ef9312dddc8b20a2fc3e3722919846",
       "triggerType" : "PUSH"
     }, {
       "hash" : "511e81809c5a967e1fceccad46ad33e260e2ecd2",
       "status" : "CANCELED",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5173",
       "triggerID" : "511e81809c5a967e1fceccad46ad33e260e2ecd2",
       "triggerType" : "PUSH"
     }, {
       "hash" : "f82a01fae4e8eac22291c2e4476345dd4ab7679d",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "f82a01fae4e8eac22291c2e4476345dd4ab7679d",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 511e81809c5a967e1fceccad46ad33e260e2ecd2 Azure: [CANCELED](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5173) 
   * f82a01fae4e8eac22291c2e4476345dd4ab7679d UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [HUDI-9318] Refactor the log records presentation in FileGroupRecordBuffer [hudi]

Posted by "danny0405 (via GitHub)" <gi...@apache.org>.
danny0405 commented on code in PR #13225:
URL: https://github.com/apache/hudi/pull/13225#discussion_r2061251430


##########
hudi-client/hudi-flink-client/src/main/java/org/apache/hudi/client/model/HoodieFlinkRecord.java:
##########
@@ -170,11 +166,11 @@ public HoodieRecord prependMetaFields(Schema recordSchema, Schema targetSchema,
 
   @Override
   public HoodieRecord updateMetaField(Schema recordSchema, int ordinal, String value) {
-    ValidationUtils.checkArgument(recordSchema.getField(RECORD_KEY_METADATA_FIELD) != null,
-        "The record is expected to contain metadata fields.");
-    GenericRowData rowData = (GenericRowData) getData();
-    rowData.setField(ordinal, StringData.fromString(value));
-    return this;
+    String[] metaVals = new String[HoodieRecord.HOODIE_META_COLUMNS.size()];
+    metaVals[ordinal] = value;
+    boolean withOperation = recordSchema.getField(OPERATION_METADATA_FIELD) != null;
+    RowData rowData = new HoodieRowDataWithPartialMetaFields(metaVals, Collections.singleton(ordinal), getData(), withOperation);

Review Comment:
   not sure why only the partial meta fields are updated, during compaction, all the meta fields should be kept and persisted to 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.

To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [HUDI-9318] Refactor the log records presentation in FileGroupRecordBuffer [hudi]

Posted by "cshuo (via GitHub)" <gi...@apache.org>.
cshuo commented on code in PR #13225:
URL: https://github.com/apache/hudi/pull/13225#discussion_r2062569206


##########
hudi-common/src/main/java/org/apache/hudi/common/table/read/BufferedRecord.java:
##########
@@ -0,0 +1,110 @@
+/*
+ * 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.common.table.read;
+
+import org.apache.hudi.common.engine.HoodieReaderContext;
+import org.apache.hudi.common.model.DeleteRecord;
+import org.apache.hudi.common.model.HoodieKey;
+import org.apache.hudi.common.model.HoodieRecord;
+import org.apache.hudi.common.util.Option;
+import org.apache.hudi.exception.HoodieException;
+
+import org.apache.avro.Schema;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.Properties;
+
+import static org.apache.hudi.common.model.HoodieRecord.DEFAULT_ORDERING_VALUE;
+
+/**
+ * Buffered Record used by file group reader.
+ *
+ * @param <T> The type of the engine specific row.
+ */
+public class BufferedRecord<T> implements Serializable {

Review Comment:
   `BufferedRecord` is introduced for merging and caching purpose in file group reader:
   1) there exists different apis between `BufferedRecord` and `HoodieRecord`, these changes are specific for fg reader, and may not general enough to `HoodieRecord`, e.g., `getSchemaId`, `toBinary`.
   2) `BufferedRecord` will be cached and serialized into `ExternalSpillableMap`, and it's known that the perf bottleneck of compaction lies in the spilling of `ExternalSpillableMap`, so we tries to make the caching record simple and cleaner enough to save more space and reduce spilling. We've run a microbenchmark for the PR, and 50%+ memory for `ExternalSpillableMap` in FG reader are saved.



-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [HUDI-9318] Refactor the log records presentation in FileGroupRecordBuffer [hudi]

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #13225:
URL: https://github.com/apache/hudi/pull/13225#issuecomment-2833905486

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "cea90417b10a3f7834eef28dcd1ff47e8e09b8e4",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5162",
       "triggerID" : "cea90417b10a3f7834eef28dcd1ff47e8e09b8e4",
       "triggerType" : "PUSH"
     }, {
       "hash" : "a66eb0f382ef9312dddc8b20a2fc3e3722919846",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5169",
       "triggerID" : "a66eb0f382ef9312dddc8b20a2fc3e3722919846",
       "triggerType" : "PUSH"
     }, {
       "hash" : "511e81809c5a967e1fceccad46ad33e260e2ecd2",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5173",
       "triggerID" : "511e81809c5a967e1fceccad46ad33e260e2ecd2",
       "triggerType" : "PUSH"
     }, {
       "hash" : "f82a01fae4e8eac22291c2e4476345dd4ab7679d",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "f82a01fae4e8eac22291c2e4476345dd4ab7679d",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * a66eb0f382ef9312dddc8b20a2fc3e3722919846 Azure: [SUCCESS](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5169) 
   * 511e81809c5a967e1fceccad46ad33e260e2ecd2 Azure: [PENDING](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5173) 
   * f82a01fae4e8eac22291c2e4476345dd4ab7679d UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [HUDI-9318] Refactor the log records presentation in FileGroupRecordBuffer [hudi]

Posted by "danny0405 (via GitHub)" <gi...@apache.org>.
danny0405 merged PR #13225:
URL: https://github.com/apache/hudi/pull/13225


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [HUDI-9318] Refactor the log records presentation in FileGroupRecordBuffer [hudi]

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #13225:
URL: https://github.com/apache/hudi/pull/13225#issuecomment-2833342699

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "cea90417b10a3f7834eef28dcd1ff47e8e09b8e4",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5162",
       "triggerID" : "cea90417b10a3f7834eef28dcd1ff47e8e09b8e4",
       "triggerType" : "PUSH"
     }, {
       "hash" : "a66eb0f382ef9312dddc8b20a2fc3e3722919846",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5169",
       "triggerID" : "a66eb0f382ef9312dddc8b20a2fc3e3722919846",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * cea90417b10a3f7834eef28dcd1ff47e8e09b8e4 Azure: [SUCCESS](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5162) 
   * a66eb0f382ef9312dddc8b20a2fc3e3722919846 Azure: [PENDING](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5169) 
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [HUDI-9318] Refactor the log records presentation in FileGroupRecordBuffer [hudi]

Posted by "zhangyue19921010 (via GitHub)" <gi...@apache.org>.
zhangyue19921010 commented on code in PR #13225:
URL: https://github.com/apache/hudi/pull/13225#discussion_r2061325941


##########
hudi-common/src/main/java/org/apache/hudi/common/table/read/BufferedRecord.java:
##########
@@ -0,0 +1,110 @@
+/*
+ * 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.common.table.read;
+
+import org.apache.hudi.common.engine.HoodieReaderContext;
+import org.apache.hudi.common.model.DeleteRecord;
+import org.apache.hudi.common.model.HoodieKey;
+import org.apache.hudi.common.model.HoodieRecord;
+import org.apache.hudi.common.util.Option;
+import org.apache.hudi.exception.HoodieException;
+
+import org.apache.avro.Schema;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.Properties;
+
+import static org.apache.hudi.common.model.HoodieRecord.DEFAULT_ORDERING_VALUE;
+
+/**
+ * Buffered Record used by file group reader.
+ *
+ * @param <T> The type of the engine specific row.
+ */
+public class BufferedRecord<T> implements Serializable {

Review Comment:
   We already have `HoodieRecord`. Why we still need a new `BufferedRecord`



##########
hudi-common/src/main/java/org/apache/hudi/avro/HoodieAvroReaderContext.java:
##########
@@ -160,24 +161,27 @@ public String getRecordKey(IndexedRecord record, Schema schema) {
   }
 
   @Override
-  public HoodieRecord constructHoodieRecord(
-      Option<IndexedRecord> recordOpt,
-      Map<String, Object> metadataMap) {
-    if (!recordOpt.isPresent()) {
+  public HoodieRecord<IndexedRecord> constructHoodieRecord(BufferedRecord<IndexedRecord> bufferedRecord) {
+    if (bufferedRecord.isDelete()) {
       return SpillableMapUtils.generateEmptyPayload(
-          (String) metadataMap.get(INTERNAL_META_RECORD_KEY),
-          (String) metadataMap.get(INTERNAL_META_PARTITION_PATH),
-          (Comparable<?>) metadataMap.get(INTERNAL_META_ORDERING_FIELD),
+          bufferedRecord.getRecordKey(),
+          null,

Review Comment:
   Why we no longer need metadataMap.get(INTERNAL_META_PARTITION_PATH) information?



##########
hudi-common/src/main/java/org/apache/hudi/common/model/HoodieRecord.java:
##########
@@ -211,7 +213,14 @@ public HoodieOperation getOperation() {
     return operation;
   }
 
-  public abstract Comparable<?> getOrderingValue(Schema recordSchema, Properties props);
+  public Comparable<?> getOrderingValue(Schema recordSchema, Properties props) {
+    if (orderingValue == null) {
+      orderingValue = doGetOrderingValue(recordSchema, props);
+    }
+    return orderingValue;
+  }
+
+  protected abstract Comparable<?> doGetOrderingValue(Schema recordSchema, Properties props);

Review Comment:
   could u add java doc to explain the difference between `doGetOrderingValue` and `getOrderingValue` to avoid confusing. maybe we can rename to something like `extractOrderingValueFromData`?



##########
hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/common/model/HoodieSparkRecord.java:
##########
@@ -89,6 +89,8 @@ public class HoodieSparkRecord extends HoodieRecord<InternalRow> {
    */
   private final transient StructType schema;
 
+  private transient Comparable<?> orderingValue;

Review Comment:
   A new variable `orderingValue` is defined, which seems to be used to cache the ordering value, but I don’t see where it is initialized or called.



##########
hudi-client/hudi-spark-client/src/main/scala/org/apache/hudi/BaseSparkInternalRowReaderContext.java:
##########
@@ -112,6 +112,15 @@ public InternalRow seal(InternalRow internalRow) {
     return internalRow.copy();
   }
 
+  @Override
+  public InternalRow toBinaryRow(Schema schema, InternalRow internalRow) {
+    if (internalRow instanceof UnsafeRow) {
+      return internalRow;
+    }
+    final UnsafeProjection unsafeProjection = HoodieInternalRowUtils.getCachedUnsafeProjection(schema);

Review Comment:
   In PR https://github.com/apache/hudi/pull/12949 we have an avro schema cache using Caffeine, which could improve  performance in HoodieInternalRowUtils.getCachedXXX,would do mind to take care of similar questions calling getCachedUnsafeProjection function?



-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [HUDI-9318] Refactor the log records presentation in FileGroupRecordBuffer [hudi]

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #13225:
URL: https://github.com/apache/hudi/pull/13225#issuecomment-2831781789

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "cea90417b10a3f7834eef28dcd1ff47e8e09b8e4",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5162",
       "triggerID" : "cea90417b10a3f7834eef28dcd1ff47e8e09b8e4",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * cea90417b10a3f7834eef28dcd1ff47e8e09b8e4 Azure: [PENDING](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5162) 
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [HUDI-9318] Refactor the log records presentation in FileGroupRecordBuffer [hudi]

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #13225:
URL: https://github.com/apache/hudi/pull/13225#issuecomment-2833951455

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "cea90417b10a3f7834eef28dcd1ff47e8e09b8e4",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5162",
       "triggerID" : "cea90417b10a3f7834eef28dcd1ff47e8e09b8e4",
       "triggerType" : "PUSH"
     }, {
       "hash" : "a66eb0f382ef9312dddc8b20a2fc3e3722919846",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5169",
       "triggerID" : "a66eb0f382ef9312dddc8b20a2fc3e3722919846",
       "triggerType" : "PUSH"
     }, {
       "hash" : "511e81809c5a967e1fceccad46ad33e260e2ecd2",
       "status" : "CANCELED",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5173",
       "triggerID" : "511e81809c5a967e1fceccad46ad33e260e2ecd2",
       "triggerType" : "PUSH"
     }, {
       "hash" : "f82a01fae4e8eac22291c2e4476345dd4ab7679d",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5176",
       "triggerID" : "f82a01fae4e8eac22291c2e4476345dd4ab7679d",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 511e81809c5a967e1fceccad46ad33e260e2ecd2 Azure: [CANCELED](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5173) 
   * f82a01fae4e8eac22291c2e4476345dd4ab7679d Azure: [PENDING](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5176) 
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [HUDI-9318] Refactor the log records presentation in FileGroupRecordBuffer [hudi]

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #13225:
URL: https://github.com/apache/hudi/pull/13225#issuecomment-2831826336

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "cea90417b10a3f7834eef28dcd1ff47e8e09b8e4",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5162",
       "triggerID" : "cea90417b10a3f7834eef28dcd1ff47e8e09b8e4",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * cea90417b10a3f7834eef28dcd1ff47e8e09b8e4 Azure: [SUCCESS](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5162) 
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [HUDI-9318] Refactor the log records presentation in FileGroupRecordBuffer [hudi]

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #13225:
URL: https://github.com/apache/hudi/pull/13225#issuecomment-2831781045

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "cea90417b10a3f7834eef28dcd1ff47e8e09b8e4",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "cea90417b10a3f7834eef28dcd1ff47e8e09b8e4",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * cea90417b10a3f7834eef28dcd1ff47e8e09b8e4 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [HUDI-9318] Refactor the log records presentation in FileGroupRecordBuffer [hudi]

Posted by "danny0405 (via GitHub)" <gi...@apache.org>.
danny0405 commented on code in PR #13225:
URL: https://github.com/apache/hudi/pull/13225#discussion_r2061250971


##########
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/table/format/FlinkRowDataReaderContext.java:
##########
@@ -148,35 +149,26 @@ public String getRecordKey(RowData record, Schema schema) {
   }
 
   @Override
-  public HoodieRecord<RowData> constructHoodieRecord(Option<RowData> recordOption, Map<String, Object> metadataMap) {
-    HoodieKey hoodieKey = new HoodieKey(
-        (String) metadataMap.get(INTERNAL_META_RECORD_KEY),
-        (String) metadataMap.get(INTERNAL_META_PARTITION_PATH));
-    RowData rowData = recordOption.get();
+  public HoodieRecord<RowData> constructHoodieRecord(BufferedRecord<RowData> bufferedRecord) {
+    HoodieKey hoodieKey = new HoodieKey(bufferedRecord.getRecordKey(), null);
     // delete record
-    if (recordOption.isEmpty()) {
-      Comparable orderingValue;
-      if (metadataMap.containsKey(INTERNAL_META_ORDERING_FIELD)) {
-        orderingValue = (Comparable) metadataMap.get(INTERNAL_META_ORDERING_FIELD);
-      } else {
-        throw new HoodieException("There should be ordering value in metadataMap.");
-      }
+    if (bufferedRecord.isDelete()) {
+      Comparable orderingValue = bufferedRecord.getOrderingValue();
       return new HoodieEmptyRecord<>(hoodieKey, HoodieOperation.DELETE, orderingValue, HoodieRecord.HoodieRecordType.FLINK);
     }
-    return new HoodieFlinkRecord(hoodieKey, rowData);
+    return new HoodieFlinkRecord(hoodieKey, bufferedRecord.getRecord());

Review Comment:
   do we need to set up the ordering value to avoid redundant computation in the merger.



-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [HUDI-9318] Refactor the log records presentation in FileGroupRecordBuffer [hudi]

Posted by "danny0405 (via GitHub)" <gi...@apache.org>.
danny0405 commented on code in PR #13225:
URL: https://github.com/apache/hudi/pull/13225#discussion_r2061251125


##########
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/table/format/FlinkRowDataReaderContext.java:
##########
@@ -190,6 +182,18 @@ public RowData seal(RowData rowData) {
     return rowDataSerializer.copy(rowData);
   }
 
+  @Override
+  public RowData toBinaryRow(Schema avroSchema, RowData record) {
+    if (record instanceof BinaryRowData) {
+      return record;
+    }
+    if (rowDataSerializer == null) {
+      RowType requiredRowType = (RowType) RowDataAvroQueryContexts.fromAvroSchema(getSchemaHandler().getRequiredSchema()).getRowType().getLogicalType();

Review Comment:
   should we use `avroSchema` 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.

To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [HUDI-9318] Refactor the log records presentation in FileGroupRecordBuffer [hudi]

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #13225:
URL: https://github.com/apache/hudi/pull/13225#issuecomment-2833886215

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "cea90417b10a3f7834eef28dcd1ff47e8e09b8e4",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5162",
       "triggerID" : "cea90417b10a3f7834eef28dcd1ff47e8e09b8e4",
       "triggerType" : "PUSH"
     }, {
       "hash" : "a66eb0f382ef9312dddc8b20a2fc3e3722919846",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5169",
       "triggerID" : "a66eb0f382ef9312dddc8b20a2fc3e3722919846",
       "triggerType" : "PUSH"
     }, {
       "hash" : "511e81809c5a967e1fceccad46ad33e260e2ecd2",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "511e81809c5a967e1fceccad46ad33e260e2ecd2",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * a66eb0f382ef9312dddc8b20a2fc3e3722919846 Azure: [SUCCESS](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5169) 
   * 511e81809c5a967e1fceccad46ad33e260e2ecd2 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [HUDI-9318] Refactor the log records presentation in FileGroupRecordBuffer [hudi]

Posted by "cshuo (via GitHub)" <gi...@apache.org>.
cshuo commented on code in PR #13225:
URL: https://github.com/apache/hudi/pull/13225#discussion_r2061317968


##########
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/table/format/FlinkRowDataReaderContext.java:
##########
@@ -148,35 +149,26 @@ public String getRecordKey(RowData record, Schema schema) {
   }
 
   @Override
-  public HoodieRecord<RowData> constructHoodieRecord(Option<RowData> recordOption, Map<String, Object> metadataMap) {
-    HoodieKey hoodieKey = new HoodieKey(
-        (String) metadataMap.get(INTERNAL_META_RECORD_KEY),
-        (String) metadataMap.get(INTERNAL_META_PARTITION_PATH));
-    RowData rowData = recordOption.get();
+  public HoodieRecord<RowData> constructHoodieRecord(BufferedRecord<RowData> bufferedRecord) {
+    HoodieKey hoodieKey = new HoodieKey(bufferedRecord.getRecordKey(), null);
     // delete record
-    if (recordOption.isEmpty()) {
-      Comparable orderingValue;
-      if (metadataMap.containsKey(INTERNAL_META_ORDERING_FIELD)) {
-        orderingValue = (Comparable) metadataMap.get(INTERNAL_META_ORDERING_FIELD);
-      } else {
-        throw new HoodieException("There should be ordering value in metadataMap.");
-      }
+    if (bufferedRecord.isDelete()) {
+      Comparable orderingValue = bufferedRecord.getOrderingValue();
       return new HoodieEmptyRecord<>(hoodieKey, HoodieOperation.DELETE, orderingValue, HoodieRecord.HoodieRecordType.FLINK);
     }
-    return new HoodieFlinkRecord(hoodieKey, rowData);
+    return new HoodieFlinkRecord(hoodieKey, bufferedRecord.getRecord());

Review Comment:
   Ok, we can do it now that there are ordering value in `BufferedRecord`.



##########
hudi-client/hudi-spark-client/src/main/scala/org/apache/hudi/BaseSparkInternalRowReaderContext.java:
##########
@@ -112,6 +112,15 @@ public InternalRow seal(InternalRow internalRow) {
     return internalRow.copy();
   }
 
+  @Override
+  public InternalRow toBinaryRow(Schema schema, InternalRow internalRow) {
+    if (internalRow instanceof UnsafeRow) {
+      return internalRow;
+    }
+    final UnsafeProjection unsafeProjection = HoodieInternalRowUtils.getCachedUnsafeProjection(schema);

Review Comment:
   Thks for reminding, `schema` here is decoded from `HoodieReaderContext#decodeAvroSchema`, which is already interned by `AvroSchemaCache#intern` introduced in #12949.



##########
hudi-client/hudi-flink-client/src/main/java/org/apache/hudi/client/model/HoodieFlinkRecord.java:
##########
@@ -170,11 +166,11 @@ public HoodieRecord prependMetaFields(Schema recordSchema, Schema targetSchema,
 
   @Override
   public HoodieRecord updateMetaField(Schema recordSchema, int ordinal, String value) {
-    ValidationUtils.checkArgument(recordSchema.getField(RECORD_KEY_METADATA_FIELD) != null,
-        "The record is expected to contain metadata fields.");
-    GenericRowData rowData = (GenericRowData) getData();
-    rowData.setField(ordinal, StringData.fromString(value));
-    return this;
+    String[] metaVals = new String[HoodieRecord.HOODIE_META_COLUMNS.size()];
+    metaVals[ordinal] = value;
+    boolean withOperation = recordSchema.getField(OPERATION_METADATA_FIELD) != null;
+    RowData rowData = new HoodieRowDataWithPartialMetaFields(metaVals, Collections.singleton(ordinal), getData(), withOperation);

Review Comment:
   Yes, all meta fields will be kept, but only `FILENAME_METADATA_FIELD` is updated per record during compaction. 



##########
hudi-common/src/main/java/org/apache/hudi/common/model/HoodieRecord.java:
##########
@@ -211,7 +213,14 @@ public HoodieOperation getOperation() {
     return operation;
   }
 
-  public abstract Comparable<?> getOrderingValue(Schema recordSchema, Properties props);
+  public Comparable<?> getOrderingValue(Schema recordSchema, Properties props) {
+    if (orderingValue == null) {
+      orderingValue = doGetOrderingValue(recordSchema, props);
+    }
+    return orderingValue;
+  }
+
+  protected abstract Comparable<?> doGetOrderingValue(Schema recordSchema, Properties props);

Review Comment:
   will add some doc.



##########
hudi-common/src/main/java/org/apache/hudi/avro/HoodieAvroReaderContext.java:
##########
@@ -160,24 +161,27 @@ public String getRecordKey(IndexedRecord record, Schema schema) {
   }
 
   @Override
-  public HoodieRecord constructHoodieRecord(
-      Option<IndexedRecord> recordOpt,
-      Map<String, Object> metadataMap) {
-    if (!recordOpt.isPresent()) {
+  public HoodieRecord<IndexedRecord> constructHoodieRecord(BufferedRecord<IndexedRecord> bufferedRecord) {
+    if (bufferedRecord.isDelete()) {
       return SpillableMapUtils.generateEmptyPayload(
-          (String) metadataMap.get(INTERNAL_META_RECORD_KEY),
-          (String) metadataMap.get(INTERNAL_META_PARTITION_PATH),
-          (Comparable<?>) metadataMap.get(INTERNAL_META_ORDERING_FIELD),
+          bufferedRecord.getRecordKey(),
+          null,

Review Comment:
   see more context herer: https://github.com/apache/hudi/pull/13213#discussion_r2056133806



##########
hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/common/model/HoodieSparkRecord.java:
##########
@@ -89,6 +89,8 @@ public class HoodieSparkRecord extends HoodieRecord<InternalRow> {
    */
   private final transient StructType schema;
 
+  private transient Comparable<?> orderingValue;

Review Comment:
   Yes, this field is added by mistake during rebasing & resolve conflicts..will remove it.



##########
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/table/format/FlinkRowDataReaderContext.java:
##########
@@ -190,6 +182,18 @@ public RowData seal(RowData rowData) {
     return rowDataSerializer.copy(rowData);
   }
 
+  @Override
+  public RowData toBinaryRow(Schema avroSchema, RowData record) {
+    if (record instanceof BinaryRowData) {
+      return record;
+    }
+    if (rowDataSerializer == null) {
+      RowType requiredRowType = (RowType) RowDataAvroQueryContexts.fromAvroSchema(getSchemaHandler().getRequiredSchema()).getRowType().getLogicalType();

Review Comment:
   Yes, schema per record should be used.



##########
hudi-common/src/main/java/org/apache/hudi/common/table/read/BufferedRecord.java:
##########
@@ -0,0 +1,110 @@
+/*
+ * 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.common.table.read;
+
+import org.apache.hudi.common.engine.HoodieReaderContext;
+import org.apache.hudi.common.model.DeleteRecord;
+import org.apache.hudi.common.model.HoodieKey;
+import org.apache.hudi.common.model.HoodieRecord;
+import org.apache.hudi.common.util.Option;
+import org.apache.hudi.exception.HoodieException;
+
+import org.apache.avro.Schema;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.Properties;
+
+import static org.apache.hudi.common.model.HoodieRecord.DEFAULT_ORDERING_VALUE;
+
+/**
+ * Buffered Record used by file group reader.
+ *
+ * @param <T> The type of the engine specific row.
+ */
+public class BufferedRecord<T> implements Serializable {

Review Comment:
   `BufferedRecord` is introduced for merging and caching purpose in file group reader:
   1) there exists different apis between `BufferedRecord` and `HoodieRecord`, these changes are specific for fg reader, and may not general enough to `HoodieRecord`, e.g., `getSchemaId`, `toBinary`.
   2) `BufferedRecord` will be cached and serialized into `ExternalSpillableMap`, and it's known that the perf bottleneck of compaction lies in the spilling of `ExternalSpillableMap`, so we tries to make the caching record simple and cleaner enough to save more space and reduce spilling. We've run a microbenchmark for the PR, and 50%+ memory for `ExternalSpillableMap` are saved.



-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [HUDI-9318] Refactor the log records presentation in FileGroupRecordBuffer [hudi]

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #13225:
URL: https://github.com/apache/hudi/pull/13225#issuecomment-2833342042

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "cea90417b10a3f7834eef28dcd1ff47e8e09b8e4",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5162",
       "triggerID" : "cea90417b10a3f7834eef28dcd1ff47e8e09b8e4",
       "triggerType" : "PUSH"
     }, {
       "hash" : "a66eb0f382ef9312dddc8b20a2fc3e3722919846",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "a66eb0f382ef9312dddc8b20a2fc3e3722919846",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * cea90417b10a3f7834eef28dcd1ff47e8e09b8e4 Azure: [SUCCESS](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5162) 
   * a66eb0f382ef9312dddc8b20a2fc3e3722919846 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [HUDI-9318] Refactor the log records presentation in FileGroupRecordBuffer [hudi]

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #13225:
URL: https://github.com/apache/hudi/pull/13225#issuecomment-2833376154

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "cea90417b10a3f7834eef28dcd1ff47e8e09b8e4",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5162",
       "triggerID" : "cea90417b10a3f7834eef28dcd1ff47e8e09b8e4",
       "triggerType" : "PUSH"
     }, {
       "hash" : "a66eb0f382ef9312dddc8b20a2fc3e3722919846",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5169",
       "triggerID" : "a66eb0f382ef9312dddc8b20a2fc3e3722919846",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * a66eb0f382ef9312dddc8b20a2fc3e3722919846 Azure: [SUCCESS](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5169) 
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [HUDI-9318] Refactor the log records presentation in FileGroupRecordBuffer [hudi]

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #13225:
URL: https://github.com/apache/hudi/pull/13225#issuecomment-2833887522

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "cea90417b10a3f7834eef28dcd1ff47e8e09b8e4",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5162",
       "triggerID" : "cea90417b10a3f7834eef28dcd1ff47e8e09b8e4",
       "triggerType" : "PUSH"
     }, {
       "hash" : "a66eb0f382ef9312dddc8b20a2fc3e3722919846",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5169",
       "triggerID" : "a66eb0f382ef9312dddc8b20a2fc3e3722919846",
       "triggerType" : "PUSH"
     }, {
       "hash" : "511e81809c5a967e1fceccad46ad33e260e2ecd2",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5173",
       "triggerID" : "511e81809c5a967e1fceccad46ad33e260e2ecd2",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * a66eb0f382ef9312dddc8b20a2fc3e3722919846 Azure: [SUCCESS](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5169) 
   * 511e81809c5a967e1fceccad46ad33e260e2ecd2 Azure: [PENDING](https://dev.azure.com/apachehudi/a1a51da7-8592-47d4-88dc-fd67bed336bb/_build/results?buildId=5173) 
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [HUDI-9318] Refactor the log records presentation in FileGroupRecordBuffer [hudi]

Posted by "danny0405 (via GitHub)" <gi...@apache.org>.
danny0405 commented on code in PR #13225:
URL: https://github.com/apache/hudi/pull/13225#discussion_r2062922529


##########
hudi-client/hudi-flink-client/src/main/java/org/apache/hudi/client/model/HoodieFlinkRecord.java:
##########
@@ -170,11 +165,11 @@ public HoodieRecord prependMetaFields(Schema recordSchema, Schema targetSchema,
 
   @Override
   public HoodieRecord updateMetaField(Schema recordSchema, int ordinal, String value) {
-    ValidationUtils.checkArgument(recordSchema.getField(RECORD_KEY_METADATA_FIELD) != null,
-        "The record is expected to contain metadata fields.");
-    GenericRowData rowData = (GenericRowData) getData();
-    rowData.setField(ordinal, StringData.fromString(value));
-    return this;
+    String[] metaVals = new String[HoodieRecord.HOODIE_META_COLUMNS.size()];

Review Comment:
   do we still need the array here?



-- 
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: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org