You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by Atri Sharma <at...@gmail.com> on 2021/09/27 08:33:43 UTC

Parsing FILTER Operator

Using the Babel parser, I get an error while parsing the following query:

"SELECT COUNT(*) FILTER (WHERE timestampColumn > '2021-01-01),
timestampColumn FROM testTable WHERE timestampColumn > '2021-01-01"
    + "00:00:00.123' GROUP BY timestampColumn"

The exception raised is:

Caused by: org.apache.calcite.sql.parser.SqlParseException:
Encountered "2021" at line 1, column 119.
Was expecting one of:
    ")" ...
    "." ...
    <QUOTED_STRING> ...
    "UESCAPE" ...
    "NOT" ...
    "IN" ...
    "<" ...
    "<=" ...
    ">" ...
    ">=" ...
    "=" ...
    "<>" ...
    "!=" ...
    "BETWEEN" ...
    "LIKE" ...
    "SIMILAR" ...
    "+" ...
    "-" ...
    "*" ...
    "/" ...

What am I missing, please?


-- 
Regards,

Atri
l'apprenant

Re: Parsing FILTER Operator

Posted by Atri Sharma <at...@gmail.com>.
Thanks Stamatis.

Apologies for the noise. Reminds me not to send emails before a cup of coffee...

On Mon, Sep 27, 2021 at 2:32 PM Stamatis Zampetakis <za...@gmail.com> wrote:
>
> Hi Atri,
>
> The timestamp literal seems to be missing a closing quote '2021-01-01 vs
> '2021-01-01'.
>
> Best,
> Stamatis
>
> On Mon, Sep 27, 2021 at 10:59 AM Atri Sharma <at...@gmail.com> wrote:
>
> > Thanks for the reply.
> >
> > I dont think that was the case (I am not running from SQLLine, but
> > from a custom Calcite integration).
> >
> > I think it was something to do with the timestamp formatting, fixing
> > that seems to work. Let me try a couple of other queries and revert.
> >
> > On Mon, Sep 27, 2021 at 2:11 PM hongkang jiang <jh...@gmail.com>
> > wrote:
> > >
> > > "SELECT COUNT(*) FILTER (WHERE timestampColumn > '2021-01-01),
> > > timestampColumn FROM testTable WHERE timestampColumn > '2021-01-01"
> > >     + "00:00:00.123' GROUP BY timestampColumn"
> > >
> > > There's a semicolon missing.
> > >
> > > On Mon, Sep 27, 2021 at 4:34 PM Atri Sharma <at...@gmail.com> wrote:
> > >
> > > > Using the Babel parser, I get an error while parsing the following
> > query:
> > > >
> > > > "SELECT COUNT(*) FILTER (WHERE timestampColumn > '2021-01-01),
> > > > timestampColumn FROM testTable WHERE timestampColumn > '2021-01-01"
> > > >     + "00:00:00.123' GROUP BY timestampColumn"
> > > >
> > > > The exception raised is:
> > > >
> > > > Caused by: org.apache.calcite.sql.parser.SqlParseException:
> > > > Encountered "2021" at line 1, column 119.
> > > > Was expecting one of:
> > > >     ")" ...
> > > >     "." ...
> > > >     <QUOTED_STRING> ...
> > > >     "UESCAPE" ...
> > > >     "NOT" ...
> > > >     "IN" ...
> > > >     "<" ...
> > > >     "<=" ...
> > > >     ">" ...
> > > >     ">=" ...
> > > >     "=" ...
> > > >     "<>" ...
> > > >     "!=" ...
> > > >     "BETWEEN" ...
> > > >     "LIKE" ...
> > > >     "SIMILAR" ...
> > > >     "+" ...
> > > >     "-" ...
> > > >     "*" ...
> > > >     "/" ...
> > > >
> > > > What am I missing, please?
> > > >
> > > >
> > > > --
> > > > Regards,
> > > >
> > > > Atri
> > > > l'apprenant
> > > >
> >
> > --
> > Regards,
> >
> > Atri
> > l'apprenant
> >

-- 
Regards,

Atri
l'apprenant

Re: Parsing FILTER Operator

Posted by Stamatis Zampetakis <za...@gmail.com>.
Hi Atri,

The timestamp literal seems to be missing a closing quote '2021-01-01 vs
'2021-01-01'.

Best,
Stamatis

On Mon, Sep 27, 2021 at 10:59 AM Atri Sharma <at...@gmail.com> wrote:

