[ASTERIXDB-2839] Fix a bug of Optmized Spatial Join
- user model changes: no
- storage format changes: no
- interface changes: no
Details:
- This merge request fixes a bug in which the Optimized Spatial Join plan is not triggered when the join input type is ARectangle.
Change-Id: I16b0a3ef81214433331aeef364eccdff7d1027bb
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/13905
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Dmitry Lychagin <dmitry.lychagin@couchbase.com>
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/PullSelectOutOfSpatialJoin.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/PullSelectOutOfSpatialJoin.java
index 9653793..e395549 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/PullSelectOutOfSpatialJoin.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/PullSelectOutOfSpatialJoin.java
@@ -146,7 +146,8 @@
context.getMetadataProvider(), typeEnvironment);
IAType rightType = (IAType) context.getExpressionTypeComputer().getType(f.getArguments().get(1).getValue(),
context.getMetadataProvider(), typeEnvironment);
- if ((leftType != BuiltinType.ARECTANGLE) || (rightType != BuiltinType.ARECTANGLE)) {
+ if ((leftType.getTypeTag() != BuiltinType.ARECTANGLE.getTypeTag())
+ || (rightType.getTypeTag() != BuiltinType.ARECTANGLE.getTypeTag())) {
return false;
}
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/util/SpatialJoinUtils.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/util/SpatialJoinUtils.java
index 16135e5..ca997e0 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/util/SpatialJoinUtils.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/util/SpatialJoinUtils.java
@@ -185,7 +185,8 @@
context.getMetadataProvider(), typeEnvironment);
IAType rightType = (IAType) context.getExpressionTypeComputer().getType(spatialJoinRightArg,
context.getMetadataProvider(), typeEnvironment);
- if ((leftType != BuiltinType.ARECTANGLE) || (rightType != BuiltinType.ARECTANGLE)) {
+ if ((leftType.getTypeTag() != BuiltinType.ARECTANGLE.getTypeTag())
+ || (rightType.getTypeTag() != BuiltinType.ARECTANGLE.getTypeTag())) {
return false;
}