From 3ce9e7cfca4a03543d62fc468f4cce92c198ffb5 Mon Sep 17 00:00:00 2001 From: jakevin <30525741+jackwener@users.noreply.github.com> Date: Thu, 7 Jul 2022 22:32:07 +0800 Subject: [PATCH] [enhance](planner): remove redundant field in sort (#10624) SortInfo is in SortNode. But there are some replicated field in SortNode Issue Number: close #10616 Remove the redundant field in `TSortNode` which exist in `TSortInfo`. [API-BREAK] This has changed `Thrift` file. --- .../org/apache/doris/analysis/SortInfo.java | 16 ++++++++++++++ .../translator/PhysicalPlanTranslator.java | 1 - .../org/apache/doris/planner/SortNode.java | 22 +++++-------------- gensrc/thrift/PlanNodes.thrift | 9 -------- 4 files changed, 21 insertions(+), 27 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/SortInfo.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/SortInfo.java index 3e0703414b..05763e8d07 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/analysis/SortInfo.java +++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/SortInfo.java @@ -21,6 +21,7 @@ package org.apache.doris.analysis; import org.apache.doris.common.TreeNode; +import org.apache.doris.thrift.TSortInfo; import com.google.common.base.Preconditions; import com.google.common.base.Predicates; @@ -136,6 +137,10 @@ public class SortInfo { return sortTupleSlotExprs; } + public void setSortTupleSlotExprs(List sortTupleSlotExprs) { + this.sortTupleSlotExprs = sortTupleSlotExprs; + } + public TupleDescriptor getSortTupleDescriptor() { return sortTupleDesc; } @@ -273,4 +278,15 @@ public class SortInfo { } return substOrderBy; } + + /** + * Convert the sort info to TSortInfo. + */ + public TSortInfo toThrift() { + TSortInfo sortInfo = new TSortInfo( + Expr.treesToThrift(orderingExprs), + isAscOrder, + nullsFirstParams); + return sortInfo; + } } diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/PhysicalPlanTranslator.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/PhysicalPlanTranslator.java index da69c993fa..98a697db74 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/PhysicalPlanTranslator.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/PhysicalPlanTranslator.java @@ -229,7 +229,6 @@ public class PhysicalPlanTranslator extends PlanOperatorVisitor ordering_exprs - 5: optional list is_asc_order // Indicates whether the imposed limit comes DEFAULT_ORDER_BY_LIMIT. 6: optional bool is_default_limit - // Indicates, for each expr, if nulls should be listed first or last. This is - // independent of is_asc_order. - 7: optional list nulls_first - // Expressions evaluated over the input row that materialize the tuple to be so - // Contains one expr per slot in the materialized tuple. - 8: optional list sort_tuple_slot_exprs } enum TAnalyticWindowType {