columns = new ArrayList<>();
int channel = 0;
for (Symbol symbol : tableScanNode.getOutputSymbols()) {
columns.add(tableScanNode.getAssignments().get(symbol));
Input input = new Input(channel);
sourceLayout.put(symbol, input);
Type type = checkNotNull(context.getTypes().get(symbol), "No type for symbol %s", symbol);
sourceTypes.put(input, type);
channel++;
}
}
else {
// plan source
source = sourceNode.accept(this, context);
sourceLayout = source.getLayout();
sourceTypes = getInputTypes(source.getLayout(), source.getTupleInfos());
}
// build output mapping
ImmutableMap.Builder<Symbol, Input> outputMappingsBuilder = ImmutableMap.builder();
for (int i = 0; i < outputSymbols.size(); i++) {
Symbol symbol = outputSymbols.get(i);
outputMappingsBuilder.put(symbol, new Input(i));
}
Map<Symbol, Input> outputMappings = outputMappingsBuilder.build();
try {
// compiler uses inputs instead of symbols, so rewrite the expressions first