Search in sources :

Example 6 with IPhysicalPropertiesVector

use of org.apache.hyracks.algebricks.core.algebra.properties.IPhysicalPropertiesVector in project asterixdb by apache.

the class SortGroupByPOperator method computeDeliveredProperties.

@Override
public void computeDeliveredProperties(ILogicalOperator op, IOptimizationContext context) {
    List<ILocalStructuralProperty> propsLocal = new LinkedList<ILocalStructuralProperty>();
    GroupByOperator gOp = (GroupByOperator) op;
    Set<LogicalVariable> columnSet = new ListSet<LogicalVariable>();
    List<OrderColumn> ocs = new ArrayList<OrderColumn>();
    if (!columnSet.isEmpty()) {
        propsLocal.add(new LocalGroupingProperty(columnSet));
    }
    for (OrderColumn oc : orderColumns) {
        ocs.add(oc);
    }
    propsLocal.add(new LocalOrderProperty(ocs));
    for (ILogicalPlan p : gOp.getNestedPlans()) {
        for (Mutable<ILogicalOperator> r : p.getRoots()) {
            ILogicalOperator rOp = r.getValue();
            propsLocal.addAll(rOp.getDeliveredPhysicalProperties().getLocalProperties());
        }
    }
    ILogicalOperator op2 = op.getInputs().get(0).getValue();
    IPhysicalPropertiesVector childProp = op2.getDeliveredPhysicalProperties();
    deliveredProperties = new StructuralPropertiesVector(childProp.getPartitioningProperty(), propsLocal);
}
Also used : LogicalVariable(org.apache.hyracks.algebricks.core.algebra.base.LogicalVariable) StructuralPropertiesVector(org.apache.hyracks.algebricks.core.algebra.properties.StructuralPropertiesVector) GroupByOperator(org.apache.hyracks.algebricks.core.algebra.operators.logical.GroupByOperator) OrderColumn(org.apache.hyracks.algebricks.core.algebra.properties.OrderColumn) LocalGroupingProperty(org.apache.hyracks.algebricks.core.algebra.properties.LocalGroupingProperty) ILogicalOperator(org.apache.hyracks.algebricks.core.algebra.base.ILogicalOperator) ArrayList(java.util.ArrayList) IPhysicalPropertiesVector(org.apache.hyracks.algebricks.core.algebra.properties.IPhysicalPropertiesVector) LinkedList(java.util.LinkedList) ListSet(org.apache.hyracks.algebricks.common.utils.ListSet) LocalOrderProperty(org.apache.hyracks.algebricks.core.algebra.properties.LocalOrderProperty) ILogicalPlan(org.apache.hyracks.algebricks.core.algebra.base.ILogicalPlan) ILocalStructuralProperty(org.apache.hyracks.algebricks.core.algebra.properties.ILocalStructuralProperty)

Example 7 with IPhysicalPropertiesVector

use of org.apache.hyracks.algebricks.core.algebra.properties.IPhysicalPropertiesVector in project asterixdb by apache.

the class BulkloadPOperator method getRequiredPropertiesForChildren.

@Override
public PhysicalRequirements getRequiredPropertiesForChildren(ILogicalOperator op, IPhysicalPropertiesVector reqdByParent, IOptimizationContext context) {
    List<LogicalVariable> scanVariables = new ArrayList<>();
    scanVariables.addAll(primaryKeys);
    scanVariables.add(new LogicalVariable(-1));
    IPhysicalPropertiesVector physicalProps = dataSource.getPropertiesProvider().computePropertiesVector(scanVariables);
    StructuralPropertiesVector spv = new StructuralPropertiesVector(physicalProps.getPartitioningProperty(), physicalProps.getLocalProperties());
    return new PhysicalRequirements(new IPhysicalPropertiesVector[] { spv }, IPartitioningRequirementsCoordinator.NO_COORDINATION);
}
Also used : LogicalVariable(org.apache.hyracks.algebricks.core.algebra.base.LogicalVariable) StructuralPropertiesVector(org.apache.hyracks.algebricks.core.algebra.properties.StructuralPropertiesVector) ArrayList(java.util.ArrayList) IPhysicalPropertiesVector(org.apache.hyracks.algebricks.core.algebra.properties.IPhysicalPropertiesVector) PhysicalRequirements(org.apache.hyracks.algebricks.core.algebra.properties.PhysicalRequirements)

