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

Dominik Bünzli edited comment on FLINK-31207 at 7/14/26 12:53 PM:
------------------------------------------------------------------

Hi [~twalthr], Hi @[~martijnvisser] 

I took some time to do a PoC implementation for the higher order functions 
"ARRAY_FILTER" and "TRANSFORM", which allow filtering elements from arrays 
based on a predicate and applying lambda-based transformations to arrays or 
maps.

They can be used like:

====================================================================
SELECT id, ARRAY_FILTER(vals, x -> x > 2) 
FROM (VALUES (1, ARRAY[1, 2, 3, 4]), (2, ARRAY[0, 1]), (3, CAST(NULL AS 
ARRAY<INT>))) 
AS t(id, vals)
====================================================================

SELECT TRANSFORM(MAP['a', 1, 'b', 2], (k, v) -> v * 100)
====================================================================

SELECT TRANSFORM(ARRAY['a', 'bb', 'ccc'], s -> CHAR_LENGTH(s))
====================================================================

I would love to contribute my code, do I need to create a FLIP? If so, I read 
that I need to open a Google Doc. Anything else needed or just sending the 
Google Doc to the mailing list?

Kind Regards
Dominik

 


was (Author: JIRAUSER309386):
Hi [~twalthr], Hi @[~martijnvisser] 

I took some time to do a PoC implementation for the higher order functions 
"ARRAY_FILTER" and "TRANSFORM", which allow filtering elements from arrays 
based on a predicate and applying lambda-based transformations to arrays or 
maps.

They can be used like:


SELECT id, ARRAY_FILTER(vals, x -> x > 2) 
FROM (VALUES (1, ARRAY[1, 2, 3, 4]), (2, ARRAY[0, 1]), (3, CAST(NULL AS 
ARRAY<INT>))) 
AS t(id, vals)


SELECT TRANSFORM(MAP['a', 1, 'b', 2], (k, v) -> v * 100)

SELECT TRANSFORM(ARRAY['a', 'bb', 'ccc'], s -> CHAR_LENGTH(s))

I would love to contribute my code, do I need to create a FLIP? If so, I read 
that I need to open a Google Doc. Anything else needed or just sending the 
Google Doc to the mailing list?

Kind Regards
Dominik


 

> Supports high order function like other engine
> ----------------------------------------------
>
>                 Key: FLINK-31207
>                 URL: https://issues.apache.org/jira/browse/FLINK-31207
>             Project: Flink
>          Issue Type: New Feature
>            Reporter: Jacky Lau
>            Priority: Major
>
> spark [https://spark.apache.org/docs/latest/api/sql/index.html#transform]
> transform/transform_keys/transform_values 
> after calcite  https://issues.apache.org/jira/browse/CALCITE-3679s upports 
> high order functions, we should supports many high order funcsions like 
> spark/presto



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to