> Thanks for the reply.
>
> I dont think that was the case (I am not running from SQLLine, but
> from a custom Calcite integration).
>
> I think it was something to do with the timestamp formatting, fixing
> that seems to work. Let me try a couple of other queries and revert.
>
> On Mon, Sep 27, 2021 at 2:11 PM hongkang jiang <jh...@gmail.com>
> wrote:
> >
> > "SELECT COUNT(*) FILTER (WHERE timestampColumn > '2021-01-01),
> > timestampColumn FROM testTable WHERE timestampColumn > '2021-01-01"
> >     + "00:00:00.123' GROUP BY timestampColumn"
> >
> > There's a semicolon missing.
> >
> > On Mon, Sep 27, 2021 at 4:34 PM Atri Sharma <at...@gmail.com> wrote:
> >
> > > Using the Babel parser, I get an error while parsing the following
> query:
> > >
> > > "SELECT COUNT(*) FILTER (WHERE timestampColumn > '2021-01-01),
> > > timestampColumn FROM testTable WHERE timestampColumn > '2021-01-01"
> > >     + "00:00:00.123' GROUP BY timestampColumn"
> > >
> > > The exception raised is:
> > >
> > > Caused by: org.apache.calcite.sql.parser.SqlParseException:
> > > Encountered "2021" at line 1, column 119.
> > > Was expecting one of:
> > >     ")" ...
> > >     "." ...
> > >     <QUOTED_STRING> ...
> > >     "UESCAPE" ...
> > >     "NOT" ...
> > >     "IN" ...
> > >     "<" ...
> > >     "<=" ...
> > >     ">" ...
> > >     ">=" ...
> > >     "=" ...
> > >     "<>" ...
> > >     "!=" ...
> > >     "BETWEEN" ...
> > >     "LIKE" ...
> > >     "SIMILAR" ...
> > >     "+" ...
> > >     "-" ...
> > >     "*" ...
> > >     "/" ...
> > >
> > > What am I missing, please?
> > >
> > >
> > > --
> > > Regards,
> > >
> > > Atri
> > > l'apprenant
> > >
>
> --
> Regards,
>
> Atri
> l'apprenant
>

Re: Parsing FILTER Operator

Posted by Atri Sharma <at...@gmail.com>.
Thanks for the reply.

I dont think that was the case (I am not running from SQLLine, but
from a custom Calcite integration).

I think it was something to do with the timestamp formatting, fixing
that seems to work. Let me try a couple of other queries and revert.

On Mon, Sep 27, 2021 at 2:11 PM hongkang jiang <jh...@gmail.com> wrote:
>
> "SELECT COUNT(*) FILTER (WHERE timestampColumn > '2021-01-01),
> timestampColumn FROM testTable WHERE timestampColumn > '2021-01-01"
>     + "00:00:00.123' GROUP BY timestampColumn"
>
> There's a semicolon missing.
>
> On Mon, Sep 27, 2021 at 4:34 PM Atri Sharma <at...@gmail.com> wrote:
>
> > Using the Babel parser, I get an error while parsing the following query:
> >
> > "SELECT COUNT(*) FILTER (WHERE timestampColumn > '2021-01-01),
> > timestampColumn FROM testTable WHERE timestampColumn > '2021-01-01"
> >     + "00:00:00.123' GROUP BY timestampColumn"
> >
> > The exception raised is:
> >
> > Caused by: org.apache.calcite.sql.parser.SqlParseException:
> > Encountered "2021" at line 1, column 119.
> > Was expecting one of:
> >     ")" ...
> >     "." ...
> >     <QUOTED_STRING> ...
> >     "UESCAPE" ...
> >     "NOT" ...
> >     "IN" ...
> >     "<" ...
> >     "<=" ...
> >     ">" ...
> >     ">=" ...
> >     "=" ...
> >     "<>" ...
> >     "!=" ...
> >     "BETWEEN" ...
> >     "LIKE" ...
> >     "SIMILAR" ...
> >     "+" ...
> >     "-" ...
> >     "*" ...
> >     "/" ...
> >
> > What am I missing, please?
> >
> >
> > --
> > Regards,
> >
> > Atri
> > l'apprenant
> >

-- 
Regards,

Atri
l'apprenant

Re: Parsing FILTER Operator

Posted by hongkang jiang <jh...@gmail.com>.
"SELECT COUNT(*) FILTER (WHERE timestampColumn > '2021-01-01),
timestampColumn FROM testTable WHERE timestampColumn > '2021-01-01"
    + "00:00:00.123' GROUP BY timestampColumn"

There's a semicolon missing.

On Mon, Sep 27, 2021 at 4:34 PM Atri Sharma <at...@gmail.com> wrote:

> Using the Babel parser, I get an error while parsing the following query:
>
> "SELECT COUNT(*) FILTER (WHERE timestampColumn > '2021-01-01),
> timestampColumn FROM testTable WHERE timestampColumn > '2021-01-01"
>     + "00:00:00.123' GROUP BY timestampColumn"
>
> The exception raised is:
>
> Caused by: org.apache.calcite.sql.parser.SqlParseException:
> Encountered "2021" at line 1, column 119.
> Was expecting one of:
>     ")" ...
>     "." ...
>     <QUOTED_STRING> ...
>     "UESCAPE" ...
>     "NOT" ...
>     "IN" ...
>     "<" ...
>     "<=" ...
>     ">" ...
>     ">=" ...
>     "=" ...
>     "<>" ...
>     "!=" ...
>     "BETWEEN" ...
>     "LIKE" ...
>     "SIMILAR" ...
>     "+" ...
>     "-" ...
>     "*" ...
>     "/" ...
>
> What am I missing, please?
>
>
> --
> Regards,
>
> Atri
> l'apprenant
>