The parser will accept literally anything if you put it in backticks (or 
whatever are the identifier quote symbol in the current parser config). It just 
thinks it is the name of a user-defined type. Not what you want.

> On Oct 2, 2023, at 11:54 AM, Thomas Wang <w...@datability.io> wrote:
> 
> Thanks Jiajun. It looks like the following syntax with the backticks works
> for me.
> 
> SELECT CAST(NULL AS `MAP<STRING, STRING>`) FROM schema.table
> 
> Thomas
> 
> On Sun, Oct 1, 2023 at 11:23 PM Jiajun Xie <jiajunbernou...@gmail.com>
> wrote:
> 
>> Hi Thomas,
>> 
>> Cast map syntax is not supported in the current release version.
>> But we will support it in the 1.36.0 version.
>> 
>> FYI: https://issues.apache.org/jira/browse/CALCITE-5570
>> 
>> On Sun, 1 Oct 2023 at 22:38, Thomas Wang <w...@datability.io> wrote:
>> 
>>> Hi Mihai,
>>> 
>>> Could you point me to more information w.r.t modifying the parser? Also,
>> I
>>> noticed for the ARRAY type, I can do CAST(NULL AS BIGINT ARRAY), but the
>>> grammar doesn't seem to have MAP supported, does it? Did I miss
>> something?
>>> Thanks.
>>> 
>>> Thomas
>>> 
>>> On Sat, Sep 30, 2023 at 7:59 PM Mihai Budiu <mbu...@gmail.com> wrote:
>>> 
>>>> Calcite is open source, so you can certainly modify the parser. The
>>>> architecture of the parser had been designed to be flexible and even
>>>> calcite has several parsers, the strandard one, server, and Babel. Let
>> me
>>>> know if you need help figuring out how to roll your own.
>>>> 
>>>> Mihai
>>>> ________________________________
>>>> From: Thomas Wang <w...@datability.io>
>>>> Sent: Saturday, September 30, 2023 7:42:19 PM
>>>> To: dev@calcite.apache.org <dev@calcite.apache.org>
>>>> Subject: Re: SQL Parsing
>>>> 
>>>> Thanks Mihai, "BIGINT ARRAY" seems to work! Just curious if I can have
>>>> flexibility to change the behavior of the parse to parse
>> "ARRAY<BIGINT>"
>>>> instead?
>>>> 
>>>> Thomas
>>>> 
>>>> On Sat, Sep 30, 2023 at 6:32 PM Mihai Budiu <mbu...@gmail.com> wrote:
>>>> 
>>>>> The syntax is "bigint array"
>>>>> https://calcite.apache.org/docs/reference.html
>>>>> ________________________________
>>>>> From: Thomas Wang <w...@datability.io>
>>>>> Sent: Saturday, September 30, 2023 6:27:46 PM
>>>>> To: dev@calcite.apache.org <dev@calcite.apache.org>
>>>>> Subject: SQL Parsing
>>>>> 
>>>>> Hi Apache Calcite Community,
>>>>> 
>>>>> I'm new to Apache Calcite and trying to use it for SQL parsing and
>> SQL
>>>>> rewriting.
>>>>> 
>>>>> I tried to parse a couple of SELECT statements and it works pretty
>>> well.
>>>>> However, when I tried to parse a SELECT statement that contains a
>> cast
>>> to
>>>>> array like below, it complains it cannot recognize ARRAY.
>>>>> 
>>>>> SELECT CAST(NULL AS ARRAY<BIGINT>) FROM schema.t1
>>>>> 
>>>>> However, casting to BIGINT seems ok. The following SELECT is ok.
>>>>> 
>>>>> SELECT CAST(NULL AS BIGINT) FROM schema.t1
>>>>> 
>>>>> Is there any configuration I need to enable to enable/support parsing
>>>>> ARRAY? Thanks.
>>>>> 
>>>>> Thomas
>>>>> 
>>>> 
>>> 
>> 

Reply via email to