voonhous commented on code in PR #19810:
URL: https://github.com/apache/hudi/pull/19810#discussion_r3923982053
##########
hudi-common/src/test/java/org/apache/hudi/common/schema/TestHoodieSchemaUtils.java:
##########
@@ -2084,6 +2086,140 @@ public void
testGetNestedFieldComplexNestedMapAndArray() {
assertEquals(HoodieSchemaType.LONG,
result.get().getRight().schema().getType());
}
+ /**
+ * Record with a namespace, a record-level doc, a custom record prop,
per-field docs and a nested
+ * record - all of its top-level fields required.
+ */
+ private static HoodieSchema allRequiredPersonSchema() {
+ HoodieSchema address = HoodieSchema.createRecord(
+ "Address",
+ "ns.test",
+ "the address record",
+ Arrays.asList(
+ HoodieSchemaField.of("city",
HoodieSchema.create(HoodieSchemaType.STRING), "city doc", null),
+ HoodieSchemaField.of("zip",
HoodieSchema.create(HoodieSchemaType.INT), null, null)));
+ HoodieSchema schema = HoodieSchema.createRecord(
+ "Person",
+ "ns.test",
+ "the person record",
+ Arrays.asList(
+ HoodieSchemaField.of("id",
HoodieSchema.create(HoodieSchemaType.INT), "id doc", null),
+ HoodieSchemaField.of("name",
HoodieSchema.create(HoodieSchemaType.STRING), null, null),
+ HoodieSchemaField.of("address", address, "address doc", null)));
+ schema.addProp("hoodie.custom.prop", "custom-value");
+ return schema;
+ }
+
+ @Test
+ public void testAsNullableMakesEveryTopLevelFieldNullable() {
Review Comment:
Added `testAsNullablePinsTheInternalSchemaRoundTripLosses` in 4f9886f810fc:
a `default: 0` field comes back with a null default, an ENUM comes back STRING,
a `["string","null"]` union comes back null-first, and a VECTOR(3) column
survives with its dimension. The javadoc names the three losses (86382cd6e3a3).
--
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]