use of org.apache.hyracks.algebricks.core.algebra.properties.IPhysicalPropertiesVector in project asterixdb by apache.
the class SubplanPOperator method computeDeliveredProperties.
@Override
public void computeDeliveredProperties(ILogicalOperator op, IOptimizationContext context) {
AbstractLogicalOperator op2 = (AbstractLogicalOperator) op.getInputs().get(0).getValue();
IPhysicalPropertiesVector childsProperties = op2.getPhysicalOperator().getDeliveredProperties();
List<ILocalStructuralProperty> propsLocal = new ArrayList<>();
if (childsProperties.getLocalProperties() != null) {
propsLocal.addAll(childsProperties.getLocalProperties());
}
// ... get local properties for newly created variables...
SubplanOperator subplan = (SubplanOperator) op;
for (ILogicalPlan plan : subplan.getNestedPlans()) {
for (Mutable<ILogicalOperator> r : plan.getRoots()) {
AbstractLogicalOperator rOp = (AbstractLogicalOperator) r.getValue();
propsLocal.addAll(rOp.getPhysicalOperator().getDeliveredProperties().getLocalProperties());
}
}
deliveredProperties = new StructuralPropertiesVector(childsProperties.getPartitioningProperty(), propsLocal);
}
use of org.apache.hyracks.algebricks.core.algebra.properties.IPhysicalPropertiesVector in project asterixdb by apache.
the class WriteResultPOperator method getRequiredPropertiesForChildren.
@Override
public PhysicalRequirements getRequiredPropertiesForChildren(ILogicalOperator op, IPhysicalPropertiesVector reqdByParent, IOptimizationContext context) {
List<LogicalVariable> scanVariables = new ArrayList<LogicalVariable>();
scanVariables.addAll(keys);
scanVariables.add(new LogicalVariable(-1));
IPhysicalPropertiesVector r = dataSource.getPropertiesProvider().computePropertiesVector(scanVariables);
IPhysicalPropertiesVector[] requirements = new IPhysicalPropertiesVector[1];
requirements[0] = r;
return new PhysicalRequirements(requirements, IPartitioningRequirementsCoordinator.NO_COORDINATION);
}
use of org.apache.hyracks.algebricks.core.algebra.properties.IPhysicalPropertiesVector in project asterixdb by apache.
the class EnforceStructuralPropertiesRule method addEnforcers.
private void addEnforcers(AbstractLogicalOperator op, int childIndex, IPhysicalPropertiesVector diffPropertiesVector, IPhysicalPropertiesVector required, IPhysicalPropertiesVector deliveredByChild, INodeDomain domain, boolean nestedPlan, IOptimizationContext context) throws AlgebricksException {
IPartitioningProperty pp = diffPropertiesVector.getPartitioningProperty();
if (pp == null || pp.getPartitioningType() == PartitioningType.UNPARTITIONED) {
addLocalEnforcers(op, childIndex, diffPropertiesVector.getLocalProperties(), nestedPlan, context);
IPhysicalPropertiesVector deliveredByNewChild = ((AbstractLogicalOperator) op.getInputs().get(0).getValue()).getDeliveredPhysicalProperties();
if (!nestedPlan) {
addPartitioningEnforcers(op, childIndex, pp, required, deliveredByNewChild, domain, context);
}
} else {
if (!nestedPlan) {
addPartitioningEnforcers(op, childIndex, pp, required, deliveredByChild, pp.getNodeDomain(), context);
}
AbstractLogicalOperator newChild = (AbstractLogicalOperator) op.getInputs().get(childIndex).getValue();
IPhysicalPropertiesVector newDiff = newPropertiesDiff(newChild, required, true, context);
AlgebricksConfig.ALGEBRICKS_LOGGER.finest(">>>> New properties diff: " + newDiff + "\n");
if (newDiff != null) {
addLocalEnforcers(op, childIndex, newDiff.getLocalProperties(), nestedPlan, context);
}
}
}
use of org.apache.hyracks.algebricks.core.algebra.properties.IPhysicalPropertiesVector in project asterixdb by apache.
the class EnforceStructuralPropertiesRule method getStartChildIndex.
// Gets the index of a child to start top-down data property enforcement.
// If there is a partitioning-compatible child with the operator in opRef,
// start from this child; otherwise, start from child zero.
private int getStartChildIndex(AbstractLogicalOperator op, PhysicalRequirements pr, boolean nestedPlan, IOptimizationContext context) throws AlgebricksException {
IPhysicalPropertiesVector[] reqdProperties = null;
if (pr != null) {
reqdProperties = pr.getRequiredProperties();
}
List<IPartitioningProperty> deliveredPartitioningPropertiesFromChildren = new ArrayList<>();
for (Mutable<ILogicalOperator> childRef : op.getInputs()) {
AbstractLogicalOperator child = (AbstractLogicalOperator) childRef.getValue();
deliveredPartitioningPropertiesFromChildren.add(child.getDeliveredPhysicalProperties().getPartitioningProperty());
}
int partitioningCompatibleChild = 0;
for (int i = 0; i < op.getInputs().size(); i++) {
IPartitioningProperty deliveredPropertyFromChild = deliveredPartitioningPropertiesFromChildren.get(i);
if (reqdProperties == null || reqdProperties[i] == null || reqdProperties[i].getPartitioningProperty() == null || deliveredPropertyFromChild == null || reqdProperties[i].getPartitioningProperty().getPartitioningType() != deliveredPartitioningPropertiesFromChildren.get(i).getPartitioningType()) {
continue;
}
IPartitioningProperty requiredPropertyForChild = reqdProperties[i].getPartitioningProperty();
// If child i's delivered partitioning property already satisfies the required property, stop and return the child index.
if (PropertiesUtil.matchPartitioningProps(requiredPropertyForChild, deliveredPropertyFromChild, true)) {
partitioningCompatibleChild = i;
break;
}
}
return partitioningCompatibleChild;
}
use of org.apache.hyracks.algebricks.core.algebra.properties.IPhysicalPropertiesVector in project asterixdb by apache.
the class AbstractPreclusteredGroupByPOperator method computeDeliveredProperties.
// Obs: We don't propagate properties corresponding to decors, since they
// are func. dep. on the group-by variables.
@Override
public void computeDeliveredProperties(ILogicalOperator op, IOptimizationContext context) {
List<ILocalStructuralProperty> propsLocal = new ArrayList<>();
GroupByOperator gby = (GroupByOperator) op;
ILogicalOperator op2 = gby.getInputs().get(0).getValue();
IPhysicalPropertiesVector childProp = op2.getDeliveredPhysicalProperties();
IPartitioningProperty pp = childProp.getPartitioningProperty();
List<ILocalStructuralProperty> childLocals = childProp.getLocalProperties();
if (childLocals == null) {
deliveredProperties = new StructuralPropertiesVector(pp, propsLocal);
return;
}
for (ILocalStructuralProperty lsp : childLocals) {
ILocalStructuralProperty propagatedLsp = getPropagatedProperty(lsp, gby);
if (propagatedLsp != null) {
propsLocal.add(propagatedLsp);
}
}
deliveredProperties = new StructuralPropertiesVector(pp, propsLocal);
}
Aggregations