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


##########
hudi-common/src/main/java/org/apache/hudi/common/schema/HoodieSchemaRepair.java:
##########
@@ -40,7 +40,7 @@
  *
  * <p>{@link #hasTimestampMillisField(HoodieSchema)} is the cheap pre-check 
used to decide whether the
  * repair is worth wiring in at all. Its sibling in the metadata-table domain 
is
- * {@code HoodieTableMetadataUtil#isTimestampMillisField}, which answers the 
same question for one field
+ * {@code HoodieSchemaUtils#isTimestampMillisField}, which answers the same 
question for one field

Review Comment:
   🤖 nit: the preceding sentence still says the sibling lives "in the 
metadata-table domain" — now that it's in `HoodieSchemaUtils`, it might be 
worth rewording to something like "Its per-field sibling is ...".
   
   <sub><i>⚠️ AI-generated; verify before applying. React 👍/👎 to flag 
quality.</i></sub>



##########
hudi-common/src/main/java/org/apache/hudi/common/schema/HoodieSchemaUtils.java:
##########
@@ -520,6 +520,51 @@ public static HoodieSchema 
generateProjectionSchema(HoodieSchema originalSchema,
     return HoodieSchema.createRecord(originalSchema.getName(), 
originalSchema.getNamespace().orElse(null), 
originalSchema.getDoc().orElse(null), projectedFields);
   }
 
+  /**
+   * Generate a reader schema off the provided writeSchema, to just project 
out the provided columns.
+   *
+   * <p>This overload is intended for callers that already have a 
name-to-field map,
+   * such as the realtime reader.</p>
+   *
+   * @param writeSchema      the source schema
+   * @param schemaFieldsMap  prebuilt case-insensitive field-name map
+   * @param fieldNames       the list of field names to include in the 
projection
+   * @param isError          whether the projected schema is an error schema
+   * @return new HoodieSchema containing only the specified fields
+   */
+  public static HoodieSchema generateProjectionSchema(HoodieSchema writeSchema,
+                                                      Map<String, 
HoodieSchemaField> schemaFieldsMap,
+                                                      List<String> fieldNames,
+                                                      boolean isError) {

Review Comment:
   🤖 nit: `isError` looks redundant since `writeSchema.isError()` is already 
available inside the method (which is what the original helper used) — could we 
drop the parameter and read it off `writeSchema` directly?
   
   <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