kubaugust commented on code in PR #11817:
URL: https://github.com/apache/nifi/pull/11817#discussion_r4323895194
##########
nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/json/TestJsonSchemaInference.java:
##########
@@ -178,17 +182,43 @@ public void testNestedChoiceOfEmptyOrStringArray() throws
IOException {
assertSame(RecordFieldType.STRING, arrayElementType.getFieldType());
}
+ @Test
+ void testDeeplyNestedNonWiderRecordsCompleteQuickly() {
+ final String json = "[{\"doc\":[" + createNestedJson("a", 40) + "," +
createNestedJson("b", 40) + "]}]";
+
+ final RecordSchema schema =
assertTimeoutPreemptively(Duration.ofSeconds(10),
+ () -> inferSchema(new
ByteArrayInputStream(json.getBytes(StandardCharsets.UTF_8))));
+
+ final DataType elementType = ((ArrayDataType)
schema.getDataType("doc").get()).getElementType();
+ assertEquals(List.of("content", "a", "b"), ((RecordDataType)
elementType).getChildSchema().getFieldNames());
+ }
+
+ @Test
+ void testNestedRecordWithSupersetOfFieldsKeepsItsFieldOrder() throws
IOException {
Review Comment:
Removed. My initial approach could in fact change the output fields order,
so I wanted to make sure that I don't break anything. But now with the changed
approach, I think it's safe to remove
--
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]