Example 8 with IPhysicalPropertiesVector

use of org.apache.hyracks.algebricks.core.algebra.properties.IPhysicalPropertiesVector in project asterixdb by apache.

the class JoinMultiComparator method deliveredLocalProperties.

@Override
protected List<ILocalStructuralProperty> deliveredLocalProperties(ILogicalOperator op, IOptimizationContext context) throws AlgebricksException {
    List<ILocalStructuralProperty> deliveredLocalProperties = new ArrayList<>();
    // Inner join can kick off the "role reversal" optimization, which can kill data properties for the probe side.
    if (kind != JoinKind.LEFT_OUTER) {
        return deliveredLocalProperties;
    }
    AbstractLogicalOperator probeOp = (AbstractLogicalOperator) op.getInputs().get(0).getValue();
    IPhysicalPropertiesVector probeSideProperties = probeOp.getPhysicalOperator().getDeliveredProperties();
    List<ILocalStructuralProperty> probeSideLocalProperties = probeSideProperties.getLocalProperties();
    if (probeSideLocalProperties != null) {
        // is destroyed.
        for (ILocalStructuralProperty property : probeSideLocalProperties) {
            Set<LogicalVariable> groupingVars = new ListSet<>();
            Set<LogicalVariable> leftBranchVars = new ListSet<>();
            property.getVariables(groupingVars);
            leftBranchVars.addAll(getKeysLeftBranch());
            if (groupingVars.containsAll(leftBranchVars)) {
                deliveredLocalProperties.add(new LocalGroupingProperty(groupingVars));
            }
        }
    }
    return deliveredLocalProperties;
}
Also used : LogicalVariable(org.apache.hyracks.algebricks.core.algebra.base.LogicalVariable) AbstractLogicalOperator(org.apache.hyracks.algebricks.core.algebra.operators.logical.AbstractLogicalOperator) ListSet(org.apache.hyracks.algebricks.common.utils.ListSet) LocalGroupingProperty(org.apache.hyracks.algebricks.core.algebra.properties.LocalGroupingProperty) ArrayList(java.util.ArrayList) IPhysicalPropertiesVector(org.apache.hyracks.algebricks.core.algebra.properties.IPhysicalPropertiesVector) ILocalStructuralProperty(org.apache.hyracks.algebricks.core.algebra.properties.ILocalStructuralProperty)

Example 9 with IPhysicalPropertiesVector

use of org.apache.hyracks.algebricks.core.algebra.properties.IPhysicalPropertiesVector in project asterixdb by apache.

the class InsertDeleteUpsertPOperator method getRequiredPropertiesForChildren.

@Override
public PhysicalRequirements getRequiredPropertiesForChildren(ILogicalOperator op, IPhysicalPropertiesVector reqdByParent, IOptimizationContext context) {
    List<LogicalVariable> scanVariables = new ArrayList<LogicalVariable>();
    scanVariables.addAll(keys);
    scanVariables.add(payload);
    if (additionalNonFilteringFields != null) {
        scanVariables.addAll(additionalNonFilteringFields);
    }
    IPhysicalPropertiesVector r = dataSource.getPropertiesProvider().computePropertiesVector(scanVariables);
    r.getLocalProperties().clear();
    IPhysicalPropertiesVector[] requirements = new IPhysicalPropertiesVector[1];
    requirements[0] = r;
    return new PhysicalRequirements(requirements, IPartitioningRequirementsCoordinator.NO_COORDINATION);
}
Also used : LogicalVariable(org.apache.hyracks.algebricks.core.algebra.base.LogicalVariable) ArrayList(java.util.ArrayList) IPhysicalPropertiesVector(org.apache.hyracks.algebricks.core.algebra.properties.IPhysicalPropertiesVector) PhysicalRequirements(org.apache.hyracks.algebricks.core.algebra.properties.PhysicalRequirements)

Example 10 with IPhysicalPropertiesVector

use of org.apache.hyracks.algebricks.core.algebra.properties.IPhysicalPropertiesVector in project asterixdb by apache.

the class IsomorphismOperatorVisitor method visitExchangeOperator.

