table.getParameters().put(
AVRO_SCHEMA_LITERAL_PROPERTY_NAME,
descriptor.getSchema().toString());
} else if (table.getParameters().get(AVRO_SCHEMA_URL_PROPERTY_NAME) != null) {
if (descriptor.getSchemaUrl() == null) {
throw new DatasetException("Cannot update " + AVRO_SCHEMA_URL_PROPERTY_NAME +
" since descriptor schema URL is not set.");
}
table.getParameters().put(
AVRO_SCHEMA_URL_PROPERTY_NAME,
descriptor.getSchemaUrl().toExternalForm());
} else {
throw new DatasetException("Cannot update Avro schema since neither " +
AVRO_SCHEMA_LITERAL_PROPERTY_NAME + " nor " +
AVRO_SCHEMA_URL_PROPERTY_NAME + " is set.");
}
// keep the custom properties up-to-date
addPropertiesForDescriptor(table, descriptor);