This is an automated email from the ASF dual-hosted git repository.

mblow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/asterixdb.git

commit 2f67d8026bc2d06d843274c3fdcda20ad838d742
Author: Ritik Raj <[email protected]>
AuthorDate: Mon Aug 26 11:09:16 2024 +0530

    [ASTERIXDB-3491][STO] Resetting numTupleCount when skipping MegaLeafPage
    
    - user model changes: no
    - storage format changes: no
    - interface changes: no
    
    Details:
    Resetting TupleCount on skipping MegaLeafPage, so the column reader could 
also skip the megaLeafPage.
    
    Ext-ref: MB-63297
    
    Change-Id: I5ec807992737a9b2f117478e96cfdd179ca10dd1
    Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/18763
    Integration-Tests: Jenkins <[email protected]>
    Reviewed-by: Wail Alkowaileet <[email protected]>
    Tested-by: Murtadha Hubail <[email protected]>
---
 .../ASTERIXDB-3491/ASTERIXDB-3491.001.ddl.sqlpp    | 28 ++++++++++++++++++++++
 .../ASTERIXDB-3491/ASTERIXDB-3491.002.update.sqlpp | 23 ++++++++++++++++++
 .../ASTERIXDB-3491/ASTERIXDB-3491.003.update.sqlpp | 22 +++++++++++++++++
 .../ASTERIXDB-3491/ASTERIXDB-3491.004.query.sqlpp  | 24 +++++++++++++++++++
 .../assembly/ASTERIXDB-3491/ASTERIXDB-3491.004.adm |  0
 .../src/test/resources/runtimets/sqlpp_queries.xml |  5 ++++
 .../column/operation/query/ColumnAssembler.java    |  9 +++++++
 .../column/tuple/MergeColumnTupleReference.java    |  5 ++++
 .../column/tuple/QueryColumnTupleReference.java    |  5 ++++
 .../tuple/QueryColumnWithMetaTupleReference.java   |  6 +++++
 .../lsm/tuples/AbstractColumnTupleReference.java   |  3 +++
 11 files changed, 130 insertions(+)

diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/column/assembly/ASTERIXDB-3491/ASTERIXDB-3491.001.ddl.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/column/assembly/ASTERIXDB-3491/ASTERIXDB-3491.001.ddl.sqlpp
new file mode 100644
index 0000000000..d151eb1317
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/column/assembly/ASTERIXDB-3491/ASTERIXDB-3491.001.ddl.sqlpp
@@ -0,0 +1,28 @@
+/*
+ * 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.
+ */
+
+ DROP DATAVERSE test IF EXISTS;
+ CREATE DATAVERSE test;
+
+ USE test;
+
+ CREATE DATASET ColumnDataset
+ PRIMARY KEY (uid:int) WITH {
+     "storage-format": {"format": "column"}
+ };
\ No newline at end of file
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/column/assembly/ASTERIXDB-3491/ASTERIXDB-3491.002.update.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/column/assembly/ASTERIXDB-3491/ASTERIXDB-3491.002.update.sqlpp
new file mode 100644
index 0000000000..6fc1a3db61
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/column/assembly/ASTERIXDB-3491/ASTERIXDB-3491.002.update.sqlpp
@@ -0,0 +1,23 @@
+/*
+ * 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;
+UPSERT INTO ColumnDataset(
+    {"uid": 1, "a": [{"x": "aaaaaaaaaazzzz"}, {"x": "aaaaaaaaaaabzzzz"}, {"x": 
"aaaaaaaaaaaaabzzzzzzzz"}]}
+);
\ No newline at end of file
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/column/assembly/ASTERIXDB-3491/ASTERIXDB-3491.003.update.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/column/assembly/ASTERIXDB-3491/ASTERIXDB-3491.003.update.sqlpp
new file mode 100644
index 0000000000..e8e22773ed
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/column/assembly/ASTERIXDB-3491/ASTERIXDB-3491.003.update.sqlpp
@@ -0,0 +1,22 @@
+/*
+ * 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;
+DELETE FROM ColumnDataset
+WHERE uid = 1;
\ No newline at end of file
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/column/assembly/ASTERIXDB-3491/ASTERIXDB-3491.004.query.sqlpp
 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/column/assembly/ASTERIXDB-3491/ASTERIXDB-3491.004.query.sqlpp
new file mode 100644
index 0000000000..476c051ac7
--- /dev/null
+++ 
b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/column/assembly/ASTERIXDB-3491/ASTERIXDB-3491.004.query.sqlpp
@@ -0,0 +1,24 @@
+/*
+ * 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 VALUE a.x
+ FROM ColumnDataset c, c.a a
+ WHERE a.x = "aaaaaaaaaaaaaaaaaaaaazzzzzzaaaaaaa"
+ ;
\ No newline at end of file
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/results/column/assembly/ASTERIXDB-3491/ASTERIXDB-3491.004.adm
 
b/asterixdb/asterix-app/src/test/resources/runtimets/results/column/assembly/ASTERIXDB-3491/ASTERIXDB-3491.004.adm
new file mode 100644
index 0000000000..e69de29bb2
diff --git 
a/asterixdb/asterix-app/src/test/resources/runtimets/sqlpp_queries.xml 
b/asterixdb/asterix-app/src/test/resources/runtimets/sqlpp_queries.xml
index 6f614ef13e..558dd3661b 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/sqlpp_queries.xml
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/sqlpp_queries.xml
@@ -16293,6 +16293,11 @@
         <output-dir compare="Text">assembly/004</output-dir>
       </compilation-unit>
     </test-case>
+    <test-case FilePath="column">
+      <compilation-unit name="assembly/ASTERIXDB-3491">
+        <output-dir compare="Text">assembly/ASTERIXDB-3491</output-dir>
+      </compilation-unit>
+    </test-case>
     <test-case FilePath="column">
       <compilation-unit name="delete/001">
         <output-dir compare="Text">delete/001</output-dir>
diff --git 
a/asterixdb/asterix-column/src/main/java/org/apache/asterix/column/operation/query/ColumnAssembler.java
 
b/asterixdb/asterix-column/src/main/java/org/apache/asterix/column/operation/query/ColumnAssembler.java
index e619ecf99a..82a9b635f2 100644
--- 
a/asterixdb/asterix-column/src/main/java/org/apache/asterix/column/operation/query/ColumnAssembler.java
+++ 
b/asterixdb/asterix-column/src/main/java/org/apache/asterix/column/operation/query/ColumnAssembler.java
@@ -110,6 +110,15 @@ public final class ColumnAssembler {
     }
 
     public int skip(int count) throws HyracksDataException {
+        try {
+            return doSkip(count);
+        } catch (ColumnarValueException e) {
+            appendInformation(e);
+            throw e;
+        }
+    }
+
+    private int doSkip(int count) throws HyracksDataException {
         if (numberOfTuples == 0 || count == 0) {
             // Avoid advancing tupleIndex and numberOfSkips if a mega leaf 
node is filtered out
             return 0;
diff --git 
a/asterixdb/asterix-column/src/main/java/org/apache/asterix/column/tuple/MergeColumnTupleReference.java
 
b/asterixdb/asterix-column/src/main/java/org/apache/asterix/column/tuple/MergeColumnTupleReference.java
index 33126e81e1..8c434d7cb8 100644
--- 
a/asterixdb/asterix-column/src/main/java/org/apache/asterix/column/tuple/MergeColumnTupleReference.java
+++ 
b/asterixdb/asterix-column/src/main/java/org/apache/asterix/column/tuple/MergeColumnTupleReference.java
@@ -59,6 +59,11 @@ public final class MergeColumnTupleReference extends 
AbstractAsterixColumnTupleR
         return primaryKeyReaders;
     }
 
+    @Override
+    protected void skipMegaLeafNode() {
+        // no-op
+    }
+
     @Override
     protected boolean startNewPage(ByteBuffer pageZero, int numberOfColumns, 
int numberOfTuples) {
         //Skip filters
diff --git 
a/asterixdb/asterix-column/src/main/java/org/apache/asterix/column/tuple/QueryColumnTupleReference.java
 
b/asterixdb/asterix-column/src/main/java/org/apache/asterix/column/tuple/QueryColumnTupleReference.java
index 7ba0aae5cd..e1dddf1632 100644
--- 
a/asterixdb/asterix-column/src/main/java/org/apache/asterix/column/tuple/QueryColumnTupleReference.java
+++ 
b/asterixdb/asterix-column/src/main/java/org/apache/asterix/column/tuple/QueryColumnTupleReference.java
@@ -87,6 +87,11 @@ public final class QueryColumnTupleReference extends 
AbstractAsterixColumnTupleR
         return ((QueryColumnMetadata) info).getPrimaryKeyReaders();
     }
 
+    @Override
+    protected void skipMegaLeafNode() {
+        assembler.reset(0);
+    }
+
     @Override
     protected boolean startNewPage(ByteBuffer pageZero, int numberOfColumns, 
int numberOfTuples)
             throws HyracksDataException {
diff --git 
a/asterixdb/asterix-column/src/main/java/org/apache/asterix/column/tuple/QueryColumnWithMetaTupleReference.java
 
b/asterixdb/asterix-column/src/main/java/org/apache/asterix/column/tuple/QueryColumnWithMetaTupleReference.java
index 1e4aaeaadb..e7402c3651 100644
--- 
a/asterixdb/asterix-column/src/main/java/org/apache/asterix/column/tuple/QueryColumnWithMetaTupleReference.java
+++ 
b/asterixdb/asterix-column/src/main/java/org/apache/asterix/column/tuple/QueryColumnWithMetaTupleReference.java
@@ -90,6 +90,12 @@ public final class QueryColumnWithMetaTupleReference extends 
AbstractAsterixColu
         return ((QueryColumnMetadata) info).getPrimaryKeyReaders();
     }
 
+    @Override
+    protected void skipMegaLeafNode() {
+        assembler.reset(0);
+        metaAssembler.reset(0);
+    }
+
     @Override
     protected boolean startNewPage(ByteBuffer pageZero, int numberOfColumns, 
int numberOfTuples)
             throws HyracksDataException {
diff --git 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree-column/src/main/java/org/apache/hyracks/storage/am/lsm/btree/column/impls/lsm/tuples/AbstractColumnTupleReference.java
 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree-column/src/main/java/org/apache/hyracks/storage/am/lsm/btree/column/impls/lsm/tuples/AbstractColumnTupleReference.java
index 99dabfccd6..f30007d9f9 100644
--- 
a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree-column/src/main/java/org/apache/hyracks/storage/am/lsm/btree/column/impls/lsm/tuples/AbstractColumnTupleReference.java
+++ 
b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-btree-column/src/main/java/org/apache/hyracks/storage/am/lsm/btree/column/impls/lsm/tuples/AbstractColumnTupleReference.java
@@ -155,12 +155,15 @@ public abstract class AbstractColumnTupleReference 
implements IColumnTupleIterat
              */
             skip(Math.max(skipCount, 0));
         } else {
+            skipMegaLeafNode();
             numOfSkippedMegaLeafNodes++;
         }
 
         totalNumberOfMegaLeafNodes++;
     }
 
+    protected abstract void skipMegaLeafNode();
+
     @Override
     public final void setAt(int startIndex) throws HyracksDataException {
         if (tupleIndex == startIndex) {

Reply via email to