drill-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jinfeng Ni (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DRILL-1877) Throw unsupported error message for || operator early in the parsing stage
Date Thu, 15 Jan 2015 19:37:34 GMT

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

Jinfeng Ni commented on DRILL-1877:
-----------------------------------

Before we make change, we probably need decide whether Drill will adopt MYSQL way or Postgres
way in handling the boolean operator.

Standard SQL has only "AND" "OR" "NOT" operators.  Some system, for instance, Mysql,  will
treat "&&" as "AND", "||" as "OR".  While other system like Postgre only has "AND",
"OR".  For mysql style, the use of "||" as "OR" operator will overload the "||" operator,
since it could be also used as string concat. 

http://dev.mysql.com/doc/refman/5.7/en/logical-operators.html

http://www.postgresql.org/docs/9.4/static/functions-logical.html

Therefore, the first question is whether we want to use "||" for both boolean and string concat
operator. 

For your patch, you modify ExprParser.g. Seems ExprLexer.g will also need change to be consistent.
Both of them are handling the parsing of expression in DRILL's logical/physical plan, and
should be consistent in handling how we handle "||" as either boolean or string operator.




 

> Throw unsupported error message for || operator early in the parsing stage
> --------------------------------------------------------------------------
>
>                 Key: DRILL-1877
>                 URL: https://issues.apache.org/jira/browse/DRILL-1877
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: SQL Parser
>    Affects Versions: 0.7.0
>            Reporter: Victoria Markman
>            Assignee: Jinfeng Ni
>            Priority: Minor
>             Fix For: 0.9.0
>
>         Attachments: DRILL-1877.1.patch, DRILL-1877.2.patch
>
>
> If we don't plan to support concat operator (||), we should throw a decent error message
early.
> The error is cryptic:
> 0: jdbc:drill:schema=dfs> select cast(l_orderkey as varchar(10)) || '-' || cast(l_partkey
as varchar(10)) from cp.`tpch/lineitem.parquet`;
> Query failed: Query stopped., Line 65, Column 29: "value" is neither a method, a field,
nor a member class of "org.apache.drill.exec.expr.holders.VarCharHolder" [ bc85685d-e08a-494b-aa9f-5b3fa4ee4033
on atsqa4-133.qa.lab:3
> 1010 ]
> Error: exception while executing query: Failure while executing query. (state=,code=0)
> I believe that error that I'm getting from the query below is the result of not throwing
"Unsupported" message earlier.
> Please correct me if I'm wrong.
> 0: jdbc:drill:schema=dfs> select
> . . . . . . . . . . . . >         cast(l_orderkey as varchar(10)) || '-' || cast(l_partkey
as varchar(10))
> . . . . . . . . . . . . > from
> . . . . . . . . . . . . >         (
> . . . . . . . . . . . . >         select  sum(l_quantity),
> . . . . . . . . . . . . >                 l_orderkey,
> . . . . . . . . . . . . >                 l_partkey
> . . . . . . . . . . . . >         from    cp.`tpch/lineitem.parquet`
> . . . . . . . . . . . . >         group by
> . . . . . . . . . . . . >                 l_orderkey,
> . . . . . . . . . . . . >                 l_partkey
> . . . . . . . . . . . . >         )
> . . . . . . . . . . . . > group by
> . . . . . . . . . . . . >         cast(l_orderkey as varchar(10)) || '-' || cast(l_partkey
as varchar(10));
> Query failed: Query failed: Failure while running fragment., You tried to do a batch
data read operation when you were in a state of STOP.  You can only do this type of operation
when you are in a state of OK or OK_NEW_SCHEMA. [ f5cb68a8-7c05-4e02-a104-56081e6d34ce on
atsqa4-133.qa.lab:31010 ]
> [ f5cb68a8-7c05-4e02-a104-56081e6d34ce on atsqa4-133.qa.lab:31010 ]



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

Mime
View raw message