use of org.apache.hyracks.algebricks.core.algebra.properties.StructuralPropertiesVector in project asterixdb by apache.
the class UnionAllPOperator method getRequiredPropertiesForChildren.
@Override
public PhysicalRequirements getRequiredPropertiesForChildren(ILogicalOperator op, IPhysicalPropertiesVector reqdByParent, IOptimizationContext context) {
StructuralPropertiesVector pv0 = OperatorPropertiesUtil.checkUnpartitionedAndGetPropertiesVector(op, new StructuralPropertiesVector(new RandomPartitioningProperty(context.getComputationNodeDomain()), null));
StructuralPropertiesVector pv1 = OperatorPropertiesUtil.checkUnpartitionedAndGetPropertiesVector(op, new StructuralPropertiesVector(new RandomPartitioningProperty(context.getComputationNodeDomain()), null));
return new PhysicalRequirements(new StructuralPropertiesVector[] { pv0, pv1 }, IPartitioningRequirementsCoordinator.NO_COORDINATION);
}
use of org.apache.hyracks.algebricks.core.algebra.properties.StructuralPropertiesVector in project asterixdb by apache.
the class UnionAllPOperator method computeDeliveredProperties.
@Override
public void computeDeliveredProperties(ILogicalOperator op, IOptimizationContext context) {
AbstractLogicalOperator op2 = (AbstractLogicalOperator) op.getInputs().get(0).getValue();
IPartitioningProperty pp = op2.getDeliveredPhysicalProperties().getPartitioningProperty();
this.deliveredProperties = new StructuralPropertiesVector(pp, new ArrayList<>(0));
}
use of org.apache.hyracks.algebricks.core.algebra.properties.StructuralPropertiesVector in project asterixdb by apache.
the class EnforceStructuralPropertiesRule method rewritePre.
@Override
public boolean rewritePre(Mutable<ILogicalOperator> opRef, IOptimizationContext context) throws AlgebricksException {
AbstractLogicalOperator op = (AbstractLogicalOperator) opRef.getValue();
// wait for the physical operators to be set first
if (op.getPhysicalOperator() == null) {
return false;
}
if (context.checkIfInDontApplySet(this, op)) {
return false;
}
List<FunctionalDependency> fds = context.getFDList(op);
if (fds != null && !fds.isEmpty()) {
return false;
}
// These are actually logical constraints, so they could be pre-computed
// somewhere else, too.
physicalOptimizationConfig = context.getPhysicalOptimizationConfig();
AlgebricksConfig.ALGEBRICKS_LOGGER.fine(">>>> Optimizing operator " + op.getPhysicalOperator() + ".\n");
PhysicalOptimizationsUtil.computeFDsAndEquivalenceClasses(op, context);
StructuralPropertiesVector pvector = new StructuralPropertiesVector(new RandomPartitioningProperty(context.getComputationNodeDomain()), new LinkedList<ILocalStructuralProperty>());
boolean changed = physOptimizeOp(opRef, pvector, false, context);
op.computeDeliveredPhysicalProperties(context);
AlgebricksConfig.ALGEBRICKS_LOGGER.finest(">>>> Structural properties for " + op.getPhysicalOperator() + ": " + op.getDeliveredPhysicalProperties() + "\n");
context.addToDontApplySet(this, opRef.getValue());
return changed;
}
use of org.apache.hyracks.algebricks.core.algebra.properties.StructuralPropertiesVector in project asterixdb by apache.
the class BTreeSearchPOperator method getRequiredPropertiesForChildren.
@Override
public PhysicalRequirements getRequiredPropertiesForChildren(ILogicalOperator op, IPhysicalPropertiesVector reqdByParent, IOptimizationContext context) {
if (requiresBroadcast) {
// For primary indexes optimizing an equality condition we can reduce the broadcast requirement to hash partitioning.
if (isPrimaryIndex && isEqCondition) {
// If this is a composite primary index, then all of the keys should be provided.
Index searchIndex = ((DataSourceIndex) idx).getIndex();
int numberOfKeyFields = searchIndex.getKeyFieldNames().size();
if (numberOfKeyFields < 2 || (lowKeyVarList.size() == numberOfKeyFields && highKeyVarList.size() == numberOfKeyFields)) {
StructuralPropertiesVector[] pv = new StructuralPropertiesVector[1];
ListSet<LogicalVariable> searchKeyVars = new ListSet<>();
searchKeyVars.addAll(lowKeyVarList);
searchKeyVars.addAll(highKeyVarList);
// Also, add a local sorting property to enforce a sort before the primary-index operator.
List<ILocalStructuralProperty> propsLocal = new ArrayList<>();
List<OrderColumn> orderColumns = new ArrayList<>();
for (LogicalVariable orderVar : searchKeyVars) {
orderColumns.add(new OrderColumn(orderVar, OrderKind.ASC));
}
propsLocal.add(new LocalOrderProperty(orderColumns));
pv[0] = new StructuralPropertiesVector(new UnorderedPartitionedProperty(searchKeyVars, domain), propsLocal);
return new PhysicalRequirements(pv, IPartitioningRequirementsCoordinator.NO_COORDINATION);
}
}
StructuralPropertiesVector[] pv = new StructuralPropertiesVector[1];
pv[0] = new StructuralPropertiesVector(new BroadcastPartitioningProperty(domain), null);
return new PhysicalRequirements(pv, IPartitioningRequirementsCoordinator.NO_COORDINATION);
} else {
return super.getRequiredPropertiesForChildren(op, reqdByParent, context);
}
}
use of org.apache.hyracks.algebricks.core.algebra.properties.StructuralPropertiesVector 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