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

2022-10-26 Thread Eric Xiao (Jira)


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

Eric Xiao edited comment on FLINK-20578 at 10/26/22 7:24 PM:
-

Hi I wanted to get more involved in contributing to the Flink project and found 
this starter task - my team is working with the Table / SQL APIs, so I thought 
this would be a good beginning task to work on :). [~surahman] are you still 
working on this issue? If not I would love to take over.

> If Flink support empty array, which data type of elements in array should be 
> ? Does it cause new problems.
[~pensz] I think what we can do is:
 # (Look below for examples from other databases) Set a default data type when 
the empty array is created: Two options for the default data type:
 ## Use or create a new empty/void data type.
 ## Use an existing data type i.e. Integer.
 # Teach operations such as `COALESCE` how to type coercion from the default 
data type to the desired data type (a separate PR).

I think Step 1 is sufficient enough to unblock users in creating an empty array 
for the time being but Step 2 is required to allow seamless SQL experience. 
Without step two users will most likely have to manually convert their empty 
array's data type.

With step 1:

 
{code:java}
SELECT COALESCE(int_column, CAST(ARRAY[] as INT)){code}
 

With step 1 and 2:
{code:java}
SELECT COALESCE(int_column, ARRAY[]) {code}
*Default Data Type*
I believe the query in the issue would qualify as a query with no context. I 
tested in other query engines and these are the results I got:

Trino:

!Screen Shot 2022-10-26 at 2.28.49 PM.png|width=957,height=340!

They use unknown datatype

Spark:

!image-2022-10-26-14-42-08-468.png|width=505,height=112!

They use unknown datatype

BigQuery:
!Screen Shot 2022-10-25 at 10.50.47 PM.png|width=374,height=158!

!image-2022-10-26-14-42-57-579.png|width=373,height=125!
They use integer datatype


was (Author: JIRAUSER295489):
Hi I wanted to get more involved in contributing to the Flink project and found 
this starter task - my team is working with the Table / SQL APIs, so I thought 
this would be a good beginning task to work on :). [~surahman] are you still 
working on this issue? If not I would love to take over.

> If Flink support empty array, which data type of elements in array should be 
> ? Does it cause new problems.
[~pensz] I think what we can do is:
 # (Look below for examples from other databases) Set a default data type when 
the empty array is created: Two options for the default data type:
 ## Use or create a new empty/void data type.
 ## Use an existing data type i.e. Integer.
 # Teach operations such as `COALESCE` how to type coercion from the default 
data type to the desired data type (a separate PR).

Default Data Type
I believe the query in the issue would qualify as a query with no context. I 
tested in other query engines and these are the results I got:

Trino:

!Screen Shot 2022-10-26 at 2.28.49 PM.png|width=957,height=340!

They use unknown datatype

Spark:

!image-2022-10-26-14-42-08-468.png|width=505,height=112!

They use unknown datatype

BigQuery:
!Screen Shot 2022-10-25 at 10.50.47 PM.png|width=374,height=158!

!image-2022-10-26-14-42-57-579.png|width=373,height=125!
They use integer datatype

> 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: pull-request-available, starter
> Fix For: 1.17.0
>
> Attachments: Screen Shot 2022-10-25 at 10.50.42 PM.png, Screen Shot 
> 2022-10-25 at 10.50.47 PM.png, Screen Shot 2022-10-25 at 11.01.06 PM.png, 
> Screen Shot 2022-10-26 at 2.28.49 PM.png, image-2022-10-26-14-42-08-468.png, 
> image-2022-10-26-14-42-57-579.png
>
>
> 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.20.10#820010)


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

2022-10-26 Thread Eric Xiao (Jira)


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

Eric Xiao edited comment on FLINK-20578 at 10/26/22 7:20 PM:
-

Hi I wanted to get more involved in contributing to the Flink project and found 
this starter task - my team is working with the Table / SQL APIs, so I thought 
this would be a good beginning task to work on :). [~surahman] are you still 
working on this issue? If not I would love to take over.

