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

luoyuxia commented on FLINK-26764:
----------------------------------

When I try to support it, I meet some problem. Currently, in Flink, the 
FIRST_VALUE  always ignore null by default. But in almost all other engine like 
 [Spark|https://spark.apache.org/docs/2.4.2/api/sql/index.html#first_value], 
[Hive|https://cwiki.apache.org/confluence/display/hive/languagemanual+windowingandanalytics],
 
[Oracle|https://docs.oracle.com/cd/B19306_01/server.102/b14200/functions057.htm],
 
[Snowflake|https://docs.snowflake.com/en/sql-reference/functions/first_value.html],
 etc always not ignore null by default.

In this case, we have two options:

1: Not to follow other engines' behavior.  It's fine but may be not friendly to 
the other engines' users  when they switch to Flink. Users may make mistake in 
this function.

2: Follow other engines' behavior. It make the behavior compatible with other 
engines, and thus more user friendly. But it will change the default behavior 
for FIRST_VALUE and will bring  compatibility issue when user upgrade their 
Flink.

I'm fine with any one of these two options, but perfer the second one.

[~jark] [~godfreyhe] Could you please have a look?

 

> Support RESPECT  NULLS for FIRST_VALUE/LAST_VALUE
> -------------------------------------------------
>
>                 Key: FLINK-26764
>                 URL: https://issues.apache.org/jira/browse/FLINK-26764
>             Project: Flink
>          Issue Type: New Feature
>          Components: Table SQL / API, Table SQL / Planner
>            Reporter: luoyuxia
>            Assignee: luoyuxia
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.16.0
>
>
> Flink supports fucntion FIRST_VALUE/LAST_VALUE, but the behavior is always 
> ignore null value.
> But the 
> [Spark|https://spark.apache.org/docs/2.4.2/api/sql/index.html#first_value], 
> [Hive|https://cwiki.apache.org/confluence/display/hive/languagemanual+windowingandanalytics],
>  
> [Oracle|https://docs.oracle.com/cd/B19306_01/server.102/b14200/functions057.htm],
>  
> [Snowflake|https://docs.snowflake.com/en/sql-reference/functions/first_value.html],
>  etc, also support to respect null for FIRST_VALUE/LAST_VALUE.
> Should we also support to allow users to specifc whether to ignore null?



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to