[ 
https://issues.apache.org/jira/browse/DRILL-1100?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Alexander Zarei updated DRILL-1100:
-----------------------------------

    Description: 
When an out of bound column in a CSV file is queried, for example, 

SELECT columns[12] as column_12  FROM `dfs`.`root`.`./sneaky.csv`;

the result is a column with all null values:

+------------+
| column_12  |
+------------+
| null       |
| null       |
| null       |
| null       |
| null       |
+------------+

However, it makes more sense to return an error instead because the file has 
only 10 columns.

The file content:

someDirectoryFoo,true,false,false,100,root,root,"2013-10-11T14:31:58.000-0700","2013-10-11T14:31:58.000-0700","-rw-r--r--."
someDirectoryBar,true,false,false,100,root,root,"2013-10-11T14:31:58.000-0700","2013-10-11T14:31:58.000-0700","-rw-r--r--."
aFile,false,true,false,1234,root,root,"2013-10-11T14:31:58.000-0700","2013-10-11T14:31:58.000-0700","-rw-r--r--."
anotherFile,false,true,false,2345,root,root,"2012-11-11T14:31:58.000-0700","2012-11-11T14:31:58.000-0700","-rw-r--r--."
yetAnotherFile,false,true,false,3456,root,root,"2011-11-11T14:31:58.000-0700","2012-11-11T14:31:58.000-0700","-rw-r--r--."

  was:
When an out of bound column is queried, for example, 

SELECT columns[12] as column_12  FROM `dfs`.`root`.`./sneaky.csv`;

the result is a column with all null values:

+------------+
| column_12  |
+------------+
| null       |
| null       |
| null       |
| null       |
| null       |
+------------+

However, it makes more sense to return an error instead.

The file content:

someDirectoryFoo,true,false,false,100,root,root,"2013-10-11T14:31:58.000-0700","2013-10-11T14:31:58.000-0700","-rw-r--r--."
someDirectoryBar,true,false,false,100,root,root,"2013-10-11T14:31:58.000-0700","2013-10-11T14:31:58.000-0700","-rw-r--r--."
aFile,false,true,false,1234,root,root,"2013-10-11T14:31:58.000-0700","2013-10-11T14:31:58.000-0700","-rw-r--r--."
anotherFile,false,true,false,2345,root,root,"2012-11-11T14:31:58.000-0700","2012-11-11T14:31:58.000-0700","-rw-r--r--."
yetAnotherFile,false,true,false,3456,root,root,"2011-11-11T14:31:58.000-0700","2012-11-11T14:31:58.000-0700","-rw-r--r--."


> Returning NULL instead of array-index-out-of-bound error in CSV files
> ---------------------------------------------------------------------
>
>                 Key: DRILL-1100
>                 URL: https://issues.apache.org/jira/browse/DRILL-1100
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Client - JDBC, Client - ODBC
>         Environment: SqlLine in Linux and C# in Windows
>            Reporter: Alexander Zarei
>            Priority: Minor
>
> When an out of bound column in a CSV file is queried, for example, 
> SELECT columns[12] as column_12  FROM `dfs`.`root`.`./sneaky.csv`;
> the result is a column with all null values:
> +------------+
> | column_12  |
> +------------+
> | null       |
> | null       |
> | null       |
> | null       |
> | null       |
> +------------+
> However, it makes more sense to return an error instead because the file has 
> only 10 columns.
> The file content:
> someDirectoryFoo,true,false,false,100,root,root,"2013-10-11T14:31:58.000-0700","2013-10-11T14:31:58.000-0700","-rw-r--r--."
> someDirectoryBar,true,false,false,100,root,root,"2013-10-11T14:31:58.000-0700","2013-10-11T14:31:58.000-0700","-rw-r--r--."
> aFile,false,true,false,1234,root,root,"2013-10-11T14:31:58.000-0700","2013-10-11T14:31:58.000-0700","-rw-r--r--."
> anotherFile,false,true,false,2345,root,root,"2012-11-11T14:31:58.000-0700","2012-11-11T14:31:58.000-0700","-rw-r--r--."
> yetAnotherFile,false,true,false,3456,root,root,"2011-11-11T14:31:58.000-0700","2012-11-11T14:31:58.000-0700","-rw-r--r--."



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to