Skip to content

Commit

Permalink
apply variable only if changed
Browse files Browse the repository at this point in the history
Signed-off-by: Murphy <[email protected]>
  • Loading branch information
murphyatwork committed Dec 20, 2024
1 parent 9ec48ae commit 22b598a
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions fe/fe-core/src/main/java/com/starrocks/planner/SortNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
import com.starrocks.common.StarRocksException;
import com.starrocks.qe.ConnectContext;
import com.starrocks.qe.SessionVariable;
import com.starrocks.server.GlobalStateMgr;
import com.starrocks.sql.optimizer.operator.TopNType;
import com.starrocks.thrift.TExplainLevel;
import com.starrocks.thrift.TNormalPlanNode;
Expand Down Expand Up @@ -220,8 +221,14 @@ protected void toThrift(TPlanNode msg) {
msg.sort_node = new TSortNode(sortInfo, useTopN);
msg.sort_node.setOffset(offset);
SessionVariable sessionVariable = ConnectContext.get().getSessionVariable();
msg.sort_node.setMax_buffered_rows(sessionVariable.getFullSortMaxBufferedRows());
msg.sort_node.setMax_buffered_bytes(sessionVariable.getFullSortMaxBufferedBytes());
SessionVariable defaultVariable = GlobalStateMgr.getCurrentState().getVariableMgr().getDefaultSessionVariable();
if (sessionVariable.getFullSortMaxBufferedBytes() != defaultVariable.getFullSortMaxBufferedBytes()) {
msg.sort_node.setMax_buffered_bytes(sessionVariable.getFullSortMaxBufferedBytes());
}
if (sessionVariable.getFullSortMaxBufferedRows() != defaultVariable.getFullSortMaxBufferedRows()) {
msg.sort_node.setMax_buffered_rows(sessionVariable.getFullSortMaxBufferedRows());
}

msg.sort_node.setLate_materialization(sessionVariable.isFullSortLateMaterialization());
msg.sort_node.setEnable_parallel_merge(sessionVariable.isEnableParallelMerge());

Expand Down

0 comments on commit 22b598a

Please sign in to comment.