You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Saad Ur Rahman (Jira)" <ji...@apache.org> on 2021/10/24 17:56:00 UTC

[jira] [Comment Edited] (FLINK-20578) Cannot create empty array using ARRAY[]

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

Saad Ur Rahman edited comment on FLINK-20578 at 10/24/21, 5:55 PM:
-------------------------------------------------------------------

As I understand the problem we would need to overrideĀ [SqlMultisetValueConstructor.checkOperandTypes|https://github.com/apache/calcite/blob/77bb696d020bea4467151109ffed4ced53ff0c2d/core/src/main/java/org/apache/calcite/sql/fun/SqlMultisetValueConstructor.java#L87] in [SqlArrayConstructor|https://github.com/apache/flink/blob/2cb477343de5dce70978c0add5ec58edbaec157c/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/functions/sql/SqlArrayConstructor.java#L33]

My solution would be to perform a check in the overridden _SqlArrayConstructor.checkOperandTypes_ for empty _argTypes_, pack the _callBinding_ with a value and pass it to the _super.checkOperandTypes_ to process it as it would before. The reason I want to pack it with a value is that there was a reason why an empty _argTypes_ was supposed to originally throw an error.

Then the question becomes that which [~pensz] raised: what [argument type|https://ci.apache.org/projects/flink/flink-docs-release-1.13/docs/dev/table/types/#constructured-data-types] should be used?


was (Author: surahman):
As I understand the problem we would need to override

[SqlMultisetValueConstructor.checkOperandTypes|https://github.com/apache/calcite/blob/77bb696d020bea4467151109ffed4ced53ff0c2d/core/src/main/java/org/apache/calcite/sql/fun/SqlMultisetValueConstructor.java#L87]:

In [SqlArrayConstructor|https://github.com/apache/flink/blob/2cb477343de5dce70978c0add5ec58edbaec157c/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/functions/sql/SqlArrayConstructor.java#L33]



My solution would be to perform a check in the overridden _SqlArrayConstructor.checkOperandTypes_ for empty _argTypes_, pack the _callBinding_ with a value and pass it to the _super.checkOperandTypes_ to process it as it would before. The reason I want to pack it with a value is that there was a reason why an empty _argTypes_ was supposed to originally throw an error.

Then the question becomes that which [~pensz] raised: what [argument type|https://ci.apache.org/projects/flink/flink-docs-release-1.13/docs/dev/table/types/#constructured-data-types] should be used?

> Cannot create empty array using ARRAY[]
> ---------------------------------------
>
>                 Key: FLINK-20578
>                 URL: https://issues.apache.org/jira/browse/FLINK-20578
>             Project: Flink
>          Issue Type: Sub-task
>          Components: Table SQL / API
>    Affects Versions: 1.11.2
>            Reporter: Fabian Hueske
>            Priority: Major
>              Labels: starter
>             Fix For: 1.15.0
>
>
> Calling the ARRAY function without an element (`ARRAY[]`) results in an error message.
> Is that the expected behavior?
> How can users create empty arrays?



--
This message was sent by Atlassian Jira
(v8.3.4#803005)