[
https://issues.apache.org/jira/browse/DRILL-3218?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14570016#comment-14570016
]
Deneche A. Hakim commented on DRILL-3218:
-----------------------------------------
Looks like a casting problem. Adding proper casting seems to solve the problem:
{noformat}
> select max(cast(columns[0] as int)) over(partition by cast(columns[2] as
> date) order by cast(columns[1] as timestamp)) from `3218.csv`;
+---------+
| EXPR$0 |
+---------+
| 11 |
| 14 |
| 810 |
| 180 |
| 594 |
| 25 |
| 25 |
| 125 |
| 5 |
+---------+
{noformat}
{noformat}
> select max(cast(columns[1] as timestamp)) over(partition by cast(columns[2]
> as date) order by cast(columns[1] as timestamp)) from `3218.csv`;
+--------------------------+
| EXPR$0 |
+--------------------------+
| 2015-03-04 06:41:42.87 |
| 2015-02-04 06:41:42.87 |
| 2015-04-04 06:41:42.87 |
| 2015-01-04 06:41:42.87 |
| 2015-01-04 06:41:42.869 |
| 2015-08-04 06:41:42.371 |
| 2015-07-04 06:41:42.171 |
| 2015-04-04 06:41:42.871 |
| 2015-06-04 06:41:42.871 |
+--------------------------+
{noformat}
{noformat}
> select max(cast(columns[2] as date)) over(partition by cast(columns[2] as
> date) order by cast(columns[1] as timestamp)) from `3218.csv`;
+-------------+
| EXPR$0 |
+-------------+
| 1956-02-07 |
| 1956-03-07 |
| 1956-07-07 |
| 1956-08-07 |
| 1991-01-03 |
| 2011-01-13 |
| 2011-06-13 |
| 2011-07-13 |
| 2011-09-13 |
+-------------+
{noformat}
I am marking this JIRA Invalid. [~khfaraaz] can you open a new JIRA to fix the
error message ?
> 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)