Search in sources :

Example 21 with ILocalStructuralProperty

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

the class HashPartitionMergeExchangePOperator method getRequiredPropertiesForChildren.

@Override
public PhysicalRequirements getRequiredPropertiesForChildren(ILogicalOperator op, IPhysicalPropertiesVector reqdByParent, IOptimizationContext context) {
    List<ILocalStructuralProperty> orderProps = new LinkedList<ILocalStructuralProperty>();
    List<OrderColumn> columns = new ArrayList<OrderColumn>();
    for (OrderColumn oc : orderColumns) {
        LogicalVariable var = oc.getColumn();
        columns.add(new OrderColumn(var, oc.getOrder()));
    }
    orderProps.add(new LocalOrderProperty(columns));
    StructuralPropertiesVector[] r = new StructuralPropertiesVector[] { new StructuralPropertiesVector(null, orderProps) };
    return new PhysicalRequirements(r, IPartitioningRequirementsCoordinator.NO_COORDINATION);
}
Also used : LogicalVariable(org.apache.hyracks.algebricks.core.algebra.base.LogicalVariable) StructuralPropertiesVector(org.apache.hyracks.algebricks.core.algebra.properties.StructuralPropertiesVector) OrderColumn(org.apache.hyracks.algebricks.core.algebra.properties.OrderColumn) LocalOrderProperty(org.apache.hyracks.algebricks.core.algebra.properties.LocalOrderProperty) ArrayList(java.util.ArrayList) ILocalStructuralProperty(org.apache.hyracks.algebricks.core.algebra.properties.ILocalStructuralProperty) LinkedList(java.util.LinkedList) PhysicalRequirements(org.apache.hyracks.algebricks.core.algebra.properties.PhysicalRequirements)

Example 22 with ILocalStructuralProperty

use of org.apache.hyracks.algebricks.core.algebra.properties.ILocalStructuralProperty 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 23 with ILocalStructuralProperty

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

the class NestedTupleSourcePOperator method computeDeliveredProperties.

@Override
public void computeDeliveredProperties(ILogicalOperator op, IOptimizationContext context) {
    Mutable<ILogicalOperator> dataSource = ((NestedTupleSourceOperator) op).getDataSourceReference();
    AbstractLogicalOperator op2 = (AbstractLogicalOperator) dataSource.getValue().getInputs().get(0).getValue();
    IPhysicalPropertiesVector inheritedProps = op2.getDeliveredPhysicalProperties();
    AbstractLogicalOperator parent = (AbstractLogicalOperator) dataSource.getValue();
    if (parent.getOperatorTag() != LogicalOperatorTag.GROUP) {
        deliveredProperties = inheritedProps.clone();
        return;
    }
    GroupByOperator gby = (GroupByOperator) parent;
    List<ILocalStructuralProperty> originalLocalProperties = inheritedProps.getLocalProperties();
    List<ILocalStructuralProperty> newLocalProperties = null;
    if (originalLocalProperties != null) {
        newLocalProperties = new ArrayList<>();
        for (ILocalStructuralProperty lsp : originalLocalProperties) {
            ILocalStructuralProperty groupLocalLsp = lsp.regardToGroup(gby.getGbyVarList());
            if (groupLocalLsp != null) {
                // Adds the property that is satisfied in the context of a particular group.
                newLocalProperties.add(groupLocalLsp);
            }
        }
        // Adds the original local properties as they are still maintained.
        // The optimizer should be able to process multiple delivered local order/grouping properties.
        newLocalProperties.addAll(originalLocalProperties);
    }
    deliveredProperties = new StructuralPropertiesVector(inheritedProps.getPartitioningProperty(), newLocalProperties);
}
Also used : StructuralPropertiesVector(org.apache.hyracks.algebricks.core.algebra.properties.StructuralPropertiesVector) NestedTupleSourceOperator(org.apache.hyracks.algebricks.core.algebra.operators.logical.NestedTupleSourceOperator) GroupByOperator(org.apache.hyracks.algebricks.core.algebra.operators.logical.GroupByOperator) AbstractLogicalOperator(org.apache.hyracks.algebricks.core.algebra.operators.logical.AbstractLogicalOperator) ILogicalOperator(org.apache.hyracks.algebricks.core.algebra.base.ILogicalOperator) IPhysicalPropertiesVector(org.apache.hyracks.algebricks.core.algebra.properties.IPhysicalPropertiesVector) ILocalStructuralProperty(org.apache.hyracks.algebricks.core.algebra.properties.ILocalStructuralProperty)

Example 24 with ILocalStructuralProperty

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

the class IndexBulkloadPOperator method getRequiredPropertiesForChildren.