@Override
public Boolean visitExchangeOperator(ExchangeOperator op, ILogicalOperator arg) throws AlgebricksException {
    AbstractLogicalOperator aop = (AbstractLogicalOperator) arg;
    if (aop.getOperatorTag() != LogicalOperatorTag.EXCHANGE) {
        return Boolean.FALSE;
    }
    // require the same partition property
    if (!(op.getPhysicalOperator().getOperatorTag() == aop.getPhysicalOperator().getOperatorTag())) {
        return Boolean.FALSE;
    }
    variableMapping.clear();
    IsomorphismUtilities.mapVariablesTopDown(op, arg, variableMapping);
    IPhysicalPropertiesVector properties = op.getPhysicalOperator().getDeliveredProperties();
    IPhysicalPropertiesVector propertiesArg = aop.getPhysicalOperator().getDeliveredProperties();
    if (properties == null && propertiesArg == null) {
        return Boolean.TRUE;
    }
    if (properties == null || propertiesArg == null) {
        return Boolean.FALSE;
    }
    IPartitioningProperty partProp = properties.getPartitioningProperty();
    IPartitioningProperty partPropArg = propertiesArg.getPartitioningProperty();
    if (!partProp.getPartitioningType().equals(partPropArg.getPartitioningType())) {
        return Boolean.FALSE;
    }
    List<LogicalVariable> columns = new ArrayList<LogicalVariable>();
    partProp.getColumns(columns);
    List<LogicalVariable> columnsArg = new ArrayList<LogicalVariable>();
    partPropArg.getColumns(columnsArg);
    if (columns.size() != columnsArg.size()) {
        return Boolean.FALSE;
    }
    if (columns.size() == 0) {
        return Boolean.TRUE;
    }
    for (int i = 0; i < columnsArg.size(); i++) {
        LogicalVariable rightVar = columnsArg.get(i);
        LogicalVariable leftVar = variableMapping.get(rightVar);
        if (leftVar != null) {
            columnsArg.set(i, leftVar);
        }
    }
    return VariableUtilities.varListEqualUnordered(columns, columnsArg);
}
Also used : LogicalVariable(org.apache.hyracks.algebricks.core.algebra.base.LogicalVariable) AbstractLogicalOperator(org.apache.hyracks.algebricks.core.algebra.operators.logical.AbstractLogicalOperator) ArrayList(java.util.ArrayList) IPhysicalPropertiesVector(org.apache.hyracks.algebricks.core.algebra.properties.IPhysicalPropertiesVector) IPartitioningProperty(org.apache.hyracks.algebricks.core.algebra.properties.IPartitioningProperty)

Aggregations

IPhysicalPropertiesVector (org.apache.hyracks.algebricks.core.algebra.properties.IPhysicalPropertiesVector)22 ArrayList (java.util.ArrayList)14 StructuralPropertiesVector (org.apache.hyracks.algebricks.core.algebra.properties.StructuralPropertiesVector)13 AbstractLogicalOperator (org.apache.hyracks.algebricks.core.algebra.operators.logical.AbstractLogicalOperator)12 LogicalVariable (org.apache.hyracks.algebricks.core.algebra.base.LogicalVariable)11 ILocalStructuralProperty (org.apache.hyracks.algebricks.core.algebra.properties.ILocalStructuralProperty)11 IPartitioningProperty (org.apache.hyracks.algebricks.core.algebra.properties.IPartitioningProperty)8 ILogicalOperator (org.apache.hyracks.algebricks.core.algebra.base.ILogicalOperator)6 PhysicalRequirements (org.apache.hyracks.algebricks.core.algebra.properties.PhysicalRequirements)6 ListSet (org.apache.hyracks.algebricks.common.utils.ListSet)4 ILogicalPlan (org.apache.hyracks.algebricks.core.algebra.base.ILogicalPlan)4 GroupByOperator (org.apache.hyracks.algebricks.core.algebra.operators.logical.GroupByOperator)4 LocalOrderProperty (org.apache.hyracks.algebricks.core.algebra.properties.LocalOrderProperty)4 LinkedList (java.util.LinkedList)3 LocalGroupingProperty (org.apache.hyracks.algebricks.core.algebra.properties.LocalGroupingProperty)3 OrderColumn (org.apache.hyracks.algebricks.core.algebra.properties.OrderColumn)3 HashMap (java.util.HashMap)1 Mutable (org.apache.commons.lang3.mutable.Mutable)1 AlgebricksPartitionConstraint (org.apache.hyracks.algebricks.common.constraints.AlgebricksPartitionConstraint)1 NotImplementedException (org.apache.hyracks.algebricks.common.exceptions.NotImplementedException)1