// Signal error by returning a null flow specification anyway.
planContext.setFlowSpec(null);
return planContext;
}
HashJoinNode joinNode = new HashJoinNode(leftName, rightName, leftKey, rightKey,
window, getSourceName(), leftContext.getOutFields(), rightContext.getOutFields(),
planContext.getConf());
// Set this node to expect multiple input schemas.
List<Schema> inputSchemas = new ArrayList<Schema>();
inputSchemas.add(leftContext.getSchema());
inputSchemas.add(rightContext.getSchema());
joinNode.setAttr(PlanNode.MULTI_INPUT_SCHEMA_ATTR, inputSchemas);
flowSpec.attachToLastLayer(joinNode);
// Create an output context defining our fields, etc.
PlanContext outContext = new PlanContext(planContext);
SymbolTable outTable = SymbolTable.mergeSymbols(leftContext.getSymbolTable(),
rightContext.getSymbolTable(), planContext.getSymbolTable());
outContext.setSymbolTable(outTable);
List<TypedField> outputFields = new ArrayList<TypedField>();
outputFields.addAll(leftContext.getOutFields());
outputFields.addAll(rightContext.getOutFields());
outputFields = distinctFields(outputFields);
outContext.setOutFields(outputFields);
Schema outSchema = createFieldSchema(outputFields);
outContext.setSchema(outSchema);
joinNode.setAttr(PlanNode.OUTPUT_SCHEMA_ATTR, outSchema);
return outContext;
}