use of org.apache.hyracks.dataflow.std.intersect.IntersectOperatorDescriptor in project asterixdb by apache.
the class IntersectPOperator method contributeRuntimeOperator.
@Override
public void contributeRuntimeOperator(IHyracksJobBuilder builder, JobGenContext context, ILogicalOperator op, IOperatorSchema opSchema, IOperatorSchema[] inputSchemas, IOperatorSchema outerPlanSchema) throws AlgebricksException {
// logical op should have checked all the mismatch issues.
IntersectOperator logicalOp = (IntersectOperator) op;
int nInput = logicalOp.getNumInput();
int[][] compareFields = new int[nInput][];
IBinaryComparatorFactory[] comparatorFactories = JobGenHelper.variablesToAscBinaryComparatorFactories(logicalOp.getInputVariables(0), context.getTypeEnvironment(op), context);
INormalizedKeyComputerFactoryProvider nkcfProvider = context.getNormalizedKeyComputerFactoryProvider();
INormalizedKeyComputerFactory nkcf = null;
if (nkcfProvider != null) {
Object type = context.getTypeEnvironment(op).getVarType(logicalOp.getInputVariables(0).get(0));
if (type != null) {
nkcf = nkcfProvider.getNormalizedKeyComputerFactory(type, true);
}
}
for (int i = 0; i < logicalOp.getNumInput(); i++) {
compareFields[i] = JobGenHelper.variablesToFieldIndexes(logicalOp.getInputVariables(i), inputSchemas[i]);
}
IOperatorDescriptorRegistry spec = builder.getJobSpec();
RecordDescriptor recordDescriptor = JobGenHelper.mkRecordDescriptor(context.getTypeEnvironment(op), opSchema, context);
IntersectOperatorDescriptor opDescriptor = null;
try {
opDescriptor = new IntersectOperatorDescriptor(spec, nInput, compareFields, nkcf, comparatorFactories, recordDescriptor);
} catch (HyracksException e) {
throw new AlgebricksException(e);
}
contributeOpDesc(builder, (AbstractLogicalOperator) op, opDescriptor);
for (int i = 0; i < op.getInputs().size(); i++) {
builder.contributeGraphEdge(op.getInputs().get(i).getValue(), 0, op, i);
}
}
use of org.apache.hyracks.dataflow.std.intersect.IntersectOperatorDescriptor in project asterixdb by apache.
the class IntersectOperatorDescriptorTest method testNormalOperatorInitialization.
@Test
public void testNormalOperatorInitialization() throws HyracksException {
IntersectOperatorDescriptor operatorDescriptor = new IntersectOperatorDescriptor(mockRegistry, nInputs, compareFields, normalizedKeyFactory, comparatorFactory, outRecordDescriptor);
assertEquals(nInputs, operatorDescriptor.getInputArity());
}
Aggregations