/** * Creates a new node with a single input for the optimizer plan. * * @param pactContract The PACT that the node represents. */ protected SingleInputNode(SingleInputOperator<?, ?, ?> pactContract) { super(pactContract); int[] k = pactContract.getKeyColumns(0); this.keys = k == null || k.length == 0 ? null : new FieldSet(k); }
/** * Creates a new node with a single input for the optimizer plan. * * @param pactContract The PACT that the node represents. */ protected SingleInputNode(SingleInputOperator<?, ?, ?> pactContract) { super(pactContract); int[] k = pactContract.getKeyColumns(0); this.keys = k == null || k.length == 0 ? null : new FieldSet(k); }
@Override protected void getSingleInputNodeSchema(SingleInputPlanNode node, SparseKeySchema schema) throws CompilerPostPassException, ConflictingFieldTypeInfoException { // check that we got the right types SingleInputOperator<?, ?, ?> contract = (SingleInputOperator<?, ?, ?>) node.getSingleInputNode().getPactContract(); if (! (contract instanceof RecordOperator)) { throw new CompilerPostPassException("Error: Operator is not a Record based contract. Wrong compiler invokation."); } RecordOperator recContract = (RecordOperator) contract; // add the information to the schema int[] localPositions = contract.getKeyColumns(0); Class<? extends Key<?>>[] types = recContract.getKeyClasses(); for (int i = 0; i < localPositions.length; i++) { schema.addType(localPositions[i], types[i]); } // this is a temporary fix, we should solve this more generic if (contract instanceof GroupReduceOperatorBase) { Ordering groupOrder = ((GroupReduceOperatorBase<?, ?, ?>) contract).getGroupOrder(); if (groupOrder != null) { addOrderingToSchema(groupOrder, schema); } } }
@Override protected void getSingleInputNodeSchema(SingleInputPlanNode node, SparseKeySchema schema) throws CompilerPostPassException, ConflictingFieldTypeInfoException { // check that we got the right types SingleInputOperator<?, ?, ?> contract = (SingleInputOperator<?, ?, ?>) node.getSingleInputNode().getPactContract(); if (! (contract instanceof RecordOperator)) { throw new CompilerPostPassException("Error: Operator is not a Record based contract. Wrong compiler invokation."); } RecordOperator recContract = (RecordOperator) contract; // add the information to the schema int[] localPositions = contract.getKeyColumns(0); Class<? extends Key<?>>[] types = recContract.getKeyClasses(); for (int i = 0; i < localPositions.length; i++) { schema.addType(localPositions[i], types[i]); } // this is a temporary fix, we should solve this more generic if (contract instanceof GroupReduceOperatorBase) { Ordering groupOrder = ((GroupReduceOperatorBase<?, ?, ?>) contract).getGroupOrder(); if (groupOrder != null) { addOrderingToSchema(groupOrder, schema); } } }