>From Preetham Poluparthi <[email protected]>: Preetham Poluparthi has uploaded this change for review. ( https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/20772?usp=email )
Change subject: [ASTERIXDB-3683][COMP] Fix isomorphic window joins ...................................................................... [ASTERIXDB-3683][COMP] Fix isomorphic window joins - user model changes: no - storage format changes: no - interface changes: no Ext-ref: MB-69788 Change-Id: I69f56d136621591de915628cd1e308e8743f946a --- A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/window/isomorphic/isomorphic.1.ddl.sqlpp A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/window/isomorphic/isomorphic.2.update.sqlpp A asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/window/isomorphic/isomorphic.3.query.sqlpp A asterixdb/asterix-app/src/test/resources/runtimets/results/window/isomorphic/isomorphic.3.adm M asterixdb/asterix-app/src/test/resources/runtimets/sqlpp_queries.xml M hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/visitors/IsomorphismOperatorVisitor.java 6 files changed, 205 insertions(+), 1 deletion(-) git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb refs/changes/72/20772/1 diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/window/isomorphic/isomorphic.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/window/isomorphic/isomorphic.1.ddl.sqlpp new file mode 100644 index 0000000..47a6a97 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/window/isomorphic/isomorphic.1.ddl.sqlpp @@ -0,0 +1,36 @@ +/* + * 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. + */ +/* + * Description : Isomorphic Window functions Test + * Expected Res : SUCCESS + */ + +drop dataverse test if exists; +create dataverse test; + +use test; + +create type prim as open { + `timestamp` : bigint + }; + +create dataset stock_market_price_usd(prim) +primary key `timestamp`; + + diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/window/isomorphic/isomorphic.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/window/isomorphic/isomorphic.2.update.sqlpp new file mode 100644 index 0000000..0155125 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/window/isomorphic/isomorphic.2.update.sqlpp @@ -0,0 +1,30 @@ +/* + * 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. + */ +/* + * Description : Isomorphic Window functions Test + * Expected Res : SUCCESS + */ + +use test; + +INSERT INTO stock_market_price_usd( + SELECT VALUE {"timestamp": intVal + 1764530820000, "value" : 100 + intVal * 0.05 } + FROM range(1, 100) intVal +); + diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/window/isomorphic/isomorphic.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/window/isomorphic/isomorphic.3.query.sqlpp new file mode 100644 index 0000000..f9b48b7 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/window/isomorphic/isomorphic.3.query.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. + */ +/* + * Description : Isomorphic Window functions Test + * Expected Res : SUCCESS + */ +use test; + +SELECT l.timestamp, (l.`value` + r.`value`) as `value` +FROM + ( SELECT timestamp, avg(`value`) OVER (ORDER BY timestamp RANGE BETWEEN 30 PRECEDING AND CURRENT ROW) AS `value` FROM stock_market_price_usd sub ) l + JOIN + ( SELECT timestamp, sum(`value`) OVER (ORDER BY timestamp RANGE BETWEEN 30 PRECEDING AND CURRENT ROW) AS `value` FROM stock_market_price_usd sub ) r + ON l.timestamp = r.timestamp +order by timestamp; + + diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/window/isomorphic/isomorphic.3.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/window/isomorphic/isomorphic.3.adm new file mode 100644 index 0000000..9fda828 --- /dev/null +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/window/isomorphic/isomorphic.3.adm @@ -0,0 +1,100 @@ +{ "timestamp": 1764530820001, "value": 200.1 } +{ "timestamp": 1764530820002, "value": 300.22499999999997 } +{ "timestamp": 1764530820003, "value": 400.3999999999999 } +{ "timestamp": 1764530820004, "value": 500.62499999999994 } +{ "timestamp": 1764530820005, "value": 600.9 } +{ "timestamp": 1764530820006, "value": 701.2249999999999 } +{ "timestamp": 1764530820007, "value": 801.6 } +{ "timestamp": 1764530820008, "value": 902.025 } +{ "timestamp": 1764530820009, "value": 1002.5 } +{ "timestamp": 1764530820010, "value": 1103.025 } +{ "timestamp": 1764530820011, "value": 1203.6 } +{ "timestamp": 1764530820012, "value": 1304.225 } +{ "timestamp": 1764530820013, "value": 1404.8999999999999 } +{ "timestamp": 1764530820014, "value": 1505.625 } +{ "timestamp": 1764530820015, "value": 1606.4 } +{ "timestamp": 1764530820016, "value": 1707.225 } +{ "timestamp": 1764530820017, "value": 1808.1 } +{ "timestamp": 1764530820018, "value": 1909.0249999999999 } +{ "timestamp": 1764530820019, "value": 2010.0 } +{ "timestamp": 1764530820020, "value": 2111.025 } +{ "timestamp": 1764530820021, "value": 2212.1000000000004 } +{ "timestamp": 1764530820022, "value": 2313.225 } +{ "timestamp": 1764530820023, "value": 2414.4 } +{ "timestamp": 1764530820024, "value": 2515.625 } +{ "timestamp": 1764530820025, "value": 2616.9 } +{ "timestamp": 1764530820026, "value": 2718.2250000000004 } +{ "timestamp": 1764530820027, "value": 2819.6 } +{ "timestamp": 1764530820028, "value": 2921.025 } +{ "timestamp": 1764530820029, "value": 3022.5 } +{ "timestamp": 1764530820030, "value": 3124.025 } +{ "timestamp": 1764530820031, "value": 3225.6000000000004 } +{ "timestamp": 1764530820032, "value": 3227.2 } +{ "timestamp": 1764530820033, "value": 3228.8 } +{ "timestamp": 1764530820034, "value": 3230.3999999999996 } +{ "timestamp": 1764530820035, "value": 3232.0 } +{ "timestamp": 1764530820036, "value": 3233.6000000000004 } +{ "timestamp": 1764530820037, "value": 3235.2 } +{ "timestamp": 1764530820038, "value": 3236.8 } +{ "timestamp": 1764530820039, "value": 3238.3999999999996 } +{ "timestamp": 1764530820040, "value": 3240.0 } +{ "timestamp": 1764530820041, "value": 3241.6000000000004 } +{ "timestamp": 1764530820042, "value": 3243.2 } +{ "timestamp": 1764530820043, "value": 3244.8 } +{ "timestamp": 1764530820044, "value": 3246.3999999999996 } +{ "timestamp": 1764530820045, "value": 3248.0 } +{ "timestamp": 1764530820046, "value": 3249.6000000000004 } +{ "timestamp": 1764530820047, "value": 3251.2 } +{ "timestamp": 1764530820048, "value": 3252.8 } +{ "timestamp": 1764530820049, "value": 3254.3999999999996 } +{ "timestamp": 1764530820050, "value": 3256.0 } +{ "timestamp": 1764530820051, "value": 3257.6000000000004 } +{ "timestamp": 1764530820052, "value": 3259.2 } +{ "timestamp": 1764530820053, "value": 3260.8 } +{ "timestamp": 1764530820054, "value": 3262.3999999999996 } +{ "timestamp": 1764530820055, "value": 3264.0 } +{ "timestamp": 1764530820056, "value": 3265.6000000000004 } +{ "timestamp": 1764530820057, "value": 3267.2 } +{ "timestamp": 1764530820058, "value": 3268.8 } +{ "timestamp": 1764530820059, "value": 3270.3999999999996 } +{ "timestamp": 1764530820060, "value": 3272.0 } +{ "timestamp": 1764530820061, "value": 3273.6000000000004 } +{ "timestamp": 1764530820062, "value": 3275.2 } +{ "timestamp": 1764530820063, "value": 3276.8 } +{ "timestamp": 1764530820064, "value": 3278.3999999999996 } +{ "timestamp": 1764530820065, "value": 3280.0 } +{ "timestamp": 1764530820066, "value": 3281.6000000000004 } +{ "timestamp": 1764530820067, "value": 3283.2 } +{ "timestamp": 1764530820068, "value": 3284.8 } +{ "timestamp": 1764530820069, "value": 3286.3999999999996 } +{ "timestamp": 1764530820070, "value": 3288.0 } +{ "timestamp": 1764530820071, "value": 3289.6000000000004 } +{ "timestamp": 1764530820072, "value": 3291.2 } +{ "timestamp": 1764530820073, "value": 3292.8 } +{ "timestamp": 1764530820074, "value": 3294.3999999999996 } +{ "timestamp": 1764530820075, "value": 3296.0 } +{ "timestamp": 1764530820076, "value": 3297.6000000000004 } +{ "timestamp": 1764530820077, "value": 3299.2 } +{ "timestamp": 1764530820078, "value": 3300.8 } +{ "timestamp": 1764530820079, "value": 3302.3999999999996 } +{ "timestamp": 1764530820080, "value": 3304.0 } +{ "timestamp": 1764530820081, "value": 3305.6000000000004 } +{ "timestamp": 1764530820082, "value": 3307.2 } +{ "timestamp": 1764530820083, "value": 3308.8 } +{ "timestamp": 1764530820084, "value": 3310.3999999999996 } +{ "timestamp": 1764530820085, "value": 3312.0 } +{ "timestamp": 1764530820086, "value": 3313.6000000000004 } +{ "timestamp": 1764530820087, "value": 3315.2 } +{ "timestamp": 1764530820088, "value": 3316.8 } +{ "timestamp": 1764530820089, "value": 3318.3999999999996 } +{ "timestamp": 1764530820090, "value": 3320.0 } +{ "timestamp": 1764530820091, "value": 3321.6000000000004 } +{ "timestamp": 1764530820092, "value": 3323.2 } +{ "timestamp": 1764530820093, "value": 3324.8 } +{ "timestamp": 1764530820094, "value": 3326.3999999999996 } +{ "timestamp": 1764530820095, "value": 3328.0 } +{ "timestamp": 1764530820096, "value": 3329.6000000000004 } +{ "timestamp": 1764530820097, "value": 3331.2 } +{ "timestamp": 1764530820098, "value": 3332.8 } +{ "timestamp": 1764530820099, "value": 3334.3999999999996 } +{ "timestamp": 1764530820100, "value": 3336.0 } 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 44bbeac..6da101e 100644 --- a/asterixdb/asterix-app/src/test/resources/runtimets/sqlpp_queries.xml +++ b/asterixdb/asterix-app/src/test/resources/runtimets/sqlpp_queries.xml @@ -16092,6 +16092,11 @@ </compilation-unit> </test-case> <test-case FilePath="window"> + <compilation-unit name="isomorphic"> + <output-dir compare="Text">isomorphic</output-dir> + </compilation-unit> + </test-case> + <test-case FilePath="window"> <compilation-unit name="lag_01"> <output-dir compare="Text">lag_01</output-dir> </compilation-unit> diff --git a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/visitors/IsomorphismOperatorVisitor.java b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/visitors/IsomorphismOperatorVisitor.java index 7ee3c53..8f04234 100644 --- a/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/visitors/IsomorphismOperatorVisitor.java +++ b/hyracks-fullstack/algebricks/algebricks-core/src/main/java/org/apache/hyracks/algebricks/core/algebra/operators/logical/visitors/IsomorphismOperatorVisitor.java @@ -787,7 +787,7 @@ private ILogicalOperator copyAndSubstituteVar(ILogicalOperator op, ILogicalOperator argOp) throws AlgebricksException { - ILogicalOperator newOp = OperatorManipulationUtil.deepCopy(argOp); + ILogicalOperator newOp = OperatorManipulationUtil.bottomUpCopyOperators(argOp); variableMapping.clear(); IsomorphismUtilities.mapVariablesTopDown(op, argOp, variableMapping); -- To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/20772?usp=email To unsubscribe, or for help writing mail filters, visit https://asterix-gerrit.ics.uci.edu/settings?usp=email Gerrit-MessageType: newchange Gerrit-Project: asterixdb Gerrit-Branch: trinity Gerrit-Change-Id: I69f56d136621591de915628cd1e308e8743f946a Gerrit-Change-Number: 20772 Gerrit-PatchSet: 1 Gerrit-Owner: Preetham Poluparthi <[email protected]>
