Search in sources :

Example 16 with LocalOrderProperty

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

the class DataSourcePartitioningProvider method computePropertiesVector.

@Override
public IPhysicalPropertiesVector computePropertiesVector(List<LogicalVariable> scanVariables) {
    IPhysicalPropertiesVector propsVector;
    IPartitioningProperty pp;
    List<ILocalStructuralProperty> propsLocal = new ArrayList<>();
    switch(ds.getDatasourceType()) {
        case DataSource.Type.LOADABLE:
        case DataSource.Type.EXTERNAL_DATASET:
            pp = new RandomPartitioningProperty(domain);
            ds.computeLocalStructuralProperties(propsLocal, scanVariables);
            break;
        case DataSource.Type.FEED:
            pp = getFeedPartitioningProperty(ds, domain, scanVariables);
            break;
        case DataSource.Type.INTERNAL_DATASET:
            Set<LogicalVariable> pvars = new ListSet<>();
            pp = getInternalDatasetPartitioningProperty(ds, domain, scanVariables, pvars);
            propsLocal.add(new LocalOrderProperty(getOrderColumns(pvars)));
            break;
        default:
            throw new IllegalArgumentException();
    }
    propsVector = new StructuralPropertiesVector(pp, propsLocal);
    return propsVector;
}
Also used : LogicalVariable(org.apache.hyracks.algebricks.core.algebra.base.LogicalVariable) StructuralPropertiesVector(org.apache.hyracks.algebricks.core.algebra.properties.StructuralPropertiesVector) ListSet(org.apache.hyracks.algebricks.common.utils.ListSet) LocalOrderProperty(org.apache.hyracks.algebricks.core.algebra.properties.LocalOrderProperty) ArrayList(java.util.ArrayList) IPhysicalPropertiesVector(org.apache.hyracks.algebricks.core.algebra.properties.IPhysicalPropertiesVector) RandomPartitioningProperty(org.apache.hyracks.algebricks.core.algebra.properties.RandomPartitioningProperty) ILocalStructuralProperty(org.apache.hyracks.algebricks.core.algebra.properties.ILocalStructuralProperty) IPartitioningProperty(org.apache.hyracks.algebricks.core.algebra.properties.IPartitioningProperty)

Example 17 with LocalOrderProperty

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

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

use of org.apache.hyracks.algebricks.core.algebra.properties.LocalOrderProperty 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)

Aggregations

LocalOrderProperty (org.apache.hyracks.algebricks.core.algebra.properties.LocalOrderProperty)19 ArrayList (java.util.ArrayList)18 OrderColumn (org.apache.hyracks.algebricks.core.algebra.properties.OrderColumn)17 LogicalVariable (org.apache.hyracks.algebricks.core.algebra.base.LogicalVariable)15 ILocalStructuralProperty (org.apache.hyracks.algebricks.core.algebra.properties.ILocalStructuralProperty)15 StructuralPropertiesVector (org.apache.hyracks.algebricks.core.algebra.properties.StructuralPropertiesVector)12 PhysicalRequirements (org.apache.hyracks.algebricks.core.algebra.properties.PhysicalRequirements)8 LinkedList (java.util.LinkedList)5 ListSet (org.apache.hyracks.algebricks.common.utils.ListSet)5 IPartitioningProperty (org.apache.hyracks.algebricks.core.algebra.properties.IPartitioningProperty)5 Mutable (org.apache.commons.lang3.mutable.Mutable)4 ILogicalExpression (org.apache.hyracks.algebricks.core.algebra.base.ILogicalExpression)4 ILogicalOperator (org.apache.hyracks.algebricks.core.algebra.base.ILogicalOperator)4 VariableReferenceExpression (org.apache.hyracks.algebricks.core.algebra.expressions.VariableReferenceExpression)4 IPhysicalPropertiesVector (org.apache.hyracks.algebricks.core.algebra.properties.IPhysicalPropertiesVector)4 LocalGroupingProperty (org.apache.hyracks.algebricks.core.algebra.properties.LocalGroupingProperty)4 UnorderedPartitionedProperty (org.apache.hyracks.algebricks.core.algebra.properties.UnorderedPartitionedProperty)4 HashMap (java.util.HashMap)3 MutableObject (org.apache.commons.lang3.mutable.MutableObject)3 AbstractLogicalOperator (org.apache.hyracks.algebricks.core.algebra.operators.logical.AbstractLogicalOperator)3