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

(Updated July 5, 2014, 12:27 p.m.)


Review request for drill, Aditya Kishore and Mehant Baid.


Changes
-------

Implemented review comments.
Enhanced testcase with new test.
Rebased on current master.


Repository: drill-git


Description
-------

Added implementation for String functions:
- ascii(str)
- toascii(str, srcEncoding)
- btrim(str, chars)
- char(int)
- repeat(str, numOfTimes)
- reverse(str)


Diffs (updated)
-----

  
exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/StringFunctionUtil.java
 16ff8f2 
  
exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/StringFunctions.java
 92ac56f 
  
exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestStringFunctions.java
 3f9ba5e 
  exec/java-exec/src/test/resources/functions/string/testStringFuncs.json 
PRE-CREATION 

Diff: https://reviews.apache.org/r/21614/diff/


Testing
-------

Yes.

$ mvn test -Dtest=TestStringFunctions#testNewStringFuncs
-------------------------------
ACTUAL         EXPECTED
-------------------------------
97              97
65              65
-32             -32
A               A
trim            trim
Peace Peace Peace               Peace Peace Peace 
????? ????? ????? ?????                 ????? ????? ????? ????? 
katcit          katcit
âpple          âpple
-------------------------------


SQLLINE TESTS:

SELECT employee_id, toascii('âpple','ISO-8859-1') as ascii_str FROM 
cp.`employee.json` limit 10; 
+-------------+------------+
| employee_id | ascii_str  |
+-------------+------------+
| 1           | âpple     |
| 2           | âpple     |
| 4           | âpple     |
| 5           | âpple     |
| 6           | âpple     |
| 7           | âpple     |
| 8           | âpple     |
| 9           | âpple     |
| 10          | âpple     |
| 11          | âpple     |
+-------------+------------+
10 rows selected (0.315 seconds)


SELECT employee_id, first_name as first_name, reverse(first_name) as 
revrese_name,  repeat(first_name,2) as repeat_name FROM cp.`employee.json` 
limit 10; 
+-------------+------------+--------------+-------------+
| employee_id | first_name | revrese_name | repeat_name |
+-------------+------------+--------------+-------------+
| 1           | Sheri      | irehS        | SheriSheri  |
| 2           | Derrick    | kcirreD      | DerrickDerrick |
| 4           | Michael    | leahciM      | MichaelMichael |
| 5           | Maya       | ayaM         | MayaMaya    |
| 6           | Roberta    | atreboR      | RobertaRoberta |
| 7           | Rebecca    | accebeR      | RebeccaRebecca |
| 8           | Kim        | miK          | KimKim      |
| 9           | Brenda     | adnerB       | BrendaBrenda |
| 10          | Darren     | nerraD       | DarrenDarren |
| 11          | Jonathan   | nahtanoJ     | JonathanJonatha |
+-------------+------------+--------------+-------------+


SELECT employee_id, first_name as first_name, ascii(first_name) as ascii_ch, 
chr(65) as char_65 FROM cp.`employee.json` limit 10; 
+-------------+------------+------------+------------+
| employee_id | first_name |  ascii_ch  |  char_65   |
+-------------+------------+------------+------------+
| 1           | Sheri      | 83         | A          |
| 2           | Derrick    | 68         | A          |
| 4           | Michael    | 77         | A          |
| 5           | Maya       | 77         | A          |
| 6           | Roberta    | 82         | A          |
| 7           | Rebecca    | 82         | A          |
| 8           | Kim        | 75         | A          |
| 9           | Brenda     | 66         | A          |
| 10          | Darren     | 68         | A          |
| 11          | Jonathan   | 74         | A          |
+-------------+------------+------------+------------+


Thanks,

Yash Sharma

Reply via email to