commit | afa8b133824cd0e9cd3c5dcce6fe7da601dc16a5 | [log] [tgz] |
---|---|---|
author | Makoto Yui <myui@apache.org> | Tue Nov 26 01:53:29 2019 +0900 |
committer | Makoto Yui <myui@apache.org> | Tue Nov 26 01:53:29 2019 +0900 |
tree | 53f943e050822ce074a795ad35fae5a738d42d7e | |
parent | 7f23a86d66e0030fb3eb92dddf0cd3b6a1a46bac [diff] |
[HIVEMALL-165] Fixed to accept any primitive ## What changes were proposed in this pull request? Fix a bug that `array_remove` UDF throws exception when the first argument is null ## What type of PR is it? Bug Fix ## What is the Jira issue? https://issues.apache.org/jira/browse/HIVEMALL-165 ## How was this patch tested? manual tests on EMR ## How to use this feature? ```sql WITH data4 as ( select false as n, array(2.0, 3.0, 4.0) as nums union all select true as n, array(2.0, 3.0, 4.0) as nums ) select array_remove(if(n = true, null, nums), 2.0) as c1, array_remove(if(n = true, null, nums), array(3.0,2.0)) as c2, array_remove(if(n = false, null, nums), 2.0) as c3 from data4; > c1 c2 c3 > [3,4] [4] NULL > NULL NULL [3,4] select array_remove(array(2.0,2.1,3.0,4.0,2.0),2), array_remove(array(2.0,3.0,4.0),array(3,2.0)); > [2.1,3,4] [4] SELECT array_remove(array(1,null,3),null); > [1,3] SELECT array_remove(array(1,null,3,null,5),null); > [1,3,5] SELECT array_remove(array(1,null,3),array(null)); > [1,3] SELECT array_remove(array('aaa','bbb'),'bbb'); > ["aaa"] SELECT array_remove(array('aaa','bbb','ccc','bbb'), array('bbb','ccc')); > ["aaa"] select array_remove(array(null),null); > [] select array_remove(array(null,'bbb'),'aaa'); > [null,"bbb"] ``` ## Checklist - [x] Did you apply source code formatter, i.e., `./bin/format_code.sh`, for your commit? - [x] Did you run system tests on Hive (or Spark)? Author: Makoto Yui <myui@apache.org> Closes #217 from myui/HIVEMALL-165.
Apache Hivemall is a scalable machine learning library that runs on Apache Hive, Apache Spark, and Apache Pig. Hivemall is designed to be scalable to the number of training instances as well as the number of training features.
Find more examples on our user guide and find a brief introduction to Hivemall in this slide.
Support is through user@hivemall.incubator.apache.org, not by a direct e-mail.
If you are planning to contribute to this repository, we first request you to create an issue at our JIRA page even if the topic is not related to source code itself (e.g., documentation, new idea and proposal).
All Hivemall functions are defined under resources/ddl. In order to update the definition files, the following script helps inserting function name and class path of your new UDF:
$ ./bin/update_ddls.sh
Moreover, don't forget to update function list in the document as well:
$ ./bin/update_func_md.sh
Note that, before creating a pull request including Java code, please make sure your code follows our coding conventions by applying formatter:
$ ./bin/format_code.sh