maltesander commented on code in PR #11387:
URL: https://github.com/apache/nifi/pull/11387#discussion_r3563223213


##########
nifi-extension-bundles/nifi-iceberg-bundle/nifi-iceberg-processors/src/test/java/org/apache/nifi/processors/iceberg/record/DelegatedRecordTest.java:
##########
@@ -135,4 +139,88 @@ void testGetTimestampDateTimeFields() {
         final Object stopped = delegatedRecord.getField(STOPPED_FIELD);
         assertEquals(STOPPED_CONVERTED, stopped);
     }
+
+    /**
+     * Iceberg writers read values positionally against the table struct, so 
position 0 must always return the value of
+     * the table's first column ("id"), independent of the field ordering in 
the incoming Record schema.
+     */
+    @Test
+    void testGetByPositionMatchesTableColumnNameRegardlessOfInputOrder() {
+        final Types.StructType structType = Types.StructType.of(
+                Types.NestedField.required(1, "id", Types.IntegerType.get()),
+                Types.NestedField.optional(2, "amount", 
Types.DecimalType.of(10, 2)),
+                Types.NestedField.optional(3, "label", Types.StringType.get())
+        );

Review Comment:
   Thank you for the feedback @exceptionfactory . I moved the hardcoded 
constants to static variables and tried reusing existing ones: 
https://github.com/apache/nifi/pull/11387/commits/fedc6d466688e1e9781586121e58f90ca2680126



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