Skip to content

Instantly share code, notes, and snippets.

@frsyuki
Created June 26, 2015 02:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frsyuki/54bd9a99cd0d7a2465cd to your computer and use it in GitHub Desktop.
Save frsyuki/54bd9a99cd0d7a2465cd to your computer and use it in GitHub Desktop.
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