[ 
https://issues.apache.org/jira/browse/DRILL-3218?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14570109#comment-14570109
 ] 

Khurram Faraaz commented on DRILL-3218:
---------------------------------------


The below query fails after columns from CSV file are casted to appropriate 
datatypes. Casting columns[0] to BIGINT also results in same Exception.

{code}
0: jdbc:drill:schema=dfs.tmp> SELECT MAX(cast( columns[2] as CHAR(2) )) 
OVER(PARTITION BY cast( columns[2] as CHAR(2)) ORDER BY cast( columns[0] as INT 
)) FROM `allData.csv`;
Error: SYSTEM ERROR: org.codehaus.commons.compiler.CompileException: Line 243, 
Column 31: Unknown variable or type "incoming"

Fragment 0:0

[Error Id: 46302e43-59e0-42b2-838a-32d1b239c486 on centos-01.qa.lab:31010] 
(state=,code=0)
{code}

Running just the aggregate gives correct results as shown below, the 
CompileException is seen only when there is a window definition (with or 
without casting of the partition by and order by keys)

{code}
0: jdbc:drill:schema=dfs.tmp> SELECT MAX(cast( columns[2] as CHAR(2) )) FROM 
`allData.csv`;
+---------+
| EXPR$0  |
+---------+
| WY      |
+---------+
1 row selected (0.168 seconds)
{code}

First five lines from data file

{code}
[root@centos-01 ~]# head -n 5 allData.csv 
-337516559,39342852852629160,VT,AXXXXXXXXXXXXXXXXXXXXXXXXXCXXXXXXXXXXXXXXXXXXXXXXXXB,2014-06-02
 00:28:02.418,1952-08-14,false,729363085.95,8:16:8.58
406158122,81588677006971200,IN,AXXXXXXXXXXXXXXXXXXXXXXXXXCXXXXXXXXXXXXXXXXXXXXXXXXB,2014-06-02
 00:28:02.418,2001-03-08,false,1292460500.48,9:11:49.17
1221407024,30009558124347168,VT,DXXXXXXXXXXXXXXXXXXXXXXXXXEXXXXXXXXXXXXXXXXXXXXXXXXF,2014-06-02
 00:28:02.419,2000-10-18,true,395110006.277,18:44:25.43
-1609141704,47841997008600128,ND,GXXXXXXXXXXXXXXXXXXXXXXXXXHXXXXXXXXXXXXXXXXXXXXXXXXI,2014-06-02
 00:28:02.420,1991-05-13,true,1293582041.37,20:52:8.56
-1032159521,38891661529640288,SD,HXXXXXXXXXXXXXXXXXXXXXXXXXIXXXXXXXXXXXXXXXXXXXXXXXXJ,2014-06-02
 00:28:02.420,1965-02-21,false,983657842.924,19:46:10.42
{code}

> Window function usage throws CompileException
> ---------------------------------------------
>
>                 Key: DRILL-3218
>                 URL: https://issues.apache.org/jira/browse/DRILL-3218
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Execution - Flow
>    Affects Versions: 1.0.0
>         Environment: faec150598840c40827e6493992d81209aa936da
>            Reporter: Khurram Faraaz
>            Assignee: Deneche A. Hakim
>              Labels: window_function
>             Fix For: 1.1.0
>
>         Attachments: drillbit_DRILL_3218.log
>
>
> PARTITION BY date ORDER BY timestamp
> {code}
> 0: jdbc:drill:schema=dfs.tmp> SELECT MAX(columns[0]) OVER (PARTITION BY 
> columns[6] ORDER BY columns[4]) FROM `allTypData2.csv`;
> Error: SYSTEM ERROR: org.codehaus.commons.compiler.CompileException: Line 
> 330, Column 31: Unknown variable or type "incoming"
> Fragment 0:0
> [Error Id: 285af8f1-ddb4-4d3e-a2d7-bfaef20df5e0 on centos-02.qa.lab:31010] 
> (state=,code=0)
> {code}
> I will add more details in a bit.



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

Reply via email to