Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,10 @@ public Object process(Node nd, Stack<Node> stack, NodeProcessorCtx procCtx,
ReduceSinkOperator reduceSinkOperator = (ReduceSinkOperator) nd;
ReduceSinkDesc reduceSinkDesc = reduceSinkOperator.getConf();

// Check whether the reduce sink operator contains top n
if (reduceSinkDesc.getTopN() < 0 || !reduceSinkDesc.isOrdering()) {
// HIVE-29322: Skip creating TopNKeyOperator when LIMIT pushdown has already applied (topN != -1)
// and the query uses a single reducer with no partition columns. In this scenario,
// TopNKey offers no extra pruning benefit and only adds unnecessary processing overhead.
if (reduceSinkDesc.getTopN() > -1 || !reduceSinkDesc.isOrdering()) {
return null;
}

Expand Down