mirror of
https://github.com/apache/impala.git
synced 2026-01-07 09:02:19 -05:00
IMPALA-4662: Fix NULL literal handling in Kudu IN list predicates
The KuduScanNode attempts to push IN list predicates to the Kudu scan, but NULL literals cannot be pushed. The code in KuduScanNode needed to check if the Literals in the InPredicate is a NullLiteral, in which case the entire IN list should not be pushed to Kudu. The same handling is already in place for binary predicate pushdown. Change-Id: Iaf2c10a326373ad80aef51a85cec64071daefa7b Reviewed-on: http://gerrit.cloudera.org:8080/5505 Reviewed-by: Michael Brown <mikeb@cloudera.com> Reviewed-by: Matthew Jacobs <mj@cloudera.com> Tested-by: Internal Jenkins
This commit is contained in:
committed by
Internal Jenkins
parent
54194af6ef
commit
c2faf4a8a1
@@ -309,7 +309,7 @@ public class KuduScanNode extends ScanNode {
|
||||
SlotRef ref = (SlotRef) predicate.getChild(0);
|
||||
LiteralExpr literal = (LiteralExpr) predicate.getChild(1);
|
||||
|
||||
// Cannot push prediates with null literal values (KUDU-1595).
|
||||
// Cannot push predicates with null literal values (KUDU-1595).
|
||||
if (literal instanceof NullLiteral) return false;
|
||||
|
||||
String colName = ref.getDesc().getColumn().getName();
|
||||
@@ -379,8 +379,13 @@ public class KuduScanNode extends ScanNode {
|
||||
List<Object> values = Lists.newArrayList();
|
||||
for (int i = 1; i < predicate.getChildren().size(); ++i) {
|
||||
if (!(predicate.getChild(i).isLiteral())) return false;
|
||||
Object value = getKuduInListValue((LiteralExpr) predicate.getChild(i));
|
||||
Preconditions.checkNotNull(value == null);
|
||||
LiteralExpr literal = (LiteralExpr) predicate.getChild(i);
|
||||
|
||||
// Cannot push predicates with null literal values (KUDU-1595).
|
||||
if (literal instanceof NullLiteral) return false;
|
||||
|
||||
Object value = getKuduInListValue(literal);
|
||||
Preconditions.checkNotNull(value);
|
||||
values.add(value);
|
||||
}
|
||||
|
||||
|
||||
@@ -314,3 +314,15 @@ PLAN-ROOT SINK
|
||||
predicates: CAST(a.id AS STRING) > '123'
|
||||
kudu predicates: a.id > 10
|
||||
====
|
||||
# IMPALA-4662: Kudu analysis failure for NULL literal in IN list
|
||||
# NULL literal in values list results in applying predicate at scan node
|
||||
select id from functional_kudu.alltypestiny where
|
||||
id in (1, null) and string_col in (null) and bool_col in (null) and double_col in (null)
|
||||
and float_col in (null) and tinyint_col in (null) and smallint_col in (null) and
|
||||
bigint_col in (null)
|
||||
---- PLAN
|
||||
PLAN-ROOT SINK
|
||||
|
|
||||
00:SCAN KUDU [functional_kudu.alltypestiny]
|
||||
predicates: id IN (1, NULL), bigint_col IN (NULL), bool_col IN (NULL), double_col IN (NULL), float_col IN (NULL), smallint_col IN (NULL), string_col IN (NULL), tinyint_col IN (NULL)
|
||||
====
|
||||
|
||||
Reference in New Issue
Block a user