You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "sohardforaname (via GitHub)" <gi...@apache.org> on 2023/05/09 07:42:15 UTC
[GitHub] [doris] sohardforaname opened a new pull request, #19445: [Enhance](Nereids)add default order by of non-order query for nereids
sohardforaname opened a new pull request, #19445:
URL: https://github.com/apache/doris/pull/19445
# Proposed changes
Issue Number: close #xxx
## Problem summary
Describe your changes.
## Checklist(Required)
* [ ] Does it affect the original behavior
* [ ] Has unit tests been added
* [ ] Has document been added or modified
* [ ] Does it need to update dependencies
* [ ] Is this PR support rollback (If NO, please explain WHY)
## Further comments
If this is a relatively large or complex change, kick off the discussion at [dev@doris.apache.org](mailto:dev@doris.apache.org) by explaining why you chose the solution you did and what alternatives you considered, etc...
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] sohardforaname commented on pull request #19445: [Enhance](Nereids)add default order by of non-order query for nereids
Posted by "sohardforaname (via GitHub)" <gi...@apache.org>.
sohardforaname commented on PR #19445:
URL: https://github.com/apache/doris/pull/19445#issuecomment-1540001674
run p0
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] hello-stephen commented on pull request #19445: [Enhance](Nereids)add default order by of non-order query for nereids
Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #19445:
URL: https://github.com/apache/doris/pull/19445#issuecomment-1539749639
TeamCity pipeline, clickbench performance test result:
the sum of best hot time: 34.7 seconds
stream load tsv: 423 seconds loaded 74807831229 Bytes, about 168 MB/s
stream load json: 23 seconds loaded 2358488459 Bytes, about 97 MB/s
stream load orc: 59 seconds loaded 1101869774 Bytes, about 17 MB/s
stream load parquet: 30 seconds loaded 861443392 Bytes, about 27 MB/s
https://doris-community-test-1308700295.cos.ap-hongkong.myqcloud.com/tmp/20230509091039_clickbench_pr_140833.html
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] sohardforaname commented on pull request #19445: [Enhance](Nereids)add default order by of non-order query for nereids
Posted by "sohardforaname (via GitHub)" <gi...@apache.org>.
sohardforaname commented on PR #19445:
URL: https://github.com/apache/doris/pull/19445#issuecomment-1539620996
run buildall
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] sohardforaname commented on pull request #19445: [Enhance](Nereids)add default order by of non-order query for nereids
Posted by "sohardforaname (via GitHub)" <gi...@apache.org>.
sohardforaname commented on PR #19445:
URL: https://github.com/apache/doris/pull/19445#issuecomment-1539998113
run p0
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] morrySnow commented on a diff in pull request #19445: [Enhance](Nereids)add default order by of non-order query for nereids
Posted by "morrySnow (via GitHub)" <gi...@apache.org>.
morrySnow commented on code in PR #19445:
URL: https://github.com/apache/doris/pull/19445#discussion_r1194528963
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/AddDefaultOrderByForLimit.java:
##########
@@ -0,0 +1,64 @@
+// 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.
+
+package org.apache.doris.nereids.rules.analysis;
+
+import org.apache.doris.catalog.OlapTable;
+import org.apache.doris.nereids.properties.OrderKey;
+import org.apache.doris.nereids.rules.Rule;
+import org.apache.doris.nereids.rules.RuleType;
+import org.apache.doris.nereids.trees.expressions.Slot;
+import org.apache.doris.nereids.trees.plans.logical.LogicalOlapScan;
+import org.apache.doris.nereids.trees.plans.logical.LogicalSort;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Lists;
+
+import java.util.List;
+
+/**
+ * add default order by for limit
+ * select * from t limit 10 offset 5
+ * to: select * from t order by {keys} limit 10 offset 5
+ */
+public class AddDefaultOrderByForLimit implements AnalysisRuleFactory {
+
+ @Override
+ public List<Rule> buildRules() {
+ return ImmutableList.of(
+ RuleType.ADD_DEFAULT_ORDER_BY_FOR_LIMIT.build(
Review Comment:
should use custom rewrite to ensure limit is the root node
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/analyzer/NereidsAnalyzer.java:
##########
@@ -57,6 +58,9 @@ public class NereidsAnalyzer extends BatchRewriteJob {
bottomUp(
new CheckBound()
),
+ bottomUp(
+ new AddDefaultOrderByForLimit()
Review Comment:
should do it in rewriter before split limit and after merge filter and project
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/AddDefaultOrderByForLimit.java:
##########
@@ -0,0 +1,64 @@
+// 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.
+
+package org.apache.doris.nereids.rules.analysis;
+
+import org.apache.doris.catalog.OlapTable;
+import org.apache.doris.nereids.properties.OrderKey;
+import org.apache.doris.nereids.rules.Rule;
+import org.apache.doris.nereids.rules.RuleType;
+import org.apache.doris.nereids.trees.expressions.Slot;
+import org.apache.doris.nereids.trees.plans.logical.LogicalOlapScan;
+import org.apache.doris.nereids.trees.plans.logical.LogicalSort;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Lists;
+
+import java.util.List;
+
+/**
+ * add default order by for limit
+ * select * from t limit 10 offset 5
+ * to: select * from t order by {keys} limit 10 offset 5
+ */
+public class AddDefaultOrderByForLimit implements AnalysisRuleFactory {
+
+ @Override
+ public List<Rule> buildRules() {
+ return ImmutableList.of(
+ RuleType.ADD_DEFAULT_ORDER_BY_FOR_LIMIT.build(
+ logicalLimit(logicalFilter(logicalOlapScan()))
+ .then(limit -> limit.withChildren(ImmutableList.of(
+ new LogicalSort<>(buildOrderKeys(limit.child().child()), limit.child()))))),
+ RuleType.ADD_DEFAULT_ORDER_BY_FOR_LIMIT.build(
+ logicalLimit(logicalOlapScan())
Review Comment:
should also include limit(project(filter(scan)))
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
[GitHub] [doris] morrySnow closed pull request #19445: [Enhance](Nereids)add default order by of non-order query for nereids
Posted by "morrySnow (via GitHub)" <gi...@apache.org>.
morrySnow closed pull request #19445: [Enhance](Nereids)add default order by of non-order query for nereids
URL: https://github.com/apache/doris/pull/19445
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org