-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/43706/#review120646
-----------------------------------------------------------




ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java (line 230)
<https://reviews.apache.org/r/43706/#comment182109>

    Using "char" as the function name may conflict with the use of "char" as a 
type name .. can you make this "chr"/UDFChr instead?



ql/src/java/org/apache/hadoop/hive/ql/udf/UDFChar.java (line 51)
<https://reviews.apache.org/r/43706/#comment182105>

    I believe you can replace all of the numeric Writable versions of 
evaluate() to possibly 2 versions: LongWritable and DoubleWritable.
    
    For the old-style UDFs, Hive is able to convert a parameter of short type 
to a long, and so on.



ql/src/java/org/apache/hadoop/hive/ql/udf/UDFChar.java (line 82)
<https://reviews.apache.org/r/43706/#comment182106>

    Can you confirm if that is the right behavior here, to return null for 
value 0?


Can you also add qfile tests for TestCliDriver?

- Jason Dere


On Feb. 18, 2016, 3:37 a.m., Alejandro Fernandez wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/43706/
> -----------------------------------------------------------
> 
> (Updated Feb. 18, 2016, 3:37 a.m.)
> 
> 
> Review request for hive, Jason Dere and Vikram Dixit Kumaraswamy.
> 
> 
> Bugs: HIVE-13063
>     https://issues.apache.org/jira/browse/HIVE-13063
> 
> 
> Repository: hive-git
> 
> 
> Description
> -------
> 
> Create UDFS for these functions.
> 
> CHAR: convert n where n : [0, 256) into the ascii equivalent as a varchar. If 
> n is less than 0 or greater than 255, return the empty string. If n is 0, 
> return null.
> 
> REPLACE: replace all substrings of 'str' that match 'search' with 'rep'.
> Example. SELECT REPLACE('Hack and Hue', 'H', 'BL');
> Equals 'BLack and BLue'"
> 
> 
> Diffs
> -----
> 
>   ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java e0e030f 
>   ql/src/java/org/apache/hadoop/hive/ql/udf/UDFChar.java PRE-CREATION 
>   ql/src/java/org/apache/hadoop/hive/ql/udf/UDFReplace.java PRE-CREATION 
>   ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFChar.java 
> PRE-CREATION 
>   
> ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFReplace.java 
> PRE-CREATION 
> 
> Diff: https://reviews.apache.org/r/43706/diff/
> 
> 
> Testing
> -------
> 
> Verified that UDFs work.
> 
> ADD JAR hdfs://c6401.ambari.apache.org:8020/tmp/hive-exec.jar;
> CREATE TEMPORARY FUNCTION char_udf AS 'org.apache.hadoop.hive.ql.udf.UDFChar';
> CREATE TEMPORARY FUNCTION replace_udf AS 
> 'org.apache.hadoop.hive.ql.udf.UDFReplace';
> 
> SHOW FUNCTIONS;
> 
> DESCRIBE FUNCTION char_udf;
> DESCRIBE FUNCTION replace_udf;
> 
> select char_udf(-1), 
> char_udf(0), 
> char_udf(1), 
> char_udf(48), 
> char_udf(65), 
> char_udf(68.12), 
> char_udf(32457964);
> 
> select replace_udf('', '', ''), 
> replace_udf(null, '', ''), 
> replace_udf('', null, ''), 
> replace_udf('', '', null), 
> replace_udf('Hack and Hue', 'H', 'BL'), 
> replace_udf('ABABrdvABrk', 'AB', 'a');
> 
> 
> File Attachments
> ----------------
> 
> Query1
>   
> https://reviews.apache.org/media/uploaded/files/2016/02/18/6f9c8b55-3e75-448f-bd71-93d6c3c900b8__Screen_Shot_2016-02-17_at_7.21.07_PM.png
> Query2
>   
> https://reviews.apache.org/media/uploaded/files/2016/02/18/cedeeec0-388b-433b-a4f6-94888054d1a9__Screen_Shot_2016-02-17_at_7.20.57_PM.png
> 
> 
> Thanks,
> 
> Alejandro Fernandez
> 
>

Reply via email to