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

[Impala-ASF-CR] IMPALA-8891: Fix non-standard null handling in concat ws()

jichen has uploaded a new patch set (#9). ( http://gerrit.cloudera.org:8080/14885 )

Change subject: IMPALA-8891: Fix non-standard null handling in concat_ws()
......................................................................

IMPALA-8891: Fix non-standard null handling in concat_ws()

This patch fix the non-standard null handling logic for
function 'concat_ws', while maintain the original null
handing for function 'concat'

Existing statuses:
For function concat_ws, any null string element in array
argument strs will result in null result, just like below:
------------------------------------------------
select concat_ws('-','foo',null,'bar') as expr1;
+-------+
| expr1 |
+-------+
| NULL  |
+-------+

New Statuses:
In this implementation, the function is conform to hive standard:
1.will join all the non-null string object as the result
2.if all string objects are null, return empty string
3.if separator is null, return null
below is a example:
-------------------------------------------------
select concat_ws('-','foo',null,'bar') as expr1;
+----------+
|  expr1   |
+----------+
| foo-bar  |
+----------+
------------------------------------------------

Key changes:
* Reimplement function StringFunctions::ConcatWs by filtering the null value
  and only process the valid string values, based on original code structure.
* Since in the original implementation of function StringFunctions::Concat,
  it directly invoke function StringFunctions::ConcatWs. The changed behavior
  of function StringFunctions::ConcatWs will also affect function
  StringFunctions::Concat, to maintain the original standard of function,
  we also reimplement function StringFunctions::Concat.

Testing:
* Ran exaustive tests.

Change-Id: I64cd3bfbb952e431a0cf52a5835ac05d2513d29b
---
M be/src/exprs/expr-test.cc
M be/src/exprs/string-functions-ir.cc
2 files changed, 74 insertions(+), 21 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/85/14885/9
-- 
To view, visit http://gerrit.cloudera.org:8080/14885
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I64cd3bfbb952e431a0cf52a5835ac05d2513d29b
Gerrit-Change-Number: 14885
Gerrit-PatchSet: 9
Gerrit-Owner: jichen <ji...@cloudera.com>
Gerrit-Reviewer: Csaba Ringhofer <cs...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: jichen <ji...@cloudera.com>