> If Flink support empty array, which data type of elements in array should be 
> ? Does it cause new problems.
[~pensz] I think what we can do is:
 # (Look below for examples from other databases) Set a default data type when 
the empty array is created: Two options for the default data type:
 ## Use or create a new empty/void data type.
 ## Use an existing data type i.e. Integer.
 # Teach operations such as `COALESCE` how to type coercion from the default 
data type to the desired data type (a separate PR).

Default Data Type
I believe the query in the issue would qualify as a query with no context. I 
tested in other query engines and these are the results I got:

Trino:

!Screen Shot 2022-10-26 at 2.28.49 PM.png|width=957,height=340!

They use unknown datatype

Spark:

!image-2022-10-26-14-42-08-468.png|width=505,height=112!

They use unknown datatype

BigQuery:
!Screen Shot 2022-10-25 at 10.50.47 PM.png|width=374,height=158!

!image-2022-10-26-14-42-57-579.png|width=373,height=125!
They use integer datatype


was (Author: JIRAUSER295489):
Hi I wanted to get more involved in contributing to the Flink project and found 
this starter task - my team is working with the Table / SQL APIs, so I thought 
this would be a good beginning task to work on :). [~surahman] are you still 
working on this issue? If not I would love to take over.

> If Flink support empty array, which data type of elements in array should be 
> ? Does it cause new problems.
[~pensz] I think there are two paths:
1. If we given more context on what the array type should be we should try 
using that.
2. If we have no context we use a default data type.

Path #1 - 
I can forsee queries as such `SELECT COALESCE(empty_str_column,ARRAY[])` where 
we could infer the data should be of string type and try to return that.

Path #2 - Default Data Type
I believe the query in the issue would qualify as a query with no context. I 
tested in other query engines and these are the results I got:

Trino:

!Screen Shot 2022-10-26 at 2.28.49 PM.png|width=957,height=340!

They use unknown datatype

Spark:

!image-2022-10-26-14-42-08-468.png|width=505,height=112!

They use unknown datatype

BigQuery:
!Screen Shot 2022-10-25 at 10.50.47 PM.png|width=374,height=158!

!image-2022-10-26-14-42-57-579.png|width=373,height=125!
They use integer datatype

> 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: pull-request-available, starter
> Fix For: 1.17.0
>
> Attachments: Screen Shot 2022-10-25 at 10.50.42 PM.png, Screen Shot 
> 2022-10-25 at 10.50.47 PM.png, Screen Shot 2022-10-25 at 11.01.06 PM.png, 
> Screen Shot 2022-10-26 at 2.28.49 PM.png, image-2022-10-26-14-42-08-468.png, 
> image-2022-10-26-14-42-57-579.png
>
>
> 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.20.10#820010)


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

2022-10-26 Thread Eric Xiao (Jira)


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

Eric Xiao edited comment on FLINK-20578 at 10/26/22 6:43 PM:
-

Hi I wanted to get more involved in contributing to the Flink project and found 
this starter task - my team is working with the Table / SQL APIs, so I thought 
this would be a good beginning task to work on :). [~surahman] are you still 
working on this issue? If not I would love to take over.

> If Flink support empty array, which data type of elements in array should be 
> ? Does it cause new problems.
[~pensz] I think there are two paths:
1. If we given more context on what the array type should be we should try 
using that.
2. If we have no context we use a default data type.

Path #1 - 
I can forsee queries as such `SELECT COALESCE(empty_str_column,ARRAY[])` where 
we could infer the data should be of string type and try to return that.

Path #2 - Default Data Type
I believe the query in the issue would qualify as a query with no context. I 
tested in other query engines and these are the results I got:

Trino:

!Screen Shot 2022-10-26 at 2.28.49 PM.png|width=957,height=340!

They use unknown datatype

Spark:

!image-2022-10-26-14-42-08-468.png|width=505,height=112!

They use unknown datatype

BigQuery:
!Screen Shot 2022-10-25 at 10.50.47 PM.png|width=374,height=158!

