use of org.apache.hyracks.algebricks.core.algebra.properties.StructuralPropertiesVector 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.StructuralPropertiesVector in project asterixdb by apache.
the class NestedLoopJoinPOperator method computeDeliveredProperties.
@Override
public void computeDeliveredProperties(ILogicalOperator iop, IOptimizationContext context) {
if (partitioningType != JoinPartitioningType.BROADCAST) {
throw new NotImplementedException(partitioningType + " nested loop joins are not implemented.");
}
IPartitioningProperty pp;
AbstractLogicalOperator op = (AbstractLogicalOperator) iop;
if (op.getExecutionMode() == AbstractLogicalOperator.ExecutionMode.PARTITIONED) {
AbstractLogicalOperator op2 = (AbstractLogicalOperator) op.getInputs().get(1).getValue();
IPhysicalPropertiesVector pv1 = op2.getPhysicalOperator().getDeliveredProperties();
if (pv1 == null) {
pp = null;
} else {
pp = pv1.getPartitioningProperty();
}
} else {
pp = IPartitioningProperty.UNPARTITIONED;
}
// Nested loop join cannot maintain the local structure property for the probe side
// because of the I/O optimization for the build branch.
this.deliveredProperties = new StructuralPropertiesVector(pp, null);
}
use of org.apache.hyracks.algebricks.core.algebra.properties.StructuralPropertiesVector 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);
}
use of org.apache.hyracks.algebricks.core.algebra.properties.StructuralPropertiesVector in project asterixdb by apache.
the class RandomPartitionExchangePOperator method computeDeliveredProperties.
@Override
public void computeDeliveredProperties(ILogicalOperator op, IOptimizationContext context) {
AbstractLogicalOperator op2 = (AbstractLogicalOperator) op.getInputs().get(0).getValue();
this.deliveredProperties = new StructuralPropertiesVector(new RandomPartitioningProperty(domain), op2.getDeliveredPhysicalProperties().getLocalProperties());
}
use of org.apache.hyracks.algebricks.core.algebra.properties.StructuralPropertiesVector 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