use of org.apache.hyracks.algebricks.core.algebra.properties.ILocalStructuralProperty.PropertyType in project asterixdb by apache.
the class PropertiesUtil method matchNormalizedLocalProperties.
// Checks whether normalized delivered properties can satisfy normalized required property.
private static boolean matchNormalizedLocalProperties(List<ILocalStructuralProperty> reqs, List<ILocalStructuralProperty> dlvds) {
boolean hasOrderPropertyInReq = false;
boolean hasGroupingPropertyInReq = false;
boolean orderPropertyMet = false;
boolean groupingPropertyMet = false;
for (ILocalStructuralProperty req : reqs) {
PropertyType reqType = req.getPropertyType();
hasOrderPropertyInReq |= reqType == PropertyType.LOCAL_ORDER_PROPERTY;
hasGroupingPropertyInReq |= reqType == PropertyType.LOCAL_GROUPING_PROPERTY;
for (ILocalStructuralProperty dlvd : dlvds) {
PropertyType dlvdType = dlvd.getPropertyType();
if (reqType == PropertyType.LOCAL_ORDER_PROPERTY && dlvdType != PropertyType.LOCAL_ORDER_PROPERTY) {
// property.
continue;
}
if (reqType == PropertyType.LOCAL_ORDER_PROPERTY) {
LocalOrderProperty lop = (LocalOrderProperty) dlvd;
// It is enough that one required ordering property is met.
orderPropertyMet |= lop.implies(req);
} else {
Set<LogicalVariable> reqdCols = new ListSet<>();
Set<LogicalVariable> dlvdCols = new ListSet<>();
req.getColumns(reqdCols);
dlvd.getColumns(dlvdCols);
// It is enough that one required grouping property is met.
groupingPropertyMet |= isPrefixOf(reqdCols.iterator(), dlvdCols.iterator());
}
}
}
// satisfied and one of required grouping properties is satisfied.
return (!hasOrderPropertyInReq || orderPropertyMet) && (!hasGroupingPropertyInReq || groupingPropertyMet);
}
use of org.apache.hyracks.algebricks.core.algebra.properties.ILocalStructuralProperty.PropertyType in project asterixdb by apache.
the class AbstractPreclusteredGroupByPOperator method getPropagatedProperty.
// Returns the local structure property that is propagated from an input local structure property
// through a pre-clustered GROUP BY physical operator.
private ILocalStructuralProperty getPropagatedProperty(ILocalStructuralProperty lsp, GroupByOperator gby) {
PropertyType propertyType = lsp.getPropertyType();
if (propertyType == PropertyType.LOCAL_GROUPING_PROPERTY) {
// A new grouping property is generated.
return new LocalGroupingProperty(new ListSet<>(gby.getGbyVarList()));
} else {
LocalOrderProperty lop = (LocalOrderProperty) lsp;
List<OrderColumn> orderColumns = new ArrayList<>();
for (OrderColumn oc : lop.getOrderColumns()) {
LogicalVariable v2 = getLhsGbyVar(gby, oc.getColumn());
if (v2 != null) {
orderColumns.add(new OrderColumn(v2, oc.getOrder()));
} else {
break;
}
}
// maintained.
return orderColumns.isEmpty() ? null : new LocalOrderProperty(orderColumns);
}
}
Aggregations