There is an open issue: https://issues.apache.org/jira/browse/CALCITE-3504

The SPARK function which creates an empty array (ARRAY()) infers an UNKNOWN 
ARRAY type. So I guess the empty constructor could work the same way.

The only difficulty I can foresee is that this change would introduce ambiguity 
in the grammar.

Not having literals for empty arrays is like having numbers without a zero 
literal.

Mihai

-----Original Message-----
From: Ran Tao 
Sent: Tuesday, August 01, 2023 5:04 AM
To: dev@calcite.apache.org
Subject: Re: Empty array literal

Hi, mbudiu.

thanks for creating this discussion.

I have tested with apache flink array function, the flink array function form 
is array[1,2,3], however it does not support `array[]`.
It will raise a exception:
`org.apache.calcite.sql.validate.SqlValidatorException: Require at least 1 
argument`, obviously, this exception comes from calcite.

If calcite support this, then flink also support it.

It would be better if you can confirm whether the sql standard supports it.

Best Regards,
Ran Tao
https://github.com/chucheng92


<mbu...@gmail.com> 于2023年8月1日周二 09:35写道:

> Hello,
>
>
>
> It looks to me like the Calcite grammar does not accept empty array 
> literals "ARRAY[]".
>
> This sounds like a serious omission.
>
> Is there a fundamental reason why this isn't in the grammar?
>
> If there isn't, I can file an issue for it.
>
> I can see a workaround using the Spark "ARRAY()" function.
>
>
>
> Thank you,
>
> Mihai
>
>

Reply via email to