Search in sources :

Example 6 with IntersectOperator

use of org.apache.hyracks.algebricks.core.algebra.operators.logical.IntersectOperator in project asterixdb by apache.

the class IntersectPOperator method computeDeliveredProperties.

@Override
public void computeDeliveredProperties(ILogicalOperator iop, IOptimizationContext context) throws AlgebricksException {
    IntersectOperator op = (IntersectOperator) iop;
    IPartitioningProperty pp = op.getInputs().get(0).getValue().getDeliveredPhysicalProperties().getPartitioningProperty();
    HashMap<LogicalVariable, LogicalVariable> varMaps = new HashMap<>(op.getOutputVars().size());
    for (int i = 0; i < op.getOutputVars().size(); i++) {
        varMaps.put(op.getInputVariables(0).get(i), op.getOutputVars().get(i));
    }
    pp.substituteColumnVars(varMaps);
    List<ILocalStructuralProperty> propsLocal = new ArrayList<>();
    List<OrderColumn> orderColumns = new ArrayList<>();
    for (LogicalVariable var : op.getOutputVars()) {
        orderColumns.add(new OrderColumn(var, OrderOperator.IOrder.OrderKind.ASC));
    }
    propsLocal.add(new LocalOrderProperty(orderColumns));
    deliveredProperties = new StructuralPropertiesVector(pp, propsLocal);
}
Also used : LogicalVariable(org.apache.hyracks.algebricks.core.algebra.base.LogicalVariable) StructuralPropertiesVector(org.apache.hyracks.algebricks.core.algebra.properties.StructuralPropertiesVector) HashMap(java.util.HashMap) OrderColumn(org.apache.hyracks.algebricks.core.algebra.properties.OrderColumn) ArrayList(java.util.ArrayList) IPartitioningProperty(org.apache.hyracks.algebricks.core.algebra.properties.IPartitioningProperty) LocalOrderProperty(org.apache.hyracks.algebricks.core.algebra.properties.LocalOrderProperty) IntersectOperator(org.apache.hyracks.algebricks.core.algebra.operators.logical.IntersectOperator) ILocalStructuralProperty(org.apache.hyracks.algebricks.core.algebra.properties.ILocalStructuralProperty)

Example 7 with IntersectOperator

use of org.apache.hyracks.algebricks.core.algebra.operators.logical.IntersectOperator in project asterixdb by apache.

the class IsomorphismVariableMappingVisitor method mapVariablesForIntersect.

private void mapVariablesForIntersect(IntersectOperator op, ILogicalOperator arg) {
    if (op.getOperatorTag() != arg.getOperatorTag()) {
        return;
    }
    IntersectOperator opArg = (IntersectOperator) arg;
    if (op.getNumInput() != opArg.getNumInput()) {
        return;
    }
    for (int i = 0; i < op.getNumInput(); i++) {
        for (int j = 0; j < op.getInputVariables(i).size(); j++) {
            if (!varEquivalent(op.getInputVariables(i).get(j), opArg.getInputVariables(i).get(j))) {
                return;
            }
        }
    }
    mapVariables(op.getOutputVars(), opArg.getOutputVars());
}
Also used : IntersectOperator(org.apache.hyracks.algebricks.core.algebra.operators.logical.IntersectOperator)

Aggregations

IntersectOperator (org.apache.hyracks.algebricks.core.algebra.operators.logical.IntersectOperator)7 LogicalVariable (org.apache.hyracks.algebricks.core.algebra.base.LogicalVariable)5 ArrayList (java.util.ArrayList)4 List (java.util.List)2 AlgebricksException (org.apache.hyracks.algebricks.common.exceptions.AlgebricksException)2 ILocalStructuralProperty (org.apache.hyracks.algebricks.core.algebra.properties.ILocalStructuralProperty)2 IPartitioningProperty (org.apache.hyracks.algebricks.core.algebra.properties.IPartitioningProperty)2 LocalOrderProperty (org.apache.hyracks.algebricks.core.algebra.properties.LocalOrderProperty)2 OrderColumn (org.apache.hyracks.algebricks.core.algebra.properties.OrderColumn)2 StructuralPropertiesVector (org.apache.hyracks.algebricks.core.algebra.properties.StructuralPropertiesVector)2 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Mutable (org.apache.commons.lang3.mutable.Mutable)1 ILogicalOperator (org.apache.hyracks.algebricks.core.algebra.base.ILogicalOperator)1 VariableReferenceExpression (org.apache.hyracks.algebricks.core.algebra.expressions.VariableReferenceExpression)1 OrderOperator (org.apache.hyracks.algebricks.core.algebra.operators.logical.OrderOperator)1 PhysicalRequirements (org.apache.hyracks.algebricks.core.algebra.properties.PhysicalRequirements)1 UnorderedPartitionedProperty (org.apache.hyracks.algebricks.core.algebra.properties.UnorderedPartitionedProperty)1 INormalizedKeyComputerFactoryProvider (org.apache.hyracks.algebricks.data.INormalizedKeyComputerFactoryProvider)1 IBinaryComparatorFactory (org.apache.hyracks.api.dataflow.value.IBinaryComparatorFactory)1