You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by gg...@apache.org on 2021/09/23 03:17:01 UTC
[asterixdb] branch master updated: [ASTERIXDB-2966][IDX] Disabling
array index INLJ for non-equjoins in probe
This is an automated email from the ASF dual-hosted git repository.
ggalvizo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/asterixdb.git
The following commit(s) were added to refs/heads/master by this push:
new a42e666 [ASTERIXDB-2966][IDX] Disabling array index INLJ for non-equjoins in probe
a42e666 is described below
commit a42e6669f77eea38a1c5697b31520f8c39f7ec70
Author: ggalvizo <gg...@uci.edu>
AuthorDate: Mon Sep 20 12:27:58 2021 -0700
[ASTERIXDB-2966][IDX] Disabling array index INLJ for non-equjoins in probe
- user model changes: no
- storage format changes: no
- interface changes: no
If there are non-equijoins in the probe (which lead to NL joins),
disable INLJ acceleration from array indexes. This is a broader scope
than the cross-joins in the probe from the previous fix.
Change-Id: I0d36784272acc43f4eb4d876d8f6ebe07b8014ff
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/13303
Integration-Tests: Jenkins <je...@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <je...@fulliautomatix.ics.uci.edu>
Reviewed-by: Dmitry Lychagin <dm...@couchbase.com>
---
.../optimizer/rules/am/ArrayBTreeAccessMethod.java | 25 +++++++++++++++++++---
1 file changed, 22 insertions(+), 3 deletions(-)
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/ArrayBTreeAccessMethod.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/ArrayBTreeAccessMethod.java
index b733b52..8d79c7d 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/ArrayBTreeAccessMethod.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/am/ArrayBTreeAccessMethod.java
@@ -30,6 +30,7 @@ import org.apache.asterix.common.exceptions.ErrorCode;
import org.apache.asterix.metadata.entities.Dataset;
import org.apache.asterix.metadata.entities.Index;
import org.apache.asterix.metadata.utils.ArrayIndexUtil;
+import org.apache.asterix.om.functions.BuiltinFunctions;
import org.apache.asterix.om.types.IAType;
import org.apache.asterix.om.utils.NonTaggedFormatUtil;
import org.apache.commons.lang3.mutable.Mutable;
@@ -38,9 +39,10 @@ import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
import org.apache.hyracks.algebricks.core.algebra.base.ILogicalExpression;
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.LogicalExpressionTag;
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.ConstantExpression;
+import org.apache.hyracks.algebricks.core.algebra.expressions.AbstractFunctionCallExpression;
import org.apache.hyracks.algebricks.core.algebra.operators.logical.AbstractBinaryJoinOperator;
import org.apache.hyracks.algebricks.core.algebra.operators.logical.LeftOuterUnnestOperator;
import org.apache.hyracks.algebricks.core.algebra.operators.logical.UnnestOperator;
@@ -101,7 +103,7 @@ public class ArrayBTreeAccessMethod extends BTreeAccessMethod {
return false;
}
- // TODO (GLENN): There is a bug with cross-products originating from the probe. Disable this case for now.
+ // TODO (GLENN): There is a bug with nested-loop joins originating from the probe. Disable this case for now.
Deque<ILogicalOperator> opStack = new ArrayDeque<>();
List<ILogicalOperator> visited = new ArrayList<>();
opStack.add(probeSubTree.getRoot());
@@ -111,8 +113,25 @@ public class ArrayBTreeAccessMethod extends BTreeAccessMethod {
if (workingOp.getOperatorTag() == LogicalOperatorTag.INNERJOIN
|| workingOp.getOperatorTag() == LogicalOperatorTag.LEFTOUTERJOIN) {
AbstractBinaryJoinOperator joinOperator = (AbstractBinaryJoinOperator) workingOp;
- if (joinOperator.getCondition().getValue().equals(ConstantExpression.TRUE)) {
+ ILogicalExpression joinCondition = joinOperator.getCondition().getValue();
+ List<Mutable<ILogicalExpression>> conjuncts = new ArrayList<>();
+ if (joinCondition.splitIntoConjuncts(conjuncts)) {
+ for (Mutable<ILogicalExpression> conjunct : conjuncts) {
+ if (conjunct.getValue().getExpressionTag() != LogicalExpressionTag.FUNCTION_CALL) {
+ return false;
+ }
+ AbstractFunctionCallExpression expr = (AbstractFunctionCallExpression) joinCondition;
+ if (expr.getFunctionIdentifier() != BuiltinFunctions.EQ) {
+ return false;
+ }
+ }
+ } else if (joinCondition.getExpressionTag() != LogicalExpressionTag.FUNCTION_CALL) {
return false;
+ } else {
+ AbstractFunctionCallExpression expr = (AbstractFunctionCallExpression) joinCondition;
+ if (expr.getFunctionIdentifier() != BuiltinFunctions.EQ) {
+ return false;
+ }
}
}
visited.add(workingOp);