emkornfield commented on code in PR #15283:
URL: https://github.com/apache/iceberg/pull/15283#discussion_r2990942763


##########
kafka-connect/kafka-connect/src/test/java/org/apache/iceberg/connect/data/TestRecordConverter.java:
##########
@@ -881,6 +888,203 @@ public void testEvolveTypeDetectionStructNested() {
     assertThat(updateMap.get("st.ff").type()).isInstanceOf(DoubleType.class);
   }
 
+  private RecordConverter variantConverter() {
+    Table table = mock(Table.class);
+    when(table.schema()).thenReturn(VARIANT_SCHEMA);
+    return new RecordConverter(table, config);
+  }
+
+  @Test
+  public void testConvertVariantValueFromNull() {
+    Variant variant = variantConverter().convertVariantValue(null);
+    assertThat(variant).isNotNull();
+    assertThat(variant.value().type()).isEqualTo(PhysicalType.NULL);
+  }
+
+  @Test
+  public void testConvertVariantValueFromPrimitiveString() {
+    Variant variant = variantConverter().convertVariantValue("hello");
+    assertThat(variant).isNotNull();
+    assertThat(variant.metadata()).isNotNull();
+    assertThat(variant.metadata().dictionarySize()).isEqualTo(0);
+    assertThat(variant.value().type()).isEqualTo(PhysicalType.STRING);
+    assertThat(variant.value().asPrimitive().get()).isEqualTo("hello");
+  }
+
+  @Test
+  public void testConvertVariantValueFromPrimitiveNumber() {
+    Variant variant = variantConverter().convertVariantValue(123);
+    assertThat(variant).isNotNull();
+    assertThat(variant.metadata().dictionarySize()).isEqualTo(0);
+    assertThat(variant.value().type()).isEqualTo(PhysicalType.INT32);
+    assertThat(variant.value().asPrimitive().get()).isEqualTo(123);
+  }
+
+  @Test
+  public void testConvertVariantValueFromBoolean() {
+    Variant variant = variantConverter().convertVariantValue(true);
+    assertThat(variant).isNotNull();
+    assertThat(variant.value().type()).isEqualTo(PhysicalType.BOOLEAN_TRUE);
+    assertThat(variant.value().asPrimitive().get()).isEqualTo(true);
+  }
+
+  @Test

Review Comment:
   does this test add any value of the test below?



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to