use of org.apache.hyracks.algebricks.core.algebra.operators.logical.AbstractLogicalOperator 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.operators.logical.AbstractLogicalOperator in project asterixdb by apache.
the class IsomorphismOperatorVisitor method visitInsertDeleteUpsertOperator.
@Override
public Boolean visitInsertDeleteUpsertOperator(InsertDeleteUpsertOperator op, ILogicalOperator arg) throws AlgebricksException {
AbstractLogicalOperator aop = (AbstractLogicalOperator) arg;
if (aop.getOperatorTag() != LogicalOperatorTag.INSERT_DELETE_UPSERT) {
return Boolean.FALSE;
}
InsertDeleteUpsertOperator insertOpArg = (InsertDeleteUpsertOperator) copyAndSubstituteVar(op, arg);
boolean isomorphic = VariableUtilities.varListEqualUnordered(op.getSchema(), insertOpArg.getSchema());
if (!op.getDataSource().equals(insertOpArg.getDataSource())) {
isomorphic = false;
}
if (!op.getPayloadExpression().equals(insertOpArg.getPayloadExpression())) {
isomorphic = false;
}
return isomorphic;
}
use of org.apache.hyracks.algebricks.core.algebra.operators.logical.AbstractLogicalOperator in project asterixdb by apache.
the class IsomorphismOperatorVisitor method visitSplitOperator.
@Override
public Boolean visitSplitOperator(SplitOperator op, ILogicalOperator arg) throws AlgebricksException {
AbstractLogicalOperator aop = (AbstractLogicalOperator) arg;
if (aop.getOperatorTag() != LogicalOperatorTag.SPLIT) {
return Boolean.FALSE;
}
SplitOperator sOpArg = (SplitOperator) copyAndSubstituteVar(op, arg);
boolean isomorphic = op.getBranchingExpression().getValue().equals(sOpArg.getBranchingExpression().getValue());
return isomorphic;
}
use of org.apache.hyracks.algebricks.core.algebra.operators.logical.AbstractLogicalOperator in project asterixdb by apache.
the class IsomorphismOperatorVisitor method visitDistributeResultOperator.
@Override
public Boolean visitDistributeResultOperator(DistributeResultOperator op, ILogicalOperator arg) throws AlgebricksException {
AbstractLogicalOperator aop = (AbstractLogicalOperator) arg;
if (aop.getOperatorTag() != LogicalOperatorTag.DISTRIBUTE_RESULT) {
return Boolean.FALSE;
}
DistributeResultOperator writeOpArg = (DistributeResultOperator) copyAndSubstituteVar(op, arg);
boolean isomorphic = VariableUtilities.varListEqualUnordered(op.getSchema(), writeOpArg.getSchema());
return isomorphic;
}
use of org.apache.hyracks.algebricks.core.algebra.operators.logical.AbstractLogicalOperator in project asterixdb by apache.
the class IsomorphismOperatorVisitor method visitUnionOperator.
@Override
public Boolean visitUnionOperator(UnionAllOperator op, ILogicalOperator arg) throws AlgebricksException {
AbstractLogicalOperator aop = (AbstractLogicalOperator) arg;
if (aop.getOperatorTag() != LogicalOperatorTag.UNIONALL) {
return Boolean.FALSE;
}
UnionAllOperator unionOpArg = (UnionAllOperator) copyAndSubstituteVar(op, arg);
List<Triple<LogicalVariable, LogicalVariable, LogicalVariable>> mapping = op.getVariableMappings();
List<Triple<LogicalVariable, LogicalVariable, LogicalVariable>> mappingArg = unionOpArg.getVariableMappings();
if (mapping.size() != mappingArg.size()) {
return Boolean.FALSE;
}
return VariableUtilities.varListEqualUnordered(mapping, mappingArg);
}
Aggregations