hudi-agent commented on code in PR #19837:
URL: https://github.com/apache/hudi/pull/19837#discussion_r3934243032


##########
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/sink/partitioner/index/RecordLevelIndexBackend.java:
##########
@@ -163,6 +169,24 @@ private BucketCache getOrBootstrapPartition(String 
partitionPath) {
     return cache;
   }
 
+  /**
+   * Returns the partition cache, creating an empty one without scanning the 
persisted index if it
+   * does not exist yet.
+   *
+   * <p>Used for preloaded mappings that are already known to be complete for 
the partition, e.g. one
+   * emitted by a bootstrap operator that has already scanned the persisted 
index upstream.
+   */
+  private BucketCache getOrCreatePartitionCache(String partitionPath) {

Review Comment:
   🤖 nit: `getOrCreatePartitionCache` and the existing 
`getOrBootstrapPartition` are both get-or-create helpers for the same cache 
map, but their names signal completely different operations ("create" vs 
"bootstrap a partition"). Something like `getOrCreateEmptyPartitionCache` vs 
`getOrLoadPartitionCache` (or similar parallel pair) would make it clearer at 
the call site which one scans the persisted index and which doesn't.
   
   <sub><i>⚠️ AI-generated; verify before applying. React 👍/👎 to flag 
quality.</i></sub>



##########
hudi-flink-datasource/hudi-flink/src/main/java/org/apache/hudi/sink/partitioner/DynamicBucketAssignFunction.java:
##########
@@ -118,6 +123,14 @@ private boolean isRecordKeyOfThisTask(String recordKey) {
 
   @Override
   public void processElement(HoodieFlinkInternalRow record, Context ctx, 
Collector<HoodieFlinkInternalRow> out) throws Exception {
+    if (record.isIndexRecord()) {
+      // Applies a preloaded index record emitted by a bootstrap operator 
directly to the partitioned

Review Comment:
   🤖 nit: this 3-line comment largely restates what the class-level Javadoc 
(just added above) already says about index records — could you trim it to 
something like `// preloaded index record: mapping already known, skip bucket 
assignment and do not emit` to avoid the repetition?
   
   <sub><i>⚠️ AI-generated; verify before applying. React 👍/👎 to flag 
quality.</i></sub>



-- 
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]

Reply via email to