!image-2022-10-26-14-42-57-579.png|width=373,height=125!
They use integer datatype


was (Author: JIRAUSER295489):
Hi I wanted to get more involved in contributing to the Flink project and found 
this starter task - my team is working with the Table / SQL APIs, so I thought 
this would be a good beginning task to work on :). [~surahman] are you still 
working on this issue? If not I would love to take over.

> If Flink support empty array, which data type of elements in array should be 
> ? Does it cause new problems.
[~pensz] I think there are two paths:
1. If we given more context on what the array type should be we should try 
using that.
2. If we have no context we use a default data type.

Path #1 - 
I can forsee queries as such `SELECT COALESCE(empty_str_column,ARRAY[])` where 
we could infer the data should be of string type and try to return that.

Path #2 - Default Data Type
I believe the query in the issue would qualify as a query with no context. I 
tested in other query engines and these are the results I got:

Trino:

!Screen Shot 2022-10-26 at 2.28.49 PM.png|width=957,height=340!

They use unknown datatype

BigQuery:
!Screen Shot 2022-10-25 at 10.50.47 PM.png|width=374,height=158!!Screen Shot 
2022-10-25 at 10.50.42 PM.png|width=761,height=148!
They use integer datatype

> 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: pull-request-available, starter
> Fix For: 1.17.0
>
> Attachments: Screen Shot 2022-10-25 at 10.50.42 PM.png, Screen Shot 
> 2022-10-25 at 10.50.47 PM.png, Screen Shot 2022-10-25 at 11.01.06 PM.png, 
> Screen Shot 2022-10-26 at 2.28.49 PM.png, image-2022-10-26-14-42-08-468.png, 
> image-2022-10-26-14-42-57-579.png
>
>
> 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.20.10#820010)


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

2022-10-26 Thread Eric Xiao (Jira)


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

Eric Xiao edited comment on FLINK-20578 at 10/26/22 6:29 PM:
-

Hi I wanted to get more involved in contributing to the Flink project and found 
this starter task - my team is working with the Table / SQL APIs, so I thought 
this would be a good beginning task to work on :). [~surahman] are you still 
working on this issue? If not I would love to take over.

> If Flink support empty array, which data type of elements in array should be 
> ? Does it cause new problems.
[~pensz] I think there are two paths:
1. If we given more context on what the array type should be we should try 
using that.
2. If we have no context we use a default data type.

Path #1 - 
I can forsee queries as such `SELECT COALESCE(empty_str_column,ARRAY[])` where 
we could infer the data should be of string type and try to return that.

Path #2 - Default Data Type
I believe the query in the issue would qualify as a query with no context. I 
tested in other query engines and these are the results I got:

Trino:

!Screen Shot 2022-10-26 at 2.28.49 PM.png|width=957,height=340!

They use unknown datatype

BigQuery:
!Screen Shot 2022-10-25 at 10.50.47 PM.png|width=374,height=158!!Screen Shot 
2022-10-25 at 10.50.42 PM.png|width=761,height=148!
They use integer datatype


was (Author: JIRAUSER295489):
Hi I wanted to get more involved in contributing to the Flink project and found 
this starter task - my team is working with the Table / SQL APIs, so I thought 
this would be a good beginning task to work on :). [~surahman] are you still 
working on this issue? If not I would love to take over.

> If Flink support empty array, which data type of elements in array should be 
> ? Does it cause new problems.
[~pensz] I think there are two paths:
1. If we given more context on what the array type should be we should try 
using that.
2. If we have no context we use a default data type.

Path #1 - 
I can forsee queries as such `SELECT COALESCE(empty_str_column,ARRAY[])` where 
we could infer the data should be of string type and try to return that. 

Path #2 - Default Data Type
I believe the query in the issue would qualify as a query with no context. I 
tested in other query engines and these are the results I got:

Trino:

They use unknown datatype

BigQuery:

They use integer datatype

a similar query in Trino (Presto) and BigQuery and they use a data type Integer 
as the data type. This could be a good default behaviour?

