aihuaxu commented on code in PR #11324: URL: https://github.com/apache/iceberg/pull/11324#discussion_r1825983981
########## api/src/test/java/org/apache/iceberg/TestAccessors.java: ########## @@ -247,4 +252,70 @@ public void testEmptySchema() { Schema emptySchema = new Schema(); assertThat(emptySchema.accessorForField(17)).isNull(); } + + @Test + public void testVariant() throws JsonProcessingException { + Base64.Encoder encoder = Base64.getEncoder(); + boolean expectedTrue = true; + boolean expectedFalse = false; + int expectedInt = 2147483647; + long expectedLong = 2147483648L; + float expectedFloat = 1.2345f; + double expectedDouble = 1.23456; + BigDecimal expectedDecimal = new BigDecimal(123456); + String expectedString = "abc"; + String expectedBytes = + new String(encoder.encode(expectedString.getBytes()), StandardCharsets.UTF_8); + int nestInt = 10; + + String json = + "{\"false\":" + + expectedFalse + + ", \"true\":" + + expectedTrue + + ", \"string\": \"" + + expectedString + + "\"," + + "\"int\":" + + expectedInt + + "," + + "\"long\":" + + expectedLong + + ", \"float\":" + + expectedFloat + + "," + + "\"double\":" + + expectedDouble + + ", \"bytes\":\"" + + expectedBytes + + "\", \"decimal\":" + + expectedDecimal + + "," + + "\"nest1\": {\"nest2\":" + + nestInt + + "}" + + "}"; + + VariantLike variant = JsonVariant.of(json); + assertAccessorReturns(Types.VariantType.get(), variant); Review Comment: I removed JsonVariant for now and also this test now. -- 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: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org