@Override
public PhysicalRequirements getRequiredPropertiesForChildren(ILogicalOperator op, IPhysicalPropertiesVector reqdByParent, IOptimizationContext context) {
    //skVarMap is used to remove duplicated variable references for order operator
    Map<Integer, Object> skVarMap = new HashMap<Integer, Object>();
    List<LogicalVariable> scanVariables = new ArrayList<>();
    scanVariables.addAll(primaryKeys);
    scanVariables.add(new LogicalVariable(-1));
    IPhysicalPropertiesVector physicalProps = dataSourceIndex.getDataSource().getPropertiesProvider().computePropertiesVector(scanVariables);
    List<ILocalStructuralProperty> localProperties = new ArrayList<>();
    List<OrderColumn> orderColumns = new ArrayList<OrderColumn>();
    // OR [token, PK] if the index is not partitioned
    for (LogicalVariable skVar : secondaryKeys) {
        if (!skVarMap.containsKey(skVar.getId())) {
            orderColumns.add(new OrderColumn(skVar, OrderKind.ASC));
            skVarMap.put(skVar.getId(), null);
        }
    }
    for (LogicalVariable pkVar : primaryKeys) {
        orderColumns.add(new OrderColumn(pkVar, OrderKind.ASC));
    }
    localProperties.add(new LocalOrderProperty(orderColumns));
    StructuralPropertiesVector spv = new StructuralPropertiesVector(physicalProps.getPartitioningProperty(), localProperties);
    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) HashMap(java.util.HashMap) OrderColumn(org.apache.hyracks.algebricks.core.algebra.properties.OrderColumn) ArrayList(java.util.ArrayList) IPhysicalPropertiesVector(org.apache.hyracks.algebricks.core.algebra.properties.IPhysicalPropertiesVector) PhysicalRequirements(org.apache.hyracks.algebricks.core.algebra.properties.PhysicalRequirements) LocalOrderProperty(org.apache.hyracks.algebricks.core.algebra.properties.LocalOrderProperty) ILocalStructuralProperty(org.apache.hyracks.algebricks.core.algebra.properties.ILocalStructuralProperty)

Example 25 with ILocalStructuralProperty

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

the class InMemoryHashJoinPOperator method deliveredLocalProperties.

@Override
protected List<ILocalStructuralProperty> deliveredLocalProperties(ILogicalOperator op, IOptimizationContext context) {
    AbstractLogicalOperator op0 = (AbstractLogicalOperator) op.getInputs().get(0).getValue();
    IPhysicalPropertiesVector pv0 = op0.getPhysicalOperator().getDeliveredProperties();
    List<ILocalStructuralProperty> lp0 = pv0.getLocalProperties();
    if (lp0 != null) {
        // maintains the local properties on the probe side
        return new LinkedList<ILocalStructuralProperty>(lp0);
    }
    return new LinkedList<ILocalStructuralProperty>();
}
Also used : AbstractLogicalOperator(org.apache.hyracks.algebricks.core.algebra.operators.logical.AbstractLogicalOperator) IPhysicalPropertiesVector(org.apache.hyracks.algebricks.core.algebra.properties.IPhysicalPropertiesVector) ILocalStructuralProperty(org.apache.hyracks.algebricks.core.algebra.properties.ILocalStructuralProperty) LinkedList(java.util.LinkedList)

Aggregations

ILocalStructuralProperty (org.apache.hyracks.algebricks.core.algebra.properties.ILocalStructuralProperty)30 ArrayList (java.util.ArrayList)24 StructuralPropertiesVector (org.apache.hyracks.algebricks.core.algebra.properties.StructuralPropertiesVector)22 LogicalVariable (org.apache.hyracks.algebricks.core.algebra.base.LogicalVariable)19 LocalOrderProperty (org.apache.hyracks.algebricks.core.algebra.properties.LocalOrderProperty)15 OrderColumn (org.apache.hyracks.algebricks.core.algebra.properties.OrderColumn)14 AbstractLogicalOperator (org.apache.hyracks.algebricks.core.algebra.operators.logical.AbstractLogicalOperator)13 IPhysicalPropertiesVector (org.apache.hyracks.algebricks.core.algebra.properties.IPhysicalPropertiesVector)11 ILogicalOperator (org.apache.hyracks.algebricks.core.algebra.base.ILogicalOperator)10 IPartitioningProperty (org.apache.hyracks.algebricks.core.algebra.properties.IPartitioningProperty)10 ListSet (org.apache.hyracks.algebricks.common.utils.ListSet)9 LinkedList (java.util.LinkedList)8 PhysicalRequirements (org.apache.hyracks.algebricks.core.algebra.properties.PhysicalRequirements)8 LocalGroupingProperty (org.apache.hyracks.algebricks.core.algebra.properties.LocalGroupingProperty)7 UnorderedPartitionedProperty (org.apache.hyracks.algebricks.core.algebra.properties.UnorderedPartitionedProperty)6 ILogicalPlan (org.apache.hyracks.algebricks.core.algebra.base.ILogicalPlan)5 GroupByOperator (org.apache.hyracks.algebricks.core.algebra.operators.logical.GroupByOperator)5 HashMap (java.util.HashMap)4 HashSet (java.util.HashSet)4 FunctionalDependency (org.apache.hyracks.algebricks.core.algebra.properties.FunctionalDependency)4