use of org.apache.hyracks.algebricks.core.algebra.operators.logical.MaterializeOperator in project asterixdb by apache.
the class IntroduceMaterializationForInsertWithSelfScanRule method rewritePost.
@Override
public boolean rewritePost(Mutable<ILogicalOperator> opRef, IOptimizationContext context) throws AlgebricksException {
AbstractLogicalOperator op = (AbstractLogicalOperator) opRef.getValue();
if (op.getOperatorTag() != LogicalOperatorTag.INSERT_DELETE_UPSERT) {
return false;
}
InsertDeleteUpsertOperator insertOp = (InsertDeleteUpsertOperator) op;
boolean sameDataset = checkIfInsertAndScanDatasetsSame(op, ((DatasetDataSource) insertOp.getDataSource()).getDataset().getDatasetName());
if (sameDataset) {
MaterializeOperator materializeOperator = new MaterializeOperator();
MaterializePOperator materializePOperator = new MaterializePOperator(true);
materializeOperator.setPhysicalOperator(materializePOperator);
materializeOperator.getInputs().add(new MutableObject<ILogicalOperator>(insertOp.getInputs().get(0).getValue()));
context.computeAndSetTypeEnvironmentForOperator(materializeOperator);
insertOp.getInputs().clear();
insertOp.getInputs().add(new MutableObject<ILogicalOperator>(materializeOperator));
context.computeAndSetTypeEnvironmentForOperator(insertOp);
return true;
} else {
return false;
}
}
use of org.apache.hyracks.algebricks.core.algebra.operators.logical.MaterializeOperator in project asterixdb by apache.
the class LogicalOperatorDeepCopyWithNewVariablesVisitor method visitMaterializeOperator.
@Override
public ILogicalOperator visitMaterializeOperator(MaterializeOperator op, ILogicalOperator arg) throws AlgebricksException {
MaterializeOperator opCopy = new MaterializeOperator();
deepCopyInputsAnnotationsAndExecutionMode(op, arg, opCopy);
return opCopy;
}
Aggregations