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

(Updated Feb. 26, 2016, 9:40 p.m.)


Review request for hive, Jason Dere and Vikram Dixit Kumaraswamy.


Changes
-------

Added qtests


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 (updated)
-----

  ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java e0e030f 
  ql/src/java/org/apache/hadoop/hive/ql/udf/UDFChr.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/TestGenericUDFChr.java 
PRE-CREATION 
  ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFReplace.java 
PRE-CREATION 
  ql/src/test/queries/clientpositive/udf_chr.q PRE-CREATION 
  ql/src/test/queries/clientpositive/udf_replace.q PRE-CREATION 
  ql/src/test/results/clientpositive/udf_chr.q.out PRE-CREATION 
  ql/src/test/results/clientpositive/udf_replace.q.out 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