[ https://issues.apache.org/jira/browse/DRILL-2669?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15121303#comment-15121303 ]
Oscar Morante edited comment on DRILL-2669 at 1/28/16 12:52 PM: ---------------------------------------------------------------- Hi, I think I'm running into the same issue. Given some json data with this shape: {code:javascript} { "timestamp": "2015-11-03T07:21:24.066Z"} {code} This query fails: {code} select to_timestamp(`timestamp`, 'yyyy-MM-dd''T''HH:mm:ss.SSS''Z''') from mydatasource limit 1; Error: SYSTEM ERROR: ExpressionParsingException: Expression has syntax error! line 1:38:mismatched input 'T' expecting CParen Fragment 1:3 [Error Id: e1f0fd04-52a4-4b79-bef6-7262a88a7e28 on 10.2.26.3:31010] (state=,code=0) {code} And this one works: {code} select to_timestamp(`timestamp`, 'yyyy-MM-dd''T''HH:mm:ss.SSS''Z''') from (select * from mydatasource); {code} UPDATE: I copy&pasted the wrong error, it's ok now. was (Author: spacepluk): Hi, I think I'm running into the same issue. Given some json data with this shape: {code:javascript} { "timestamp": "2015-11-03T07:21:24.066Z"} {code} This query fails: {code} select to_timestamp(`timestamp`, 'yyyy-MM-dd''T''HH:mm:ss.SSS''Z''') from mydatasource; Error: PARSE ERROR: Non-query expression encountered in illegal context while parsing SQL query: select to_timestamp(`timestamp`, 'yyyy-MM-dd''T''HH:mm:ss.SSS''Z''') from (seleect * from tvmetrix.raw limit 1) {code} And this one works: {code} select to_timestamp(`timestamp`, 'yyyy-MM-dd''T''HH:mm:ss.SSS''Z''') from (select * from mydatasource); {code} > Error happening without limit clause and works with limit clause > ---------------------------------------------------------------- > > Key: DRILL-2669 > URL: https://issues.apache.org/jira/browse/DRILL-2669 > Project: Apache Drill > Issue Type: Bug > Components: Functions - Drill > Affects Versions: 0.8.0 > Environment: mapr sandbox 4.0.2 > Reporter: Sudhakar Thota > Fix For: Future > > > Perhaps this could be a bug. I get the same results. > But the plan is very different, the UnionExchange is set up immediately after > the scan operation in successful case( Case 1 ), where as UnionExchange is > happening after scan>project (Case -2). > Case -1.Successful case. > {code} > 0: jdbc:drill:> explain plan for select to_timestamp(t.t, > 'YYYY-MM-dd''T''HH:mm:ss.SSS''Z''') FROM (select * from > dfs.sthota_prq.`/tstamp_test/*.parquet` limit 13015351) t; > ----------------------+ > text json > ----------------------+ > 00-00 Screen > 00-01 Project(EXPR$0=[TO_TIMESTAMP(ITEM($0, 't'), > 'YYYY-MM-dd''T''HH:mm:ss.SSS''Z''')]) > 00-02 SelectionVectorRemover > 00-03 Limit(fetch=[13015351]) > 00-04 UnionExchange > 01-01 Scan(groupscan=[ParquetGroupScan [entries=[ReadEntryWithPath > [path=maprfs:/mapr/demo.mapr.com/user/sthota/parquet/tstamp_test/1_2_0.parquet], > ReadEntryWithPath > [path=maprfs:/mapr/demo.mapr.com/user/sthota/parquet/tstamp_test/1_1_0.parquet], > ReadEntryWithPath > [path=maprfs:/mapr/demo.mapr.com/user/sthota/parquet/tstamp_test/1_0_0.parquet]], > selectionRoot=/mapr/demo.mapr.com/user/sthota/parquet/tstamp_test, > numFiles=3, columns=[`*`]]]) > { > "head" : > Unknown macro: { "version" } > , > {code} > Case -2. Unsuccessful case: > {code} > 0: jdbc:drill:> explain plan for select to_timestamp(t.t, > 'YYYY-MM-dd''T''HH:mm:ss.SSS''Z''') FROM (select * from > dfs.sthota_prq.`/tstamp_test/*.parquet` ) t; > ----------------------+ > text json > ----------------------+ > 00-00 Screen > 00-01 UnionExchange > 01-01 Project(EXPR$0=[TO_TIMESTAMP(ITEM($0, 't'), > 'YYYY-MM-dd''T''HH:mm:ss.SSS''Z''')]) > 01-02 Scan(groupscan=[ParquetGroupScan [entries=[ReadEntryWithPath > [path=maprfs:/mapr/demo.mapr.com/user/sthota/parquet/tstamp_test/1_2_0.parquet], > ReadEntryWithPath > [path=maprfs:/mapr/demo.mapr.com/user/sthota/parquet/tstamp_test/1_1_0.parquet], > ReadEntryWithPath > [path=maprfs:/mapr/demo.mapr.com/user/sthota/parquet/tstamp_test/1_0_0.parquet]], > selectionRoot=/mapr/demo.mapr.com/user/sthota/parquet/tstamp_test, > numFiles=3, columns=[`*`]]]) > { > "head" : > Unknown macro: { "version" } > , > {code} > {code} > 0: jdbc:drill:> select to_timestamp(t.t, 'YYYY-MM-dd''T''HH:mm:ss.SSS''Z''') > FROM (select * from dfs.sthota_prq.`/tstamp_test/*.parquet` limit 10) t; > ------------ > EXPR$0 > ------------ > 2015-01-27 13:43:53.0 > 2015-01-27 13:43:49.0 > 2015-01-27 13:43:47.0 > 2015-01-27 13:43:47.0 > 2015-01-27 13:43:47.0 > 2015-01-27 13:43:45.0 > 2015-01-27 13:43:43.0 > 2015-01-27 13:43:43.0 > 2015-01-27 13:43:43.0 > 2015-01-27 13:43:39.0 > ------------ > 10 rows selected (1.127 seconds) > {code} > {code} > 0: jdbc:drill:> select to_timestamp(t.t, 'YYYY-MM-dd''T''HH:mm:ss.SSS''Z''') > FROM (select * from dfs.sthota_prq.`/tstamp_test/*.parquet`) t; > {code} > {code} > 0: jdbc:drill:> select to_timestamp(t.t, 'YYYY-MM-dd''T''HH:mm:ss.SSS''Z''') > FROM (select * from dfs.sthota_prq.`/tstamp_test/*.parquet`) t; > Query failed: RemoteRpcException: Failure while trying to start remote > fragment, Expression has syntax error! line 1:30:mismatched input 'T' > expecting CParen [ ab817e5a-9b74-47dd-b3c6-3bbf025c7de9 on maprdemo:31010 ] > Error: exception while executing query: Failure while executing query. > (state=,code=0) > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)