in c3r-cli-spark/src/main/java/com/amazonaws/c3r/spark/io/schema/InteractiveSchemaGenerator.java [159:194]
public void run() {
if (!allowCleartextColumns) {
consoleOutput.println();
consoleOutput.println("NOTE: Cleartext columns are not permitted for this collaboration");
consoleOutput.println(" and will not be provided as an option in prompts.");
}
generateColumns();
final List<ColumnSchema> flattenedColumnSchemas = generatedColumnSchemas.stream()
.flatMap(List::stream)
.collect(Collectors.toList());
if (flattenedColumnSchemas.isEmpty()) {
if (unsupportedTypeColumnCount >= sourceColumnCount) {
consoleOutput.println("No source columns could be considered for output:");
consoleOutput.println(" all columns were of an unsupported type and the");
consoleOutput.println(" specified collaboration does not allow cleartext.");
} else {
consoleOutput.println("No target columns were specified.");
}
return;
}
final TableSchema schema;
if (hasHeaders()) {
schema = new MappedTableSchema(flattenedColumnSchemas);
} else {
schema = new PositionalTableSchema(generatedColumnSchemas);
}
try (BufferedWriter writer = Files.newBufferedWriter(Path.of(targetJsonFile), StandardCharsets.UTF_8)) {
writer.write(GsonUtil.toJson(schema));
} catch (IOException e) {
throw new C3rRuntimeException("Could not write to target schema file.", e);
}
consoleOutput.println("Schema written to " + targetJsonFile + ".");
}