You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@asterixdb.apache.org by AsterixDB Code Review <do...@asterix-gerrit.ics.uci.edu> on 2024/02/21 20:25:35 UTC
Change in asterixdb[master]: [ASTERIXDB-3359][COMP] Project only the necessary columns on delete
From Wail Alkowaileet <wa...@gmail.com>:
Wail Alkowaileet has uploaded this change for review. ( https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/18172 )
Change subject: [ASTERIXDB-3359][COMP] Project only the necessary columns on delete
......................................................................
[ASTERIXDB-3359][COMP] Project only the necessary columns on delete
- user model changes: no
- storage format changes: no
- interface changes: no
Details:
When a delete operation is initiated, all columns will be projected.
This is inefficient as only a few columns are needed. Namely, the
columns of the delete predicate and the indexed columns (if any).
Change-Id: I51a26f40b1ba0597a66f08a78097cd20a42c4c76
---
M asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/pushdown/processor/ColumnValueAccessPushdownProcessor.java
1 file changed, 36 insertions(+), 0 deletions(-)
git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb refs/changes/72/18172/1
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/pushdown/processor/ColumnValueAccessPushdownProcessor.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/pushdown/processor/ColumnValueAccessPushdownProcessor.java
index 7db3dd2..30844a7 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/pushdown/processor/ColumnValueAccessPushdownProcessor.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/pushdown/processor/ColumnValueAccessPushdownProcessor.java
@@ -32,8 +32,10 @@
import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
import org.apache.hyracks.algebricks.core.algebra.base.ILogicalOperator;
import org.apache.hyracks.algebricks.core.algebra.base.IOptimizationContext;
+import org.apache.hyracks.algebricks.core.algebra.base.LogicalOperatorTag;
import org.apache.hyracks.algebricks.core.algebra.base.LogicalVariable;
import org.apache.hyracks.algebricks.core.algebra.expressions.IVariableTypeEnvironment;
+import org.apache.hyracks.algebricks.core.algebra.operators.logical.InsertDeleteUpsertOperator;
/**
* Computes the expected schema for columnar datasets (whether internal or external). The expected schema is then
@@ -84,6 +86,13 @@
for (UseDescriptor useDescriptor : useDescriptors) {
LogicalVariable producedVariable = useDescriptor.getProducedVariable();
ILogicalOperator op = useDescriptor.getOperator();
+ if (isDelete(op)) {
+ /*
+ * Delete operation uses the record variable as an expression. Hence, all fields will be projected.
+ * This is inefficient as only the columns of the delete predicate AND the indexed columns are needed.
+ */
+ continue;
+ }
IVariableTypeEnvironment typeEnv = PushdownUtil.getTypeEnv(op, context);
expressionVisitor.transform(useDescriptor.getExpression(), producedVariable, typeEnv);
}
@@ -101,4 +110,13 @@
}
}
}
+
+ private boolean isDelete(ILogicalOperator op) {
+ if (op.getOperatorTag() != LogicalOperatorTag.INSERT_DELETE_UPSERT) {
+ return false;
+ }
+
+ InsertDeleteUpsertOperator deleteOp = (InsertDeleteUpsertOperator) op;
+ return deleteOp.getOperation() == InsertDeleteUpsertOperator.Kind.DELETE;
+ }
}
--
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/18172
To unsubscribe, or for help writing mail filters, visit https://asterix-gerrit.ics.uci.edu/settings
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Change-Id: I51a26f40b1ba0597a66f08a78097cd20a42c4c76
Gerrit-Change-Number: 18172
Gerrit-PatchSet: 1
Gerrit-Owner: Wail Alkowaileet <wa...@gmail.com>
Gerrit-MessageType: newchange