Skip to content

Commit d888d3c

Browse files
committed
[fix](topN)runtime_predicate is only triggered when the column name is obtained (apache#27485)
1 parent 772f181 commit d888d3c

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎be/src/vec/exec/vsort_node.cpp‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,12 +142,12 @@ Status VSortNode::sink(RuntimeState* state, vectorized::Block* input_block, bool
142142
RETURN_IF_CANCELLED(state);
143143
RETURN_IF_ERROR(state->check_query_state("vsort, while sorting input."));
144144

145+
auto& sort_description = _sorter->get_sort_description();
146+
auto col = input_block->get_by_position(sort_description[0].column_number);
145147
// update runtime predicate
146-
if (_use_topn_opt) {
148+
if (_use_topn_opt && !col.name.empty()) {
147149
Field new_top = _sorter->get_top_value();
148150
if (!new_top.is_null() && (old_top.is_null() || new_top != old_top)) {
149-
auto& sort_description = _sorter->get_sort_description();
150-
auto col = input_block->get_by_position(sort_description[0].column_number);
151151
bool is_reverse = sort_description[0].direction < 0;
152152
auto query_ctx = state->get_query_ctx();
153153
RETURN_IF_ERROR(

0 commit comments

Comments
 (0)