>From Peeyush Gupta <[email protected]>: Peeyush Gupta has submitted this change. ( https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/20394?usp=email )
Change subject: [ASTERIXDB-3646][COMP] Missing fields when selecting all fields with window function ...................................................................... [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 <[email protected]> Tested-by: Peeyush Gupta <[email protected]> Reviewed-by: Ali Alsuliman <[email protected]> --- M asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/pushdown/PushdownContext.java A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/column/pushdown/window_subquery/window_query.001.ddl.sqlpp A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/column/pushdown/window_subquery/window_query.002.update.sqlpp A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/column/pushdown/window_subquery/window_query.003.query.sqlpp A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/column/pushdown/window_subquery/window_query.004.query.sqlpp A asterixdb/asterix-app/src/test/resources/runtimets/results/column/pushdown/window_subquery/window_query.002.adm A asterixdb/asterix-app/src/test/resources/runtimets/results/column/pushdown/window_subquery/window_query.003.adm M asterixdb/asterix-app/src/test/resources/runtimets/sqlpp_queries.xml 8 files changed, 140 insertions(+), 1 deletion(-) Approvals: Peeyush Gupta: Verified Anon. E. Moose #1000171: Ali Alsuliman: Looks good to me, approved Jenkins: Verified 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 f161cc2..b94f643 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 @@ 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 0000000..6b05219 --- /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 0000000..9a492eb --- /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 0000000..f50dfb7 --- /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 0000000..1e65756 --- /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 0000000..291243f --- /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 0000000..cee9a39 --- /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 4df2c35..7b9e4e6 100644 --- a/asterixdb/asterix-app/src/test/resources/runtimets/sqlpp_queries.xml +++ b/asterixdb/asterix-app/src/test/resources/runtimets/sqlpp_queries.xml @@ -16786,6 +16786,11 @@ </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> </compilation-unit> -- To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/20394?usp=email To unsubscribe, or for help writing mail filters, visit https://asterix-gerrit.ics.uci.edu/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: asterixdb Gerrit-Branch: ionic Gerrit-Change-Id: Ia6d6dfcf5597c52f728f50b7eccef56f46c6ad41 Gerrit-Change-Number: 20394 Gerrit-PatchSet: 3 Gerrit-Owner: Peeyush Gupta <[email protected]> Gerrit-Reviewer: Ali Alsuliman <[email protected]> Gerrit-Reviewer: Anon. E. Moose #1000171 Gerrit-Reviewer: Jenkins <[email protected]> Gerrit-Reviewer: Murtadha Hubail <[email protected]> Gerrit-Reviewer: Peeyush Gupta <[email protected]>
