You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@impala.apache.org by "Quanlong Huang (Code Review)" <ge...@cloudera.org> on 2022/12/12 01:29:36 UTC

[Impala-ASF-CR] IMPALA-11779: Fix crash in TopNNode due to slots in null type

Quanlong Huang has uploaded a new patch set (#2). ( http://gerrit.cloudera.org:8080/19336 )

Change subject: IMPALA-11779: Fix crash in TopNNode due to slots in null type
......................................................................

IMPALA-11779: Fix crash in TopNNode due to slots in null type

BE can't codegen or evaluate exprs in NULL type. So when FE transfer
exprs to BE (via thrift), it will convert exprs in NULL type into
NullLiteral with Boolean type, e.g. see code in Exprr#treeToThrift().
The type doesn't matter since ScalarExprEvaluator::GetValue() in BE
returns nullptr for null values of all types, and nullptr is treated as
null value.

Most of the exprs in BE are generated from thrift TExprs transferred
from FE, which guarantees they are not NULL type exprs. However, in
TopNPlanNode::Init(), we create SlotRefs directly based on the sort
tuple descriptor. If there are NULL type slots in the tuple descriptor,
we get SlotRefs in NULL type, which will crash codegen or evaluation (if
codegen is disabled) on them.

This patch adds checks on the slot types and creates NullLiteral instead
for NULL type slots, which makes the code consistent with FE. Also makes
ScalarExpr::Init() public so TopNPlanNode can use it.

Tests:
 - Added new tests in partitioned-top-n.test
 - Ran exhaustive tests

Change-Id: I6aaf80c5129eaf788c70c8f041021eaf73087f94
---
M be/src/exec/topn-node.cc
M be/src/exprs/null-literal.h
M be/src/exprs/scalar-expr.h
M testdata/workloads/functional-query/queries/QueryTest/partitioned-top-n.test
4 files changed, 62 insertions(+), 13 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/36/19336/2
-- 
To view, visit http://gerrit.cloudera.org:8080/19336
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I6aaf80c5129eaf788c70c8f041021eaf73087f94
Gerrit-Change-Number: 19336
Gerrit-PatchSet: 2
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>