[ 
https://issues.apache.org/jira/browse/IMPALA-8891?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16998392#comment-16998392
 ] 

ASF subversion and git services commented on IMPALA-8891:
---------------------------------------------------------

Commit 4c04e6773855d9e2a0093c92f37bb34d59143723 in impala's branch 
refs/heads/master from jchen
[ https://gitbox.apache.org/repos/asf?p=impala.git;h=4c04e67 ]

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

This patch fixes the non-standard null handling logic for
function 'concat_ws', while maintaining the original null
handling 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 conforms to hive standard:
1.will join all the non-null string objects 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.
* StringFunctions::Concat was also reimplemented, as it used to
  call ConcatWs but should keep the original NULL handling.

Testing:
* Ran exaustive tests.

Change-Id: I64cd3bfbb952e431a0cf52a5835ac05d2513d29b
Reviewed-on: http://gerrit.cloudera.org:8080/14885
Reviewed-by: Impala Public Jenkins <[email protected]>
Tested-by: Impala Public Jenkins <[email protected]>


> concat_ws() null handling is non-standard
> -----------------------------------------
>
>                 Key: IMPALA-8891
>                 URL: https://issues.apache.org/jira/browse/IMPALA-8891
>             Project: IMPALA
>          Issue Type: Bug
>          Components: Backend
>    Affects Versions: Impala 3.2.0, Impala 3.3.0
>            Reporter: Tim Armstrong
>            Assignee: jichen
>            Priority: Major
>              Labels: newbie
>
> [~grahn] reports
> {quote}Looks like Impala’s CONCAT_WS() does not behave correctly if an 
> argument is NULL — it returns NULL and it should not.  Mismatch between 
> Hive/MySQL and Impala (and apologies for not filing a bug)
> {quote}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to