field.addProp(FLATTENED_SOURCE_KEY, flattenSource); for (Map.Entry<String, JsonNode> entry : f.getJsonProps().entrySet()) { field.addProp(entry.getKey(), entry.getValue());
private static Schema.Field copy(Schema.Field f) { Schema.Field copy = AvroUtils.cloneField(f); // retain mapping properties, note that this needs to use the Jackson 1 API until // we can use AVRO-1585 for (Map.Entry<String, JsonNode> prop : f.getJsonProps().entrySet()) { copy.addProp(prop.getKey(), prop.getValue()); } return copy; }
private static Schema.Field copy(Schema.Field f) { Schema.Field copy = AvroUtils.cloneField(f); // retain mapping properties for (Map.Entry<String, JsonNode> prop : f.getJsonProps().entrySet()) { copy.addProp(prop.getKey(), prop.getValue()); } return copy; }
field.addProp(FLATTENED_SOURCE_KEY, flattenSource); for (Map.Entry<String, JsonNode> entry : f.getJsonProps().entrySet()) { field.addProp(entry.getKey(), entry.getValue());
field.addProp(FLATTENED_SOURCE_KEY, flattenSource); for (Map.Entry<String, JsonNode> entry : f.getJsonProps().entrySet()) { field.addProp(entry.getKey(), entry.getValue());
if (!isMetadataField(field.name())) { Schema.Field newField = new Schema.Field(field.name(), field.schema(), field.doc(), null); for (Map.Entry<String, JsonNode> prop : field.getJsonProps().entrySet()) { newField.addProp(prop.getKey(), prop.getValue());
@Test public void testPropsPresent() { Schema schema = HoodieAvroUtils.addMetadataFields(new Schema.Parser().parse(EXAMPLE_SCHEMA)); boolean piiPresent = false; for (Schema.Field field : schema.getFields()) { if (HoodieAvroUtils.isMetadataField(field.name())) { continue; } Assert.assertTrue("field name is null", field.name() != null); Map<String, JsonNode> props = field.getJsonProps(); Assert.assertTrue("The property is null", props != null); if (field.name().equals("pii_col")) { piiPresent = true; Assert.assertTrue("sensitivity_level is removed in field 'pii_col'", props.containsKey("column_category")); } else { Assert.assertTrue("The property shows up but not set", props.size() == 0); } } Assert.assertTrue("column pii_col doesn't show up", piiPresent); } }
@Override public Map<String, JsonNode> getJsonProps() { return wrapped.getJsonProps(); }
private static Schema.Field copy(Schema.Field f) { Schema.Field copy = AvroUtils.cloneField(f); // retain mapping properties, note that this needs to use the Jackson 1 API until // we can use AVRO-1585 for (Map.Entry<String, JsonNode> prop : f.getJsonProps().entrySet()) { copy.addProp(prop.getKey(), prop.getValue()); } return copy; }