!Screen Shot 2022-10-25 at 10.50.42 PM.png!
!Screen Shot 2022-10-25 at 10.50.47 PM.png! 
!Screen Shot 2022-10-25 at 11.01.06 PM.png! 


> 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: pull-request-available, starter
> Fix For: 1.17.0
>
> Attachments: Screen Shot 2022-10-25 at 10.50.42 PM.png, Screen Shot 
> 2022-10-25 at 10.50.47 PM.png, Screen Shot 2022-10-25 at 11.01.06 PM.png, 
> Screen Shot 2022-10-26 at 2.28.49 PM.png
>
>
> 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.20.10#820010)


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

2022-10-26 Thread Eric Xiao (Jira)


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

Eric Xiao edited comment on FLINK-20578 at 10/26/22 6:27 PM:
-

Hi I wanted to get more involved in contributing to the Flink project and found 
this starter task - my team is working with the Table / SQL APIs, so I thought 
this would be a good beginning task to work on :). [~surahman] are you still 
working on this issue? If not I would love to take over.

> If Flink support empty array, which data type of elements in array should be 
> ? Does it cause new problems.
[~pensz] I think there are two paths:
1. If we given more context on what the array type should be we should try 
using that.
2. If we have no context we use a default data type.

Path #1 - 
I can forsee queries as such `SELECT COALESCE(empty_str_column,ARRAY[])` where 
we could infer the data should be of string type and try to return that. 

Path #2 - Default Data Type
I believe the query in the issue would qualify as a query with no context. I 
tested in other query engines and these are the results I got:

Trino:

They use unknown datatype

BigQuery:

They use integer datatype

a similar query in Trino (Presto) and BigQuery and they use a data type Integer 
as the data type. This could be a good default behaviour?

!Screen Shot 2022-10-25 at 10.50.42 PM.png!
!Screen Shot 2022-10-25 at 10.50.47 PM.png! 
!Screen Shot 2022-10-25 at 11.01.06 PM.png! 



was (Author: JIRAUSER295489):
Hi I wanted to get more involved in contributing to the Flink project and found 
this starter task - my team is working with the Table / SQL APIs, so I thought 
this would be a good beginning task to work on :). [~surahman] are you still 
working on this issue? If not I would love to take over.

> If Flink support empty array, which data type of elements in array should be 
> ? Does it cause new problems.
[~pensz] I think there are two paths:
1. If we given more context on what the array type should be we should try 
using that.
2. If we have no context we use a default data type.

Path #1 - 
I can forsee queries as such `SELECT COALESCE(empty_str_column,ARRAY[])` where 
we could infer the data should be of string type and try to return that. 

Path #2 - Default Data Type
I believe the query in the issue would qualify as a query with no context. I 
tested a similar query in Trino (Presto) and BigQuery and they use a data type 
Integer as the data type. This could be a good default behaviour?

!Screen Shot 2022-10-25 at 10.50.42 PM.png!
!Screen Shot 2022-10-25 at 10.50.47 PM.png! 
!Screen Shot 2022-10-25 at 11.01.06 PM.png! 


> 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: pull-request-available, starter
> Fix For: 1.17.0
>
> Attachments: Screen Shot 2022-10-25 at 10.50.42 PM.png, Screen Shot 
> 2022-10-25 at 10.50.47 PM.png, Screen Shot 2022-10-25 at 11.01.06 PM.png
>
>
> 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.20.10#820010)


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

2022-10-25 Thread Eric Xiao (Jira)


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

Eric Xiao edited comment on FLINK-20578 at 10/26/22 4:19 AM:
-

Hi I wanted to get more involved in contributing to the Flink project and found 
this starter task - my team is working with the Table / SQL APIs, so I thought 
this would be a good beginning task to work on :). [~surahman] are you still 
working on this issue? If not I would love to take over.

> If Flink support empty array, which data type of elements in array should be 
> ? Does it cause new problems.
[~pensz] I think there are two paths:
1. If we given more context on what the array type should be we should try 
using that.
2. If we have no context we use a default data type.

