Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Drill >> mail # dev >> Review Request 21058: Drill-630: Adding substr(expression, start) function. Also bugfix for (Drill-542)


Copy link to this message
-
Re: Review Request 21058: Drill-630: Adding substr(expression, start) function. Also bugfix for (Drill-542 & Drill-543)

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

(Updated May 6, 2014, 6:16 p.m.)
Review request for drill, Aditya Kishore, Jacques Nadeau, Jinfeng Ni, and Mehant Baid.
Changes

Implemented review comments !!
Repository: drill-git
Description

Adding substr(expression, start) to improve string substring function.
This is also a bug fix for https://issues.apache.org/jira/browse/DRILL-542.
Diffs (updated)

  exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/StringFunctions.java aca5933
  exec/java-exec/src/test/java/org/apache/drill/exec/physical/impl/TestStringFunctions.java 09d1361
  exec/java-exec/src/test/resources/functions/string/testSubstr.json e885381

Diff: https://reviews.apache.org/r/21058/diff/
Testing

Yes.
JUnit Test Case:

 $mvn test -Dtest=TestStringFunctions#testSubstr

Results :

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 53.030 s
[INFO] Finished at: 2014-05-04T16:08:26+05:30
[INFO] Final Memory: 44M/711M
[INFO] ------------------------------------------------------------------------
SQLLINE Test

0: jdbc:drill:zk=local> SELECT employee_id, first_name, substring(first_name, 3) sub_str FROM cp.`employee.json` limit 20;
+-------------+------------+------------+
| employee_id | first_name |  sub_str   |
+-------------+------------+------------+
| 1           | Sheri      | eri        |
| 2           | Derrick    | rrick      |
| 4           | Michael    | chael      |
| 5           | Maya       | ya         |
| 6           | Roberta    | berta      |
| 7           | Rebecca    | becca      |
| 8           | Kim        | m          |
| 9           | Brenda     | enda       |
| 10          | Darren     | rren       |
| 11          | Jonathan   | nathan     |
| 12          | Jewel      | wel        |
| 13          | Peggy      | ggy        |
| 14          | Bryan      | yan        |
| 15          | Walter     | lter       |
| 16          | Peggy      | ggy        |
| 17          | Brenda     | enda       |
| 18          | Daniel     | niel       |
| 19          | Dianne     | anne       |
| 20          | Beverly    | verly      |
| 21          | Pedro      | dro        |
+-------------+------------+------------+
Thanks,

Yash Sharma