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


##########
hudi-flink-datasource/hudi-flink/src/test/java/org/apache/hudi/utils/TestCompactionUtil.java:
##########
@@ -171,6 +173,27 @@ void testInferMetadataConf(boolean metadataEnabled) throws 
Exception {
         this.conf.get(FlinkOptions.METADATA_ENABLED), is(metadataEnabled));
   }
 
+  @Test
+  void testInferTableConfiguration() throws Exception {
+    beforeEach();
+    Configuration inferred = new Configuration();
+
+    CompactionUtil.setOrderingFields(inferred, metaClient);
+    CompactionUtil.setPartitionField(inferred, metaClient);
+
+    assertEquals("ts", inferred.get(FlinkOptions.ORDERING_FIELDS));
+    assertEquals("partition", inferred.get(FlinkOptions.PARTITION_PATH_FIELD));
+  }
+
+  @Test

Review Comment:
   🤖 nit: `testCompactionSequence` doesn't really describe what's being tested 
— it asserts constructor instantiation, a null-safe 
`scheduleMetadataCompaction` call, and `isLIFO` case-insensitivity, which 
aren't related to a "sequence". Could you split these into focused tests (e.g. 
`testIsLIFOCaseInsensitive`) or at least rename to something like 
`testUtilityMethodsSmoke`?
   
   <sub><i>⚠️ AI-generated; verify before applying. React 👍/👎 to flag 
quality.</i></sub>



##########
hudi-flink-datasource/hudi-flink/src/test/java/org/apache/hudi/util/TestDataTypeUtils.java:
##########
@@ -81,4 +94,126 @@ public void testToHoodieSchema() {
     assertEquals(HoodieSchemaType.STRING,
         
requiredSchema.getField("missing").get().schema().getNonNullType().getType());
   }
+
+  @Test
+  void testTypePredicatesAndPrecision() {
+    assertTrue(DataTypeUtils.isTimestampType(DataTypes.TIMESTAMP(3)));
+    assertFalse(DataTypeUtils.isTimestampType(DataTypes.TIMESTAMP_LTZ(3)));
+    assertTrue(DataTypeUtils.isDateType(DataTypes.DATE()));
+    assertTrue(DataTypeUtils.isDatetimeType(DataTypes.DATE()));
+    assertTrue(DataTypeUtils.isDatetimeType(DataTypes.TIMESTAMP(3)));
+    assertFalse(DataTypeUtils.isDatetimeType(DataTypes.STRING()));
+    assertEquals(3, 
DataTypeUtils.precision(DataTypes.TIMESTAMP(3).getLogicalType()));
+    assertEquals(6, 
DataTypeUtils.precision(DataTypes.TIMESTAMP_LTZ(6).getLogicalType()));
+    assertThrows(AssertionError.class,
+        () -> DataTypeUtils.precision(DataTypes.STRING().getLogicalType()));
+    assertTrue(DataTypeUtils.isFamily(
+        DataTypes.INT().getLogicalType(), LogicalTypeFamily.NUMERIC));
+  }
+
+  @Test
+  void testRowTypeProjectionUtilities() {
+    Schema schema = Schema.newBuilder()
+        .column("id", DataTypes.INT())
+        .column("name", DataTypes.STRING())
+        .columnByExpression("computed", "id + 1")
+        .build();
+    RowType rowType = DataTypeUtils.toRowType(schema);
+
+    assertEquals(Arrays.asList("id", "name"), rowType.getFieldNames());
+    RowType projected = (RowType) DataTypes.ROW(
+        DataTypes.FIELD("name", DataTypes.STRING()),
+        DataTypes.FIELD("id", DataTypes.INT()))
+        .getLogicalType();
+    assertArrayEquals(new int[] {1, 0}, DataTypeUtils.projectOrdinals(rowType, 
projected));
+    assertEquals(Arrays.asList("name", "id"), Arrays.asList(
+        DataTypeUtils.projectRowFields(rowType, new String[] {"name", 
"id"})[0].getName(),
+        DataTypeUtils.projectRowFields(rowType, new String[] {"name", 
"id"})[1].getName()));
+  }
+
+  @Test
+  void testResolvePartitionValues() {
+    assertEquals("value", DataTypeUtils.resolvePartition("value", 
DataTypes.STRING()));
+    assertEquals(true, DataTypeUtils.resolvePartition("true", 
DataTypes.BOOLEAN()));
+    assertEquals((byte) 1, DataTypeUtils.resolvePartition("1", 
DataTypes.TINYINT()));
+    assertEquals((short) 2, DataTypeUtils.resolvePartition("2", 
DataTypes.SMALLINT()));
+    assertEquals(3, DataTypeUtils.resolvePartition("3", DataTypes.INT()));
+    assertEquals(4L, DataTypeUtils.resolvePartition("4", DataTypes.BIGINT()));
+    assertEquals(1.5F, DataTypeUtils.resolvePartition("1.5", 
DataTypes.FLOAT()));
+    assertEquals(2.5D, DataTypeUtils.resolvePartition("2.5", 
DataTypes.DOUBLE()));
+    assertEquals(LocalDate.of(2026, 8, 6),
+        DataTypeUtils.resolvePartition("2026-08-06", DataTypes.DATE()));
+    assertEquals(LocalDateTime.of(2026, 8, 6, 12, 30),
+        DataTypeUtils.resolvePartition("2026-08-06T12:30:00", 
DataTypes.TIMESTAMP()));
+    assertEquals(new BigDecimal("12.30"),

Review Comment:
   🤖 nit: `assertEquals(null, ...)` could be 
`assertNull(DataTypeUtils.resolvePartition(null, DataTypes.STRING()))` — 
clearer intent and better failure messages.
   
   <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