Ian Maxon has uploaded a new change for review.

  https://asterix-gerrit.ics.uci.edu/1743

Change subject: ASTERIXDB-1905: Incorrect filter for post-load sidx
......................................................................

ASTERIXDB-1905: Incorrect filter for post-load sidx

The issue seems to be limited to RTrees. The MBR evaluators
were not accounting for the point MBR optimization as they
were in the compiled load pidx+sidx case

Change-Id: Iea158ad4c29ad4421020a28a72e68637bc538560
---
A 
asterixdb/asterix-app/src/test/resources/runtimets/queries/filters/load-with-secondary-rtree/load-with-secondary-rtree.6.query.aql
A 
asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/filters/load-with-secondary-rtree/load-with-secondary-rtree.6.query.sqlpp
A 
asterixdb/asterix-app/src/test/resources/runtimets/results/filters/load-with-secondary-rtree/load-with-secondary-rtree.2.adm
M 
asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/SecondaryRTreeOperationsHelper.java
M 
asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/base/IDataFormat.java
M 
asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/formats/NonTaggedDataFormat.java
6 files changed, 58 insertions(+), 4 deletions(-)


  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb 
refs/changes/43/1743/1

diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries/filters/load-with-secondary-rtree/load-with-secondary-rtree.6.query.aql
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/filters/load-with-secondary-rtree/load-with-secondary-rtree.6.query.aql
new file mode 100644
index 0000000..0a02b14
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries/filters/load-with-secondary-rtree/load-with-secondary-rtree.6.query.aql
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+use dataverse test;
+
+for $m in dataset('FacebookMessages')
+where spatial-intersect($m.sender-location, 
create-polygon([40.0,79.87,30.0,75.0,50.0,80.0,10.0,10.0]))
+and $m.send-time > datetime("2012-11-20T10:10:00.000Z")
+order by $m.send-time
+return $m
+
+
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/filters/load-with-secondary-rtree/load-with-secondary-rtree.6.query.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/filters/load-with-secondary-rtree/load-with-secondary-rtree.6.query.sqlpp
new file mode 100644
index 0000000..c082af4
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/filters/load-with-secondary-rtree/load-with-secondary-rtree.6.query.sqlpp
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use test;
+
+select element m
+from  FacebookMessages as m
+where 
(test.`spatial-intersect`(m.`sender-location`,test.`create-polygon`([40.0,79.87,30.0,75.0,50.0,80.0,10.0,10.0]))
 and (m.`send-time` > test.datetime('2012-11-20T10:10:00.000Z')))
+order by m.`send-time`
+;
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/filters/load-with-secondary-rtree/load-with-secondary-rtree.2.adm
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/filters/load-with-secondary-rtree/load-with-secondary-rtree.2.adm
new file mode 100644
index 0000000..f87754d
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/filters/load-with-secondary-rtree/load-with-secondary-rtree.2.adm
@@ -0,0 +1 @@
+{ "message-id": 12, "author-id": 10, "in-response-to": 6, "sender-location": 
point("42.26,77.76"), "message": " can't stand t-mobile its voicemail-service 
is OMG:(", "send-time": datetime("2012-12-20T10:10:00.000Z") }
\ No newline at end of file
diff --git 
a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/SecondaryRTreeOperationsHelper.java
 
b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/SecondaryRTreeOperationsHelper.java
index 352bc6a..7f2572d 100644
--- 
a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/SecondaryRTreeOperationsHelper.java
+++ 
b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/SecondaryRTreeOperationsHelper.java
@@ -176,7 +176,7 @@
         int recordColumn = dataset.getDatasetType() == DatasetType.INTERNAL ? 
numPrimaryKeys : 0;
         secondaryFieldAccessEvalFactories =
                 
metadataProvider.getFormat().createMBRFactory(isEnforcingKeyTypes ? 
enforcedItemType : itemType,
-                        secondaryKeyFields.get(0), recordColumn, 
numDimensions, filterFieldName);
+                        secondaryKeyFields.get(0), recordColumn, 
numDimensions, filterFieldName, isPointMBR);
         secondaryComparatorFactories = new 
IBinaryComparatorFactory[numNestedSecondaryKeyFields];
         valueProviderFactories = new 
IPrimitiveValueProviderFactory[numNestedSecondaryKeyFields];
         ISerializerDeserializer[] secondaryRecFields =
diff --git 
a/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/base/IDataFormat.java
 
b/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/base/IDataFormat.java
index 3c31f00..53c24cf 100644
--- 
a/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/base/IDataFormat.java
+++ 
b/asterixdb/asterix-om/src/main/java/org/apache/asterix/formats/base/IDataFormat.java
@@ -82,7 +82,7 @@
     public IScalarEvaluatorFactory 
getConstantEvalFactory(IAlgebricksConstantValue value) throws 
AlgebricksException;
 
     public IScalarEvaluatorFactory[] createMBRFactory(ARecordType recType, 
List<String> fldName, int recordColumn,
-            int dimension, List<String> filterFieldName) throws 
AlgebricksException;
+                                                      int dimension, 
List<String> filterFieldName, boolean isPointMBR) throws AlgebricksException;
 
     public IExpressionEvalSizeComputer getExpressionEvalSizeComputer();
 
diff --git 
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/formats/NonTaggedDataFormat.java
 
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/formats/NonTaggedDataFormat.java
index 01aff1a..8991989 100644
--- 
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/formats/NonTaggedDataFormat.java
+++ 
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/formats/NonTaggedDataFormat.java
@@ -242,9 +242,9 @@
     @SuppressWarnings("unchecked")
     @Override
     public IScalarEvaluatorFactory[] createMBRFactory(ARecordType recType, 
List<String> fldName, int recordColumn,
-            int dimension, List<String> filterFieldName) throws 
AlgebricksException {
+                                                      int dimension, 
List<String> filterFieldName, boolean isPointMBR) throws AlgebricksException {
         IScalarEvaluatorFactory evalFactory = 
getFieldAccessEvaluatorFactory(recType, fldName, recordColumn);
-        int numOfFields = dimension * 2;
+        int numOfFields = isPointMBR ? dimension : dimension * 2;
         IScalarEvaluatorFactory[] evalFactories =
                 new IScalarEvaluatorFactory[numOfFields + (filterFieldName == 
null ? 0 : 1)];
 

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/1743
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iea158ad4c29ad4421020a28a72e68637bc538560
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Ian Maxon <[email protected]>

Reply via email to