Path #1 - 
I can forsee queries as such `SELECT COALESCE(empty_str_column,ARRAY[])` where 
we could infer the data should be of string type and try to return that. 

Path #2 - Default Data Type
I believe the query in the issue would qualify as a query with no context. I 
tested a similar query in Trino (Presto) and BigQuery and they use a data type 
Integer as the data type. This could be a good default behaviour?

!Screen Shot 2022-10-25 at 10.50.42 PM.png!
!Screen Shot 2022-10-25 at 10.50.47 PM.png! 
!Screen Shot 2022-10-25 at 11.01.06 PM.png! 



was (Author: JIRAUSER295489):
Hi I wanted to get more involved in contributing to the Flink project and found 
this starter task - my team is working with the Table / SQL APIs, so I thought 
this would be a good beginning task to work on :). [~surahman] are you still 
working on this issue, I noticed it has been a year since your last comment.

> If Flink support empty array, which data type of elements in array should be 
> ? Does it cause new problems.
[~pensz] I think there are two paths:
1. If we given more context on what the array type should be we should try 
using that.
2. If we have no context we use a default data type.

Path #1 - 
I can forsee queries as such `SELECT COALESCE(empty_str_column,ARRAY[])` where 
we could infer the data should be of string type and try to return that. 

Path #2 - Default Data Type
I believe the query in the issue would qualify as a query with no context. I 
tested a similar query in Trino (Presto) and BigQuery and they use a data type 
Integer as the data type. This could be a good default behaviour?

!Screen Shot 2022-10-25 at 10.50.42 PM.png!
!Screen Shot 2022-10-25 at 10.50.47 PM.png! 
!Screen Shot 2022-10-25 at 11.01.06 PM.png! 


> 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: pull-request-available, starter
> Fix For: 1.17.0
>
> Attachments: Screen Shot 2022-10-25 at 10.50.42 PM.png, Screen Shot 
> 2022-10-25 at 10.50.47 PM.png, Screen Shot 2022-10-25 at 11.01.06 PM.png
>
>
> 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.20.10#820010)


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

2022-10-25 Thread Eric Xiao (Jira)


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

Eric Xiao edited comment on FLINK-20578 at 10/26/22 3:53 AM:
-

Hi I wanted to get more involved in contributing to the Flink project and found 
this starter task - my team is working with the Table / SQL APIs, so I thought 
this would be a good beginning task to work on :). [~surahman] are you still 
working on this issue, I noticed it has been a year since your last comment.

> If Flink support empty array, which data type of elements in array should be 
> ? Does it cause new problems.
[~pensz] I think there are two paths:
1. If we given more context on what the array type should be we should try 
using that.
2. If we have no context we use a default data type.

Path #1 - 
I can forsee queries as such `SELECT COALESCE(empty_str_column,ARRAY[])` where 
we could infer the data should be of string type and try to return that. 

Path #2 - Default Data Type
I believe the query in the issue would qualify as a query with no context. I 
tested a similar query in Trino (Presto) and BigQuery and they use a data type 
Integer as the data type. This could be a good default behaviour?

!Screen Shot 2022-10-25 at 10.50.42 PM.png!
!Screen Shot 2022-10-25 at 10.50.47 PM.png! 
!Screen Shot 2022-10-25 at 11.01.06 PM.png! 



was (Author: JIRAUSER295489):
Hi I wanted to get more involved in contributing to the Flink project and found 
this starter task - my team is working with the Table / SQL APIs, so I thought 
this would be a good beginning task to work on :). [~surahman] are you still 
working on this issue, I noticed it has been a year since your last comment.

> If Flink support empty array, which data type of elements in array should be 
> ? Does it cause new problems.
[~pensz] I tested a similar query in Trino (Presto) and BigQuery and they by 
default use Integer as the data type. This could be a good default behaviour?

!Screen Shot 2022-10-25 at 10.50.42 PM.png!
!Screen Shot 2022-10-25 at 10.50.47 PM.png! 
!Screen Shot 2022-10-25 at 11.01.06 PM.png! 


> 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.17.0
>
> Attachments: Screen Shot 2022-10-25 at 10.50.42 PM.png, Screen Shot 
> 2022-10-25 at 10.50.47 PM.png, Screen Shot 2022-10-25 at 11.01.06 PM.png
>
>
> 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.20.10#820010)


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

2022-10-25 Thread Eric Xiao (Jira)


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

Eric Xiao edited comment on FLINK-20578 at 10/26/22 3:04 AM:
-

Hi I wanted to get more involved in contributing to the Flink project and found 
this starter task - my team is working with the Table / SQL APIs, so I thought 
this would be a good beginning task to work on :). [~surahman] are you still 
working on this issue, I noticed it has been a year since your last comment.

> If Flink support empty array, which data type of elements in array should be 
> ? Does it cause new problems.
[~pensz] I tested a similar query in Trino (Presto) and BigQuery and they by 
default use Integer as the data type. This could be a good default behaviour?

!Screen Shot 2022-10-25 at 10.50.42 PM.png!
!Screen Shot 2022-10-25 at 10.50.47 PM.png! 
!Screen Shot 2022-10-25 at 11.01.06 PM.png! 



was (Author: JIRAUSER295489):
Hi I wanted to get more involved in contributing to the Flink project and found 
this starter task - my team is working with the Table / SQL APIs, so I thought 
this would be a good beginning task to work on :). [~surahman] are you still 
working on this issue, I noticed it has been a year since your last comment.

> If Flink support empty array, which data type of elements in array should be 
> ? Does it cause new problems.
[~pensz] I tested a similar query in Trino (Presto) and BigQuery and they by 
default use Integer as the data type. This could be a good default behaviour?

!Screen Shot 2022-10-25 at 10.50.42 PM.png!


> 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.17.0
>
> Attachments: Screen Shot 2022-10-25 at 10.50.42 PM.png, Screen Shot 
> 2022-10-25 at 10.50.47 PM.png, Screen Shot 2022-10-25 at 11.01.06 PM.png
>
>
> 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.20.10#820010)


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

2021-10-24 Thread Saad Ur Rahman (Jira)


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

Saad Ur Rahman edited comment on FLINK-20578 at 10/24/21, 11:52 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?

 

If all you would like to do is suppress the error then something like this 
would probably suffice 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]:

 
{noformat}
@Override
public boolean checkOperandTypes(SqlCallBinding callBinding, boolean 
throwOnFailure) {
try {
return super.checkOperandTypes(callBinding, throwOnFailure);
} catch (CalciteException e) {
if 
(e.getMessage().equals(RESOURCE.requireAtLeastOneArg().ex().getMessage())) {
return true;
}
throw e;
}
}{noformat}
 


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?

 

If all you would like to do is suppress the error then something like this 
would probably suffice 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]:

 
{noformat}
@Override
public boolean checkOperandTypes(SqlCallBinding callBinding, boolean 
throwOnFailure) {
try {
return super.checkOperandTypes(callBinding, throwOnFailure);
} catch (CalciteException e) {
if (e.getMessage().equals(RESOURCE.requireAtLeastOneArg())) {
return true;
}
throw e;
}
}{noformat}
 

> 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)


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

2021-10-24 Thread Saad Ur Rahman (Jira)


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

Saad Ur Rahman edited comment on FLINK-20578 at 10/24/21, 10:38 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?

 

If all you would like to do is suppress the error then something like this 
would probably suffice 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]:

 
{noformat}
@Override
public boolean checkOperandTypes(SqlCallBinding callBinding, boolean 
throwOnFailure) {
try {
return super.checkOperandTypes(callBinding, throwOnFailure);
} catch (CalciteException e) {
if (e.getMessage().equals(RESOURCE.requireAtLeastOneArg())) {
return true;
}
throw e;
}
}{noformat}
 


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)


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

2021-10-24 Thread Saad Ur Rahman (Jira)


[ 
https://issues.apache.org/jira/browse/FLINK-20578?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=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)