in src/main/java/com/google/cloud/solutions/autotokenize/common/AvroSchemaToCatalogSchema.java [116:169]
public ColumnSchemaFlatKeys process() {
switch (schema().getType()) {
case RECORD:
return processRecord();
case ARRAY:
return processArray();
case UNION:
return processUnion();
case ENUM:
return ColumnSchemaFlatKeys.of(
schemaBuilder()
.setDescription(
descriptionJoiner.join(
emptyToNull(baseDescription()),
schema().getDoc(),
"Permitted Values:",
schema().getEnumSymbols()))
.build(),
ImmutableMap.of(avroParentFlatKey(), catalogParentFlatKey()));
case FIXED:
return ColumnSchemaFlatKeys.of(
schemaBuilder()
.setDescription(
descriptionJoiner.join(
emptyToNull(baseDescription()),
schema().getDoc(),
"Fixed bytes size: " + schema().getFixedSize()))
.build(),
ImmutableMap.of(avroParentFlatKey(), catalogParentFlatKey()));
case MAP:
throw new IllegalArgumentException(
"Type not supported in Schema - " + schema().getType());
// Simple Fields need no other processing.
case NULL:
case STRING:
case BYTES:
case INT:
case LONG:
case FLOAT:
case DOUBLE:
case BOOLEAN:
default:
return ColumnSchemaFlatKeys.of(
schemaBuilder().build(),
ImmutableMap.of(avroParentFlatKey(), catalogParentFlatKey()));
}
}