use of org.apache.hyracks.algebricks.core.algebra.properties.IPartitioningProperty in project asterixdb by apache.
the class IsomorphismOperatorVisitor method visitExchangeOperator.
@Override
public Boolean visitExchangeOperator(ExchangeOperator op, ILogicalOperator arg) throws AlgebricksException {
AbstractLogicalOperator aop = (AbstractLogicalOperator) arg;
if (aop.getOperatorTag() != LogicalOperatorTag.EXCHANGE) {
return Boolean.FALSE;
}
// require the same partition property
if (!(op.getPhysicalOperator().getOperatorTag() == aop.getPhysicalOperator().getOperatorTag())) {
return Boolean.FALSE;
}
variableMapping.clear();
IsomorphismUtilities.mapVariablesTopDown(op, arg, variableMapping);
IPhysicalPropertiesVector properties = op.getPhysicalOperator().getDeliveredProperties();
IPhysicalPropertiesVector propertiesArg = aop.getPhysicalOperator().getDeliveredProperties();
if (properties == null && propertiesArg == null) {
return Boolean.TRUE;
}
if (properties == null || propertiesArg == null) {
return Boolean.FALSE;
}
IPartitioningProperty partProp = properties.getPartitioningProperty();
IPartitioningProperty partPropArg = propertiesArg.getPartitioningProperty();
if (!partProp.getPartitioningType().equals(partPropArg.getPartitioningType())) {
return Boolean.FALSE;
}
List<LogicalVariable> columns = new ArrayList<LogicalVariable>();
partProp.getColumns(columns);
List<LogicalVariable> columnsArg = new ArrayList<LogicalVariable>();
partPropArg.getColumns(columnsArg);
if (columns.size() != columnsArg.size()) {
return Boolean.FALSE;
}
if (columns.size() == 0) {
return Boolean.TRUE;
}
for (int i = 0; i < columnsArg.size(); i++) {
LogicalVariable rightVar = columnsArg.get(i);
LogicalVariable leftVar = variableMapping.get(rightVar);
if (leftVar != null) {
columnsArg.set(i, leftVar);
}
}
return VariableUtilities.varListEqualUnordered(columns, columnsArg);
}
use of org.apache.hyracks.algebricks.core.algebra.properties.IPartitioningProperty 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.IPartitioningProperty 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.IPartitioningProperty in project asterixdb by apache.
the class DataSourcePartitioningProvider method getInternalDatasetPartitioningProperty.
private static IPartitioningProperty getInternalDatasetPartitioningProperty(DataSource ds, INodeDomain domain, List<LogicalVariable> scanVariables, Set<LogicalVariable> pvars) {
IPartitioningProperty pp;
if (scanVariables.size() < 2) {
pp = new RandomPartitioningProperty(domain);
} else {
pvars.addAll(ds.getPrimaryKeyVariables(scanVariables));
pp = new UnorderedPartitionedProperty(pvars, domain);
}
return pp;
}
use of org.apache.hyracks.algebricks.core.algebra.properties.IPartitioningProperty in project asterixdb by apache.
the class HashPartitionExchangePOperator method computeDeliveredProperties.
@Override
public void computeDeliveredProperties(ILogicalOperator op, IOptimizationContext context) {
IPartitioningProperty p = new UnorderedPartitionedProperty(new ListSet<LogicalVariable>(hashFields), domain);
this.deliveredProperties = new StructuralPropertiesVector(p, null);
}
Aggregations