if (avroSchemaFile == null && avroSchemaReflectClass == null) {
throw new IllegalArgumentException("One of cdk.avroSchemaFile or " +
"cdk.avroSchemaReflectClass must be specified");
}
DatasetRepository repo = getDatasetRepository();
DatasetDescriptor.Builder descriptorBuilder = new DatasetDescriptor.Builder();
configureSchema(descriptorBuilder, avroSchemaFile, avroSchemaReflectClass);
if (format.equals(Formats.AVRO.getName())) {
descriptorBuilder.format(Formats.AVRO);
} else if (format.equals(Formats.PARQUET.getName())) {
descriptorBuilder.format(Formats.PARQUET);
} else {
throw new MojoExecutionException("Unrecognized format: " + format);
}
if (partitionExpression != null) {
descriptorBuilder.partitionStrategy(Accessor.getDefault().fromExpression(partitionExpression));
}
repo.create(datasetName, descriptorBuilder.build());
}