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

Oscar Morante commented on DRILL-2669:
--------------------------------------

I've been doing some more testing and I think the problem is that in some 
situations it fails to parse strings with escaped single quotes.  Just changing 
the last line of this query makes the problem appear and disappear (without 
touching the string it's complaining about):

{code:sql}
select
  'yyyy-MM-dd''T''HH:mm:ss.SSS''Z'''
from
  raw; --> FAILS
  --raw.`*`; --> FAILS
  --raw.`2015`; --> FAILS
  --raw.`2015/11`; --> FAILS
  --raw.`2015/11/3`; --> WORKS
  --raw.`2015/11/3/10-1072045-1612661.json.gz`; --> WORKS
  --(select * from raw limit 1); --> WORKS
  --(select * from raw.`*` limit 1); --> WORKS
  --(select * from raw.`2015` limit 1); --> WORKS
  --(select * from raw.`2015/11` limit 1); --> WORKS
{code}

This query gives a simpler error:

{code}
ExampleExceptionFormatter: exception message was: SYSTEM ERROR: 
ExpressionParsingException: Expression has syntax error! line 1:12:missing EOF 
at 'T'

Fragment 1:1
{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)

Reply via email to