You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by mb...@apache.org on 2025/09/20 12:24:27 UTC
(asterixdb) 25/27: [ASTERIXDB-3646][COMP] Missing fields when selecting all fields with window function
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 6cce530b019366e5f8dd6a2e2a74315aa302b28e
Author: Peeyush Gupta <pe...@couchbase.com>
AuthorDate: Thu Sep 18 14:17:11 2025 -0700
[ASTERIXDB-3646][COMP] Missing fields when selecting all fields with window function
- user model changes: no
- storage format changes: no
- interface changes: no
Ext-ref: MB-68618
Change-Id: Ia6d6dfcf5597c52f728f50b7eccef56f46c6ad41
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/20394
Integration-Tests: Jenkins <je...@fulliautomatix.ics.uci.edu>
Tested-by: Peeyush Gupta <pe...@couchbase.com>
Reviewed-by: Ali Alsuliman <al...@gmail.com>
---
.../optimizer/rules/pushdown/PushdownContext.java | 2 +-
.../window_subquery/window_query.001.ddl.sqlpp | 33 +++++++++++++++++
.../window_subquery/window_query.002.update.sqlpp | 43 ++++++++++++++++++++++
.../window_subquery/window_query.003.query.sqlpp | 28 ++++++++++++++
.../window_subquery/window_query.004.query.sqlpp | 28 ++++++++++++++
.../pushdown/window_subquery/window_query.002.adm | 1 +
.../pushdown/window_subquery/window_query.003.adm | 1 +
.../src/test/resources/runtimets/sqlpp_queries.xml | 5 +++
8 files changed, 140 insertions(+), 1 deletion(-)
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/pushdown/PushdownContext.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/pushdown/PushdownContext.java
index f161cc2a05..b94f643e1e 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/pushdown/PushdownContext.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/pushdown/PushdownContext.java
@@ -148,7 +148,7 @@ public class PushdownContext {
if (defineDescriptor == null) {
// Log to track any definition that we may have missed
LOGGER.warn("Variable {} is not defined", variable);
- return;
+ continue;
}
List<UseDescriptor> uses = useChain.get(variable);
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/column/pushdown/window_subquery/window_query.001.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/column/pushdown/window_subquery/window_query.001.ddl.sqlpp
new file mode 100644
index 0000000000..6b052195b4
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/column/pushdown/window_subquery/window_query.001.ddl.sqlpp
@@ -0,0 +1,33 @@
+/*
+ * 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 TYPE EventType AS {
+ id: int
+};
+
+CREATE DATASET events(EventType)
+PRIMARY KEY id WITH {
+ "storage-format": {"format" : "column"}
+};
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/column/pushdown/window_subquery/window_query.002.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/column/pushdown/window_subquery/window_query.002.update.sqlpp
new file mode 100644
index 0000000000..9a492ebdb8
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/column/pushdown/window_subquery/window_query.002.update.sqlpp
@@ -0,0 +1,43 @@
+/*
+ * 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;
+
+insert into events [
+ {
+ "id": 1,
+ "pid":1,
+ "val":10,
+ "sval":"a",
+ "nest": {
+ "nval":100,
+ "nsval":"aa"
+ }
+ },
+ {
+ "id": 2,
+ "pid":1,
+ "val":11,
+ "sval":"b",
+ "nest": {
+ "nval":101,
+ "nsval":"bb"
+ }
+ }
+]
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/column/pushdown/window_subquery/window_query.003.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/column/pushdown/window_subquery/window_query.003.query.sqlpp
new file mode 100644
index 0000000000..f50dfb7767
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/column/pushdown/window_subquery/window_query.003.query.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.
+ */
+
+USE test;
+
+SELECT *
+FROM (
+ SELECT events,
+ ROW_NUMBER() OVER (PARTITION BY tostring(pid) ORDER BY val) AS rn
+ FROM events
+) sub
+WHERE rn = 1;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/column/pushdown/window_subquery/window_query.004.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/column/pushdown/window_subquery/window_query.004.query.sqlpp
new file mode 100644
index 0000000000..1e6575685e
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/column/pushdown/window_subquery/window_query.004.query.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.
+ */
+
+USE test;
+
+SELECT sub.events.nest.*, sub.rn
+FROM (
+ SELECT events,
+ ROW_NUMBER() OVER (PARTITION BY tostring(pid) ORDER BY val) AS rn
+ FROM events
+) sub
+WHERE rn = 1;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/column/pushdown/window_subquery/window_query.002.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/column/pushdown/window_subquery/window_query.002.adm
new file mode 100644
index 0000000000..291243ffe1
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/column/pushdown/window_subquery/window_query.002.adm
@@ -0,0 +1 @@
+{ "sub": { "events": { "id": 1, "pid": 1, "val": 10, "sval": "a", "nest": { "nval": 100, "nsval": "aa" } }, "rn": 1 } }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/column/pushdown/window_subquery/window_query.003.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/column/pushdown/window_subquery/window_query.003.adm
new file mode 100644
index 0000000000..cee9a399dc
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/column/pushdown/window_subquery/window_query.003.adm
@@ -0,0 +1 @@
+{ "rn": 1, "nval": 100, "nsval": "aa" }
\ No newline at end of file
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 4df2c35830..7b9e4e6c72 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/sqlpp_queries.xml
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/sqlpp_queries.xml
@@ -16785,6 +16785,11 @@
<output-dir compare="Text">pushdown/same-datasource-diff-scan</output-dir>
</compilation-unit>
</test-case>
+ <test-case FilePath="column">
+ <compilation-unit name="pushdown/window_subquery">
+ <output-dir compare="Text">pushdown/window_subquery</output-dir>
+ </compilation-unit>
+ </test-case>
<test-case FilePath="column">
<compilation-unit name="select-count-one-field">
<output-dir compare="Text">select-count-one-field</output-dir>