You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@drill.apache.org by "Deneche A. Hakim (JIRA)" <ji...@apache.org> on 2015/06/06 20:41:00 UTC

[jira] [Created] (DRILL-3259) cast_empty_string_to_null only works when set at SYSTEM level

Deneche A. Hakim created DRILL-3259:
---------------------------------------

             Summary: cast_empty_string_to_null only works when set at SYSTEM level
                 Key: DRILL-3259
                 URL: https://issues.apache.org/jira/browse/DRILL-3259
             Project: Apache Drill
          Issue Type: Bug
    Affects Versions: 1.0.0
            Reporter: Deneche A. Hakim
            Assignee: Deneche A. Hakim
             Fix For: 1.2.0


When a CSV file contains "empty" values, the following query throws an exception:
{noformat}
select CAST(columns[1] as DOUBLE) FROM `twocols.csv`;
Error: SYSTEM ERROR: java.lang.NumberFormatException: empty String
(state=,code=0)
{noformat}

The problem, is that {{drill.exec.functions.cast_empty_string_to_null}} is only effective when changing the {{SYSTEM}} option and not the {{SESSION}} option:
{noformat}
0: jdbc:drill:zk=local> select name, type, bool_val from sys.options where name like '%null%';
+-------------------------------------------------+----------+-----------+
|                      name                       |   type   | bool_val  |
+-------------------------------------------------+----------+-----------+
| drill.exec.functions.cast_empty_string_to_null  | SYSTEM   | false     |
| drill.exec.functions.cast_empty_string_to_null  | SESSION  | true      |
+-------------------------------------------------+----------+-----------+
2 rows selected (0.188 seconds)
0: jdbc:drill:zk=local> select CAST(columns[1] as DOUBLE) FROM `twocols.csv`;
Error: SYSTEM ERROR: java.lang.NumberFormatException: empty String
{noformat}

{noformat}
0: jdbc:drill:zk=local> select name, type, bool_val from sys.options where name like '%null%';
+-------------------------------------------------+----------+-----------+
|                      name                       |   type   | bool_val  |
+-------------------------------------------------+----------+-----------+
| drill.exec.functions.cast_empty_string_to_null  | SYSTEM   | true      |
| drill.exec.functions.cast_empty_string_to_null  | SESSION  | false     |
+-------------------------------------------------+----------+-----------+
2 rows selected (0.135 seconds)
0: jdbc:drill:zk=local> select CAST(columns[1] as DOUBLE) FROM `twocols.csv`;
+----------+
|  EXPR$0  |
+----------+
| 143.0    |
| 104.0    |
| 46.0     |
| 387.0    |
| 23.0     |
| 112.0    |
| null     |
| 76.0     |
| null     |
| 1225.0   |
| null     |
| null     |
| null     |
| 13.0     |
| 49.0     |
| 108.0    |
| 13.0     |
| 33.0     |
| null     |
| null     |
| 10.0     |
| null     |
| null     |
| null     |
| 145.0    |
| null     |
| 24.0     |
| 614.0    |
| null     |
| null     |
| null     |
| 59.0     |
| 262.0    |
| 3.0      |
| 14022.0  |
| 4812.0   |
| 14219.0  |
| 1365.0   |
| null     |
| 1531.0   |
| null     |
| 3736.0   |
| 11327.0  |
| 3115.0   |
| null     |
| 11713.0  |
| null     |
| 3410.0   |
| null     |
| null     |
| 1620.0   |
| 9675.0   |
| 6250.0   |
| null     |
| 1625.0   |
| null     |
| 5112.0   |
| 924.0    |
| 4150.0   |
| 2920.0   |
| null     |
| 1253.0   |
| 4108.0   |
| 2703.0   |
| 3524.0   |
| null     |
| null     |
| 3921.0   |
| 4529.0   |
| null     |
| null     |
| 4672.0   |
| 2125.0   |
| null     |
| null     |
| 706.0    |
| 80.0     |
| null     |
| null     |
| 457.0    |
| 8530.0   |
| null     |
| 262.0    |
| 760.0    |
| null     |
| 791.0    |
| 12816.0  |
| 883.0    |
| 1836.0   |
| 477.0    |
| 1240.0   |
| 107.0    |
| 1200.0   |
| 198.0    |
| 624.0    |
| null     |
| 40.0     |
| 11.0     |
| 338.0    |
+----------+
99 rows selected (0.096 seconds)
{noformat}




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)