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;
}
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);
}
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);
}
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);
}
Aggregations