You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by Roman Kulyk <ro...@gmail.com> on 2017/11/06 18:30:05 UTC

Problem with SqlStmt() in Parser.jj

Hi all,

I am working with rebasing Drill to new Calcite and I faced a problem with
describe table with column qualifier. For example, Drill supports the next
construction:

DESCRIBE TABLE_NAME 'COLUMN_PATTERN'
(You can see it in TestInfoSchema.describeTableWithColQualifier and
TestInfoSchema.describeTableWithSchemaAndColQualifier tests)

After da875a67 commit, columnQualifier was removed from SqlDescribe and
Drill loses this functionality without it. I tried to override it but my
Describe methods were placed under Calcite SqlDescribe method in SqlStmt()
and I always got ParseException. So I propose to move the next block:

    <#-- Add methods to parse additional statements here -->
    <#list parser.statementParserMethods as method>
            stmt = ${method}
    </#list>

on top of the SqlStmt() method in Parser.jj to allow overriding of Calcite
statements. Could you please tell what do you think about these changes and
do I need to create a Jira for it? Or how can I add column qualifier to
SqlDescribe without these changes?

Best regards,
Roman Kulyk

Re: Problem with SqlStmt() in Parser.jj

Posted by Julian Hyde <jh...@apache.org>.
As I noted in https://issues.apache.org/jira/browse/CALCITE-1168 <https://issues.apache.org/jira/browse/CALCITE-1168> (comment #3) I don’t see why column name should be enclosed in single-quotes. It is not a character literal, it is an identifier.

We do allow

 DESCRIBE emp empno

and

  DESCRIBE “EMP” “EMPNO”

but just not

  DESCRIBE EMP ‘EMPNO’

Now I suppose that if Drill wants to do crazy stuff we should let them.

Julian


> On Nov 6, 2017, at 10:30 AM, Roman Kulyk <ro...@gmail.com> wrote:
> 
> Hi all,
> 
> I am working with rebasing Drill to new Calcite and I faced a problem with
> describe table with column qualifier. For example, Drill supports the next
> construction:
> 
> DESCRIBE TABLE_NAME 'COLUMN_PATTERN'
> (You can see it in TestInfoSchema.describeTableWithColQualifier and
> TestInfoSchema.describeTableWithSchemaAndColQualifier tests)
> 
> After da875a67 commit, columnQualifier was removed from SqlDescribe and
> Drill loses this functionality without it. I tried to override it but my
> Describe methods were placed under Calcite SqlDescribe method in SqlStmt()
> and I always got ParseException. So I propose to move the next block:
> 
>    <#-- Add methods to parse additional statements here -->
>    <#list parser.statementParserMethods as method>
>            stmt = ${method}
>    </#list>
> 
> on top of the SqlStmt() method in Parser.jj to allow overriding of Calcite
> statements. Could you please tell what do you think about these changes and
> do I need to create a Jira for it? Or how can I add column qualifier to
> SqlDescribe without these changes?
> 
> Best regards,
> Roman Kulyk