You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "hanyuzheng7 (via GitHub)" <gi...@apache.org> on 2023/08/10 02:22:51 UTC
[GitHub] [flink] hanyuzheng7 opened a new pull request, #23185: [BP-1.17][FLINK-31663][table] Add-ARRAY_EXCEPT-function.
hanyuzheng7 opened a new pull request, #23185:
URL: https://github.com/apache/flink/pull/23185
## What is the purpose of the change
This is an implementation of ARRAY_EXCEPT function
ARRAY_EXCEPT(array1, array2) - Returns an array of the elements in array1 but not in array2, without duplicates.
## Brief change log
ARRAY_EXCEPT for Table API and SQL
## Syntax:
`ARRAY_EXCEPT(array1, array2)`
## Arguments:
array: An ARRAY to be handled.
## Returns:
Returns an array of the elements in array1 but not in array2, without duplicates.
## Examples:
```
Flink SQL> SELECT array_except(array[1,2,2], array[2,3,4]);
[1]
Flink SQL> SELECT array_except(array[1,2,2], array[1]);
[2]
Flink SQL> SELECT array_except(array[1,2,2], array[42]);
[1, 2]
Flink SQL> SELECT array_except(array[1,2,2], cast(null as array<int>));
[1, 2]
Flink SQL> SELECT array_except(array[1,2,2], array[null,2]);
[1]
Flink SQL> SELECT array_except(cast(null as array<int>), array[1,2,3]);
<NULL>
Flink SQL> SELECT array_except(array[null,null,1], array[42]);
[NULL, 1]
Flink SQL> SELECT array_except(array[null,null,1], array[null, 42]);
[1]
Flink SQL> SELECT array_except(array[(TRUE, DATE '2022-04-20'), (TRUE, DATE '1990-10-14'), null], array[(TRUE, DATE '1990-10-14')]);
[(TRUE, 2022-04-20), NULL]
Flink SQL> SELECT array_except(array[(TRUE, DATE '2022-04-20'), (TRUE, DATE '1990-10-14'), null], cast(null as array<row<col1 boolean, col2 date>>));
[(TRUE, 2022-04-20), (TRUE, 1990-10-14), NULL]
Flink SQL> SELECT array_except(array[array[1,null,3], array[0], array[1]], array[array[0]]);
[[1, NULL, 3], [1]]
Flink SQL> SELECT array_except(array[map[1, 'a', 2, 'b'], map[3, 'c', 4, 'd']], array[map[3, 'c', 4, 'd']]);
[{1=a, 2=b}]
// Error message with the CommonArrayInputStrategy. Without the CommonArrayInputStrategy the output is [1]
Flink SQL> SELECT array_except(array[1], array['this is a string']);
[ERROR] Could not execute SQL statement. Reason:
org.apache.flink.table.api.ValidationException: Could not find a common type for arguments: [ARRAY<INT NOT NULL> NOT NULL, ARRAY<CHAR(16) NOT NULL> NOT NULL]
```
## Verifying this change
CollectionFunctionsITCase
## see also:
spark:https://spark.apache.org/docs/latest/api/sql/index.html#array_except
## Does this pull request potentially affect one of the following parts:
- Dependencies (does it add or upgrade a dependency): (yes / no)
- The public API, i.e., is any changed class annotated with `@Public(Evolving)`: (yes / no)
- The serializers: (yes / no / don't know)
- The runtime per-record code paths (performance sensitive): (yes / no / don't know)
- Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: (yes / no / don't know)
- The S3 file system connector: (yes / no / don't know)
## Documentation
- Does this pull request introduce a new feature? (yes / no)
- If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [BP-1.17][FLINK-31663][table] Add-ARRAY_EXCEPT-function. [flink]
Posted by "MartijnVisser (via GitHub)" <gi...@apache.org>.
MartijnVisser commented on PR #23185:
URL: https://github.com/apache/flink/pull/23185#issuecomment-1836226100
Closing this PR since we don't backport new features into existing releases
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [BP-1.17][FLINK-31663][table] Add-ARRAY_EXCEPT-function. [flink]
Posted by "MartijnVisser (via GitHub)" <gi...@apache.org>.
MartijnVisser closed pull request #23185: [BP-1.17][FLINK-31663][table] Add-ARRAY_EXCEPT-function.
URL: https://github.com/apache/flink/pull/23185
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [flink] flinkbot commented on pull request #23185: [BP-1.17][FLINK-31663][table] Add-ARRAY_EXCEPT-function.
Posted by "flinkbot (via GitHub)" <gi...@apache.org>.
flinkbot commented on PR #23185:
URL: https://github.com/apache/flink/pull/23185#issuecomment-1672445728
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "722f2ec5cd9b82844e08ad206cdb5ae8642d9681",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "722f2ec5cd9b82844e08ad206cdb5ae8642d9681",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* 722f2ec5cd9b82844e08ad206cdb5ae8642d9681 UNKNOWN
<details>
<summary>Bot commands</summary>
The @flinkbot bot supports the following commands:
- `@flinkbot run azure` re-run the last Azure build
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org