Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
List<String> columnNames = task.getColumns();
ImmutableList.Builder<Column> builder = ImmutableList.builder();
int i = 0;
for (String columnName : columnNames) {
for (Column inputColumn: inputSchema.getColumns()) {
if (inputColumn.getName().equals(columnName)) {
Column outputColumn = new Column(i++, columnName, inputColumn.getType());
builder.add(outputColumn);
break;
}
}
}
Schema outputSchema = new Schema(builder.build());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment