@Test public void testRecordWithinRecord() throws IOException { Schema originalSchema = readSchemaFromJsonFile("recordWithinRecord_original.json"); Schema expectedSchema = readSchemaFromJsonFile("recordWithinRecord_flattened.json"); Assert.assertEquals(new AvroFlattener().flatten(originalSchema, false), expectedSchema); }
public Schema flatten(Schema schema, boolean flattenComplexTypes) { Preconditions.checkNotNull(schema); this.flattenedNameJoiner = FLATTENED_NAME_JOINER; this.flattenedSourceJoiner = FLATTENED_SOURCE_JOINER; Schema flattenedSchema = flatten(schema, false, flattenComplexTypes); LOG.debug("Original Schema : " + schema); LOG.debug("Flattened Schema: " + flattenedSchema); return flattenedSchema; }
AvroFlattener { public Schema flatten(Schema schema, boolean flattenComplexTypes) { Preconditions.checkNotNull(schema); this.flattenedNameJoiner = FLATTENED_NAME_JOINER; this.flattenedSourceJoiner = FLATTENED_SOURCE_JOINER; Schema flattenedSchema = flatten(schema, false, flattenComplexTypes); LOG.debug("Original Schema : " + schema); LOG.debug("Flattened Schema: " + flattenedSchema); return flattenedSchema; } }
AvroFlattener { public Schema flatten(Schema schema, boolean flattenComplexTypes) { Preconditions.checkNotNull(schema); this.flattenedNameJoiner = FLATTENED_NAME_JOINER; this.flattenedSourceJoiner = FLATTENED_SOURCE_JOINER; Schema flattenedSchema = flatten(schema, false, flattenComplexTypes); LOG.debug("Original Schema : " + schema); LOG.debug("Flattened Schema: " + flattenedSchema); return flattenedSchema; }  }
AvroFlattener { public Schema flatten(Schema schema, boolean flattenComplexTypes) { Preconditions.checkNotNull(schema); this.flattenedNameJoiner = FLATTENED_NAME_JOINER; this.flattenedSourceJoiner = FLATTENED_SOURCE_JOINER; Schema flattenedSchema = flatten(schema, false, flattenComplexTypes); LOG.debug("Original Schema : " + schema); LOG.debug("Flattened Schema: " + flattenedSchema); return flattenedSchema; }  Schema flatten(Schema schema, boolean flattenComplexTypes); }
AvroFlattener { public Schema flatten(Schema schema, boolean flattenComplexTypes) { Preconditions.checkNotNull(schema); this.flattenedNameJoiner = FLATTENED_NAME_JOINER; this.flattenedSourceJoiner = FLATTENED_SOURCE_JOINER; Schema flattenedSchema = flatten(schema, false, flattenComplexTypes); LOG.debug("Original Schema : " + schema); LOG.debug("Flattened Schema: " + flattenedSchema); return flattenedSchema; }  Schema flatten(Schema schema, boolean flattenComplexTypes); static final String FLATTENED_SOURCE_KEY; }