You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flink.apache.org by Xuyang <xy...@163.com> on 2023/11/28 12:31:09 UTC

[DISCUSS] FLIP-392: Deprecate the Legacy Group Window Aggregation

Hi all.
I'd like to start a discussion of FLIP-392: Deprecate the Legacy Group Window Aggregation.


Although the current Flink SQL Window Aggregation documentation[1] indicates that the legacy Group Window Aggregation
syntax has been deprecated, the new Window TVF Aggregation syntax has not fully covered all of the features of the legacy one.


Compared to Group Window Aggergation, Window TVF Aggergation has several advantages, such as two-stage optimization, 
support for standard GROUPING SET syntax, and so on. However, it needs to supplement and enrich the following features.


1. Support for SESSION Window TVF Aggregation
2. Support for consuming CDC stream
3. Support for HOP window size with non-integer step length
4. Support for configurations such as early fire, late fire and allow lateness
(which are internal experimental configurations in Group Window Aggregation and not public to users yet.)
5. Unification of the Window TVF Aggregation operator in runtime at the implementation layer
(In the long term, the cost to maintain the operators about Window TVF Aggregation and Group Window Aggregation is too expensive.)


This flip aims to continue the unfinished work in FLIP-145[2], which is to fully enable the capabilities of Window TVF Aggregation
 and officially deprecate the legacy syntax Group Window Aggregation, to prepare for the removal of the legacy one in Flink 2.0. 


I have already done some preliminary POC to validate the feasibility of the related work in this flip as follows.
1. POC for SESSION Window TVF Aggregation [3]
2. POC for CUMULATE in Group Window Aggregation operator [4]
3. POC for consuming CDC stream in Window Aggregation operator [5]


Looking forward to your feedback and thoughts!



[1] https://nightlies.apache.org/flink/flink-docs-master/docs/dev/table/sql/queries/window-agg/

[2] https://cwiki.apache.org/confluence/display/FLINK/FLIP-145%3A+Support+SQL+windowing+table-valued+function#FLIP145:SupportSQLwindowingtablevaluedfunction-SessionWindows
[3] https://github.com/xuyangzhong/flink/tree/FLINK-24024
[4] https://github.com/xuyangzhong/flink/tree/poc_legacy_group_window_agg_cumulate
[5] https://github.com/xuyangzhong/flink/tree/poc_window_agg_consumes_cdc_stream



--

    Best!
    Xuyang

Re: Re: [DISCUSS] FLIP-392: Deprecate the Legacy Group Window Aggregation

Posted by Shengkai Fang <fs...@gmail.com>.
Hi, Xuyang. Thanks for your great work. Big +1!

After reading the FLIP, I have some questions. Please read the content
below.

1. Support SESSION Window TVF Aggregation
    a. Could you give an example about the pass-through column? A session
window may contain multiple rows, which value is selected by the window
operator?

2. TVF support CDC
   a. What's the behavior if all the data in the window have been removed?
   b. Could you explain more details about the how window process CDC? For
example, what's the behavior if the window only gets the DELETE data from
the upstream Operator?
   c. The subtitle is not correct here. It seems we only support Window TVF
Aggregation to consume the CDC stream.

3. Late fire/Early fire

   It's better if we can introduce a syntax like the `emit` keyword to set
the emit strategy for every window.
   ```
   SESSION(data [PARTITION BY (keycols, ...)], DESCRIPTOR(timecol), gap,
emit='')
   ```

   The drawback of the current implementation is ambiguous to users. It is
up to the operator implementation to determine whether it works. But it's
ok if we just align the behavior with the legacy window operator.

5. Unify into the Window TVF Aggregation operators in runtime at the
implementation layer

I think more work should be mentioned in the FLIP. What's the behavior if
the input schema contains a column named `window_start`? In the current
design, `window_start` is a reserved keyword in the window TVF syntax, but
it is legal in the legacy implementation.

In the FLIP, you mention the FLIP should introduce an option to fall back
to the legacy behavior. Could you tell us what's the name of the option?
BTW, I think we should unify the implementation when window TVF can do all
the work that the legacy operator can do and there is no need to introduce
an option to fallback.

If we remove the legacy window operator in the future, how users upgrade
their jobs? Do you have any plan to support state migration from the legacy
window to Windows TVF?

Best,
Shengkai




Xuyang <xy...@163.com> 于2023年12月5日周二 11:10写道:

> Hi, Feng and David.
>
>
> Thank you very much to share your thoughts.
>
>
> This flip does not include the official exposure of these experimental
> conf to users. Thus there is not adetailed description of this part.
> However, in view that some technical users may have added these
> experimental conf in actual production jobs, the processing
> of these conf while using window tvf syntax has been added to this flip.
>
>
> Overall, the behavior of using these experimental parameters is no
> different from before, and I think we should provide the compatibility
> about using these experimental conf.
>
>
> Look for your thoughs.
>
>
>
>
> --
>
>     Best!
>     Xuyang
>
>
>
>
>
> At 2023-12-05 09:17:49, "David Anderson" <da...@apache.org> wrote:
> >The current situation (where we have both the legacy windows and the
> >TVF-based windows) is confusing for users, and I'd like to see us move
> >forward as rapidly as possible.
> >
> >Since the early fire, late fire, and allowed lateness features were never
> >documented or exposed to users, I don't feel that we need to provide
> >replacements for these internal, experimental features before officially
> >deprecating the legacy group window aggregations, and I'd rather not wait.
> >
> >However, I'd be delighted to see a proposal for what that might look like.
> >
> >Best,
> >David
> >
> >On Mon, Dec 4, 2023 at 12:45 PM Feng Jin <ji...@gmail.com> wrote:
> >
> >> Hi xuyang,
> >>
> >> Thank you for initiating this proposal.
> >>
> >> I'm glad to see that TVF's functionality can be fully supported.
> >>
> >> Regarding the early fire, late fire, and allow lateness features, how
> will
> >> they be provided to users? The documentation doesn't seem to provide a
> >> detailed description of this part.
> >>
> >> Since this FLIP will also involve a lot of feature development, I am
> more
> >> than willing to help, including development and code review.
> >>
> >> Best,
> >> Feng
> >>
> >> On Tue, Nov 28, 2023 at 8:31 PM Xuyang <xy...@163.com> wrote:
> >>
> >> > Hi all.
> >> > I'd like to start a discussion of FLIP-392: Deprecate the Legacy Group
> >> > Window Aggregation.
> >> >
> >> >
> >> > Although the current Flink SQL Window Aggregation documentation[1]
> >> > indicates that the legacy Group Window Aggregation
> >> > syntax has been deprecated, the new Window TVF Aggregation syntax has
> not
> >> > fully covered all of the features of the legacy one.
> >> >
> >> >
> >> > Compared to Group Window Aggergation, Window TVF Aggergation has
> several
> >> > advantages, such as two-stage optimization,
> >> > support for standard GROUPING SET syntax, and so on. However, it
> needs to
> >> > supplement and enrich the following features.
> >> >
> >> >
> >> > 1. Support for SESSION Window TVF Aggregation
> >> > 2. Support for consuming CDC stream
> >> > 3. Support for HOP window size with non-integer step length
> >> > 4. Support for configurations such as early fire, late fire and allow
> >> > lateness
> >> > (which are internal experimental configurations in Group Window
> >> > Aggregation and not public to users yet.)
> >> > 5. Unification of the Window TVF Aggregation operator in runtime at
> the
> >> > implementation layer
> >> > (In the long term, the cost to maintain the operators about Window TVF
> >> > Aggregation and Group Window Aggregation is too expensive.)
> >> >
> >> >
> >> > This flip aims to continue the unfinished work in FLIP-145[2], which
> is
> >> to
> >> > fully enable the capabilities of Window TVF Aggregation
> >> >  and officially deprecate the legacy syntax Group Window Aggregation,
> to
> >> > prepare for the removal of the legacy one in Flink 2.0.
> >> >
> >> >
> >> > I have already done some preliminary POC to validate the feasibility
> of
> >> > the related work in this flip as follows.
> >> > 1. POC for SESSION Window TVF Aggregation [3]
> >> > 2. POC for CUMULATE in Group Window Aggregation operator [4]
> >> > 3. POC for consuming CDC stream in Window Aggregation operator [5]
> >> >
> >> >
> >> > Looking forward to your feedback and thoughts!
> >> >
> >> >
> >> >
> >> > [1]
> >> >
> >>
> https://nightlies.apache.org/flink/flink-docs-master/docs/dev/table/sql/queries/window-agg/
> >> >
> >> > [2]
> >> >
> >>
> https://cwiki.apache.org/confluence/display/FLINK/FLIP-145%3A+Support+SQL+windowing+table-valued+function#FLIP145:SupportSQLwindowingtablevaluedfunction-SessionWindows
> >> > [3] https://github.com/xuyangzhong/flink/tree/FLINK-24024
> >> > [4]
> >> >
> >>
> https://github.com/xuyangzhong/flink/tree/poc_legacy_group_window_agg_cumulate
> >> > [5]
> >> >
> >>
> https://github.com/xuyangzhong/flink/tree/poc_window_agg_consumes_cdc_stream
> >> >
> >> >
> >> >
> >> > --
> >> >
> >> >     Best!
> >> >     Xuyang
> >>
>

Re:Re: Re: Re: Re: [DISCUSS] FLIP-392: Deprecate the Legacy Group Window Aggregation

Posted by Xuyang <xy...@163.com>.
Hi, Shengkai.


> I think we shouldn't remove the operator if we can not give a solution to help users upgrade their jobs. But I think we can delay the discussion until we need to remove the operator. 


+1 for it.







--

    Best!
    Xuyang




在 2023-12-08 19:22:40,"Shengkai Fang" <fs...@gmail.com> 写道:

Hi, Xuyang. Thanks for your response.


I just thought an another way to solve this question instead of introducing a new configuration. When using legacy syntax like `GROUP BY TUMBLE(xxx), f0`, the rewritten sql can be GROUP BY f0, window_start, window_end(window_start and window_end is produced by WINDOW TVF). We can use field index here and use a new Calc node to alias them to avoid field name conflict in WindowAggregate node.


The solution is much better than before and I think it can solve the problem I mentioned before. 


What about using config named "table.optimizer.window-rewrite-enabled"


+1  


IIRC, currently compatibility across middle versions of SQL is not guaranteed. Should we add constraints on this part?


I think we shouldn't remove the operator if we can not give a solution to help users upgrade their jobs. But I think we can delay the discussion until we need to remove the operator. 


Best,
Shengkai


Xuyang <xy...@163.com> 于2023年12月8日周五 18:07写道:

Hi, Martijn, thanks for your share.


>On the topic of syntax for early/late fires, there is existing
>configuration for the legacy group windows:
>
>SET table.exec.emit.early-fire.enabled = true;
>SET table.exec.emit.early-fire.delay = 5s;
>SET table.exec.emit.late-fire.enabled = true;
>SET table.exec.emit.late-fire.delay = 0;
>SET table.exec.emit.allow-lateness = 5s;
>
>We should stick with the syntax for the TVFs, and not modify that.
Agree with you. We should follow the syntax defined in Flip-145. As for how to let these options to only take effect on a single window agg instead of all window aggs, we need to think of another way.
>On the topic of column naming, for other situations where a user wants
>to use a value that's already reserved, we require the user to include
>backticks to indicate that Flink should not use the reserved keyword
>implementation. Why isn't that sufficient in this case? I rather stay
>consistent with this behaviour instead of introducing new config
>options.
>
I just thought an another way to solve this question instead of introducing a new configuration. When using legacy syntax like `GROUP BY TUMBLE(xxx), f0`, the rewritten sql can be GROUP BY f0, window_start, window_end(window_start and window_end is produced by WINDOW TVF). We can use field index here and use a new Calc node to alias them to avoid field name conflict in WindowAggregate node.
What about this idea, cc  @Shengkai Fang ?


>I would propose to rename the FLIP to
>something like "Add Missing Table Valued Functions Features to Replace
>Legacy Group Window Aggregation".
IMO, the original title "deprecate" maybe more clear. Because although the doc has deprecated the legacy Group Window Aggregation syntax just like what I said in this Flip, but the DEPRECATED tag in doc is attached when doing the Flip-145. Let's review the content in Flip-145 again. The Flip-145 said "The existing Grouped window functions, i.e. GROUP BY TUMBLE... are still supported, but will be deprecated". So as a work to follow Flip-145, this Flip officially deprecates the legacy window syntax at this time. WDTK?



--

    Best!
    Xuyang





At 2023-12-07 16:51:44, "Martijn Visser" <ma...@apache.org> wrote:
>Hi Xuyang,
>
>Thanks a lot for starting this discussion.
>
>At first, I was a bit confused because the FLIP talks about
>deprecating the Legacy Group Window Aggregations, but they have
>already been marked as deprecated in the documentation [1].
>My understanding was that the big challenge was that we don't yet
>support SESSION windows in the Window TVF, and that the other features
>you've mentioned in the discussion threads are additional
>capabilities.
>
>However, when reading up on the actual FLIP (your discussion email
>didn't include a link [2] to it) I now understand the situation. The
>appendix table is actually the most valuable for me, because it gives
>me the overview of the missing capabilities between TVF implementation
>and the Legacy Group Window Aggregations.
>
>On the topic of syntax for early/late fires, there is existing
>configuration for the legacy group windows:
>
>SET table.exec.emit.early-fire.enabled = true;
>SET table.exec.emit.early-fire.delay = 5s;
>SET table.exec.emit.late-fire.enabled = true;
>SET table.exec.emit.late-fire.delay = 0;
>SET table.exec.emit.allow-lateness = 5s;
>
>We should stick with the syntax for the TVFs, and not modify that.
>
>On the topic of column naming, for other situations where a user wants
>to use a value that's already reserved, we require the user to include
>backticks to indicate that Flink should not use the reserved keyword
>implementation. Why isn't that sufficient in this case? I rather stay
>consistent with this behaviour instead of introducing new config
>options.
>
>Overall, +1 on this topic. I would propose to rename the FLIP to
>something like "Add Missing Table Valued Functions Features to Replace
>Legacy Group Window Aggregation".
>
>Best regards,
>
>Martijn
>
>[1] https://nightlies.apache.org/flink/flink-docs-release-1.18/docs/dev/table/sql/queries/window-agg/#group-window-aggregation
>[2] https://cwiki.apache.org/confluence/display/FLINK/FLIP-392%3A+Deprecate+the+Legacy+Group+Window+Aggregation
>
>
>On Wed, Dec 6, 2023 at 9:32 AM Xuyang <xy...@163.com> wrote:
>>
>> Hi, Shengkai. Thanks to share your thought. Let me answer related questions。
>>
>>
>> > Could you give an example about the pass-through column. A session window may contain multiple rows, which value is selected by the windowoperator?
>>
>>
>> The table function make the entire inpyt row available in the output. Take an example in Flink, if the input row is <a,b,c> with schema <f0,f1,f2>,
>> the output of the window tvf can also access the <a,b,c> with schema <f0,f1,f2>. The session window always output these multi rows with attached window_start,
>> window_end and window_time column.
>>
>>
>> > What's the behavior if all the data in the window have been removed?
>>
>>
>> Align the behavior of existing group window agg, and do not output data when the window is empty.
>>
>>
>> > Could you explain more details about the how window process CDC? For example, what's the behavior if the window only gets the DELETE data from the upstream Operator.
>>
>>
>> Also align the behavior of existing group window agg. However, there is a bug in group window agg that currently group window agg has different results when only
>> consuming -D records while using or not using minibatch. Refs more at FLINK-33760.
>>
>>
>> > The subtitle is not correct here.
>>
>>
>> Updated the doc to fix it.
>>
>>
>> > It's better if we can introduce a syntax like the `emit` keyword to set the emit strategy for every window.
>> I agree with you. But I don't recommend using this syntax SESSION(data [PARTITION BY (keycols, ...)], DESCRIPTOR(timecol), gap, emit='') because it breaks the syntax in Flip-145.
>> I think using query hint is a better idea. Anyway, this work should belong to another flip.
>>
>>
>> > I think more work should be mentioned in the FLIP. What's the behavior if the input schema contains a column named `window_start`?
>> > In the current design, `window_start` is a reserved keyword in the window TVF syntax, but it is legal in the legacy implementation.
>>
>>
>> This is a good question. Perhaps we can introduce a config to add a specific config (named "table.window-additional-columns.prefix") to add a prefix
>> of all window addition columns to solve this situation. For example, user can set the conf to "$", and the additional column from window will become
>> "$window_start", "$window_end" and "$window_time". WDYT?
>>
>>
>> > In the FLIP, you mention the FLIP should introduce an option to fall back to the legacy behavior. Could you tell us what's the name of the option?
>> > BTW, I think we should unify the implementation when window TVF can do all the work that the legacy operator can do and there is no need to introduce an option to fallback.
>>
>>
>> What about using config named "table.optimizer.window-rewrite-enabled"? If
>> I agree with you that util all features are aligned and everything is ok about window tvf, we should also remove this config about fallback.
>> But I think to be on the safe side, we can observe one or two versions of this rewrite, and allows users to roll back when problems arise.
>>
>>
>> > If we remove the legacy window operator in the future, how users upgrade their jobs? Do you have any plan to support state migration from the legacy window to Windows TVF?
>> IIRC, currently compatibility across middle versions of SQL is not guaranteed. Should we add constraints on this part?
>>
>>
>> Look for your feedback!
>>
>>
>>
>>
>>
>>
>>
>> --
>>
>>     Best!
>>     Xuyang
>>
>>
>>
>>
>>
>> At 2023-12-05 12:06:27, "liu ron" <ro...@gmail.com> wrote:
>> >Hi, xuyang
>> >
>> >Thanks for starting this FLIP discussion, currently there are two types of
>> >window aggregation in Flink SQL, namely legacy group window aggregation and
>> >window tvf aggregation, these two types of window aggregation are not fully
>> >aligned in behavior, which will bring a lot of confusion to the users, so
>> >there is a need to unify and align them. I think the final ideal state
>> >should be that there is only one window tvf aggregation, which supports
>> >Tumble, HOP, Cumulate and Session windows, and supports consuming CDC data
>> >streams. There is also support for configuring EARLY-FIRE and LATER-FIRE.
>> >
>> >This FLIP is a continuation of FLIP-145, and also supports legacy group
>> >window aggregation to flat-migrate to the new window tvf agregation, which
>> >is very useful, especially for the support of CDC streams, a pain point
>> >that users often feedback. Big +1 for this FLIP.
>> >
>> >Best,
>> >Ron
>> >
>> >Xuyang <xy...@163.com> 于2023年12月5日周二 11:11写道:
>> >
>> >> Hi, Feng and David.
>> >>
>> >>
>> >> Thank you very much to share your thoughts.
>> >>
>> >>
>> >> This flip does not include the official exposure of these experimental
>> >> conf to users. Thus there is not adetailed description of this part.
>> >> However, in view that some technical users may have added these
>> >> experimental conf in actual production jobs, the processing
>> >> of these conf while using window tvf syntax has been added to this flip.
>> >>
>> >>
>> >> Overall, the behavior of using these experimental parameters is no
>> >> different from before, and I think we should provide the compatibility
>> >> about using these experimental conf.
>> >>
>> >>
>> >> Look for your thoughs.
>> >>
>> >>
>> >>
>> >>
>> >> --
>> >>
>> >>     Best!
>> >>     Xuyang
>> >>
>> >>
>> >>
>> >>
>> >>
>> >> At 2023-12-05 09:17:49, "David Anderson" <da...@apache.org> wrote:
>> >> >The current situation (where we have both the legacy windows and the
>> >> >TVF-based windows) is confusing for users, and I'd like to see us move
>> >> >forward as rapidly as possible.
>> >> >
>> >> >Since the early fire, late fire, and allowed lateness features were never
>> >> >documented or exposed to users, I don't feel that we need to provide
>> >> >replacements for these internal, experimental features before officially
>> >> >deprecating the legacy group window aggregations, and I'd rather not wait.
>> >> >
>> >> >However, I'd be delighted to see a proposal for what that might look like.
>> >> >
>> >> >Best,
>> >> >David
>> >> >
>> >> >On Mon, Dec 4, 2023 at 12:45 PM Feng Jin <ji...@gmail.com> wrote:
>> >> >
>> >> >> Hi xuyang,
>> >> >>
>> >> >> Thank you for initiating this proposal.
>> >> >>
>> >> >> I'm glad to see that TVF's functionality can be fully supported.
>> >> >>
>> >> >> Regarding the early fire, late fire, and allow lateness features, how
>> >> will
>> >> >> they be provided to users? The documentation doesn't seem to provide a
>> >> >> detailed description of this part.
>> >> >>
>> >> >> Since this FLIP will also involve a lot of feature development, I am
>> >> more
>> >> >> than willing to help, including development and code review.
>> >> >>
>> >> >> Best,
>> >> >> Feng
>> >> >>
>> >> >> On Tue, Nov 28, 2023 at 8:31 PM Xuyang <xy...@163.com> wrote:
>> >> >>
>> >> >> > Hi all.
>> >> >> > I'd like to start a discussion of FLIP-392: Deprecate the Legacy Group
>> >> >> > Window Aggregation.
>> >> >> >
>> >> >> >
>> >> >> > Although the current Flink SQL Window Aggregation documentation[1]
>> >> >> > indicates that the legacy Group Window Aggregation
>> >> >> > syntax has been deprecated, the new Window TVF Aggregation syntax has
>> >> not
>> >> >> > fully covered all of the features of the legacy one.
>> >> >> >
>> >> >> >
>> >> >> > Compared to Group Window Aggergation, Window TVF Aggergation has
>> >> several
>> >> >> > advantages, such as two-stage optimization,
>> >> >> > support for standard GROUPING SET syntax, and so on. However, it
>> >> needs to
>> >> >> > supplement and enrich the following features.
>> >> >> >
>> >> >> >
>> >> >> > 1. Support for SESSION Window TVF Aggregation
>> >> >> > 2. Support for consuming CDC stream
>> >> >> > 3. Support for HOP window size with non-integer step length
>> >> >> > 4. Support for configurations such as early fire, late fire and allow
>> >> >> > lateness
>> >> >> > (which are internal experimental configurations in Group Window
>> >> >> > Aggregation and not public to users yet.)
>> >> >> > 5. Unification of the Window TVF Aggregation operator in runtime at
>> >> the
>> >> >> > implementation layer
>> >> >> > (In the long term, the cost to maintain the operators about Window TVF
>> >> >> > Aggregation and Group Window Aggregation is too expensive.)
>> >> >> >
>> >> >> >
>> >> >> > This flip aims to continue the unfinished work in FLIP-145[2], which
>> >> is
>> >> >> to
>> >> >> > fully enable the capabilities of Window TVF Aggregation
>> >> >> >  and officially deprecate the legacy syntax Group Window Aggregation,
>> >> to
>> >> >> > prepare for the removal of the legacy one in Flink 2.0.
>> >> >> >
>> >> >> >
>> >> >> > I have already done some preliminary POC to validate the feasibility
>> >> of
>> >> >> > the related work in this flip as follows.
>> >> >> > 1. POC for SESSION Window TVF Aggregation [3]
>> >> >> > 2. POC for CUMULATE in Group Window Aggregation operator [4]
>> >> >> > 3. POC for consuming CDC stream in Window Aggregation operator [5]
>> >> >> >
>> >> >> >
>> >> >> > Looking forward to your feedback and thoughts!
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> > [1]
>> >> >> >
>> >> >>
>> >> https://nightlies.apache.org/flink/flink-docs-master/docs/dev/table/sql/queries/window-agg/
>> >> >> >
>> >> >> > [2]
>> >> >> >
>> >> >>
>> >> https://cwiki.apache.org/confluence/display/FLINK/FLIP-145%3A+Support+SQL+windowing+table-valued+function#FLIP145:SupportSQLwindowingtablevaluedfunction-SessionWindows
>> >> >> > [3] https://github.com/xuyangzhong/flink/tree/FLINK-24024
>> >> >> > [4]
>> >> >> >
>> >> >>
>> >> https://github.com/xuyangzhong/flink/tree/poc_legacy_group_window_agg_cumulate
>> >> >> > [5]
>> >> >> >
>> >> >>
>> >> https://github.com/xuyangzhong/flink/tree/poc_window_agg_consumes_cdc_stream
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> > --
>> >> >> >
>> >> >> >     Best!
>> >> >> >     Xuyang
>> >> >>
>> >>

Re: Re: Re: Re: [DISCUSS] FLIP-392: Deprecate the Legacy Group Window Aggregation

Posted by Shengkai Fang <fs...@gmail.com>.
Hi, Xuyang. Thanks for your response.

I just thought an another way to solve this question instead of introducing
> a new configuration. When using legacy syntax like `GROUP BY TUMBLE(xxx),
> f0`, the rewritten sql can be GROUP BY f0, window_start,
> window_end(window_start and window_end is produced by WINDOW TVF). We can
> use field index here and use a new Calc node to alias them to avoid field
> name conflict in WindowAggregate node.


The solution is much better than before and I think it can solve the
problem I mentioned before.

What about using config named "table.optimizer.window-rewrite-enabled"


+1

IIRC, currently compatibility across middle versions of SQL is not
> guaranteed. Should we add constraints on this part?


I think we shouldn't remove the operator if we can not give a solution to
help users upgrade their jobs. But I think we can delay the discussion
until we need to remove the operator.

Best,
Shengkai

Xuyang <xy...@163.com> 于2023年12月8日周五 18:07写道:

> Hi, Martijn, thanks for your share.
>
> >On the topic of syntax for early/late fires, there is existing
> >configuration for the legacy group windows:
> >
> >SET table.exec.emit.early-fire.enabled = true;
> >SET table.exec.emit.early-fire.delay = 5s;
> >SET table.exec.emit.late-fire.enabled = true;
> >SET table.exec.emit.late-fire.delay = 0;
> >SET table.exec.emit.allow-lateness = 5s;
> >
> >We should stick with the syntax for the TVFs, and not modify that.
>
> Agree with you. We should follow the syntax defined in Flip-145. As for how to let these options to only take effect on a single window agg instead of all window aggs, we need to think of another way.
>
> >On the topic of column naming, for other situations where a user wants
> >to use a value that's already reserved, we require the user to include
> >backticks to indicate that Flink should not use the reserved keyword
> >implementation. Why isn't that sufficient in this case? I rather stay
> >consistent with this behaviour instead of introducing new config
> >options.
> >
>
> I just thought an another way to solve this question instead of
> introducing a new configuration. When using legacy syntax like `GROUP BY
> TUMBLE(xxx), f0`, the rewritten sql can be GROUP BY f0, window_start,
> window_end(window_start and window_end is produced by WINDOW TVF). We can
> use field index here and use a new Calc node to alias them to avoid field
> name conflict in WindowAggregate node.
> What about this idea, cc  @Shengkai Fang ?
>
> >I would propose to rename the FLIP to
> >something like "Add Missing Table Valued Functions Features to Replace
> >Legacy Group Window Aggregation".
>
> IMO, the original title "deprecate" maybe more clear. Because although the doc has deprecated the legacy Group Window Aggregation syntax just like what I said in this Flip, but the DEPRECATED tag in doc is attached when doing the Flip-145. Let's review the content in Flip-145 again. The Flip-145 said "The existing Grouped window functions, i.e. GROUP BY TUMBLE... are still supported, but will be deprecated". So as a work to follow Flip-145, this Flip officially deprecates the legacy window syntax at this time. WDTK?
>
>
> --
>     Best!
>     Xuyang
>
>
>
> At 2023-12-07 16:51:44, "Martijn Visser" <ma...@apache.org> wrote:
> >Hi Xuyang,
> >
> >Thanks a lot for starting this discussion.
> >
> >At first, I was a bit confused because the FLIP talks about
> >deprecating the Legacy Group Window Aggregations, but they have
> >already been marked as deprecated in the documentation [1].
> >My understanding was that the big challenge was that we don't yet
> >support SESSION windows in the Window TVF, and that the other features
> >you've mentioned in the discussion threads are additional
> >capabilities.
> >
> >However, when reading up on the actual FLIP (your discussion email
> >didn't include a link [2] to it) I now understand the situation. The
> >appendix table is actually the most valuable for me, because it gives
> >me the overview of the missing capabilities between TVF implementation
> >and the Legacy Group Window Aggregations.
> >
> >On the topic of syntax for early/late fires, there is existing
> >configuration for the legacy group windows:
> >
> >SET table.exec.emit.early-fire.enabled = true;
> >SET table.exec.emit.early-fire.delay = 5s;
> >SET table.exec.emit.late-fire.enabled = true;
> >SET table.exec.emit.late-fire.delay = 0;
> >SET table.exec.emit.allow-lateness = 5s;
> >
> >We should stick with the syntax for the TVFs, and not modify that.
> >
> >On the topic of column naming, for other situations where a user wants
> >to use a value that's already reserved, we require the user to include
> >backticks to indicate that Flink should not use the reserved keyword
> >implementation. Why isn't that sufficient in this case? I rather stay
> >consistent with this behaviour instead of introducing new config
> >options.
> >
> >Overall, +1 on this topic. I would propose to rename the FLIP to
> >something like "Add Missing Table Valued Functions Features to Replace
> >Legacy Group Window Aggregation".
> >
> >Best regards,
> >
> >Martijn
> >
> >[1] https://nightlies.apache.org/flink/flink-docs-release-1.18/docs/dev/table/sql/queries/window-agg/#group-window-aggregation
> >[2] https://cwiki.apache.org/confluence/display/FLINK/FLIP-392%3A+Deprecate+the+Legacy+Group+Window+Aggregation
> >
> >
> >On Wed, Dec 6, 2023 at 9:32 AM Xuyang <xy...@163.com> wrote:
> >>
> >> Hi, Shengkai. Thanks to share your thought. Let me answer related questions。
> >>
> >>
> >> > Could you give an example about the pass-through column. A session window may contain multiple rows, which value is selected by the windowoperator?
> >>
> >>
> >> The table function make the entire inpyt row available in the output. Take an example in Flink, if the input row is <a,b,c> with schema <f0,f1,f2>,
> >> the output of the window tvf can also access the <a,b,c> with schema <f0,f1,f2>. The session window always output these multi rows with attached window_start,
> >> window_end and window_time column.
> >>
> >>
> >> > What's the behavior if all the data in the window have been removed?
> >>
> >>
> >> Align the behavior of existing group window agg, and do not output data when the window is empty.
> >>
> >>
> >> > Could you explain more details about the how window process CDC? For example, what's the behavior if the window only gets the DELETE data from the upstream Operator.
> >>
> >>
> >> Also align the behavior of existing group window agg. However, there is a bug in group window agg that currently group window agg has different results when only
> >> consuming -D records while using or not using minibatch. Refs more at FLINK-33760.
> >>
> >>
> >> > The subtitle is not correct here.
> >>
> >>
> >> Updated the doc to fix it.
> >>
> >>
> >> > It's better if we can introduce a syntax like the `emit` keyword to set the emit strategy for every window.
> >> I agree with you. But I don't recommend using this syntax SESSION(data [PARTITION BY (keycols, ...)], DESCRIPTOR(timecol), gap, emit='') because it breaks the syntax in Flip-145.
> >> I think using query hint is a better idea. Anyway, this work should belong to another flip.
> >>
> >>
> >> > I think more work should be mentioned in the FLIP. What's the behavior if the input schema contains a column named `window_start`?
> >> > In the current design, `window_start` is a reserved keyword in the window TVF syntax, but it is legal in the legacy implementation.
> >>
> >>
> >> This is a good question. Perhaps we can introduce a config to add a specific config (named "table.window-additional-columns.prefix") to add a prefix
> >> of all window addition columns to solve this situation. For example, user can set the conf to "$", and the additional column from window will become
> >> "$window_start", "$window_end" and "$window_time". WDYT?
> >>
> >>
> >> > In the FLIP, you mention the FLIP should introduce an option to fall back to the legacy behavior. Could you tell us what's the name of the option?
> >> > BTW, I think we should unify the implementation when window TVF can do all the work that the legacy operator can do and there is no need to introduce an option to fallback.
> >>
> >>
> >> What about using config named "table.optimizer.window-rewrite-enabled"? If
> >> I agree with you that util all features are aligned and everything is ok about window tvf, we should also remove this config about fallback.
> >> But I think to be on the safe side, we can observe one or two versions of this rewrite, and allows users to roll back when problems arise.
> >>
> >>
> >> > If we remove the legacy window operator in the future, how users upgrade their jobs? Do you have any plan to support state migration from the legacy window to Windows TVF?
> >> IIRC, currently compatibility across middle versions of SQL is not guaranteed. Should we add constraints on this part?
> >>
> >>
> >> Look for your feedback!
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >> --
> >>
> >>     Best!
> >>     Xuyang
> >>
> >>
> >>
> >>
> >>
> >> At 2023-12-05 12:06:27, "liu ron" <ro...@gmail.com> wrote:
> >> >Hi, xuyang
> >> >
> >> >Thanks for starting this FLIP discussion, currently there are two types of
> >> >window aggregation in Flink SQL, namely legacy group window aggregation and
> >> >window tvf aggregation, these two types of window aggregation are not fully
> >> >aligned in behavior, which will bring a lot of confusion to the users, so
> >> >there is a need to unify and align them. I think the final ideal state
> >> >should be that there is only one window tvf aggregation, which supports
> >> >Tumble, HOP, Cumulate and Session windows, and supports consuming CDC data
> >> >streams. There is also support for configuring EARLY-FIRE and LATER-FIRE.
> >> >
> >> >This FLIP is a continuation of FLIP-145, and also supports legacy group
> >> >window aggregation to flat-migrate to the new window tvf agregation, which
> >> >is very useful, especially for the support of CDC streams, a pain point
> >> >that users often feedback. Big +1 for this FLIP.
> >> >
> >> >Best,
> >> >Ron
> >> >
> >> >Xuyang <xy...@163.com> 于2023年12月5日周二 11:11写道:
> >> >
> >> >> Hi, Feng and David.
> >> >>
> >> >>
> >> >> Thank you very much to share your thoughts.
> >> >>
> >> >>
> >> >> This flip does not include the official exposure of these experimental
> >> >> conf to users. Thus there is not adetailed description of this part.
> >> >> However, in view that some technical users may have added these
> >> >> experimental conf in actual production jobs, the processing
> >> >> of these conf while using window tvf syntax has been added to this flip.
> >> >>
> >> >>
> >> >> Overall, the behavior of using these experimental parameters is no
> >> >> different from before, and I think we should provide the compatibility
> >> >> about using these experimental conf.
> >> >>
> >> >>
> >> >> Look for your thoughs.
> >> >>
> >> >>
> >> >>
> >> >>
> >> >> --
> >> >>
> >> >>     Best!
> >> >>     Xuyang
> >> >>
> >> >>
> >> >>
> >> >>
> >> >>
> >> >> At 2023-12-05 09:17:49, "David Anderson" <da...@apache.org> wrote:
> >> >> >The current situation (where we have both the legacy windows and the
> >> >> >TVF-based windows) is confusing for users, and I'd like to see us move
> >> >> >forward as rapidly as possible.
> >> >> >
> >> >> >Since the early fire, late fire, and allowed lateness features were never
> >> >> >documented or exposed to users, I don't feel that we need to provide
> >> >> >replacements for these internal, experimental features before officially
> >> >> >deprecating the legacy group window aggregations, and I'd rather not wait.
> >> >> >
> >> >> >However, I'd be delighted to see a proposal for what that might look like.
> >> >> >
> >> >> >Best,
> >> >> >David
> >> >> >
> >> >> >On Mon, Dec 4, 2023 at 12:45 PM Feng Jin <ji...@gmail.com> wrote:
> >> >> >
> >> >> >> Hi xuyang,
> >> >> >>
> >> >> >> Thank you for initiating this proposal.
> >> >> >>
> >> >> >> I'm glad to see that TVF's functionality can be fully supported.
> >> >> >>
> >> >> >> Regarding the early fire, late fire, and allow lateness features, how
> >> >> will
> >> >> >> they be provided to users? The documentation doesn't seem to provide a
> >> >> >> detailed description of this part.
> >> >> >>
> >> >> >> Since this FLIP will also involve a lot of feature development, I am
> >> >> more
> >> >> >> than willing to help, including development and code review.
> >> >> >>
> >> >> >> Best,
> >> >> >> Feng
> >> >> >>
> >> >> >> On Tue, Nov 28, 2023 at 8:31 PM Xuyang <xy...@163.com> wrote:
> >> >> >>
> >> >> >> > Hi all.
> >> >> >> > I'd like to start a discussion of FLIP-392: Deprecate the Legacy Group
> >> >> >> > Window Aggregation.
> >> >> >> >
> >> >> >> >
> >> >> >> > Although the current Flink SQL Window Aggregation documentation[1]
> >> >> >> > indicates that the legacy Group Window Aggregation
> >> >> >> > syntax has been deprecated, the new Window TVF Aggregation syntax has
> >> >> not
> >> >> >> > fully covered all of the features of the legacy one.
> >> >> >> >
> >> >> >> >
> >> >> >> > Compared to Group Window Aggergation, Window TVF Aggergation has
> >> >> several
> >> >> >> > advantages, such as two-stage optimization,
> >> >> >> > support for standard GROUPING SET syntax, and so on. However, it
> >> >> needs to
> >> >> >> > supplement and enrich the following features.
> >> >> >> >
> >> >> >> >
> >> >> >> > 1. Support for SESSION Window TVF Aggregation
> >> >> >> > 2. Support for consuming CDC stream
> >> >> >> > 3. Support for HOP window size with non-integer step length
> >> >> >> > 4. Support for configurations such as early fire, late fire and allow
> >> >> >> > lateness
> >> >> >> > (which are internal experimental configurations in Group Window
> >> >> >> > Aggregation and not public to users yet.)
> >> >> >> > 5. Unification of the Window TVF Aggregation operator in runtime at
> >> >> the
> >> >> >> > implementation layer
> >> >> >> > (In the long term, the cost to maintain the operators about Window TVF
> >> >> >> > Aggregation and Group Window Aggregation is too expensive.)
> >> >> >> >
> >> >> >> >
> >> >> >> > This flip aims to continue the unfinished work in FLIP-145[2], which
> >> >> is
> >> >> >> to
> >> >> >> > fully enable the capabilities of Window TVF Aggregation
> >> >> >> >  and officially deprecate the legacy syntax Group Window Aggregation,
> >> >> to
> >> >> >> > prepare for the removal of the legacy one in Flink 2.0.
> >> >> >> >
> >> >> >> >
> >> >> >> > I have already done some preliminary POC to validate the feasibility
> >> >> of
> >> >> >> > the related work in this flip as follows.
> >> >> >> > 1. POC for SESSION Window TVF Aggregation [3]
> >> >> >> > 2. POC for CUMULATE in Group Window Aggregation operator [4]
> >> >> >> > 3. POC for consuming CDC stream in Window Aggregation operator [5]
> >> >> >> >
> >> >> >> >
> >> >> >> > Looking forward to your feedback and thoughts!
> >> >> >> >
> >> >> >> >
> >> >> >> >
> >> >> >> > [1]
> >> >> >> >
> >> >> >>
> >> >> https://nightlies.apache.org/flink/flink-docs-master/docs/dev/table/sql/queries/window-agg/
> >> >> >> >
> >> >> >> > [2]
> >> >> >> >
> >> >> >>
> >> >> https://cwiki.apache.org/confluence/display/FLINK/FLIP-145%3A+Support+SQL+windowing+table-valued+function#FLIP145:SupportSQLwindowingtablevaluedfunction-SessionWindows
> >> >> >> > [3] https://github.com/xuyangzhong/flink/tree/FLINK-24024
> >> >> >> > [4]
> >> >> >> >
> >> >> >>
> >> >> https://github.com/xuyangzhong/flink/tree/poc_legacy_group_window_agg_cumulate
> >> >> >> > [5]
> >> >> >> >
> >> >> >>
> >> >> https://github.com/xuyangzhong/flink/tree/poc_window_agg_consumes_cdc_stream
> >> >> >> >
> >> >> >> >
> >> >> >> >
> >> >> >> > --
> >> >> >> >
> >> >> >> >     Best!
> >> >> >> >     Xuyang
> >> >> >>
> >> >>
>
>

Re:Re: Re: Re: [DISCUSS] FLIP-392: Deprecate the Legacy Group Window Aggregation

Posted by Xuyang <xy...@163.com>.
Hi, Martijn, thanks for your share.


>On the topic of syntax for early/late fires, there is existing
>configuration for the legacy group windows:
>
>SET table.exec.emit.early-fire.enabled = true;
>SET table.exec.emit.early-fire.delay = 5s;
>SET table.exec.emit.late-fire.enabled = true;
>SET table.exec.emit.late-fire.delay = 0;
>SET table.exec.emit.allow-lateness = 5s;
>
>We should stick with the syntax for the TVFs, and not modify that.
Agree with you. We should follow the syntax defined in Flip-145. As for how to let these options to only take effect on a single window agg instead of all window aggs, we need to think of another way.
>On the topic of column naming, for other situations where a user wants
>to use a value that's already reserved, we require the user to include
>backticks to indicate that Flink should not use the reserved keyword
>implementation. Why isn't that sufficient in this case? I rather stay
>consistent with this behaviour instead of introducing new config
>options.
>
I just thought an another way to solve this question instead of introducing a new configuration. When using legacy syntax like `GROUP BY TUMBLE(xxx), f0`, the rewritten sql can be GROUP BY f0, window_start, window_end(window_start and window_end is produced by WINDOW TVF). We can use field index here and use a new Calc node to alias them to avoid field name conflict in WindowAggregate node.
What about this idea, cc  @Shengkai Fang ?


>I would propose to rename the FLIP to
>something like "Add Missing Table Valued Functions Features to Replace
>Legacy Group Window Aggregation".
IMO, the original title "deprecate" maybe more clear. Because although the doc has deprecated the legacy Group Window Aggregation syntax just like what I said in this Flip, but the DEPRECATED tag in doc is attached when doing the Flip-145. Let's review the content in Flip-145 again. The Flip-145 said "The existing Grouped window functions, i.e. GROUP BY TUMBLE... are still supported, but will be deprecated". So as a work to follow Flip-145, this Flip officially deprecates the legacy window syntax at this time. WDTK?



--

    Best!
    Xuyang





At 2023-12-07 16:51:44, "Martijn Visser" <ma...@apache.org> wrote:
>Hi Xuyang,
>
>Thanks a lot for starting this discussion.
>
>At first, I was a bit confused because the FLIP talks about
>deprecating the Legacy Group Window Aggregations, but they have
>already been marked as deprecated in the documentation [1].
>My understanding was that the big challenge was that we don't yet
>support SESSION windows in the Window TVF, and that the other features
>you've mentioned in the discussion threads are additional
>capabilities.
>
>However, when reading up on the actual FLIP (your discussion email
>didn't include a link [2] to it) I now understand the situation. The
>appendix table is actually the most valuable for me, because it gives
>me the overview of the missing capabilities between TVF implementation
>and the Legacy Group Window Aggregations.
>
>On the topic of syntax for early/late fires, there is existing
>configuration for the legacy group windows:
>
>SET table.exec.emit.early-fire.enabled = true;
>SET table.exec.emit.early-fire.delay = 5s;
>SET table.exec.emit.late-fire.enabled = true;
>SET table.exec.emit.late-fire.delay = 0;
>SET table.exec.emit.allow-lateness = 5s;
>
>We should stick with the syntax for the TVFs, and not modify that.
>
>On the topic of column naming, for other situations where a user wants
>to use a value that's already reserved, we require the user to include
>backticks to indicate that Flink should not use the reserved keyword
>implementation. Why isn't that sufficient in this case? I rather stay
>consistent with this behaviour instead of introducing new config
>options.
>
>Overall, +1 on this topic. I would propose to rename the FLIP to
>something like "Add Missing Table Valued Functions Features to Replace
>Legacy Group Window Aggregation".
>
>Best regards,
>
>Martijn
>
>[1] https://nightlies.apache.org/flink/flink-docs-release-1.18/docs/dev/table/sql/queries/window-agg/#group-window-aggregation
>[2] https://cwiki.apache.org/confluence/display/FLINK/FLIP-392%3A+Deprecate+the+Legacy+Group+Window+Aggregation
>
>
>On Wed, Dec 6, 2023 at 9:32 AM Xuyang <xy...@163.com> wrote:
>>
>> Hi, Shengkai. Thanks to share your thought. Let me answer related questions。
>>
>>
>> > Could you give an example about the pass-through column. A session window may contain multiple rows, which value is selected by the windowoperator?
>>
>>
>> The table function make the entire inpyt row available in the output. Take an example in Flink, if the input row is <a,b,c> with schema <f0,f1,f2>,
>> the output of the window tvf can also access the <a,b,c> with schema <f0,f1,f2>. The session window always output these multi rows with attached window_start,
>> window_end and window_time column.
>>
>>
>> > What's the behavior if all the data in the window have been removed?
>>
>>
>> Align the behavior of existing group window agg, and do not output data when the window is empty.
>>
>>
>> > Could you explain more details about the how window process CDC? For example, what's the behavior if the window only gets the DELETE data from the upstream Operator.
>>
>>
>> Also align the behavior of existing group window agg. However, there is a bug in group window agg that currently group window agg has different results when only
>> consuming -D records while using or not using minibatch. Refs more at FLINK-33760.
>>
>>
>> > The subtitle is not correct here.
>>
>>
>> Updated the doc to fix it.
>>
>>
>> > It's better if we can introduce a syntax like the `emit` keyword to set the emit strategy for every window.
>> I agree with you. But I don't recommend using this syntax SESSION(data [PARTITION BY (keycols, ...)], DESCRIPTOR(timecol), gap, emit='') because it breaks the syntax in Flip-145.
>> I think using query hint is a better idea. Anyway, this work should belong to another flip.
>>
>>
>> > I think more work should be mentioned in the FLIP. What's the behavior if the input schema contains a column named `window_start`?
>> > In the current design, `window_start` is a reserved keyword in the window TVF syntax, but it is legal in the legacy implementation.
>>
>>
>> This is a good question. Perhaps we can introduce a config to add a specific config (named "table.window-additional-columns.prefix") to add a prefix
>> of all window addition columns to solve this situation. For example, user can set the conf to "$", and the additional column from window will become
>> "$window_start", "$window_end" and "$window_time". WDYT?
>>
>>
>> > In the FLIP, you mention the FLIP should introduce an option to fall back to the legacy behavior. Could you tell us what's the name of the option?
>> > BTW, I think we should unify the implementation when window TVF can do all the work that the legacy operator can do and there is no need to introduce an option to fallback.
>>
>>
>> What about using config named "table.optimizer.window-rewrite-enabled"? If
>> I agree with you that util all features are aligned and everything is ok about window tvf, we should also remove this config about fallback.
>> But I think to be on the safe side, we can observe one or two versions of this rewrite, and allows users to roll back when problems arise.
>>
>>
>> > If we remove the legacy window operator in the future, how users upgrade their jobs? Do you have any plan to support state migration from the legacy window to Windows TVF?
>> IIRC, currently compatibility across middle versions of SQL is not guaranteed. Should we add constraints on this part?
>>
>>
>> Look for your feedback!
>>
>>
>>
>>
>>
>>
>>
>> --
>>
>>     Best!
>>     Xuyang
>>
>>
>>
>>
>>
>> At 2023-12-05 12:06:27, "liu ron" <ro...@gmail.com> wrote:
>> >Hi, xuyang
>> >
>> >Thanks for starting this FLIP discussion, currently there are two types of
>> >window aggregation in Flink SQL, namely legacy group window aggregation and
>> >window tvf aggregation, these two types of window aggregation are not fully
>> >aligned in behavior, which will bring a lot of confusion to the users, so
>> >there is a need to unify and align them. I think the final ideal state
>> >should be that there is only one window tvf aggregation, which supports
>> >Tumble, HOP, Cumulate and Session windows, and supports consuming CDC data
>> >streams. There is also support for configuring EARLY-FIRE and LATER-FIRE.
>> >
>> >This FLIP is a continuation of FLIP-145, and also supports legacy group
>> >window aggregation to flat-migrate to the new window tvf agregation, which
>> >is very useful, especially for the support of CDC streams, a pain point
>> >that users often feedback. Big +1 for this FLIP.
>> >
>> >Best,
>> >Ron
>> >
>> >Xuyang <xy...@163.com> 于2023年12月5日周二 11:11写道:
>> >
>> >> Hi, Feng and David.
>> >>
>> >>
>> >> Thank you very much to share your thoughts.
>> >>
>> >>
>> >> This flip does not include the official exposure of these experimental
>> >> conf to users. Thus there is not adetailed description of this part.
>> >> However, in view that some technical users may have added these
>> >> experimental conf in actual production jobs, the processing
>> >> of these conf while using window tvf syntax has been added to this flip.
>> >>
>> >>
>> >> Overall, the behavior of using these experimental parameters is no
>> >> different from before, and I think we should provide the compatibility
>> >> about using these experimental conf.
>> >>
>> >>
>> >> Look for your thoughs.
>> >>
>> >>
>> >>
>> >>
>> >> --
>> >>
>> >>     Best!
>> >>     Xuyang
>> >>
>> >>
>> >>
>> >>
>> >>
>> >> At 2023-12-05 09:17:49, "David Anderson" <da...@apache.org> wrote:
>> >> >The current situation (where we have both the legacy windows and the
>> >> >TVF-based windows) is confusing for users, and I'd like to see us move
>> >> >forward as rapidly as possible.
>> >> >
>> >> >Since the early fire, late fire, and allowed lateness features were never
>> >> >documented or exposed to users, I don't feel that we need to provide
>> >> >replacements for these internal, experimental features before officially
>> >> >deprecating the legacy group window aggregations, and I'd rather not wait.
>> >> >
>> >> >However, I'd be delighted to see a proposal for what that might look like.
>> >> >
>> >> >Best,
>> >> >David
>> >> >
>> >> >On Mon, Dec 4, 2023 at 12:45 PM Feng Jin <ji...@gmail.com> wrote:
>> >> >
>> >> >> Hi xuyang,
>> >> >>
>> >> >> Thank you for initiating this proposal.
>> >> >>
>> >> >> I'm glad to see that TVF's functionality can be fully supported.
>> >> >>
>> >> >> Regarding the early fire, late fire, and allow lateness features, how
>> >> will
>> >> >> they be provided to users? The documentation doesn't seem to provide a
>> >> >> detailed description of this part.
>> >> >>
>> >> >> Since this FLIP will also involve a lot of feature development, I am
>> >> more
>> >> >> than willing to help, including development and code review.
>> >> >>
>> >> >> Best,
>> >> >> Feng
>> >> >>
>> >> >> On Tue, Nov 28, 2023 at 8:31 PM Xuyang <xy...@163.com> wrote:
>> >> >>
>> >> >> > Hi all.
>> >> >> > I'd like to start a discussion of FLIP-392: Deprecate the Legacy Group
>> >> >> > Window Aggregation.
>> >> >> >
>> >> >> >
>> >> >> > Although the current Flink SQL Window Aggregation documentation[1]
>> >> >> > indicates that the legacy Group Window Aggregation
>> >> >> > syntax has been deprecated, the new Window TVF Aggregation syntax has
>> >> not
>> >> >> > fully covered all of the features of the legacy one.
>> >> >> >
>> >> >> >
>> >> >> > Compared to Group Window Aggergation, Window TVF Aggergation has
>> >> several
>> >> >> > advantages, such as two-stage optimization,
>> >> >> > support for standard GROUPING SET syntax, and so on. However, it
>> >> needs to
>> >> >> > supplement and enrich the following features.
>> >> >> >
>> >> >> >
>> >> >> > 1. Support for SESSION Window TVF Aggregation
>> >> >> > 2. Support for consuming CDC stream
>> >> >> > 3. Support for HOP window size with non-integer step length
>> >> >> > 4. Support for configurations such as early fire, late fire and allow
>> >> >> > lateness
>> >> >> > (which are internal experimental configurations in Group Window
>> >> >> > Aggregation and not public to users yet.)
>> >> >> > 5. Unification of the Window TVF Aggregation operator in runtime at
>> >> the
>> >> >> > implementation layer
>> >> >> > (In the long term, the cost to maintain the operators about Window TVF
>> >> >> > Aggregation and Group Window Aggregation is too expensive.)
>> >> >> >
>> >> >> >
>> >> >> > This flip aims to continue the unfinished work in FLIP-145[2], which
>> >> is
>> >> >> to
>> >> >> > fully enable the capabilities of Window TVF Aggregation
>> >> >> >  and officially deprecate the legacy syntax Group Window Aggregation,
>> >> to
>> >> >> > prepare for the removal of the legacy one in Flink 2.0.
>> >> >> >
>> >> >> >
>> >> >> > I have already done some preliminary POC to validate the feasibility
>> >> of
>> >> >> > the related work in this flip as follows.
>> >> >> > 1. POC for SESSION Window TVF Aggregation [3]
>> >> >> > 2. POC for CUMULATE in Group Window Aggregation operator [4]
>> >> >> > 3. POC for consuming CDC stream in Window Aggregation operator [5]
>> >> >> >
>> >> >> >
>> >> >> > Looking forward to your feedback and thoughts!
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> > [1]
>> >> >> >
>> >> >>
>> >> https://nightlies.apache.org/flink/flink-docs-master/docs/dev/table/sql/queries/window-agg/
>> >> >> >
>> >> >> > [2]
>> >> >> >
>> >> >>
>> >> https://cwiki.apache.org/confluence/display/FLINK/FLIP-145%3A+Support+SQL+windowing+table-valued+function#FLIP145:SupportSQLwindowingtablevaluedfunction-SessionWindows
>> >> >> > [3] https://github.com/xuyangzhong/flink/tree/FLINK-24024
>> >> >> > [4]
>> >> >> >
>> >> >>
>> >> https://github.com/xuyangzhong/flink/tree/poc_legacy_group_window_agg_cumulate
>> >> >> > [5]
>> >> >> >
>> >> >>
>> >> https://github.com/xuyangzhong/flink/tree/poc_window_agg_consumes_cdc_stream
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> > --
>> >> >> >
>> >> >> >     Best!
>> >> >> >     Xuyang
>> >> >>
>> >>

Re: Re: Re: [DISCUSS] FLIP-392: Deprecate the Legacy Group Window Aggregation

Posted by Martijn Visser <ma...@apache.org>.
Hi Xuyang,

Thanks a lot for starting this discussion.

At first, I was a bit confused because the FLIP talks about
deprecating the Legacy Group Window Aggregations, but they have
already been marked as deprecated in the documentation [1].
My understanding was that the big challenge was that we don't yet
support SESSION windows in the Window TVF, and that the other features
you've mentioned in the discussion threads are additional
capabilities.

However, when reading up on the actual FLIP (your discussion email
didn't include a link [2] to it) I now understand the situation. The
appendix table is actually the most valuable for me, because it gives
me the overview of the missing capabilities between TVF implementation
and the Legacy Group Window Aggregations.

On the topic of syntax for early/late fires, there is existing
configuration for the legacy group windows:

SET table.exec.emit.early-fire.enabled = true;
SET table.exec.emit.early-fire.delay = 5s;
SET table.exec.emit.late-fire.enabled = true;
SET table.exec.emit.late-fire.delay = 0;
SET table.exec.emit.allow-lateness = 5s;

We should stick with the syntax for the TVFs, and not modify that.

On the topic of column naming, for other situations where a user wants
to use a value that's already reserved, we require the user to include
backticks to indicate that Flink should not use the reserved keyword
implementation. Why isn't that sufficient in this case? I rather stay
consistent with this behaviour instead of introducing new config
options.

Overall, +1 on this topic. I would propose to rename the FLIP to
something like "Add Missing Table Valued Functions Features to Replace
Legacy Group Window Aggregation".

Best regards,

Martijn

[1] https://nightlies.apache.org/flink/flink-docs-release-1.18/docs/dev/table/sql/queries/window-agg/#group-window-aggregation
[2] https://cwiki.apache.org/confluence/display/FLINK/FLIP-392%3A+Deprecate+the+Legacy+Group+Window+Aggregation


On Wed, Dec 6, 2023 at 9:32 AM Xuyang <xy...@163.com> wrote:
>
> Hi, Shengkai. Thanks to share your thought. Let me answer related questions。
>
>
> > Could you give an example about the pass-through column. A session window may contain multiple rows, which value is selected by the windowoperator?
>
>
> The table function make the entire inpyt row available in the output. Take an example in Flink, if the input row is <a,b,c> with schema <f0,f1,f2>,
> the output of the window tvf can also access the <a,b,c> with schema <f0,f1,f2>. The session window always output these multi rows with attached window_start,
> window_end and window_time column.
>
>
> > What's the behavior if all the data in the window have been removed?
>
>
> Align the behavior of existing group window agg, and do not output data when the window is empty.
>
>
> > Could you explain more details about the how window process CDC? For example, what's the behavior if the window only gets the DELETE data from the upstream Operator.
>
>
> Also align the behavior of existing group window agg. However, there is a bug in group window agg that currently group window agg has different results when only
> consuming -D records while using or not using minibatch. Refs more at FLINK-33760.
>
>
> > The subtitle is not correct here.
>
>
> Updated the doc to fix it.
>
>
> > It's better if we can introduce a syntax like the `emit` keyword to set the emit strategy for every window.
> I agree with you. But I don't recommend using this syntax SESSION(data [PARTITION BY (keycols, ...)], DESCRIPTOR(timecol), gap, emit='') because it breaks the syntax in Flip-145.
> I think using query hint is a better idea. Anyway, this work should belong to another flip.
>
>
> > I think more work should be mentioned in the FLIP. What's the behavior if the input schema contains a column named `window_start`?
> > In the current design, `window_start` is a reserved keyword in the window TVF syntax, but it is legal in the legacy implementation.
>
>
> This is a good question. Perhaps we can introduce a config to add a specific config (named "table.window-additional-columns.prefix") to add a prefix
> of all window addition columns to solve this situation. For example, user can set the conf to "$", and the additional column from window will become
> "$window_start", "$window_end" and "$window_time". WDYT?
>
>
> > In the FLIP, you mention the FLIP should introduce an option to fall back to the legacy behavior. Could you tell us what's the name of the option?
> > BTW, I think we should unify the implementation when window TVF can do all the work that the legacy operator can do and there is no need to introduce an option to fallback.
>
>
> What about using config named "table.optimizer.window-rewrite-enabled"? If
> I agree with you that util all features are aligned and everything is ok about window tvf, we should also remove this config about fallback.
> But I think to be on the safe side, we can observe one or two versions of this rewrite, and allows users to roll back when problems arise.
>
>
> > If we remove the legacy window operator in the future, how users upgrade their jobs? Do you have any plan to support state migration from the legacy window to Windows TVF?
> IIRC, currently compatibility across middle versions of SQL is not guaranteed. Should we add constraints on this part?
>
>
> Look for your feedback!
>
>
>
>
>
>
>
> --
>
>     Best!
>     Xuyang
>
>
>
>
>
> At 2023-12-05 12:06:27, "liu ron" <ro...@gmail.com> wrote:
> >Hi, xuyang
> >
> >Thanks for starting this FLIP discussion, currently there are two types of
> >window aggregation in Flink SQL, namely legacy group window aggregation and
> >window tvf aggregation, these two types of window aggregation are not fully
> >aligned in behavior, which will bring a lot of confusion to the users, so
> >there is a need to unify and align them. I think the final ideal state
> >should be that there is only one window tvf aggregation, which supports
> >Tumble, HOP, Cumulate and Session windows, and supports consuming CDC data
> >streams. There is also support for configuring EARLY-FIRE and LATER-FIRE.
> >
> >This FLIP is a continuation of FLIP-145, and also supports legacy group
> >window aggregation to flat-migrate to the new window tvf agregation, which
> >is very useful, especially for the support of CDC streams, a pain point
> >that users often feedback. Big +1 for this FLIP.
> >
> >Best,
> >Ron
> >
> >Xuyang <xy...@163.com> 于2023年12月5日周二 11:11写道:
> >
> >> Hi, Feng and David.
> >>
> >>
> >> Thank you very much to share your thoughts.
> >>
> >>
> >> This flip does not include the official exposure of these experimental
> >> conf to users. Thus there is not adetailed description of this part.
> >> However, in view that some technical users may have added these
> >> experimental conf in actual production jobs, the processing
> >> of these conf while using window tvf syntax has been added to this flip.
> >>
> >>
> >> Overall, the behavior of using these experimental parameters is no
> >> different from before, and I think we should provide the compatibility
> >> about using these experimental conf.
> >>
> >>
> >> Look for your thoughs.
> >>
> >>
> >>
> >>
> >> --
> >>
> >>     Best!
> >>     Xuyang
> >>
> >>
> >>
> >>
> >>
> >> At 2023-12-05 09:17:49, "David Anderson" <da...@apache.org> wrote:
> >> >The current situation (where we have both the legacy windows and the
> >> >TVF-based windows) is confusing for users, and I'd like to see us move
> >> >forward as rapidly as possible.
> >> >
> >> >Since the early fire, late fire, and allowed lateness features were never
> >> >documented or exposed to users, I don't feel that we need to provide
> >> >replacements for these internal, experimental features before officially
> >> >deprecating the legacy group window aggregations, and I'd rather not wait.
> >> >
> >> >However, I'd be delighted to see a proposal for what that might look like.
> >> >
> >> >Best,
> >> >David
> >> >
> >> >On Mon, Dec 4, 2023 at 12:45 PM Feng Jin <ji...@gmail.com> wrote:
> >> >
> >> >> Hi xuyang,
> >> >>
> >> >> Thank you for initiating this proposal.
> >> >>
> >> >> I'm glad to see that TVF's functionality can be fully supported.
> >> >>
> >> >> Regarding the early fire, late fire, and allow lateness features, how
> >> will
> >> >> they be provided to users? The documentation doesn't seem to provide a
> >> >> detailed description of this part.
> >> >>
> >> >> Since this FLIP will also involve a lot of feature development, I am
> >> more
> >> >> than willing to help, including development and code review.
> >> >>
> >> >> Best,
> >> >> Feng
> >> >>
> >> >> On Tue, Nov 28, 2023 at 8:31 PM Xuyang <xy...@163.com> wrote:
> >> >>
> >> >> > Hi all.
> >> >> > I'd like to start a discussion of FLIP-392: Deprecate the Legacy Group
> >> >> > Window Aggregation.
> >> >> >
> >> >> >
> >> >> > Although the current Flink SQL Window Aggregation documentation[1]
> >> >> > indicates that the legacy Group Window Aggregation
> >> >> > syntax has been deprecated, the new Window TVF Aggregation syntax has
> >> not
> >> >> > fully covered all of the features of the legacy one.
> >> >> >
> >> >> >
> >> >> > Compared to Group Window Aggergation, Window TVF Aggergation has
> >> several
> >> >> > advantages, such as two-stage optimization,
> >> >> > support for standard GROUPING SET syntax, and so on. However, it
> >> needs to
> >> >> > supplement and enrich the following features.
> >> >> >
> >> >> >
> >> >> > 1. Support for SESSION Window TVF Aggregation
> >> >> > 2. Support for consuming CDC stream
> >> >> > 3. Support for HOP window size with non-integer step length
> >> >> > 4. Support for configurations such as early fire, late fire and allow
> >> >> > lateness
> >> >> > (which are internal experimental configurations in Group Window
> >> >> > Aggregation and not public to users yet.)
> >> >> > 5. Unification of the Window TVF Aggregation operator in runtime at
> >> the
> >> >> > implementation layer
> >> >> > (In the long term, the cost to maintain the operators about Window TVF
> >> >> > Aggregation and Group Window Aggregation is too expensive.)
> >> >> >
> >> >> >
> >> >> > This flip aims to continue the unfinished work in FLIP-145[2], which
> >> is
> >> >> to
> >> >> > fully enable the capabilities of Window TVF Aggregation
> >> >> >  and officially deprecate the legacy syntax Group Window Aggregation,
> >> to
> >> >> > prepare for the removal of the legacy one in Flink 2.0.
> >> >> >
> >> >> >
> >> >> > I have already done some preliminary POC to validate the feasibility
> >> of
> >> >> > the related work in this flip as follows.
> >> >> > 1. POC for SESSION Window TVF Aggregation [3]
> >> >> > 2. POC for CUMULATE in Group Window Aggregation operator [4]
> >> >> > 3. POC for consuming CDC stream in Window Aggregation operator [5]
> >> >> >
> >> >> >
> >> >> > Looking forward to your feedback and thoughts!
> >> >> >
> >> >> >
> >> >> >
> >> >> > [1]
> >> >> >
> >> >>
> >> https://nightlies.apache.org/flink/flink-docs-master/docs/dev/table/sql/queries/window-agg/
> >> >> >
> >> >> > [2]
> >> >> >
> >> >>
> >> https://cwiki.apache.org/confluence/display/FLINK/FLIP-145%3A+Support+SQL+windowing+table-valued+function#FLIP145:SupportSQLwindowingtablevaluedfunction-SessionWindows
> >> >> > [3] https://github.com/xuyangzhong/flink/tree/FLINK-24024
> >> >> > [4]
> >> >> >
> >> >>
> >> https://github.com/xuyangzhong/flink/tree/poc_legacy_group_window_agg_cumulate
> >> >> > [5]
> >> >> >
> >> >>
> >> https://github.com/xuyangzhong/flink/tree/poc_window_agg_consumes_cdc_stream
> >> >> >
> >> >> >
> >> >> >
> >> >> > --
> >> >> >
> >> >> >     Best!
> >> >> >     Xuyang
> >> >>
> >>

Re:Re: Re: [DISCUSS] FLIP-392: Deprecate the Legacy Group Window Aggregation

Posted by Xuyang <xy...@163.com>.
Hi, Shengkai. Thanks to share your thought. Let me answer related questions。


> Could you give an example about the pass-through column. A session window may contain multiple rows, which value is selected by the windowoperator?


The table function make the entire inpyt row available in the output. Take an example in Flink, if the input row is <a,b,c> with schema <f0,f1,f2>,
the output of the window tvf can also access the <a,b,c> with schema <f0,f1,f2>. The session window always output these multi rows with attached window_start,
window_end and window_time column.


> What's the behavior if all the data in the window have been removed?


Align the behavior of existing group window agg, and do not output data when the window is empty.


> Could you explain more details about the how window process CDC? For example, what's the behavior if the window only gets the DELETE data from the upstream Operator.


Also align the behavior of existing group window agg. However, there is a bug in group window agg that currently group window agg has different results when only
consuming -D records while using or not using minibatch. Refs more at FLINK-33760.


> The subtitle is not correct here.


Updated the doc to fix it.


> It's better if we can introduce a syntax like the `emit` keyword to set the emit strategy for every window.
I agree with you. But I don't recommend using this syntax SESSION(data [PARTITION BY (keycols, ...)], DESCRIPTOR(timecol), gap, emit='') because it breaks the syntax in Flip-145.
I think using query hint is a better idea. Anyway, this work should belong to another flip.


> I think more work should be mentioned in the FLIP. What's the behavior if the input schema contains a column named `window_start`?
> In the current design, `window_start` is a reserved keyword in the window TVF syntax, but it is legal in the legacy implementation.


This is a good question. Perhaps we can introduce a config to add a specific config (named "table.window-additional-columns.prefix") to add a prefix 
of all window addition columns to solve this situation. For example, user can set the conf to "$", and the additional column from window will become 
"$window_start", "$window_end" and "$window_time". WDYT?


> In the FLIP, you mention the FLIP should introduce an option to fall back to the legacy behavior. Could you tell us what's the name of the option?
> BTW, I think we should unify the implementation when window TVF can do all the work that the legacy operator can do and there is no need to introduce an option to fallback.


What about using config named "table.optimizer.window-rewrite-enabled"? If
I agree with you that util all features are aligned and everything is ok about window tvf, we should also remove this config about fallback.
But I think to be on the safe side, we can observe one or two versions of this rewrite, and allows users to roll back when problems arise.


> If we remove the legacy window operator in the future, how users upgrade their jobs? Do you have any plan to support state migration from the legacy window to Windows TVF?
IIRC, currently compatibility across middle versions of SQL is not guaranteed. Should we add constraints on this part?


Look for your feedback!







--

    Best!
    Xuyang





At 2023-12-05 12:06:27, "liu ron" <ro...@gmail.com> wrote:
>Hi, xuyang
>
>Thanks for starting this FLIP discussion, currently there are two types of
>window aggregation in Flink SQL, namely legacy group window aggregation and
>window tvf aggregation, these two types of window aggregation are not fully
>aligned in behavior, which will bring a lot of confusion to the users, so
>there is a need to unify and align them. I think the final ideal state
>should be that there is only one window tvf aggregation, which supports
>Tumble, HOP, Cumulate and Session windows, and supports consuming CDC data
>streams. There is also support for configuring EARLY-FIRE and LATER-FIRE.
>
>This FLIP is a continuation of FLIP-145, and also supports legacy group
>window aggregation to flat-migrate to the new window tvf agregation, which
>is very useful, especially for the support of CDC streams, a pain point
>that users often feedback. Big +1 for this FLIP.
>
>Best,
>Ron
>
>Xuyang <xy...@163.com> 于2023年12月5日周二 11:11写道:
>
>> Hi, Feng and David.
>>
>>
>> Thank you very much to share your thoughts.
>>
>>
>> This flip does not include the official exposure of these experimental
>> conf to users. Thus there is not adetailed description of this part.
>> However, in view that some technical users may have added these
>> experimental conf in actual production jobs, the processing
>> of these conf while using window tvf syntax has been added to this flip.
>>
>>
>> Overall, the behavior of using these experimental parameters is no
>> different from before, and I think we should provide the compatibility
>> about using these experimental conf.
>>
>>
>> Look for your thoughs.
>>
>>
>>
>>
>> --
>>
>>     Best!
>>     Xuyang
>>
>>
>>
>>
>>
>> At 2023-12-05 09:17:49, "David Anderson" <da...@apache.org> wrote:
>> >The current situation (where we have both the legacy windows and the
>> >TVF-based windows) is confusing for users, and I'd like to see us move
>> >forward as rapidly as possible.
>> >
>> >Since the early fire, late fire, and allowed lateness features were never
>> >documented or exposed to users, I don't feel that we need to provide
>> >replacements for these internal, experimental features before officially
>> >deprecating the legacy group window aggregations, and I'd rather not wait.
>> >
>> >However, I'd be delighted to see a proposal for what that might look like.
>> >
>> >Best,
>> >David
>> >
>> >On Mon, Dec 4, 2023 at 12:45 PM Feng Jin <ji...@gmail.com> wrote:
>> >
>> >> Hi xuyang,
>> >>
>> >> Thank you for initiating this proposal.
>> >>
>> >> I'm glad to see that TVF's functionality can be fully supported.
>> >>
>> >> Regarding the early fire, late fire, and allow lateness features, how
>> will
>> >> they be provided to users? The documentation doesn't seem to provide a
>> >> detailed description of this part.
>> >>
>> >> Since this FLIP will also involve a lot of feature development, I am
>> more
>> >> than willing to help, including development and code review.
>> >>
>> >> Best,
>> >> Feng
>> >>
>> >> On Tue, Nov 28, 2023 at 8:31 PM Xuyang <xy...@163.com> wrote:
>> >>
>> >> > Hi all.
>> >> > I'd like to start a discussion of FLIP-392: Deprecate the Legacy Group
>> >> > Window Aggregation.
>> >> >
>> >> >
>> >> > Although the current Flink SQL Window Aggregation documentation[1]
>> >> > indicates that the legacy Group Window Aggregation
>> >> > syntax has been deprecated, the new Window TVF Aggregation syntax has
>> not
>> >> > fully covered all of the features of the legacy one.
>> >> >
>> >> >
>> >> > Compared to Group Window Aggergation, Window TVF Aggergation has
>> several
>> >> > advantages, such as two-stage optimization,
>> >> > support for standard GROUPING SET syntax, and so on. However, it
>> needs to
>> >> > supplement and enrich the following features.
>> >> >
>> >> >
>> >> > 1. Support for SESSION Window TVF Aggregation
>> >> > 2. Support for consuming CDC stream
>> >> > 3. Support for HOP window size with non-integer step length
>> >> > 4. Support for configurations such as early fire, late fire and allow
>> >> > lateness
>> >> > (which are internal experimental configurations in Group Window
>> >> > Aggregation and not public to users yet.)
>> >> > 5. Unification of the Window TVF Aggregation operator in runtime at
>> the
>> >> > implementation layer
>> >> > (In the long term, the cost to maintain the operators about Window TVF
>> >> > Aggregation and Group Window Aggregation is too expensive.)
>> >> >
>> >> >
>> >> > This flip aims to continue the unfinished work in FLIP-145[2], which
>> is
>> >> to
>> >> > fully enable the capabilities of Window TVF Aggregation
>> >> >  and officially deprecate the legacy syntax Group Window Aggregation,
>> to
>> >> > prepare for the removal of the legacy one in Flink 2.0.
>> >> >
>> >> >
>> >> > I have already done some preliminary POC to validate the feasibility
>> of
>> >> > the related work in this flip as follows.
>> >> > 1. POC for SESSION Window TVF Aggregation [3]
>> >> > 2. POC for CUMULATE in Group Window Aggregation operator [4]
>> >> > 3. POC for consuming CDC stream in Window Aggregation operator [5]
>> >> >
>> >> >
>> >> > Looking forward to your feedback and thoughts!
>> >> >
>> >> >
>> >> >
>> >> > [1]
>> >> >
>> >>
>> https://nightlies.apache.org/flink/flink-docs-master/docs/dev/table/sql/queries/window-agg/
>> >> >
>> >> > [2]
>> >> >
>> >>
>> https://cwiki.apache.org/confluence/display/FLINK/FLIP-145%3A+Support+SQL+windowing+table-valued+function#FLIP145:SupportSQLwindowingtablevaluedfunction-SessionWindows
>> >> > [3] https://github.com/xuyangzhong/flink/tree/FLINK-24024
>> >> > [4]
>> >> >
>> >>
>> https://github.com/xuyangzhong/flink/tree/poc_legacy_group_window_agg_cumulate
>> >> > [5]
>> >> >
>> >>
>> https://github.com/xuyangzhong/flink/tree/poc_window_agg_consumes_cdc_stream
>> >> >
>> >> >
>> >> >
>> >> > --
>> >> >
>> >> >     Best!
>> >> >     Xuyang
>> >>
>>

Re: Re: [DISCUSS] FLIP-392: Deprecate the Legacy Group Window Aggregation

Posted by liu ron <ro...@gmail.com>.
Hi, xuyang

Thanks for starting this FLIP discussion, currently there are two types of
window aggregation in Flink SQL, namely legacy group window aggregation and
window tvf aggregation, these two types of window aggregation are not fully
aligned in behavior, which will bring a lot of confusion to the users, so
there is a need to unify and align them. I think the final ideal state
should be that there is only one window tvf aggregation, which supports
Tumble, HOP, Cumulate and Session windows, and supports consuming CDC data
streams. There is also support for configuring EARLY-FIRE and LATER-FIRE.

This FLIP is a continuation of FLIP-145, and also supports legacy group
window aggregation to flat-migrate to the new window tvf agregation, which
is very useful, especially for the support of CDC streams, a pain point
that users often feedback. Big +1 for this FLIP.

Best,
Ron

Xuyang <xy...@163.com> 于2023年12月5日周二 11:11写道:

> Hi, Feng and David.
>
>
> Thank you very much to share your thoughts.
>
>
> This flip does not include the official exposure of these experimental
> conf to users. Thus there is not adetailed description of this part.
> However, in view that some technical users may have added these
> experimental conf in actual production jobs, the processing
> of these conf while using window tvf syntax has been added to this flip.
>
>
> Overall, the behavior of using these experimental parameters is no
> different from before, and I think we should provide the compatibility
> about using these experimental conf.
>
>
> Look for your thoughs.
>
>
>
>
> --
>
>     Best!
>     Xuyang
>
>
>
>
>
> At 2023-12-05 09:17:49, "David Anderson" <da...@apache.org> wrote:
> >The current situation (where we have both the legacy windows and the
> >TVF-based windows) is confusing for users, and I'd like to see us move
> >forward as rapidly as possible.
> >
> >Since the early fire, late fire, and allowed lateness features were never
> >documented or exposed to users, I don't feel that we need to provide
> >replacements for these internal, experimental features before officially
> >deprecating the legacy group window aggregations, and I'd rather not wait.
> >
> >However, I'd be delighted to see a proposal for what that might look like.
> >
> >Best,
> >David
> >
> >On Mon, Dec 4, 2023 at 12:45 PM Feng Jin <ji...@gmail.com> wrote:
> >
> >> Hi xuyang,
> >>
> >> Thank you for initiating this proposal.
> >>
> >> I'm glad to see that TVF's functionality can be fully supported.
> >>
> >> Regarding the early fire, late fire, and allow lateness features, how
> will
> >> they be provided to users? The documentation doesn't seem to provide a
> >> detailed description of this part.
> >>
> >> Since this FLIP will also involve a lot of feature development, I am
> more
> >> than willing to help, including development and code review.
> >>
> >> Best,
> >> Feng
> >>
> >> On Tue, Nov 28, 2023 at 8:31 PM Xuyang <xy...@163.com> wrote:
> >>
> >> > Hi all.
> >> > I'd like to start a discussion of FLIP-392: Deprecate the Legacy Group
> >> > Window Aggregation.
> >> >
> >> >
> >> > Although the current Flink SQL Window Aggregation documentation[1]
> >> > indicates that the legacy Group Window Aggregation
> >> > syntax has been deprecated, the new Window TVF Aggregation syntax has
> not
> >> > fully covered all of the features of the legacy one.
> >> >
> >> >
> >> > Compared to Group Window Aggergation, Window TVF Aggergation has
> several
> >> > advantages, such as two-stage optimization,
> >> > support for standard GROUPING SET syntax, and so on. However, it
> needs to
> >> > supplement and enrich the following features.
> >> >
> >> >
> >> > 1. Support for SESSION Window TVF Aggregation
> >> > 2. Support for consuming CDC stream
> >> > 3. Support for HOP window size with non-integer step length
> >> > 4. Support for configurations such as early fire, late fire and allow
> >> > lateness
> >> > (which are internal experimental configurations in Group Window
> >> > Aggregation and not public to users yet.)
> >> > 5. Unification of the Window TVF Aggregation operator in runtime at
> the
> >> > implementation layer
> >> > (In the long term, the cost to maintain the operators about Window TVF
> >> > Aggregation and Group Window Aggregation is too expensive.)
> >> >
> >> >
> >> > This flip aims to continue the unfinished work in FLIP-145[2], which
> is
> >> to
> >> > fully enable the capabilities of Window TVF Aggregation
> >> >  and officially deprecate the legacy syntax Group Window Aggregation,
> to
> >> > prepare for the removal of the legacy one in Flink 2.0.
> >> >
> >> >
> >> > I have already done some preliminary POC to validate the feasibility
> of
> >> > the related work in this flip as follows.
> >> > 1. POC for SESSION Window TVF Aggregation [3]
> >> > 2. POC for CUMULATE in Group Window Aggregation operator [4]
> >> > 3. POC for consuming CDC stream in Window Aggregation operator [5]
> >> >
> >> >
> >> > Looking forward to your feedback and thoughts!
> >> >
> >> >
> >> >
> >> > [1]
> >> >
> >>
> https://nightlies.apache.org/flink/flink-docs-master/docs/dev/table/sql/queries/window-agg/
> >> >
> >> > [2]
> >> >
> >>
> https://cwiki.apache.org/confluence/display/FLINK/FLIP-145%3A+Support+SQL+windowing+table-valued+function#FLIP145:SupportSQLwindowingtablevaluedfunction-SessionWindows
> >> > [3] https://github.com/xuyangzhong/flink/tree/FLINK-24024
> >> > [4]
> >> >
> >>
> https://github.com/xuyangzhong/flink/tree/poc_legacy_group_window_agg_cumulate
> >> > [5]
> >> >
> >>
> https://github.com/xuyangzhong/flink/tree/poc_window_agg_consumes_cdc_stream
> >> >
> >> >
> >> >
> >> > --
> >> >
> >> >     Best!
> >> >     Xuyang
> >>
>

Re:Re: [DISCUSS] FLIP-392: Deprecate the Legacy Group Window Aggregation

Posted by Xuyang <xy...@163.com>.
Hi, Feng and David.


Thank you very much to share your thoughts.


This flip does not include the official exposure of these experimental conf to users. Thus there is not adetailed description of this part.
However, in view that some technical users may have added these experimental conf in actual production jobs, the processing
of these conf while using window tvf syntax has been added to this flip.


Overall, the behavior of using these experimental parameters is no different from before, and I think we should provide the compatibility
about using these experimental conf.


Look for your thoughs.




--

    Best!
    Xuyang





At 2023-12-05 09:17:49, "David Anderson" <da...@apache.org> wrote:
>The current situation (where we have both the legacy windows and the
>TVF-based windows) is confusing for users, and I'd like to see us move
>forward as rapidly as possible.
>
>Since the early fire, late fire, and allowed lateness features were never
>documented or exposed to users, I don't feel that we need to provide
>replacements for these internal, experimental features before officially
>deprecating the legacy group window aggregations, and I'd rather not wait.
>
>However, I'd be delighted to see a proposal for what that might look like.
>
>Best,
>David
>
>On Mon, Dec 4, 2023 at 12:45 PM Feng Jin <ji...@gmail.com> wrote:
>
>> Hi xuyang,
>>
>> Thank you for initiating this proposal.
>>
>> I'm glad to see that TVF's functionality can be fully supported.
>>
>> Regarding the early fire, late fire, and allow lateness features, how will
>> they be provided to users? The documentation doesn't seem to provide a
>> detailed description of this part.
>>
>> Since this FLIP will also involve a lot of feature development, I am more
>> than willing to help, including development and code review.
>>
>> Best,
>> Feng
>>
>> On Tue, Nov 28, 2023 at 8:31 PM Xuyang <xy...@163.com> wrote:
>>
>> > Hi all.
>> > I'd like to start a discussion of FLIP-392: Deprecate the Legacy Group
>> > Window Aggregation.
>> >
>> >
>> > Although the current Flink SQL Window Aggregation documentation[1]
>> > indicates that the legacy Group Window Aggregation
>> > syntax has been deprecated, the new Window TVF Aggregation syntax has not
>> > fully covered all of the features of the legacy one.
>> >
>> >
>> > Compared to Group Window Aggergation, Window TVF Aggergation has several
>> > advantages, such as two-stage optimization,
>> > support for standard GROUPING SET syntax, and so on. However, it needs to
>> > supplement and enrich the following features.
>> >
>> >
>> > 1. Support for SESSION Window TVF Aggregation
>> > 2. Support for consuming CDC stream
>> > 3. Support for HOP window size with non-integer step length
>> > 4. Support for configurations such as early fire, late fire and allow
>> > lateness
>> > (which are internal experimental configurations in Group Window
>> > Aggregation and not public to users yet.)
>> > 5. Unification of the Window TVF Aggregation operator in runtime at the
>> > implementation layer
>> > (In the long term, the cost to maintain the operators about Window TVF
>> > Aggregation and Group Window Aggregation is too expensive.)
>> >
>> >
>> > This flip aims to continue the unfinished work in FLIP-145[2], which is
>> to
>> > fully enable the capabilities of Window TVF Aggregation
>> >  and officially deprecate the legacy syntax Group Window Aggregation, to
>> > prepare for the removal of the legacy one in Flink 2.0.
>> >
>> >
>> > I have already done some preliminary POC to validate the feasibility of
>> > the related work in this flip as follows.
>> > 1. POC for SESSION Window TVF Aggregation [3]
>> > 2. POC for CUMULATE in Group Window Aggregation operator [4]
>> > 3. POC for consuming CDC stream in Window Aggregation operator [5]
>> >
>> >
>> > Looking forward to your feedback and thoughts!
>> >
>> >
>> >
>> > [1]
>> >
>> https://nightlies.apache.org/flink/flink-docs-master/docs/dev/table/sql/queries/window-agg/
>> >
>> > [2]
>> >
>> https://cwiki.apache.org/confluence/display/FLINK/FLIP-145%3A+Support+SQL+windowing+table-valued+function#FLIP145:SupportSQLwindowingtablevaluedfunction-SessionWindows
>> > [3] https://github.com/xuyangzhong/flink/tree/FLINK-24024
>> > [4]
>> >
>> https://github.com/xuyangzhong/flink/tree/poc_legacy_group_window_agg_cumulate
>> > [5]
>> >
>> https://github.com/xuyangzhong/flink/tree/poc_window_agg_consumes_cdc_stream
>> >
>> >
>> >
>> > --
>> >
>> >     Best!
>> >     Xuyang
>>

Re: [DISCUSS] FLIP-392: Deprecate the Legacy Group Window Aggregation

Posted by David Anderson <da...@apache.org>.
The current situation (where we have both the legacy windows and the
TVF-based windows) is confusing for users, and I'd like to see us move
forward as rapidly as possible.

Since the early fire, late fire, and allowed lateness features were never
documented or exposed to users, I don't feel that we need to provide
replacements for these internal, experimental features before officially
deprecating the legacy group window aggregations, and I'd rather not wait.

However, I'd be delighted to see a proposal for what that might look like.

Best,
David

On Mon, Dec 4, 2023 at 12:45 PM Feng Jin <ji...@gmail.com> wrote:

> Hi xuyang,
>
> Thank you for initiating this proposal.
>
> I'm glad to see that TVF's functionality can be fully supported.
>
> Regarding the early fire, late fire, and allow lateness features, how will
> they be provided to users? The documentation doesn't seem to provide a
> detailed description of this part.
>
> Since this FLIP will also involve a lot of feature development, I am more
> than willing to help, including development and code review.
>
> Best,
> Feng
>
> On Tue, Nov 28, 2023 at 8:31 PM Xuyang <xy...@163.com> wrote:
>
> > Hi all.
> > I'd like to start a discussion of FLIP-392: Deprecate the Legacy Group
> > Window Aggregation.
> >
> >
> > Although the current Flink SQL Window Aggregation documentation[1]
> > indicates that the legacy Group Window Aggregation
> > syntax has been deprecated, the new Window TVF Aggregation syntax has not
> > fully covered all of the features of the legacy one.
> >
> >
> > Compared to Group Window Aggergation, Window TVF Aggergation has several
> > advantages, such as two-stage optimization,
> > support for standard GROUPING SET syntax, and so on. However, it needs to
> > supplement and enrich the following features.
> >
> >
> > 1. Support for SESSION Window TVF Aggregation
> > 2. Support for consuming CDC stream
> > 3. Support for HOP window size with non-integer step length
> > 4. Support for configurations such as early fire, late fire and allow
> > lateness
> > (which are internal experimental configurations in Group Window
> > Aggregation and not public to users yet.)
> > 5. Unification of the Window TVF Aggregation operator in runtime at the
> > implementation layer
> > (In the long term, the cost to maintain the operators about Window TVF
> > Aggregation and Group Window Aggregation is too expensive.)
> >
> >
> > This flip aims to continue the unfinished work in FLIP-145[2], which is
> to
> > fully enable the capabilities of Window TVF Aggregation
> >  and officially deprecate the legacy syntax Group Window Aggregation, to
> > prepare for the removal of the legacy one in Flink 2.0.
> >
> >
> > I have already done some preliminary POC to validate the feasibility of
> > the related work in this flip as follows.
> > 1. POC for SESSION Window TVF Aggregation [3]
> > 2. POC for CUMULATE in Group Window Aggregation operator [4]
> > 3. POC for consuming CDC stream in Window Aggregation operator [5]
> >
> >
> > Looking forward to your feedback and thoughts!
> >
> >
> >
> > [1]
> >
> https://nightlies.apache.org/flink/flink-docs-master/docs/dev/table/sql/queries/window-agg/
> >
> > [2]
> >
> https://cwiki.apache.org/confluence/display/FLINK/FLIP-145%3A+Support+SQL+windowing+table-valued+function#FLIP145:SupportSQLwindowingtablevaluedfunction-SessionWindows
> > [3] https://github.com/xuyangzhong/flink/tree/FLINK-24024
> > [4]
> >
> https://github.com/xuyangzhong/flink/tree/poc_legacy_group_window_agg_cumulate
> > [5]
> >
> https://github.com/xuyangzhong/flink/tree/poc_window_agg_consumes_cdc_stream
> >
> >
> >
> > --
> >
> >     Best!
> >     Xuyang
>

Re: [DISCUSS] FLIP-392: Deprecate the Legacy Group Window Aggregation

Posted by Feng Jin <ji...@gmail.com>.
Hi xuyang,

Thank you for initiating this proposal.

I'm glad to see that TVF's functionality can be fully supported.

Regarding the early fire, late fire, and allow lateness features, how will
they be provided to users? The documentation doesn't seem to provide a
detailed description of this part.

Since this FLIP will also involve a lot of feature development, I am more
than willing to help, including development and code review.

Best,
Feng

On Tue, Nov 28, 2023 at 8:31 PM Xuyang <xy...@163.com> wrote:

> Hi all.
> I'd like to start a discussion of FLIP-392: Deprecate the Legacy Group
> Window Aggregation.
>
>
> Although the current Flink SQL Window Aggregation documentation[1]
> indicates that the legacy Group Window Aggregation
> syntax has been deprecated, the new Window TVF Aggregation syntax has not
> fully covered all of the features of the legacy one.
>
>
> Compared to Group Window Aggergation, Window TVF Aggergation has several
> advantages, such as two-stage optimization,
> support for standard GROUPING SET syntax, and so on. However, it needs to
> supplement and enrich the following features.
>
>
> 1. Support for SESSION Window TVF Aggregation
> 2. Support for consuming CDC stream
> 3. Support for HOP window size with non-integer step length
> 4. Support for configurations such as early fire, late fire and allow
> lateness
> (which are internal experimental configurations in Group Window
> Aggregation and not public to users yet.)
> 5. Unification of the Window TVF Aggregation operator in runtime at the
> implementation layer
> (In the long term, the cost to maintain the operators about Window TVF
> Aggregation and Group Window Aggregation is too expensive.)
>
>
> This flip aims to continue the unfinished work in FLIP-145[2], which is to
> fully enable the capabilities of Window TVF Aggregation
>  and officially deprecate the legacy syntax Group Window Aggregation, to
> prepare for the removal of the legacy one in Flink 2.0.
>
>
> I have already done some preliminary POC to validate the feasibility of
> the related work in this flip as follows.
> 1. POC for SESSION Window TVF Aggregation [3]
> 2. POC for CUMULATE in Group Window Aggregation operator [4]
> 3. POC for consuming CDC stream in Window Aggregation operator [5]
>
>
> Looking forward to your feedback and thoughts!
>
>
>
> [1]
> https://nightlies.apache.org/flink/flink-docs-master/docs/dev/table/sql/queries/window-agg/
>
> [2]
> https://cwiki.apache.org/confluence/display/FLINK/FLIP-145%3A+Support+SQL+windowing+table-valued+function#FLIP145:SupportSQLwindowingtablevaluedfunction-SessionWindows
> [3] https://github.com/xuyangzhong/flink/tree/FLINK-24024
> [4]
> https://github.com/xuyangzhong/flink/tree/poc_legacy_group_window_agg_cumulate
> [5]
> https://github.com/xuyangzhong/flink/tree/poc_window_agg_consumes_cdc_stream
>
>
>
> --
>
>     Best!
>     Xuyang

Re:Re:Re: Re: [DISCUSS] FLIP-392: Deprecate the Legacy Group Window Aggregation

Posted by Xuyang <xy...@163.com>.
Hi, all. 
Considering what Martijn suggested, as a big break, we can directly remove the old group window agg operator in 2.0 
without rewriting it to the new window agg operator. 
At the same time, every subtask in this FLIP to align the new and old window agg operators is almost covered 
by the existing JIRAs marked as feature shown below. Therefore this FLIP will be abandoned. Thanks to everyone 
who participated in the discussion.
1. Support Session Window TVF: https://issues.apache.org/jira/browse/FLINK-24024
2. Support Consuming CDC: https://issues.apache.org/jira/browse/FLINK-20281
3. Support HOP window size with non-integer step length: A new feature jira will be opened for it. Because FLIP-145[1]
only has restrictions on the relationship between size and step in CUMULATE Window and has no restrictions on HOP 
Window, but currently it will throw an exception directly. So this is an unfinished work.


[1] https://cwiki.apache.org/confluence/display/FLINK/FLIP-145%3A+Support+SQL+windowing+table-valued+function#FLIP145:SupportSQLwindowingtablevaluedfunction-SessionWindows




--

    Best!
    Xuyang





At 2024-01-02 09:37:15, "Xuyang" <xy...@163.com> wrote:
>Hi, Martijn.
>Thank you for your reminder :)
>
>
>My idea is that in the current 1.x version, we can automatically convert the agg operator in the old grammar into the agg operator
>in the new grammar. Huge changes will be introduced in version 2.0 that old syntax will be directly deleted at the code level.
>>That would imply that we will never be able to remove the old SQL
>>language from the code base, since we would always rewrite that old
>>language to the new implementation under the hood.
>I'm a little curious why the old syntax can't be removed in the code in 2.0. If you have any better ideas, let’s discuss it together.
>
>
>
>
>--
>
>    Best!
>    Xuyang
>
>
>
>
>
>At 2023-12-27 23:20:06, "Martijn Visser" <ma...@apache.org> wrote:
>>Hi Xuyang,
>>
>>It's currently the holiday season in Europe so do expect some slow responses.
>>
>>> The key reason the original FLIP is called "Deprecate the Legacy Group Window Aggregation" is that we also plan to automatically rewrite the group window agg corresponding the old syntax into the window agg corresponding the new window TVF syntax (will provide a fallback option from a compatibility perspective). Whether the window agg corresponding the new syntax is actively used by user or automatically rewritten, we all rely on the alignment of the functionality between the window agg and the legacy group window agg.
>>
>>That would imply that we will never be able to remove the old SQL
>>language from the code base, since we would always rewrite that old
>>language to the new implementation under the hood. I don't think
>>that's necessarily a good idea, especially given that Flink 2.0 is
>>coming next year and we could make a clean break there.
>>
>>Best regards,
>>
>>Martijn
>>
>>On Thu, Dec 21, 2023 at 12:44 PM Xuyang <xy...@163.com> wrote:
>>>
>>> Hi, Timo. Sorry to bother you. There's something I really need to hear your thoughts on.
>>>
>>>
>>>
>>>
>>> When I'm trying to split this flip, having reviewed this discussion and the FLIP document again, I realized that there is still a key issue that hasn't been clarified. The key reason the original FLIP is called "Deprecate the Legacy Group Window Aggregation" is that we also plan to automatically rewrite the group window agg corresponding the old syntax into the window agg corresponding the new window TVF syntax (will provide a fallback option from a compatibility perspective). Whether the window agg corresponding the new syntax is actively used by user or automatically rewritten, we all rely on the alignment of the functionality between the window agg and the legacy group window agg.
>>>
>>>
>>>
>>>
>>> To explain in detail, the original flip has the following two core parts.
>>>
>>>
>>>
>>>
>>> 1. Automatically rewrite the legacy group window agg into the new window agg during plan optimization. (Corresponding to Section 5 in the Proposed Changes of the original FLIP)
>>>
>>>
>>>
>>>
>>> 2. The alignment subtasks that the rewriting work depends on, involve aligning the features of the two operators. (No one had objections to this part of the work, and some of them are WIP) (Corresponding to Section 1-4 in the Proposed Changes of the original FLIP)
>>>
>>>
>>>
>>>
>>> Currently, there are two ways to deal with this flip.
>>>
>>>
>>>
>>>
>>> 1. According to your previous suggestion, split the subtasks of the two alignment features of supporting cdc stream and supporting HOP window size with non-integer step length into independent flips. Moreover, an additional Flip should be added to describe the work of automatic plan rewriting. In the discussion email, associate these three flips together. I'm not sure that's a bit trivial about doing this because the first two flips are small features actually. (And we need to discuss it separately and vote on them individually, right?)
>>>
>>>
>>>
>>>
>>> 2. Modify the original flip title and change the content to the following style to highlight the automatic plan rewriting.
>>>
>>>
>>>
>>>
>>> title: FLIP-392: Automatically rewrite the old syntax's agg to the window TVF agg
>>>
>>> part 1: automatic plan rewriting
>>>
>>> part 2: alignment subtasks the rewriting work depends on
>>>
>>>
>>>
>>>
>>> I'm looking forward to your reply.
>>>
>>>
>>>
>>>
>>> --
>>>
>>>     Best!
>>>     Xuyang
>>>
>>>
>>>
>>>
>>>
>>> 在 2023-12-19 22:30:27,"Timo Walther" <tw...@apache.org> 写道:
>>> >Hi Xuyang,
>>> >
>>> >sorry I missed the ping. Sounds reasonable to me. One FLIP about
>>> >changelog semantics, the other about SQL semantics.
>>> >
>>> >Regards,
>>> >Timo
>>> >
>>> >On 19.12.23 02:39, Xuyang wrote:
>>> >> Hi, Timo. Sorry for this noise.
>>> >> What do you think about splitting the flip like this?
>>> >>
>>> >>
>>> >>
>>> >>
>>> >> --
>>> >>
>>> >>      Best!
>>> >>      Xuyang
>>> >>
>>> >>
>>> >>
>>> >>
>>> >>
>>> >> At 2023-12-15 10:05:32, "Xuyang" <xy...@163.com> wrote:
>>> >>> Hi, Timo, thanks for your advice.
>>> >>>
>>> >>>
>>> >>> I am considering splitting the existing flip into two while leaving the existing flip (or without).
>>> >>> One of them points to the completion of the operator about window tvf to support CDC (there are several
>>> >>> small work items, such as window agg, window rank, window join, etc. Due to time constraints,
>>> >>> the 1.19 version takes priority to complete the window agg). The other points to the HOP window tvf
>>> >>> supports a size that is a non-integer multiple of the step. Once these two flips are basically completed
>>> >>> in 1.19, we can consider officially deprecating the old group window agg syntax in the release note.
>>> >>>
>>> >>>
>>> >>> WDYT?
>>> >>>
>>> >>>
>>> >>>
>>> >>>
>>> >>> --
>>> >>>
>>> >>>     Best!
>>> >>>     Xuyang
>>> >>>
>>> >>>
>>> >>>
>>> >>>
>>> >>>
>>> >>> At 2023-12-14 17:51:01, "Timo Walther" <tw...@apache.org> wrote:
>>> >>>> Hi Xuyang,
>>> >>>>
>>> >>>>> I'm not spliting this flip is that all of these subtasks like session
>>> >>>> window tvf and cdc support do not change the public interface and the
>>> >>>> public syntax
>>> >>>>
>>> >>>> Given the length of this mailing list discussion and number of involved
>>> >>>> people I would strongly suggest to simplify the FLIP and give it a
>>> >>>> better title to make quicker progress. In general, we all seem to be on
>>> >>>> the same page in what we want. And both session TVF support and the
>>> >>>> deprecation of the legacy group windows has been voted already and
>>> >>>> discussed thouroughly. The FLIP can purely focus on the CDC topic.
>>> >>>>
>>> >>>> Cheers,
>>> >>>> Timo
>>> >>>>
>>> >>>>
>>> >>>> On 14.12.23 08:35, Xuyang wrote:
>>> >>>>> Hi, Timo, Sergey and Lincoln Lee. Thanks for your feedback.
>>> >>>>>
>>> >>>>>
>>> >>>>>> In my opinion the FLIP touches too many
>>> >>>>>> topics at the same time and should be split into multiple FLIPs. We > should stay focused on what is needed for Flink 2.0.
>>> >>>>> The main goal and topic of this Flip is to align the abilities between the legacy group window agg syntax and the new window tvf syntax,
>>> >>>>> and then we can say that the legacy window syntax will be deprecated. IMO, although there are many misalignments about these two
>>> >>>>> syntaxes, such as session window tvf, cdc support and so on,  they are all the subtasks we need to do in this flip. Another reason I'm not
>>> >>>>> spliting this flip is that all of these subtasks like session window tvf and cdc support do not change the public interface and the public
>>> >>>>> syntax, the implements of them will only be in modules table-planner and table-runtime.
>>> >>>>>
>>> >>>>>
>>> >>>>>> Can we postpone this discussion? Currently we should focus on user
>>> >>>>>> switching to Window TVFs before Flink 2.0. Early fire, late fire and > allow lateness have not exposed through public configuration. It can be > introduced after Flink 2.0 released.
>>> >>>>>
>>> >>>>>
>>> >>>>> Agree with you. This flip will not and should not expose these experimental flink conf to users. I list them in this flip just aims to show the
>>> >>>>> misalignments about these two window syntaxes.
>>> >>>>>
>>> >>>>>
>>> >>>>> Look for your thought.
>>> >>>>>
>>> >>>>>
>>> >>>>>
>>> >>>>>
>>> >>>>> --
>>> >>>>>
>>> >>>>>       Best!
>>> >>>>>       Xuyang
>>> >>>>>
>>> >>>>>
>>> >>>>>
>>> >>>>>
>>> >>>>>
>>> >>>>> At 2023-12-13 15:40:16, "Lincoln Lee" <li...@gmail.com> wrote:
>>> >>>>>> Thanks Xuyang driving this work! It's great that everyone agrees with the
>>> >>>>>> work itself in this flip[1]!
>>> >>>>>>
>>> >>>>>> Regarding whether to split the flip or adjust the scope of this flip, I'd
>>> >>>>>> like to share some thoughts:
>>> >>>>>>
>>> >>>>>> 1. About the title of this flip, what I want to say is that flip-145[2] had
>>> >>>>>> marked the legacy group window deprecated in the documentation but the
>>> >>>>>> functionality of the new syntax is not aligned with the legacy one.
>>> >>>>>> This is not a user-friendly deprecation, so the initiation of this flip, as
>>> >>>>>> I understand it, is for the formal deprecation of the legacy window, which
>>> >>>>>> requires us to complete the functionality alignment.
>>> >>>>>>
>>> >>>>>> 2. Agree with Timo that we can process the late-fire/early-fire features
>>> >>>>>> separately. These experimental parameters have not been officially opened
>>> >>>>>> to users.
>>> >>>>>> Considering the workload, we can focus more on this version.
>>> >>>>>>
>>> >>>>>> 3. I have no objection to splitting this flip if everyone feels that the
>>> >>>>>> work included is too much.
>>> >>>>>> Regarding the support of session tvf, it seems that the main problem is
>>> >>>>>> that this part of the description occupies a large part of the flip,
>>> >>>>>> causing some misunderstandings.
>>> >>>>>> This is indeed a predetermined task in FLIP-145, just adding more
>>> >>>>>> explanation about semantics. In addition, I saw the discussion history in
>>> >>>>>> FLINK-24024[3], thanks Sergey for being willing to help driving this work
>>> >>>>>> together.
>>> >>>>>>
>>> >>>>>> [1]
>>> >>>>>> https://cwiki.apache.org/confluence/display/FLINK/FLIP-392%3A+Deprecate+the+Legacy+Group+Window+Aggregation
>>> >>>>>> [2]
>>> >>>>>> https://cwiki.apache.org/confluence/display/FLINK/FLIP-145%3A+Support+SQL+windowing+table-valued+function
>>> >>>>>> [3] https://issues.apache.org/jira/browse/FLINK-24024
>>> >>>>>>
>>> >>>>>> Best,
>>> >>>>>> Lincoln Lee
>>> >>>>>>
>>> >>>>>>
>>> >>>>>> Sergey Nuyanzin <sn...@gmail.com> 于2023年12月13日周三 08:02写道:
>>> >>>>>>
>>> >>>>>>> thanks for summarising Timo
>>> >>>>>>>
>>> >>>>>>> +1 for splitting it in different FLIPs
>>> >>>>>>> and agree about having "SESSION Window TVF Aggregation" under FLIP-145
>>> >>>>>>> Moreover the task is already there, so no need to move it from one FLIP to
>>> >>>>>>> another
>>> >>>>>>>
>>> >>>>>>>> And actually Sergey Nuyanzin wanted to work
>>> >>>>>>>> in this if I remember correctly. Not sure if this is still the case.
>>> >>>>>>>
>>> >>>>>>> Yes, however it seems there is already an existing PR for that.
>>> >>>>>>> Anyway I'm happy to help here with the review as well and will reserve some
>>> >>>>>>> time for it in coming days.
>>> >>>>>>>
>>> >>>>>>>
>>> >>>>>>>
>>> >>>>>>> On Tue, Dec 12, 2023 at 12:18 PM Timo Walther <tw...@apache.org> wrote:
>>> >>>>>>>
>>> >>>>>>>> Hi Xuyang,
>>> >>>>>>>>
>>> >>>>>>>> thanks for proposing this FLIP. In my opinion the FLIP touches too many
>>> >>>>>>>> topics at the same time and should be split into multiple FLIPs. We
>>> >>>>>>>> should stay focused on what is needed for Flink 2.0.
>>> >>>>>>>>
>>> >>>>>>>> Let me summarizing the topics:
>>> >>>>>>>>
>>> >>>>>>>> 1) SESSION Window TVF Aggregation
>>> >>>>>>>>
>>> >>>>>>>> This has been agreed in FLIP-145 already. We don't need another FLIP but
>>> >>>>>>>> someone that finally implements this after we have performed the Calcite
>>> >>>>>>>> upgrade a couple of months ago. The Calcite upgrade was important
>>> >>>>>>>> exactly for SESSION windows. And actually Sergey Nuyanzin wanted to work
>>> >>>>>>>> in this if I remember correctly. Not sure if this is still the case.
>>> >>>>>>>>
>>> >>>>>>>> 2) CDC support of Window TVFs
>>> >>>>>>>>
>>> >>>>>>>> This can be a FLIP on its own.
>>> >>>>>>>>
>>> >>>>>>>> 3) HOP window size with non-integer step length
>>> >>>>>>>>
>>> >>>>>>>> This can be a FLIP on its own.
>>> >>>>>>>>
>>> >>>>>>>> 4) Configurations such as early fire, late fire and allow lateness
>>> >>>>>>>>
>>> >>>>>>>> Can we postpone this discussion? Currently we should focus on user
>>> >>>>>>>> switching to Window TVFs before Flink 2.0. Early fire, late fire and
>>> >>>>>>>> allow lateness have not exposed through public configuration. It can be
>>> >>>>>>>> introduced after Flink 2.0 released.
>>> >>>>>>>>
>>> >>>>>>>> Regards,
>>> >>>>>>>> Timo
>>> >>>>>>>>
>>> >>>>>>>>
>>> >>>>>>>> On 12.12.23 08:01, Xuyang wrote:
>>> >>>>>>>>> Hi, Jim.
>>> >>>>>>>>> Thanks for your explaination.
>>> >>>>>>>>>> Ah, I mean to ask if you can contribute the new SESSION Table support
>>> >>>>>>>>>> without needing FLIP-392 completely settled.  I was trying to see if
>>> >>>>>>>> that
>>> >>>>>>>>>> is separate work which can be done or if there is some dependency on
>>> >>>>>>>> this
>>> >>>>>>>>>> FLIP.
>>> >>>>>>>>> The pr available about session window tvf belongs to this flip I think,
>>> >>>>>>>> and is part of the work about this flip. Actually the poc pr is not ready
>>> >>>>>>>> completely yet,
>>> >>>>>>>>> I'll try to update it to implement the session window tvf in window agg
>>> >>>>>>>> operator instead of using legacy group window agg operator.
>>> >>>>>>>>>> The tests should not be impacted.  Depending on what order our work
>>> >>>>>>>> lands
>>> >>>>>>>>>> in, one of the tests you've added/updated would likely move to the
>>> >>>>>>>>>> RestoreTests that Bonnie and I are working on.  Just mentioning that
>>> >>>>>>>> ahead
>>> >>>>>>>>>> of time
>>> >>>>>>>>>
>>> >>>>>>>>> Got it! I will pay attention to it.
>>> >>>>>>>>>
>>> >>>>>>>>>
>>> >>>>>>>>>
>>> >>>>>>>>>
>>> >>>>>>>>> --
>>> >>>>>>>>>
>>> >>>>>>>>>        Best!
>>> >>>>>>>>>        Xuyang
>>> >>>>>>>>>
>>> >>>>>>>>>
>>> >>>>>>>>>
>>> >>>>>>>>>
>>> >>>>>>>>>
>>> >>>>>>>>> 在 2023-12-11 21:35:00,"Jim Hughes" <jh...@confluent.io.INVALID> 写道:
>>> >>>>>>>>>> Hi Xuyang,
>>> >>>>>>>>>>
>>> >>>>>>>>>> On Sun, Dec 10, 2023 at 10:41 PM Xuyang <xy...@163.com> wrote:
>>> >>>>>>>>>>
>>> >>>>>>>>>>> Hi, Jim.
>>> >>>>>>>>>>>> As a clarification, since FLINK-24204 is finishing up work from
>>> >>>>>>>>>>>> FLIP-145[1], do we need to discuss anything before you work out the
>>> >>>>>>>>>>> details
>>> >>>>>>>>>>>> of FLINK-24024 as a PR?
>>> >>>>>>>>>>> Which issue do you mean? It seems that FLINK-24204[1] is the issue
>>> >>>>>>> with
>>> >>>>>>>>>>> table api&sql type system.
>>> >>>>>>>>>>>
>>> >>>>>>>>>>
>>> >>>>>>>>>> Ah, I mean to ask if you can contribute the new SESSION Table support
>>> >>>>>>>>>> without needing FLIP-392 completely settled.  I was trying to see if
>>> >>>>>>>> that
>>> >>>>>>>>>> is separate work which can be done or if there is some dependency on
>>> >>>>>>>> this
>>> >>>>>>>>>> FLIP.
>>> >>>>>>>>>>
>>> >>>>>>>>>>
>>> >>>>>>>>>>> I've got a PR up [3] for moving at least one of the classes you are
>>> >>>>>>>>>>> touching.
>>> >>>>>>>>>>> Nice work! Since we are not going to delete the legacy group window
>>> >>>>>>> agg
>>> >>>>>>>>>>> operator actually, the only compatibility issue
>>> >>>>>>>>>>> may be that when using flink sql, the legacy group window agg
>>> >>>>>>> operator
>>> >>>>>>>>>>> will be rewritten into new operators. Will these tests be affected
>>> >>>>>>>> about
>>> >>>>>>>>>>> this rewritten?
>>> >>>>>>>>>>>
>>> >>>>>>>>>>
>>> >>>>>>>>>> The tests should not be impacted.  Depending on what order our work
>>> >>>>>>>> lands
>>> >>>>>>>>>> in, one of the tests you've added/updated would likely move to the
>>> >>>>>>>>>> RestoreTests that Bonnie and I are working on.  Just mentioning that
>>> >>>>>>>> ahead
>>> >>>>>>>>>> of time
>>> >>>>>>>>>>
>>> >>>>>>>>>> Cheers,
>>> >>>>>>>>>>
>>> >>>>>>>>>> Jim
>>> >>>>>>>>>>
>>> >>>>>>>>>>
>>> >>>>>>>>>>
>>> >>>>>>>>>>>
>>> >>>>>>>>>>> [1] https://issues.apache.org/jira/browse/FLINK-24204
>>> >>>>>>>>>>>
>>> >>>>>>>>>>>
>>> >>>>>>>>>>>
>>> >>>>>>>>>>>
>>> >>>>>>>>>>>
>>> >>>>>>>>>>>
>>> >>>>>>>>>>> --
>>> >>>>>>>>>>>
>>> >>>>>>>>>>>        Best!
>>> >>>>>>>>>>>        Xuyang
>>> >>>>>>>>>>>
>>> >>>>>>>>>>>
>>> >>>>>>>>>>>
>>> >>>>>>>>>>>
>>> >>>>>>>>>>>
>>> >>>>>>>>>>> At 2023-12-09 06:25:30, "Jim Hughes" <jh...@confluent.io.INVALID>
>>> >>>>>>>> wrote:
>>> >>>>>>>>>>>> Hi Xuyang,
>>> >>>>>>>>>>>>
>>> >>>>>>>>>>>> As a clarification, since FLINK-24204 is finishing up work from
>>> >>>>>>>>>>>> FLIP-145[1], do we need to discuss anything before you work out the
>>> >>>>>>>>>>> details
>>> >>>>>>>>>>>> of FLINK-24024 as a PR?
>>> >>>>>>>>>>>>
>>> >>>>>>>>>>>> Relatedly, as that goes up for a PR, as part of FLINK-33421 [2],
>>> >>>>>>>> Bonnie
>>> >>>>>>>>>>> and
>>> >>>>>>>>>>>> I are working through migrating some of the JsonPlan Tests and
>>> >>>>>>>> ITCases to
>>> >>>>>>>>>>>> RestoreTests.  I've got a PR up [3] for moving at least one of the
>>> >>>>>>>> classes
>>> >>>>>>>>>>>> you are touching.  Let me know if I can share any details about that
>>> >>>>>>>> work.
>>> >>>>>>>>>>>>
>>> >>>>>>>>>>>> Cheers,
>>> >>>>>>>>>>>>
>>> >>>>>>>>>>>> Jim
>>> >>>>>>>>>>>>
>>> >>>>>>>>>>>> 1.
>>> >>>>>>>>>>>>
>>> >>>>>>>>>>>
>>> >>>>>>>>
>>> >>>>>>> https://cwiki.apache.org/confluence/display/FLINK/FLIP-145%3A+Support+SQL+windowing+table-valued+function#FLIP145:SupportSQLwindowingtablevaluedfunction-SessionWindows
>>> >>>>>>>>>>>>
>>> >>>>>>>>>>>> 2. https://issues.apache.org/jira/browse/FLINK-33421
>>> >>>>>>>>>>>> 3. https://github.com/apache/flink/pull/23886
>>> >>>>>>>>>>>> https://issues.apache.org/jira/browse/FLINK-33676
>>> >>>>>>>>>>>>
>>> >>>>>>>>>>>> On Tue, Nov 28, 2023 at 7:31 AM Xuyang <xy...@163.com> wrote:
>>> >>>>>>>>>>>>
>>> >>>>>>>>>>>>> Hi all.
>>> >>>>>>>>>>>>> I'd like to start a discussion of FLIP-392: Deprecate the Legacy
>>> >>>>>>>> Group
>>> >>>>>>>>>>>>> Window Aggregation.
>>> >>>>>>>>>>>>>
>>> >>>>>>>>>>>>>
>>> >>>>>>>>>>>>> Although the current Flink SQL Window Aggregation documentation[1]
>>> >>>>>>>>>>>>> indicates that the legacy Group Window Aggregation
>>> >>>>>>>>>>>>> syntax has been deprecated, the new Window TVF Aggregation syntax
>>> >>>>>>> has
>>> >>>>>>>>>>> not
>>> >>>>>>>>>>>>> fully covered all of the features of the legacy one.
>>> >>>>>>>>>>>>>
>>> >>>>>>>>>>>>>
>>> >>>>>>>>>>>>> Compared to Group Window Aggergation, Window TVF Aggergation has
>>> >>>>>>>> several
>>> >>>>>>>>>>>>> advantages, such as two-stage optimization,
>>> >>>>>>>>>>>>> support for standard GROUPING SET syntax, and so on. However, it
>>> >>>>>>>> needs
>>> >>>>>>>>>>> to
>>> >>>>>>>>>>>>> supplement and enrich the following features.
>>> >>>>>>>>>>>>>
>>> >>>>>>>>>>>>>
>>> >>>>>>>>>>>>> 1. Support for SESSION Window TVF Aggregation
>>> >>>>>>>>>>>>> 2. Support for consuming CDC stream
>>> >>>>>>>>>>>>> 3. Support for HOP window size with non-integer step length
>>> >>>>>>>>>>>>> 4. Support for configurations such as early fire, late fire and
>>> >>>>>>> allow
>>> >>>>>>>>>>>>> lateness
>>> >>>>>>>>>>>>> (which are internal experimental configurations in Group Window
>>> >>>>>>>>>>>>> Aggregation and not public to users yet.)
>>> >>>>>>>>>>>>> 5. Unification of the Window TVF Aggregation operator in runtime at
>>> >>>>>>>> the
>>> >>>>>>>>>>>>> implementation layer
>>> >>>>>>>>>>>>> (In the long term, the cost to maintain the operators about Window
>>> >>>>>>>> TVF
>>> >>>>>>>>>>>>> Aggregation and Group Window Aggregation is too expensive.)
>>> >>>>>>>>>>>>>
>>> >>>>>>>>>>>>>
>>> >>>>>>>>>>>>> This flip aims to continue the unfinished work in FLIP-145[2],
>>> >>>>>>> which
>>> >>>>>>>> is
>>> >>>>>>>>>>> to
>>> >>>>>>>>>>>>> fully enable the capabilities of Window TVF Aggregation
>>> >>>>>>>>>>>>>     and officially deprecate the legacy syntax Group Window
>>> >>>>>>>> Aggregation, to
>>> >>>>>>>>>>>>> prepare for the removal of the legacy one in Flink 2.0.
>>> >>>>>>>>>>>>>
>>> >>>>>>>>>>>>>
>>> >>>>>>>>>>>>> I have already done some preliminary POC to validate the
>>> >>>>>>> feasibility
>>> >>>>>>>> of
>>> >>>>>>>>>>>>> the related work in this flip as follows.
>>> >>>>>>>>>>>>> 1. POC for SESSION Window TVF Aggregation [3]
>>> >>>>>>>>>>>>> 2. POC for CUMULATE in Group Window Aggregation operator [4]
>>> >>>>>>>>>>>>> 3. POC for consuming CDC stream in Window Aggregation operator [5]
>>> >>>>>>>>>>>>>
>>> >>>>>>>>>>>>>
>>> >>>>>>>>>>>>> Looking forward to your feedback and thoughts!
>>> >>>>>>>>>>>>>
>>> >>>>>>>>>>>>>
>>> >>>>>>>>>>>>>
>>> >>>>>>>>>>>>> [1]
>>> >>>>>>>>>>>>>
>>> >>>>>>>>>>>
>>> >>>>>>>>
>>> >>>>>>> https://nightlies.apache.org/flink/flink-docs-master/docs/dev/table/sql/queries/window-agg/
>>> >>>>>>>>>>>>>
>>> >>>>>>>>>>>>> [2]
>>> >>>>>>>>>>>>>
>>> >>>>>>>>>>>
>>> >>>>>>>>
>>> >>>>>>> https://cwiki.apache.org/confluence/display/FLINK/FLIP-145%3A+Support+SQL+windowing+table-valued+function#FLIP145:SupportSQLwindowingtablevaluedfunction-SessionWindows
>>> >>>>>>>>>>>>> [3] https://github.com/xuyangzhong/flink/tree/FLINK-24024
>>> >>>>>>>>>>>>> [4]
>>> >>>>>>>>>>>>>
>>> >>>>>>>>>>>
>>> >>>>>>>>
>>> >>>>>>> https://github.com/xuyangzhong/flink/tree/poc_legacy_group_window_agg_cumulate
>>> >>>>>>>>>>>>> [5]
>>> >>>>>>>>>>>>>
>>> >>>>>>>>>>>
>>> >>>>>>>>
>>> >>>>>>> https://github.com/xuyangzhong/flink/tree/poc_window_agg_consumes_cdc_stream
>>> >>>>>>>>>>>>>
>>> >>>>>>>>>>>>>
>>> >>>>>>>>>>>>>
>>> >>>>>>>>>>>>> --
>>> >>>>>>>>>>>>>
>>> >>>>>>>>>>>>>        Best!
>>> >>>>>>>>>>>>>        Xuyang
>>> >>>>>>>>>>>
>>> >>>>>>>>
>>> >>>>>>>>
>>> >>>>>>>
>>> >>>>>>> --
>>> >>>>>>> Best regards,
>>> >>>>>>> Sergey
>>> >>>>>>>

Re:Re: Re: [DISCUSS] FLIP-392: Deprecate the Legacy Group Window Aggregation

Posted by Xuyang <xy...@163.com>.
Hi, Martijn.
Thank you for your reminder :)


My idea is that in the current 1.x version, we can automatically convert the agg operator in the old grammar into the agg operator
in the new grammar. Huge changes will be introduced in version 2.0 that old syntax will be directly deleted at the code level.
>That would imply that we will never be able to remove the old SQL
>language from the code base, since we would always rewrite that old
>language to the new implementation under the hood.
I'm a little curious why the old syntax can't be removed in the code in 2.0. If you have any better ideas, let’s discuss it together.




--

    Best!
    Xuyang





At 2023-12-27 23:20:06, "Martijn Visser" <ma...@apache.org> wrote:
>Hi Xuyang,
>
>It's currently the holiday season in Europe so do expect some slow responses.
>
>> The key reason the original FLIP is called "Deprecate the Legacy Group Window Aggregation" is that we also plan to automatically rewrite the group window agg corresponding the old syntax into the window agg corresponding the new window TVF syntax (will provide a fallback option from a compatibility perspective). Whether the window agg corresponding the new syntax is actively used by user or automatically rewritten, we all rely on the alignment of the functionality between the window agg and the legacy group window agg.
>
>That would imply that we will never be able to remove the old SQL
>language from the code base, since we would always rewrite that old
>language to the new implementation under the hood. I don't think
>that's necessarily a good idea, especially given that Flink 2.0 is
>coming next year and we could make a clean break there.
>
>Best regards,
>
>Martijn
>
>On Thu, Dec 21, 2023 at 12:44 PM Xuyang <xy...@163.com> wrote:
>>
>> Hi, Timo. Sorry to bother you. There's something I really need to hear your thoughts on.
>>
>>
>>
>>
>> When I'm trying to split this flip, having reviewed this discussion and the FLIP document again, I realized that there is still a key issue that hasn't been clarified. The key reason the original FLIP is called "Deprecate the Legacy Group Window Aggregation" is that we also plan to automatically rewrite the group window agg corresponding the old syntax into the window agg corresponding the new window TVF syntax (will provide a fallback option from a compatibility perspective). Whether the window agg corresponding the new syntax is actively used by user or automatically rewritten, we all rely on the alignment of the functionality between the window agg and the legacy group window agg.
>>
>>
>>
>>
>> To explain in detail, the original flip has the following two core parts.
>>
>>
>>
>>
>> 1. Automatically rewrite the legacy group window agg into the new window agg during plan optimization. (Corresponding to Section 5 in the Proposed Changes of the original FLIP)
>>
>>
>>
>>
>> 2. The alignment subtasks that the rewriting work depends on, involve aligning the features of the two operators. (No one had objections to this part of the work, and some of them are WIP) (Corresponding to Section 1-4 in the Proposed Changes of the original FLIP)
>>
>>
>>
>>
>> Currently, there are two ways to deal with this flip.
>>
>>
>>
>>
>> 1. According to your previous suggestion, split the subtasks of the two alignment features of supporting cdc stream and supporting HOP window size with non-integer step length into independent flips. Moreover, an additional Flip should be added to describe the work of automatic plan rewriting. In the discussion email, associate these three flips together. I'm not sure that's a bit trivial about doing this because the first two flips are small features actually. (And we need to discuss it separately and vote on them individually, right?)
>>
>>
>>
>>
>> 2. Modify the original flip title and change the content to the following style to highlight the automatic plan rewriting.
>>
>>
>>
>>
>> title: FLIP-392: Automatically rewrite the old syntax's agg to the window TVF agg
>>
>> part 1: automatic plan rewriting
>>
>> part 2: alignment subtasks the rewriting work depends on
>>
>>
>>
>>
>> I'm looking forward to your reply.
>>
>>
>>
>>
>> --
>>
>>     Best!
>>     Xuyang
>>
>>
>>
>>
>>
>> 在 2023-12-19 22:30:27,"Timo Walther" <tw...@apache.org> 写道:
>> >Hi Xuyang,
>> >
>> >sorry I missed the ping. Sounds reasonable to me. One FLIP about
>> >changelog semantics, the other about SQL semantics.
>> >
>> >Regards,
>> >Timo
>> >
>> >On 19.12.23 02:39, Xuyang wrote:
>> >> Hi, Timo. Sorry for this noise.
>> >> What do you think about splitting the flip like this?
>> >>
>> >>
>> >>
>> >>
>> >> --
>> >>
>> >>      Best!
>> >>      Xuyang
>> >>
>> >>
>> >>
>> >>
>> >>
>> >> At 2023-12-15 10:05:32, "Xuyang" <xy...@163.com> wrote:
>> >>> Hi, Timo, thanks for your advice.
>> >>>
>> >>>
>> >>> I am considering splitting the existing flip into two while leaving the existing flip (or without).
>> >>> One of them points to the completion of the operator about window tvf to support CDC (there are several
>> >>> small work items, such as window agg, window rank, window join, etc. Due to time constraints,
>> >>> the 1.19 version takes priority to complete the window agg). The other points to the HOP window tvf
>> >>> supports a size that is a non-integer multiple of the step. Once these two flips are basically completed
>> >>> in 1.19, we can consider officially deprecating the old group window agg syntax in the release note.
>> >>>
>> >>>
>> >>> WDYT?
>> >>>
>> >>>
>> >>>
>> >>>
>> >>> --
>> >>>
>> >>>     Best!
>> >>>     Xuyang
>> >>>
>> >>>
>> >>>
>> >>>
>> >>>
>> >>> At 2023-12-14 17:51:01, "Timo Walther" <tw...@apache.org> wrote:
>> >>>> Hi Xuyang,
>> >>>>
>> >>>>> I'm not spliting this flip is that all of these subtasks like session
>> >>>> window tvf and cdc support do not change the public interface and the
>> >>>> public syntax
>> >>>>
>> >>>> Given the length of this mailing list discussion and number of involved
>> >>>> people I would strongly suggest to simplify the FLIP and give it a
>> >>>> better title to make quicker progress. In general, we all seem to be on
>> >>>> the same page in what we want. And both session TVF support and the
>> >>>> deprecation of the legacy group windows has been voted already and
>> >>>> discussed thouroughly. The FLIP can purely focus on the CDC topic.
>> >>>>
>> >>>> Cheers,
>> >>>> Timo
>> >>>>
>> >>>>
>> >>>> On 14.12.23 08:35, Xuyang wrote:
>> >>>>> Hi, Timo, Sergey and Lincoln Lee. Thanks for your feedback.
>> >>>>>
>> >>>>>
>> >>>>>> In my opinion the FLIP touches too many
>> >>>>>> topics at the same time and should be split into multiple FLIPs. We > should stay focused on what is needed for Flink 2.0.
>> >>>>> The main goal and topic of this Flip is to align the abilities between the legacy group window agg syntax and the new window tvf syntax,
>> >>>>> and then we can say that the legacy window syntax will be deprecated. IMO, although there are many misalignments about these two
>> >>>>> syntaxes, such as session window tvf, cdc support and so on,  they are all the subtasks we need to do in this flip. Another reason I'm not
>> >>>>> spliting this flip is that all of these subtasks like session window tvf and cdc support do not change the public interface and the public
>> >>>>> syntax, the implements of them will only be in modules table-planner and table-runtime.
>> >>>>>
>> >>>>>
>> >>>>>> Can we postpone this discussion? Currently we should focus on user
>> >>>>>> switching to Window TVFs before Flink 2.0. Early fire, late fire and > allow lateness have not exposed through public configuration. It can be > introduced after Flink 2.0 released.
>> >>>>>
>> >>>>>
>> >>>>> Agree with you. This flip will not and should not expose these experimental flink conf to users. I list them in this flip just aims to show the
>> >>>>> misalignments about these two window syntaxes.
>> >>>>>
>> >>>>>
>> >>>>> Look for your thought.
>> >>>>>
>> >>>>>
>> >>>>>
>> >>>>>
>> >>>>> --
>> >>>>>
>> >>>>>       Best!
>> >>>>>       Xuyang
>> >>>>>
>> >>>>>
>> >>>>>
>> >>>>>
>> >>>>>
>> >>>>> At 2023-12-13 15:40:16, "Lincoln Lee" <li...@gmail.com> wrote:
>> >>>>>> Thanks Xuyang driving this work! It's great that everyone agrees with the
>> >>>>>> work itself in this flip[1]!
>> >>>>>>
>> >>>>>> Regarding whether to split the flip or adjust the scope of this flip, I'd
>> >>>>>> like to share some thoughts:
>> >>>>>>
>> >>>>>> 1. About the title of this flip, what I want to say is that flip-145[2] had
>> >>>>>> marked the legacy group window deprecated in the documentation but the
>> >>>>>> functionality of the new syntax is not aligned with the legacy one.
>> >>>>>> This is not a user-friendly deprecation, so the initiation of this flip, as
>> >>>>>> I understand it, is for the formal deprecation of the legacy window, which
>> >>>>>> requires us to complete the functionality alignment.
>> >>>>>>
>> >>>>>> 2. Agree with Timo that we can process the late-fire/early-fire features
>> >>>>>> separately. These experimental parameters have not been officially opened
>> >>>>>> to users.
>> >>>>>> Considering the workload, we can focus more on this version.
>> >>>>>>
>> >>>>>> 3. I have no objection to splitting this flip if everyone feels that the
>> >>>>>> work included is too much.
>> >>>>>> Regarding the support of session tvf, it seems that the main problem is
>> >>>>>> that this part of the description occupies a large part of the flip,
>> >>>>>> causing some misunderstandings.
>> >>>>>> This is indeed a predetermined task in FLIP-145, just adding more
>> >>>>>> explanation about semantics. In addition, I saw the discussion history in
>> >>>>>> FLINK-24024[3], thanks Sergey for being willing to help driving this work
>> >>>>>> together.
>> >>>>>>
>> >>>>>> [1]
>> >>>>>> https://cwiki.apache.org/confluence/display/FLINK/FLIP-392%3A+Deprecate+the+Legacy+Group+Window+Aggregation
>> >>>>>> [2]
>> >>>>>> https://cwiki.apache.org/confluence/display/FLINK/FLIP-145%3A+Support+SQL+windowing+table-valued+function
>> >>>>>> [3] https://issues.apache.org/jira/browse/FLINK-24024
>> >>>>>>
>> >>>>>> Best,
>> >>>>>> Lincoln Lee
>> >>>>>>
>> >>>>>>
>> >>>>>> Sergey Nuyanzin <sn...@gmail.com> 于2023年12月13日周三 08:02写道:
>> >>>>>>
>> >>>>>>> thanks for summarising Timo
>> >>>>>>>
>> >>>>>>> +1 for splitting it in different FLIPs
>> >>>>>>> and agree about having "SESSION Window TVF Aggregation" under FLIP-145
>> >>>>>>> Moreover the task is already there, so no need to move it from one FLIP to
>> >>>>>>> another
>> >>>>>>>
>> >>>>>>>> And actually Sergey Nuyanzin wanted to work
>> >>>>>>>> in this if I remember correctly. Not sure if this is still the case.
>> >>>>>>>
>> >>>>>>> Yes, however it seems there is already an existing PR for that.
>> >>>>>>> Anyway I'm happy to help here with the review as well and will reserve some
>> >>>>>>> time for it in coming days.
>> >>>>>>>
>> >>>>>>>
>> >>>>>>>
>> >>>>>>> On Tue, Dec 12, 2023 at 12:18 PM Timo Walther <tw...@apache.org> wrote:
>> >>>>>>>
>> >>>>>>>> Hi Xuyang,
>> >>>>>>>>
>> >>>>>>>> thanks for proposing this FLIP. In my opinion the FLIP touches too many
>> >>>>>>>> topics at the same time and should be split into multiple FLIPs. We
>> >>>>>>>> should stay focused on what is needed for Flink 2.0.
>> >>>>>>>>
>> >>>>>>>> Let me summarizing the topics:
>> >>>>>>>>
>> >>>>>>>> 1) SESSION Window TVF Aggregation
>> >>>>>>>>
>> >>>>>>>> This has been agreed in FLIP-145 already. We don't need another FLIP but
>> >>>>>>>> someone that finally implements this after we have performed the Calcite
>> >>>>>>>> upgrade a couple of months ago. The Calcite upgrade was important
>> >>>>>>>> exactly for SESSION windows. And actually Sergey Nuyanzin wanted to work
>> >>>>>>>> in this if I remember correctly. Not sure if this is still the case.
>> >>>>>>>>
>> >>>>>>>> 2) CDC support of Window TVFs
>> >>>>>>>>
>> >>>>>>>> This can be a FLIP on its own.
>> >>>>>>>>
>> >>>>>>>> 3) HOP window size with non-integer step length
>> >>>>>>>>
>> >>>>>>>> This can be a FLIP on its own.
>> >>>>>>>>
>> >>>>>>>> 4) Configurations such as early fire, late fire and allow lateness
>> >>>>>>>>
>> >>>>>>>> Can we postpone this discussion? Currently we should focus on user
>> >>>>>>>> switching to Window TVFs before Flink 2.0. Early fire, late fire and
>> >>>>>>>> allow lateness have not exposed through public configuration. It can be
>> >>>>>>>> introduced after Flink 2.0 released.
>> >>>>>>>>
>> >>>>>>>> Regards,
>> >>>>>>>> Timo
>> >>>>>>>>
>> >>>>>>>>
>> >>>>>>>> On 12.12.23 08:01, Xuyang wrote:
>> >>>>>>>>> Hi, Jim.
>> >>>>>>>>> Thanks for your explaination.
>> >>>>>>>>>> Ah, I mean to ask if you can contribute the new SESSION Table support
>> >>>>>>>>>> without needing FLIP-392 completely settled.  I was trying to see if
>> >>>>>>>> that
>> >>>>>>>>>> is separate work which can be done or if there is some dependency on
>> >>>>>>>> this
>> >>>>>>>>>> FLIP.
>> >>>>>>>>> The pr available about session window tvf belongs to this flip I think,
>> >>>>>>>> and is part of the work about this flip. Actually the poc pr is not ready
>> >>>>>>>> completely yet,
>> >>>>>>>>> I'll try to update it to implement the session window tvf in window agg
>> >>>>>>>> operator instead of using legacy group window agg operator.
>> >>>>>>>>>> The tests should not be impacted.  Depending on what order our work
>> >>>>>>>> lands
>> >>>>>>>>>> in, one of the tests you've added/updated would likely move to the
>> >>>>>>>>>> RestoreTests that Bonnie and I are working on.  Just mentioning that
>> >>>>>>>> ahead
>> >>>>>>>>>> of time
>> >>>>>>>>>
>> >>>>>>>>> Got it! I will pay attention to it.
>> >>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>> --
>> >>>>>>>>>
>> >>>>>>>>>        Best!
>> >>>>>>>>>        Xuyang
>> >>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>> 在 2023-12-11 21:35:00,"Jim Hughes" <jh...@confluent.io.INVALID> 写道:
>> >>>>>>>>>> Hi Xuyang,
>> >>>>>>>>>>
>> >>>>>>>>>> On Sun, Dec 10, 2023 at 10:41 PM Xuyang <xy...@163.com> wrote:
>> >>>>>>>>>>
>> >>>>>>>>>>> Hi, Jim.
>> >>>>>>>>>>>> As a clarification, since FLINK-24204 is finishing up work from
>> >>>>>>>>>>>> FLIP-145[1], do we need to discuss anything before you work out the
>> >>>>>>>>>>> details
>> >>>>>>>>>>>> of FLINK-24024 as a PR?
>> >>>>>>>>>>> Which issue do you mean? It seems that FLINK-24204[1] is the issue
>> >>>>>>> with
>> >>>>>>>>>>> table api&sql type system.
>> >>>>>>>>>>>
>> >>>>>>>>>>
>> >>>>>>>>>> Ah, I mean to ask if you can contribute the new SESSION Table support
>> >>>>>>>>>> without needing FLIP-392 completely settled.  I was trying to see if
>> >>>>>>>> that
>> >>>>>>>>>> is separate work which can be done or if there is some dependency on
>> >>>>>>>> this
>> >>>>>>>>>> FLIP.
>> >>>>>>>>>>
>> >>>>>>>>>>
>> >>>>>>>>>>> I've got a PR up [3] for moving at least one of the classes you are
>> >>>>>>>>>>> touching.
>> >>>>>>>>>>> Nice work! Since we are not going to delete the legacy group window
>> >>>>>>> agg
>> >>>>>>>>>>> operator actually, the only compatibility issue
>> >>>>>>>>>>> may be that when using flink sql, the legacy group window agg
>> >>>>>>> operator
>> >>>>>>>>>>> will be rewritten into new operators. Will these tests be affected
>> >>>>>>>> about
>> >>>>>>>>>>> this rewritten?
>> >>>>>>>>>>>
>> >>>>>>>>>>
>> >>>>>>>>>> The tests should not be impacted.  Depending on what order our work
>> >>>>>>>> lands
>> >>>>>>>>>> in, one of the tests you've added/updated would likely move to the
>> >>>>>>>>>> RestoreTests that Bonnie and I are working on.  Just mentioning that
>> >>>>>>>> ahead
>> >>>>>>>>>> of time
>> >>>>>>>>>>
>> >>>>>>>>>> Cheers,
>> >>>>>>>>>>
>> >>>>>>>>>> Jim
>> >>>>>>>>>>
>> >>>>>>>>>>
>> >>>>>>>>>>
>> >>>>>>>>>>>
>> >>>>>>>>>>> [1] https://issues.apache.org/jira/browse/FLINK-24204
>> >>>>>>>>>>>
>> >>>>>>>>>>>
>> >>>>>>>>>>>
>> >>>>>>>>>>>
>> >>>>>>>>>>>
>> >>>>>>>>>>>
>> >>>>>>>>>>> --
>> >>>>>>>>>>>
>> >>>>>>>>>>>        Best!
>> >>>>>>>>>>>        Xuyang
>> >>>>>>>>>>>
>> >>>>>>>>>>>
>> >>>>>>>>>>>
>> >>>>>>>>>>>
>> >>>>>>>>>>>
>> >>>>>>>>>>> At 2023-12-09 06:25:30, "Jim Hughes" <jh...@confluent.io.INVALID>
>> >>>>>>>> wrote:
>> >>>>>>>>>>>> Hi Xuyang,
>> >>>>>>>>>>>>
>> >>>>>>>>>>>> As a clarification, since FLINK-24204 is finishing up work from
>> >>>>>>>>>>>> FLIP-145[1], do we need to discuss anything before you work out the
>> >>>>>>>>>>> details
>> >>>>>>>>>>>> of FLINK-24024 as a PR?
>> >>>>>>>>>>>>
>> >>>>>>>>>>>> Relatedly, as that goes up for a PR, as part of FLINK-33421 [2],
>> >>>>>>>> Bonnie
>> >>>>>>>>>>> and
>> >>>>>>>>>>>> I are working through migrating some of the JsonPlan Tests and
>> >>>>>>>> ITCases to
>> >>>>>>>>>>>> RestoreTests.  I've got a PR up [3] for moving at least one of the
>> >>>>>>>> classes
>> >>>>>>>>>>>> you are touching.  Let me know if I can share any details about that
>> >>>>>>>> work.
>> >>>>>>>>>>>>
>> >>>>>>>>>>>> Cheers,
>> >>>>>>>>>>>>
>> >>>>>>>>>>>> Jim
>> >>>>>>>>>>>>
>> >>>>>>>>>>>> 1.
>> >>>>>>>>>>>>
>> >>>>>>>>>>>
>> >>>>>>>>
>> >>>>>>> https://cwiki.apache.org/confluence/display/FLINK/FLIP-145%3A+Support+SQL+windowing+table-valued+function#FLIP145:SupportSQLwindowingtablevaluedfunction-SessionWindows
>> >>>>>>>>>>>>
>> >>>>>>>>>>>> 2. https://issues.apache.org/jira/browse/FLINK-33421
>> >>>>>>>>>>>> 3. https://github.com/apache/flink/pull/23886
>> >>>>>>>>>>>> https://issues.apache.org/jira/browse/FLINK-33676
>> >>>>>>>>>>>>
>> >>>>>>>>>>>> On Tue, Nov 28, 2023 at 7:31 AM Xuyang <xy...@163.com> wrote:
>> >>>>>>>>>>>>
>> >>>>>>>>>>>>> Hi all.
>> >>>>>>>>>>>>> I'd like to start a discussion of FLIP-392: Deprecate the Legacy
>> >>>>>>>> Group
>> >>>>>>>>>>>>> Window Aggregation.
>> >>>>>>>>>>>>>
>> >>>>>>>>>>>>>
>> >>>>>>>>>>>>> Although the current Flink SQL Window Aggregation documentation[1]
>> >>>>>>>>>>>>> indicates that the legacy Group Window Aggregation
>> >>>>>>>>>>>>> syntax has been deprecated, the new Window TVF Aggregation syntax
>> >>>>>>> has
>> >>>>>>>>>>> not
>> >>>>>>>>>>>>> fully covered all of the features of the legacy one.
>> >>>>>>>>>>>>>
>> >>>>>>>>>>>>>
>> >>>>>>>>>>>>> Compared to Group Window Aggergation, Window TVF Aggergation has
>> >>>>>>>> several
>> >>>>>>>>>>>>> advantages, such as two-stage optimization,
>> >>>>>>>>>>>>> support for standard GROUPING SET syntax, and so on. However, it
>> >>>>>>>> needs
>> >>>>>>>>>>> to
>> >>>>>>>>>>>>> supplement and enrich the following features.
>> >>>>>>>>>>>>>
>> >>>>>>>>>>>>>
>> >>>>>>>>>>>>> 1. Support for SESSION Window TVF Aggregation
>> >>>>>>>>>>>>> 2. Support for consuming CDC stream
>> >>>>>>>>>>>>> 3. Support for HOP window size with non-integer step length
>> >>>>>>>>>>>>> 4. Support for configurations such as early fire, late fire and
>> >>>>>>> allow
>> >>>>>>>>>>>>> lateness
>> >>>>>>>>>>>>> (which are internal experimental configurations in Group Window
>> >>>>>>>>>>>>> Aggregation and not public to users yet.)
>> >>>>>>>>>>>>> 5. Unification of the Window TVF Aggregation operator in runtime at
>> >>>>>>>> the
>> >>>>>>>>>>>>> implementation layer
>> >>>>>>>>>>>>> (In the long term, the cost to maintain the operators about Window
>> >>>>>>>> TVF
>> >>>>>>>>>>>>> Aggregation and Group Window Aggregation is too expensive.)
>> >>>>>>>>>>>>>
>> >>>>>>>>>>>>>
>> >>>>>>>>>>>>> This flip aims to continue the unfinished work in FLIP-145[2],
>> >>>>>>> which
>> >>>>>>>> is
>> >>>>>>>>>>> to
>> >>>>>>>>>>>>> fully enable the capabilities of Window TVF Aggregation
>> >>>>>>>>>>>>>     and officially deprecate the legacy syntax Group Window
>> >>>>>>>> Aggregation, to
>> >>>>>>>>>>>>> prepare for the removal of the legacy one in Flink 2.0.
>> >>>>>>>>>>>>>
>> >>>>>>>>>>>>>
>> >>>>>>>>>>>>> I have already done some preliminary POC to validate the
>> >>>>>>> feasibility
>> >>>>>>>> of
>> >>>>>>>>>>>>> the related work in this flip as follows.
>> >>>>>>>>>>>>> 1. POC for SESSION Window TVF Aggregation [3]
>> >>>>>>>>>>>>> 2. POC for CUMULATE in Group Window Aggregation operator [4]
>> >>>>>>>>>>>>> 3. POC for consuming CDC stream in Window Aggregation operator [5]
>> >>>>>>>>>>>>>
>> >>>>>>>>>>>>>
>> >>>>>>>>>>>>> Looking forward to your feedback and thoughts!
>> >>>>>>>>>>>>>
>> >>>>>>>>>>>>>
>> >>>>>>>>>>>>>
>> >>>>>>>>>>>>> [1]
>> >>>>>>>>>>>>>
>> >>>>>>>>>>>
>> >>>>>>>>
>> >>>>>>> https://nightlies.apache.org/flink/flink-docs-master/docs/dev/table/sql/queries/window-agg/
>> >>>>>>>>>>>>>
>> >>>>>>>>>>>>> [2]
>> >>>>>>>>>>>>>
>> >>>>>>>>>>>
>> >>>>>>>>
>> >>>>>>> https://cwiki.apache.org/confluence/display/FLINK/FLIP-145%3A+Support+SQL+windowing+table-valued+function#FLIP145:SupportSQLwindowingtablevaluedfunction-SessionWindows
>> >>>>>>>>>>>>> [3] https://github.com/xuyangzhong/flink/tree/FLINK-24024
>> >>>>>>>>>>>>> [4]
>> >>>>>>>>>>>>>
>> >>>>>>>>>>>
>> >>>>>>>>
>> >>>>>>> https://github.com/xuyangzhong/flink/tree/poc_legacy_group_window_agg_cumulate
>> >>>>>>>>>>>>> [5]
>> >>>>>>>>>>>>>
>> >>>>>>>>>>>
>> >>>>>>>>
>> >>>>>>> https://github.com/xuyangzhong/flink/tree/poc_window_agg_consumes_cdc_stream
>> >>>>>>>>>>>>>
>> >>>>>>>>>>>>>
>> >>>>>>>>>>>>>
>> >>>>>>>>>>>>> --
>> >>>>>>>>>>>>>
>> >>>>>>>>>>>>>        Best!
>> >>>>>>>>>>>>>        Xuyang
>> >>>>>>>>>>>
>> >>>>>>>>
>> >>>>>>>>
>> >>>>>>>
>> >>>>>>> --
>> >>>>>>> Best regards,
>> >>>>>>> Sergey
>> >>>>>>>

Re: Re: [DISCUSS] FLIP-392: Deprecate the Legacy Group Window Aggregation

Posted by Martijn Visser <ma...@apache.org>.
Hi Xuyang,

It's currently the holiday season in Europe so do expect some slow responses.

> The key reason the original FLIP is called "Deprecate the Legacy Group Window Aggregation" is that we also plan to automatically rewrite the group window agg corresponding the old syntax into the window agg corresponding the new window TVF syntax (will provide a fallback option from a compatibility perspective). Whether the window agg corresponding the new syntax is actively used by user or automatically rewritten, we all rely on the alignment of the functionality between the window agg and the legacy group window agg.

That would imply that we will never be able to remove the old SQL
language from the code base, since we would always rewrite that old
language to the new implementation under the hood. I don't think
that's necessarily a good idea, especially given that Flink 2.0 is
coming next year and we could make a clean break there.

Best regards,

Martijn

On Thu, Dec 21, 2023 at 12:44 PM Xuyang <xy...@163.com> wrote:
>
> Hi, Timo. Sorry to bother you. There's something I really need to hear your thoughts on.
>
>
>
>
> When I'm trying to split this flip, having reviewed this discussion and the FLIP document again, I realized that there is still a key issue that hasn't been clarified. The key reason the original FLIP is called "Deprecate the Legacy Group Window Aggregation" is that we also plan to automatically rewrite the group window agg corresponding the old syntax into the window agg corresponding the new window TVF syntax (will provide a fallback option from a compatibility perspective). Whether the window agg corresponding the new syntax is actively used by user or automatically rewritten, we all rely on the alignment of the functionality between the window agg and the legacy group window agg.
>
>
>
>
> To explain in detail, the original flip has the following two core parts.
>
>
>
>
> 1. Automatically rewrite the legacy group window agg into the new window agg during plan optimization. (Corresponding to Section 5 in the Proposed Changes of the original FLIP)
>
>
>
>
> 2. The alignment subtasks that the rewriting work depends on, involve aligning the features of the two operators. (No one had objections to this part of the work, and some of them are WIP) (Corresponding to Section 1-4 in the Proposed Changes of the original FLIP)
>
>
>
>
> Currently, there are two ways to deal with this flip.
>
>
>
>
> 1. According to your previous suggestion, split the subtasks of the two alignment features of supporting cdc stream and supporting HOP window size with non-integer step length into independent flips. Moreover, an additional Flip should be added to describe the work of automatic plan rewriting. In the discussion email, associate these three flips together. I'm not sure that's a bit trivial about doing this because the first two flips are small features actually. (And we need to discuss it separately and vote on them individually, right?)
>
>
>
>
> 2. Modify the original flip title and change the content to the following style to highlight the automatic plan rewriting.
>
>
>
>
> title: FLIP-392: Automatically rewrite the old syntax's agg to the window TVF agg
>
> part 1: automatic plan rewriting
>
> part 2: alignment subtasks the rewriting work depends on
>
>
>
>
> I'm looking forward to your reply.
>
>
>
>
> --
>
>     Best!
>     Xuyang
>
>
>
>
>
> 在 2023-12-19 22:30:27,"Timo Walther" <tw...@apache.org> 写道:
> >Hi Xuyang,
> >
> >sorry I missed the ping. Sounds reasonable to me. One FLIP about
> >changelog semantics, the other about SQL semantics.
> >
> >Regards,
> >Timo
> >
> >On 19.12.23 02:39, Xuyang wrote:
> >> Hi, Timo. Sorry for this noise.
> >> What do you think about splitting the flip like this?
> >>
> >>
> >>
> >>
> >> --
> >>
> >>      Best!
> >>      Xuyang
> >>
> >>
> >>
> >>
> >>
> >> At 2023-12-15 10:05:32, "Xuyang" <xy...@163.com> wrote:
> >>> Hi, Timo, thanks for your advice.
> >>>
> >>>
> >>> I am considering splitting the existing flip into two while leaving the existing flip (or without).
> >>> One of them points to the completion of the operator about window tvf to support CDC (there are several
> >>> small work items, such as window agg, window rank, window join, etc. Due to time constraints,
> >>> the 1.19 version takes priority to complete the window agg). The other points to the HOP window tvf
> >>> supports a size that is a non-integer multiple of the step. Once these two flips are basically completed
> >>> in 1.19, we can consider officially deprecating the old group window agg syntax in the release note.
> >>>
> >>>
> >>> WDYT?
> >>>
> >>>
> >>>
> >>>
> >>> --
> >>>
> >>>     Best!
> >>>     Xuyang
> >>>
> >>>
> >>>
> >>>
> >>>
> >>> At 2023-12-14 17:51:01, "Timo Walther" <tw...@apache.org> wrote:
> >>>> Hi Xuyang,
> >>>>
> >>>>> I'm not spliting this flip is that all of these subtasks like session
> >>>> window tvf and cdc support do not change the public interface and the
> >>>> public syntax
> >>>>
> >>>> Given the length of this mailing list discussion and number of involved
> >>>> people I would strongly suggest to simplify the FLIP and give it a
> >>>> better title to make quicker progress. In general, we all seem to be on
> >>>> the same page in what we want. And both session TVF support and the
> >>>> deprecation of the legacy group windows has been voted already and
> >>>> discussed thouroughly. The FLIP can purely focus on the CDC topic.
> >>>>
> >>>> Cheers,
> >>>> Timo
> >>>>
> >>>>
> >>>> On 14.12.23 08:35, Xuyang wrote:
> >>>>> Hi, Timo, Sergey and Lincoln Lee. Thanks for your feedback.
> >>>>>
> >>>>>
> >>>>>> In my opinion the FLIP touches too many
> >>>>>> topics at the same time and should be split into multiple FLIPs. We > should stay focused on what is needed for Flink 2.0.
> >>>>> The main goal and topic of this Flip is to align the abilities between the legacy group window agg syntax and the new window tvf syntax,
> >>>>> and then we can say that the legacy window syntax will be deprecated. IMO, although there are many misalignments about these two
> >>>>> syntaxes, such as session window tvf, cdc support and so on,  they are all the subtasks we need to do in this flip. Another reason I'm not
> >>>>> spliting this flip is that all of these subtasks like session window tvf and cdc support do not change the public interface and the public
> >>>>> syntax, the implements of them will only be in modules table-planner and table-runtime.
> >>>>>
> >>>>>
> >>>>>> Can we postpone this discussion? Currently we should focus on user
> >>>>>> switching to Window TVFs before Flink 2.0. Early fire, late fire and > allow lateness have not exposed through public configuration. It can be > introduced after Flink 2.0 released.
> >>>>>
> >>>>>
> >>>>> Agree with you. This flip will not and should not expose these experimental flink conf to users. I list them in this flip just aims to show the
> >>>>> misalignments about these two window syntaxes.
> >>>>>
> >>>>>
> >>>>> Look for your thought.
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>> --
> >>>>>
> >>>>>       Best!
> >>>>>       Xuyang
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>> At 2023-12-13 15:40:16, "Lincoln Lee" <li...@gmail.com> wrote:
> >>>>>> Thanks Xuyang driving this work! It's great that everyone agrees with the
> >>>>>> work itself in this flip[1]!
> >>>>>>
> >>>>>> Regarding whether to split the flip or adjust the scope of this flip, I'd
> >>>>>> like to share some thoughts:
> >>>>>>
> >>>>>> 1. About the title of this flip, what I want to say is that flip-145[2] had
> >>>>>> marked the legacy group window deprecated in the documentation but the
> >>>>>> functionality of the new syntax is not aligned with the legacy one.
> >>>>>> This is not a user-friendly deprecation, so the initiation of this flip, as
> >>>>>> I understand it, is for the formal deprecation of the legacy window, which
> >>>>>> requires us to complete the functionality alignment.
> >>>>>>
> >>>>>> 2. Agree with Timo that we can process the late-fire/early-fire features
> >>>>>> separately. These experimental parameters have not been officially opened
> >>>>>> to users.
> >>>>>> Considering the workload, we can focus more on this version.
> >>>>>>
> >>>>>> 3. I have no objection to splitting this flip if everyone feels that the
> >>>>>> work included is too much.
> >>>>>> Regarding the support of session tvf, it seems that the main problem is
> >>>>>> that this part of the description occupies a large part of the flip,
> >>>>>> causing some misunderstandings.
> >>>>>> This is indeed a predetermined task in FLIP-145, just adding more
> >>>>>> explanation about semantics. In addition, I saw the discussion history in
> >>>>>> FLINK-24024[3], thanks Sergey for being willing to help driving this work
> >>>>>> together.
> >>>>>>
> >>>>>> [1]
> >>>>>> https://cwiki.apache.org/confluence/display/FLINK/FLIP-392%3A+Deprecate+the+Legacy+Group+Window+Aggregation
> >>>>>> [2]
> >>>>>> https://cwiki.apache.org/confluence/display/FLINK/FLIP-145%3A+Support+SQL+windowing+table-valued+function
> >>>>>> [3] https://issues.apache.org/jira/browse/FLINK-24024
> >>>>>>
> >>>>>> Best,
> >>>>>> Lincoln Lee
> >>>>>>
> >>>>>>
> >>>>>> Sergey Nuyanzin <sn...@gmail.com> 于2023年12月13日周三 08:02写道:
> >>>>>>
> >>>>>>> thanks for summarising Timo
> >>>>>>>
> >>>>>>> +1 for splitting it in different FLIPs
> >>>>>>> and agree about having "SESSION Window TVF Aggregation" under FLIP-145
> >>>>>>> Moreover the task is already there, so no need to move it from one FLIP to
> >>>>>>> another
> >>>>>>>
> >>>>>>>> And actually Sergey Nuyanzin wanted to work
> >>>>>>>> in this if I remember correctly. Not sure if this is still the case.
> >>>>>>>
> >>>>>>> Yes, however it seems there is already an existing PR for that.
> >>>>>>> Anyway I'm happy to help here with the review as well and will reserve some
> >>>>>>> time for it in coming days.
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>> On Tue, Dec 12, 2023 at 12:18 PM Timo Walther <tw...@apache.org> wrote:
> >>>>>>>
> >>>>>>>> Hi Xuyang,
> >>>>>>>>
> >>>>>>>> thanks for proposing this FLIP. In my opinion the FLIP touches too many
> >>>>>>>> topics at the same time and should be split into multiple FLIPs. We
> >>>>>>>> should stay focused on what is needed for Flink 2.0.
> >>>>>>>>
> >>>>>>>> Let me summarizing the topics:
> >>>>>>>>
> >>>>>>>> 1) SESSION Window TVF Aggregation
> >>>>>>>>
> >>>>>>>> This has been agreed in FLIP-145 already. We don't need another FLIP but
> >>>>>>>> someone that finally implements this after we have performed the Calcite
> >>>>>>>> upgrade a couple of months ago. The Calcite upgrade was important
> >>>>>>>> exactly for SESSION windows. And actually Sergey Nuyanzin wanted to work
> >>>>>>>> in this if I remember correctly. Not sure if this is still the case.
> >>>>>>>>
> >>>>>>>> 2) CDC support of Window TVFs
> >>>>>>>>
> >>>>>>>> This can be a FLIP on its own.
> >>>>>>>>
> >>>>>>>> 3) HOP window size with non-integer step length
> >>>>>>>>
> >>>>>>>> This can be a FLIP on its own.
> >>>>>>>>
> >>>>>>>> 4) Configurations such as early fire, late fire and allow lateness
> >>>>>>>>
> >>>>>>>> Can we postpone this discussion? Currently we should focus on user
> >>>>>>>> switching to Window TVFs before Flink 2.0. Early fire, late fire and
> >>>>>>>> allow lateness have not exposed through public configuration. It can be
> >>>>>>>> introduced after Flink 2.0 released.
> >>>>>>>>
> >>>>>>>> Regards,
> >>>>>>>> Timo
> >>>>>>>>
> >>>>>>>>
> >>>>>>>> On 12.12.23 08:01, Xuyang wrote:
> >>>>>>>>> Hi, Jim.
> >>>>>>>>> Thanks for your explaination.
> >>>>>>>>>> Ah, I mean to ask if you can contribute the new SESSION Table support
> >>>>>>>>>> without needing FLIP-392 completely settled.  I was trying to see if
> >>>>>>>> that
> >>>>>>>>>> is separate work which can be done or if there is some dependency on
> >>>>>>>> this
> >>>>>>>>>> FLIP.
> >>>>>>>>> The pr available about session window tvf belongs to this flip I think,
> >>>>>>>> and is part of the work about this flip. Actually the poc pr is not ready
> >>>>>>>> completely yet,
> >>>>>>>>> I'll try to update it to implement the session window tvf in window agg
> >>>>>>>> operator instead of using legacy group window agg operator.
> >>>>>>>>>> The tests should not be impacted.  Depending on what order our work
> >>>>>>>> lands
> >>>>>>>>>> in, one of the tests you've added/updated would likely move to the
> >>>>>>>>>> RestoreTests that Bonnie and I are working on.  Just mentioning that
> >>>>>>>> ahead
> >>>>>>>>>> of time
> >>>>>>>>>
> >>>>>>>>> Got it! I will pay attention to it.
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>> --
> >>>>>>>>>
> >>>>>>>>>        Best!
> >>>>>>>>>        Xuyang
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>> 在 2023-12-11 21:35:00,"Jim Hughes" <jh...@confluent.io.INVALID> 写道:
> >>>>>>>>>> Hi Xuyang,
> >>>>>>>>>>
> >>>>>>>>>> On Sun, Dec 10, 2023 at 10:41 PM Xuyang <xy...@163.com> wrote:
> >>>>>>>>>>
> >>>>>>>>>>> Hi, Jim.
> >>>>>>>>>>>> As a clarification, since FLINK-24204 is finishing up work from
> >>>>>>>>>>>> FLIP-145[1], do we need to discuss anything before you work out the
> >>>>>>>>>>> details
> >>>>>>>>>>>> of FLINK-24024 as a PR?
> >>>>>>>>>>> Which issue do you mean? It seems that FLINK-24204[1] is the issue
> >>>>>>> with
> >>>>>>>>>>> table api&sql type system.
> >>>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>> Ah, I mean to ask if you can contribute the new SESSION Table support
> >>>>>>>>>> without needing FLIP-392 completely settled.  I was trying to see if
> >>>>>>>> that
> >>>>>>>>>> is separate work which can be done or if there is some dependency on
> >>>>>>>> this
> >>>>>>>>>> FLIP.
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>> I've got a PR up [3] for moving at least one of the classes you are
> >>>>>>>>>>> touching.
> >>>>>>>>>>> Nice work! Since we are not going to delete the legacy group window
> >>>>>>> agg
> >>>>>>>>>>> operator actually, the only compatibility issue
> >>>>>>>>>>> may be that when using flink sql, the legacy group window agg
> >>>>>>> operator
> >>>>>>>>>>> will be rewritten into new operators. Will these tests be affected
> >>>>>>>> about
> >>>>>>>>>>> this rewritten?
> >>>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>> The tests should not be impacted.  Depending on what order our work
> >>>>>>>> lands
> >>>>>>>>>> in, one of the tests you've added/updated would likely move to the
> >>>>>>>>>> RestoreTests that Bonnie and I are working on.  Just mentioning that
> >>>>>>>> ahead
> >>>>>>>>>> of time
> >>>>>>>>>>
> >>>>>>>>>> Cheers,
> >>>>>>>>>>
> >>>>>>>>>> Jim
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>> [1] https://issues.apache.org/jira/browse/FLINK-24204
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>> --
> >>>>>>>>>>>
> >>>>>>>>>>>        Best!
> >>>>>>>>>>>        Xuyang
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>>>> At 2023-12-09 06:25:30, "Jim Hughes" <jh...@confluent.io.INVALID>
> >>>>>>>> wrote:
> >>>>>>>>>>>> Hi Xuyang,
> >>>>>>>>>>>>
> >>>>>>>>>>>> As a clarification, since FLINK-24204 is finishing up work from
> >>>>>>>>>>>> FLIP-145[1], do we need to discuss anything before you work out the
> >>>>>>>>>>> details
> >>>>>>>>>>>> of FLINK-24024 as a PR?
> >>>>>>>>>>>>
> >>>>>>>>>>>> Relatedly, as that goes up for a PR, as part of FLINK-33421 [2],
> >>>>>>>> Bonnie
> >>>>>>>>>>> and
> >>>>>>>>>>>> I are working through migrating some of the JsonPlan Tests and
> >>>>>>>> ITCases to
> >>>>>>>>>>>> RestoreTests.  I've got a PR up [3] for moving at least one of the
> >>>>>>>> classes
> >>>>>>>>>>>> you are touching.  Let me know if I can share any details about that
> >>>>>>>> work.
> >>>>>>>>>>>>
> >>>>>>>>>>>> Cheers,
> >>>>>>>>>>>>
> >>>>>>>>>>>> Jim
> >>>>>>>>>>>>
> >>>>>>>>>>>> 1.
> >>>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>
> >>>>>>> https://cwiki.apache.org/confluence/display/FLINK/FLIP-145%3A+Support+SQL+windowing+table-valued+function#FLIP145:SupportSQLwindowingtablevaluedfunction-SessionWindows
> >>>>>>>>>>>>
> >>>>>>>>>>>> 2. https://issues.apache.org/jira/browse/FLINK-33421
> >>>>>>>>>>>> 3. https://github.com/apache/flink/pull/23886
> >>>>>>>>>>>> https://issues.apache.org/jira/browse/FLINK-33676
> >>>>>>>>>>>>
> >>>>>>>>>>>> On Tue, Nov 28, 2023 at 7:31 AM Xuyang <xy...@163.com> wrote:
> >>>>>>>>>>>>
> >>>>>>>>>>>>> Hi all.
> >>>>>>>>>>>>> I'd like to start a discussion of FLIP-392: Deprecate the Legacy
> >>>>>>>> Group
> >>>>>>>>>>>>> Window Aggregation.
> >>>>>>>>>>>>>
> >>>>>>>>>>>>>
> >>>>>>>>>>>>> Although the current Flink SQL Window Aggregation documentation[1]
> >>>>>>>>>>>>> indicates that the legacy Group Window Aggregation
> >>>>>>>>>>>>> syntax has been deprecated, the new Window TVF Aggregation syntax
> >>>>>>> has
> >>>>>>>>>>> not
> >>>>>>>>>>>>> fully covered all of the features of the legacy one.
> >>>>>>>>>>>>>
> >>>>>>>>>>>>>
> >>>>>>>>>>>>> Compared to Group Window Aggergation, Window TVF Aggergation has
> >>>>>>>> several
> >>>>>>>>>>>>> advantages, such as two-stage optimization,
> >>>>>>>>>>>>> support for standard GROUPING SET syntax, and so on. However, it
> >>>>>>>> needs
> >>>>>>>>>>> to
> >>>>>>>>>>>>> supplement and enrich the following features.
> >>>>>>>>>>>>>
> >>>>>>>>>>>>>
> >>>>>>>>>>>>> 1. Support for SESSION Window TVF Aggregation
> >>>>>>>>>>>>> 2. Support for consuming CDC stream
> >>>>>>>>>>>>> 3. Support for HOP window size with non-integer step length
> >>>>>>>>>>>>> 4. Support for configurations such as early fire, late fire and
> >>>>>>> allow
> >>>>>>>>>>>>> lateness
> >>>>>>>>>>>>> (which are internal experimental configurations in Group Window
> >>>>>>>>>>>>> Aggregation and not public to users yet.)
> >>>>>>>>>>>>> 5. Unification of the Window TVF Aggregation operator in runtime at
> >>>>>>>> the
> >>>>>>>>>>>>> implementation layer
> >>>>>>>>>>>>> (In the long term, the cost to maintain the operators about Window
> >>>>>>>> TVF
> >>>>>>>>>>>>> Aggregation and Group Window Aggregation is too expensive.)
> >>>>>>>>>>>>>
> >>>>>>>>>>>>>
> >>>>>>>>>>>>> This flip aims to continue the unfinished work in FLIP-145[2],
> >>>>>>> which
> >>>>>>>> is
> >>>>>>>>>>> to
> >>>>>>>>>>>>> fully enable the capabilities of Window TVF Aggregation
> >>>>>>>>>>>>>     and officially deprecate the legacy syntax Group Window
> >>>>>>>> Aggregation, to
> >>>>>>>>>>>>> prepare for the removal of the legacy one in Flink 2.0.
> >>>>>>>>>>>>>
> >>>>>>>>>>>>>
> >>>>>>>>>>>>> I have already done some preliminary POC to validate the
> >>>>>>> feasibility
> >>>>>>>> of
> >>>>>>>>>>>>> the related work in this flip as follows.
> >>>>>>>>>>>>> 1. POC for SESSION Window TVF Aggregation [3]
> >>>>>>>>>>>>> 2. POC for CUMULATE in Group Window Aggregation operator [4]
> >>>>>>>>>>>>> 3. POC for consuming CDC stream in Window Aggregation operator [5]
> >>>>>>>>>>>>>
> >>>>>>>>>>>>>
> >>>>>>>>>>>>> Looking forward to your feedback and thoughts!
> >>>>>>>>>>>>>
> >>>>>>>>>>>>>
> >>>>>>>>>>>>>
> >>>>>>>>>>>>> [1]
> >>>>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>
> >>>>>>> https://nightlies.apache.org/flink/flink-docs-master/docs/dev/table/sql/queries/window-agg/
> >>>>>>>>>>>>>
> >>>>>>>>>>>>> [2]
> >>>>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>
> >>>>>>> https://cwiki.apache.org/confluence/display/FLINK/FLIP-145%3A+Support+SQL+windowing+table-valued+function#FLIP145:SupportSQLwindowingtablevaluedfunction-SessionWindows
> >>>>>>>>>>>>> [3] https://github.com/xuyangzhong/flink/tree/FLINK-24024
> >>>>>>>>>>>>> [4]
> >>>>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>
> >>>>>>> https://github.com/xuyangzhong/flink/tree/poc_legacy_group_window_agg_cumulate
> >>>>>>>>>>>>> [5]
> >>>>>>>>>>>>>
> >>>>>>>>>>>
> >>>>>>>>
> >>>>>>> https://github.com/xuyangzhong/flink/tree/poc_window_agg_consumes_cdc_stream
> >>>>>>>>>>>>>
> >>>>>>>>>>>>>
> >>>>>>>>>>>>>
> >>>>>>>>>>>>> --
> >>>>>>>>>>>>>
> >>>>>>>>>>>>>        Best!
> >>>>>>>>>>>>>        Xuyang
> >>>>>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>
> >>>>>>> --
> >>>>>>> Best regards,
> >>>>>>> Sergey
> >>>>>>>

Re:Re: [DISCUSS] FLIP-392: Deprecate the Legacy Group Window Aggregation

Posted by Xuyang <xy...@163.com>.
Hi, Timo. Sorry to bother you. There's something I really need to hear your thoughts on.




When I'm trying to split this flip, having reviewed this discussion and the FLIP document again, I realized that there is still a key issue that hasn't been clarified. The key reason the original FLIP is called "Deprecate the Legacy Group Window Aggregation" is that we also plan to automatically rewrite the group window agg corresponding the old syntax into the window agg corresponding the new window TVF syntax (will provide a fallback option from a compatibility perspective). Whether the window agg corresponding the new syntax is actively used by user or automatically rewritten, we all rely on the alignment of the functionality between the window agg and the legacy group window agg.




To explain in detail, the original flip has the following two core parts.




1. Automatically rewrite the legacy group window agg into the new window agg during plan optimization. (Corresponding to Section 5 in the Proposed Changes of the original FLIP)




2. The alignment subtasks that the rewriting work depends on, involve aligning the features of the two operators. (No one had objections to this part of the work, and some of them are WIP) (Corresponding to Section 1-4 in the Proposed Changes of the original FLIP)




Currently, there are two ways to deal with this flip.




1. According to your previous suggestion, split the subtasks of the two alignment features of supporting cdc stream and supporting HOP window size with non-integer step length into independent flips. Moreover, an additional Flip should be added to describe the work of automatic plan rewriting. In the discussion email, associate these three flips together. I'm not sure that's a bit trivial about doing this because the first two flips are small features actually. (And we need to discuss it separately and vote on them individually, right?)




2. Modify the original flip title and change the content to the following style to highlight the automatic plan rewriting.




title: FLIP-392: Automatically rewrite the old syntax's agg to the window TVF agg

part 1: automatic plan rewriting

part 2: alignment subtasks the rewriting work depends on




I'm looking forward to your reply.




--

    Best!
    Xuyang





在 2023-12-19 22:30:27,"Timo Walther" <tw...@apache.org> 写道:
>Hi Xuyang,
>
>sorry I missed the ping. Sounds reasonable to me. One FLIP about 
>changelog semantics, the other about SQL semantics.
>
>Regards,
>Timo
>
>On 19.12.23 02:39, Xuyang wrote:
>> Hi, Timo. Sorry for this noise.
>> What do you think about splitting the flip like this?
>> 
>> 
>> 
>> 
>> --
>> 
>>      Best!
>>      Xuyang
>> 
>> 
>> 
>> 
>> 
>> At 2023-12-15 10:05:32, "Xuyang" <xy...@163.com> wrote:
>>> Hi, Timo, thanks for your advice.
>>>
>>>
>>> I am considering splitting the existing flip into two while leaving the existing flip (or without).
>>> One of them points to the completion of the operator about window tvf to support CDC (there are several
>>> small work items, such as window agg, window rank, window join, etc. Due to time constraints,
>>> the 1.19 version takes priority to complete the window agg). The other points to the HOP window tvf
>>> supports a size that is a non-integer multiple of the step. Once these two flips are basically completed
>>> in 1.19, we can consider officially deprecating the old group window agg syntax in the release note.
>>>
>>>
>>> WDYT?
>>>
>>>
>>>
>>>
>>> --
>>>
>>>     Best!
>>>     Xuyang
>>>
>>>
>>>
>>>
>>>
>>> At 2023-12-14 17:51:01, "Timo Walther" <tw...@apache.org> wrote:
>>>> Hi Xuyang,
>>>>
>>>>> I'm not spliting this flip is that all of these subtasks like session
>>>> window tvf and cdc support do not change the public interface and the
>>>> public syntax
>>>>
>>>> Given the length of this mailing list discussion and number of involved
>>>> people I would strongly suggest to simplify the FLIP and give it a
>>>> better title to make quicker progress. In general, we all seem to be on
>>>> the same page in what we want. And both session TVF support and the
>>>> deprecation of the legacy group windows has been voted already and
>>>> discussed thouroughly. The FLIP can purely focus on the CDC topic.
>>>>
>>>> Cheers,
>>>> Timo
>>>>
>>>>
>>>> On 14.12.23 08:35, Xuyang wrote:
>>>>> Hi, Timo, Sergey and Lincoln Lee. Thanks for your feedback.
>>>>>
>>>>>
>>>>>> In my opinion the FLIP touches too many
>>>>>> topics at the same time and should be split into multiple FLIPs. We > should stay focused on what is needed for Flink 2.0.
>>>>> The main goal and topic of this Flip is to align the abilities between the legacy group window agg syntax and the new window tvf syntax,
>>>>> and then we can say that the legacy window syntax will be deprecated. IMO, although there are many misalignments about these two
>>>>> syntaxes, such as session window tvf, cdc support and so on,  they are all the subtasks we need to do in this flip. Another reason I'm not
>>>>> spliting this flip is that all of these subtasks like session window tvf and cdc support do not change the public interface and the public
>>>>> syntax, the implements of them will only be in modules table-planner and table-runtime.
>>>>>
>>>>>
>>>>>> Can we postpone this discussion? Currently we should focus on user
>>>>>> switching to Window TVFs before Flink 2.0. Early fire, late fire and > allow lateness have not exposed through public configuration. It can be > introduced after Flink 2.0 released.
>>>>>
>>>>>
>>>>> Agree with you. This flip will not and should not expose these experimental flink conf to users. I list them in this flip just aims to show the
>>>>> misalignments about these two window syntaxes.
>>>>>
>>>>>
>>>>> Look for your thought.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>>
>>>>>       Best!
>>>>>       Xuyang
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> At 2023-12-13 15:40:16, "Lincoln Lee" <li...@gmail.com> wrote:
>>>>>> Thanks Xuyang driving this work! It's great that everyone agrees with the
>>>>>> work itself in this flip[1]!
>>>>>>
>>>>>> Regarding whether to split the flip or adjust the scope of this flip, I'd
>>>>>> like to share some thoughts:
>>>>>>
>>>>>> 1. About the title of this flip, what I want to say is that flip-145[2] had
>>>>>> marked the legacy group window deprecated in the documentation but the
>>>>>> functionality of the new syntax is not aligned with the legacy one.
>>>>>> This is not a user-friendly deprecation, so the initiation of this flip, as
>>>>>> I understand it, is for the formal deprecation of the legacy window, which
>>>>>> requires us to complete the functionality alignment.
>>>>>>
>>>>>> 2. Agree with Timo that we can process the late-fire/early-fire features
>>>>>> separately. These experimental parameters have not been officially opened
>>>>>> to users.
>>>>>> Considering the workload, we can focus more on this version.
>>>>>>
>>>>>> 3. I have no objection to splitting this flip if everyone feels that the
>>>>>> work included is too much.
>>>>>> Regarding the support of session tvf, it seems that the main problem is
>>>>>> that this part of the description occupies a large part of the flip,
>>>>>> causing some misunderstandings.
>>>>>> This is indeed a predetermined task in FLIP-145, just adding more
>>>>>> explanation about semantics. In addition, I saw the discussion history in
>>>>>> FLINK-24024[3], thanks Sergey for being willing to help driving this work
>>>>>> together.
>>>>>>
>>>>>> [1]
>>>>>> https://cwiki.apache.org/confluence/display/FLINK/FLIP-392%3A+Deprecate+the+Legacy+Group+Window+Aggregation
>>>>>> [2]
>>>>>> https://cwiki.apache.org/confluence/display/FLINK/FLIP-145%3A+Support+SQL+windowing+table-valued+function
>>>>>> [3] https://issues.apache.org/jira/browse/FLINK-24024
>>>>>>
>>>>>> Best,
>>>>>> Lincoln Lee
>>>>>>
>>>>>>
>>>>>> Sergey Nuyanzin <sn...@gmail.com> 于2023年12月13日周三 08:02写道:
>>>>>>
>>>>>>> thanks for summarising Timo
>>>>>>>
>>>>>>> +1 for splitting it in different FLIPs
>>>>>>> and agree about having "SESSION Window TVF Aggregation" under FLIP-145
>>>>>>> Moreover the task is already there, so no need to move it from one FLIP to
>>>>>>> another
>>>>>>>
>>>>>>>> And actually Sergey Nuyanzin wanted to work
>>>>>>>> in this if I remember correctly. Not sure if this is still the case.
>>>>>>>
>>>>>>> Yes, however it seems there is already an existing PR for that.
>>>>>>> Anyway I'm happy to help here with the review as well and will reserve some
>>>>>>> time for it in coming days.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On Tue, Dec 12, 2023 at 12:18 PM Timo Walther <tw...@apache.org> wrote:
>>>>>>>
>>>>>>>> Hi Xuyang,
>>>>>>>>
>>>>>>>> thanks for proposing this FLIP. In my opinion the FLIP touches too many
>>>>>>>> topics at the same time and should be split into multiple FLIPs. We
>>>>>>>> should stay focused on what is needed for Flink 2.0.
>>>>>>>>
>>>>>>>> Let me summarizing the topics:
>>>>>>>>
>>>>>>>> 1) SESSION Window TVF Aggregation
>>>>>>>>
>>>>>>>> This has been agreed in FLIP-145 already. We don't need another FLIP but
>>>>>>>> someone that finally implements this after we have performed the Calcite
>>>>>>>> upgrade a couple of months ago. The Calcite upgrade was important
>>>>>>>> exactly for SESSION windows. And actually Sergey Nuyanzin wanted to work
>>>>>>>> in this if I remember correctly. Not sure if this is still the case.
>>>>>>>>
>>>>>>>> 2) CDC support of Window TVFs
>>>>>>>>
>>>>>>>> This can be a FLIP on its own.
>>>>>>>>
>>>>>>>> 3) HOP window size with non-integer step length
>>>>>>>>
>>>>>>>> This can be a FLIP on its own.
>>>>>>>>
>>>>>>>> 4) Configurations such as early fire, late fire and allow lateness
>>>>>>>>
>>>>>>>> Can we postpone this discussion? Currently we should focus on user
>>>>>>>> switching to Window TVFs before Flink 2.0. Early fire, late fire and
>>>>>>>> allow lateness have not exposed through public configuration. It can be
>>>>>>>> introduced after Flink 2.0 released.
>>>>>>>>
>>>>>>>> Regards,
>>>>>>>> Timo
>>>>>>>>
>>>>>>>>
>>>>>>>> On 12.12.23 08:01, Xuyang wrote:
>>>>>>>>> Hi, Jim.
>>>>>>>>> Thanks for your explaination.
>>>>>>>>>> Ah, I mean to ask if you can contribute the new SESSION Table support
>>>>>>>>>> without needing FLIP-392 completely settled.  I was trying to see if
>>>>>>>> that
>>>>>>>>>> is separate work which can be done or if there is some dependency on
>>>>>>>> this
>>>>>>>>>> FLIP.
>>>>>>>>> The pr available about session window tvf belongs to this flip I think,
>>>>>>>> and is part of the work about this flip. Actually the poc pr is not ready
>>>>>>>> completely yet,
>>>>>>>>> I'll try to update it to implement the session window tvf in window agg
>>>>>>>> operator instead of using legacy group window agg operator.
>>>>>>>>>> The tests should not be impacted.  Depending on what order our work
>>>>>>>> lands
>>>>>>>>>> in, one of the tests you've added/updated would likely move to the
>>>>>>>>>> RestoreTests that Bonnie and I are working on.  Just mentioning that
>>>>>>>> ahead
>>>>>>>>>> of time
>>>>>>>>>
>>>>>>>>> Got it! I will pay attention to it.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>>
>>>>>>>>>        Best!
>>>>>>>>>        Xuyang
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> 在 2023-12-11 21:35:00,"Jim Hughes" <jh...@confluent.io.INVALID> 写道:
>>>>>>>>>> Hi Xuyang,
>>>>>>>>>>
>>>>>>>>>> On Sun, Dec 10, 2023 at 10:41 PM Xuyang <xy...@163.com> wrote:
>>>>>>>>>>
>>>>>>>>>>> Hi, Jim.
>>>>>>>>>>>> As a clarification, since FLINK-24204 is finishing up work from
>>>>>>>>>>>> FLIP-145[1], do we need to discuss anything before you work out the
>>>>>>>>>>> details
>>>>>>>>>>>> of FLINK-24024 as a PR?
>>>>>>>>>>> Which issue do you mean? It seems that FLINK-24204[1] is the issue
>>>>>>> with
>>>>>>>>>>> table api&sql type system.
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Ah, I mean to ask if you can contribute the new SESSION Table support
>>>>>>>>>> without needing FLIP-392 completely settled.  I was trying to see if
>>>>>>>> that
>>>>>>>>>> is separate work which can be done or if there is some dependency on
>>>>>>>> this
>>>>>>>>>> FLIP.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>> I've got a PR up [3] for moving at least one of the classes you are
>>>>>>>>>>> touching.
>>>>>>>>>>> Nice work! Since we are not going to delete the legacy group window
>>>>>>> agg
>>>>>>>>>>> operator actually, the only compatibility issue
>>>>>>>>>>> may be that when using flink sql, the legacy group window agg
>>>>>>> operator
>>>>>>>>>>> will be rewritten into new operators. Will these tests be affected
>>>>>>>> about
>>>>>>>>>>> this rewritten?
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> The tests should not be impacted.  Depending on what order our work
>>>>>>>> lands
>>>>>>>>>> in, one of the tests you've added/updated would likely move to the
>>>>>>>>>> RestoreTests that Bonnie and I are working on.  Just mentioning that
>>>>>>>> ahead
>>>>>>>>>> of time
>>>>>>>>>>
>>>>>>>>>> Cheers,
>>>>>>>>>>
>>>>>>>>>> Jim
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> [1] https://issues.apache.org/jira/browse/FLINK-24204
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> --
>>>>>>>>>>>
>>>>>>>>>>>        Best!
>>>>>>>>>>>        Xuyang
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> At 2023-12-09 06:25:30, "Jim Hughes" <jh...@confluent.io.INVALID>
>>>>>>>> wrote:
>>>>>>>>>>>> Hi Xuyang,
>>>>>>>>>>>>
>>>>>>>>>>>> As a clarification, since FLINK-24204 is finishing up work from
>>>>>>>>>>>> FLIP-145[1], do we need to discuss anything before you work out the
>>>>>>>>>>> details
>>>>>>>>>>>> of FLINK-24024 as a PR?
>>>>>>>>>>>>
>>>>>>>>>>>> Relatedly, as that goes up for a PR, as part of FLINK-33421 [2],
>>>>>>>> Bonnie
>>>>>>>>>>> and
>>>>>>>>>>>> I are working through migrating some of the JsonPlan Tests and
>>>>>>>> ITCases to
>>>>>>>>>>>> RestoreTests.  I've got a PR up [3] for moving at least one of the
>>>>>>>> classes
>>>>>>>>>>>> you are touching.  Let me know if I can share any details about that
>>>>>>>> work.
>>>>>>>>>>>>
>>>>>>>>>>>> Cheers,
>>>>>>>>>>>>
>>>>>>>>>>>> Jim
>>>>>>>>>>>>
>>>>>>>>>>>> 1.
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>
>>>>>>> https://cwiki.apache.org/confluence/display/FLINK/FLIP-145%3A+Support+SQL+windowing+table-valued+function#FLIP145:SupportSQLwindowingtablevaluedfunction-SessionWindows
>>>>>>>>>>>>
>>>>>>>>>>>> 2. https://issues.apache.org/jira/browse/FLINK-33421
>>>>>>>>>>>> 3. https://github.com/apache/flink/pull/23886
>>>>>>>>>>>> https://issues.apache.org/jira/browse/FLINK-33676
>>>>>>>>>>>>
>>>>>>>>>>>> On Tue, Nov 28, 2023 at 7:31 AM Xuyang <xy...@163.com> wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>> Hi all.
>>>>>>>>>>>>> I'd like to start a discussion of FLIP-392: Deprecate the Legacy
>>>>>>>> Group
>>>>>>>>>>>>> Window Aggregation.
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> Although the current Flink SQL Window Aggregation documentation[1]
>>>>>>>>>>>>> indicates that the legacy Group Window Aggregation
>>>>>>>>>>>>> syntax has been deprecated, the new Window TVF Aggregation syntax
>>>>>>> has
>>>>>>>>>>> not
>>>>>>>>>>>>> fully covered all of the features of the legacy one.
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> Compared to Group Window Aggergation, Window TVF Aggergation has
>>>>>>>> several
>>>>>>>>>>>>> advantages, such as two-stage optimization,
>>>>>>>>>>>>> support for standard GROUPING SET syntax, and so on. However, it
>>>>>>>> needs
>>>>>>>>>>> to
>>>>>>>>>>>>> supplement and enrich the following features.
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> 1. Support for SESSION Window TVF Aggregation
>>>>>>>>>>>>> 2. Support for consuming CDC stream
>>>>>>>>>>>>> 3. Support for HOP window size with non-integer step length
>>>>>>>>>>>>> 4. Support for configurations such as early fire, late fire and
>>>>>>> allow
>>>>>>>>>>>>> lateness
>>>>>>>>>>>>> (which are internal experimental configurations in Group Window
>>>>>>>>>>>>> Aggregation and not public to users yet.)
>>>>>>>>>>>>> 5. Unification of the Window TVF Aggregation operator in runtime at
>>>>>>>> the
>>>>>>>>>>>>> implementation layer
>>>>>>>>>>>>> (In the long term, the cost to maintain the operators about Window
>>>>>>>> TVF
>>>>>>>>>>>>> Aggregation and Group Window Aggregation is too expensive.)
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> This flip aims to continue the unfinished work in FLIP-145[2],
>>>>>>> which
>>>>>>>> is
>>>>>>>>>>> to
>>>>>>>>>>>>> fully enable the capabilities of Window TVF Aggregation
>>>>>>>>>>>>>     and officially deprecate the legacy syntax Group Window
>>>>>>>> Aggregation, to
>>>>>>>>>>>>> prepare for the removal of the legacy one in Flink 2.0.
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> I have already done some preliminary POC to validate the
>>>>>>> feasibility
>>>>>>>> of
>>>>>>>>>>>>> the related work in this flip as follows.
>>>>>>>>>>>>> 1. POC for SESSION Window TVF Aggregation [3]
>>>>>>>>>>>>> 2. POC for CUMULATE in Group Window Aggregation operator [4]
>>>>>>>>>>>>> 3. POC for consuming CDC stream in Window Aggregation operator [5]
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> Looking forward to your feedback and thoughts!
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> [1]
>>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>
>>>>>>> https://nightlies.apache.org/flink/flink-docs-master/docs/dev/table/sql/queries/window-agg/
>>>>>>>>>>>>>
>>>>>>>>>>>>> [2]
>>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>
>>>>>>> https://cwiki.apache.org/confluence/display/FLINK/FLIP-145%3A+Support+SQL+windowing+table-valued+function#FLIP145:SupportSQLwindowingtablevaluedfunction-SessionWindows
>>>>>>>>>>>>> [3] https://github.com/xuyangzhong/flink/tree/FLINK-24024
>>>>>>>>>>>>> [4]
>>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>
>>>>>>> https://github.com/xuyangzhong/flink/tree/poc_legacy_group_window_agg_cumulate
>>>>>>>>>>>>> [5]
>>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>
>>>>>>> https://github.com/xuyangzhong/flink/tree/poc_window_agg_consumes_cdc_stream
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> --
>>>>>>>>>>>>>
>>>>>>>>>>>>>        Best!
>>>>>>>>>>>>>        Xuyang
>>>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Best regards,
>>>>>>> Sergey
>>>>>>>

Re: [DISCUSS] FLIP-392: Deprecate the Legacy Group Window Aggregation

Posted by Timo Walther <tw...@apache.org>.
Hi Xuyang,

sorry I missed the ping. Sounds reasonable to me. One FLIP about 
changelog semantics, the other about SQL semantics.

Regards,
Timo

On 19.12.23 02:39, Xuyang wrote:
> Hi, Timo. Sorry for this noise.
> What do you think about splitting the flip like this?
> 
> 
> 
> 
> --
> 
>      Best!
>      Xuyang
> 
> 
> 
> 
> 
> At 2023-12-15 10:05:32, "Xuyang" <xy...@163.com> wrote:
>> Hi, Timo, thanks for your advice.
>>
>>
>> I am considering splitting the existing flip into two while leaving the existing flip (or without).
>> One of them points to the completion of the operator about window tvf to support CDC (there are several
>> small work items, such as window agg, window rank, window join, etc. Due to time constraints,
>> the 1.19 version takes priority to complete the window agg). The other points to the HOP window tvf
>> supports a size that is a non-integer multiple of the step. Once these two flips are basically completed
>> in 1.19, we can consider officially deprecating the old group window agg syntax in the release note.
>>
>>
>> WDYT?
>>
>>
>>
>>
>> --
>>
>>     Best!
>>     Xuyang
>>
>>
>>
>>
>>
>> At 2023-12-14 17:51:01, "Timo Walther" <tw...@apache.org> wrote:
>>> Hi Xuyang,
>>>
>>>> I'm not spliting this flip is that all of these subtasks like session
>>> window tvf and cdc support do not change the public interface and the
>>> public syntax
>>>
>>> Given the length of this mailing list discussion and number of involved
>>> people I would strongly suggest to simplify the FLIP and give it a
>>> better title to make quicker progress. In general, we all seem to be on
>>> the same page in what we want. And both session TVF support and the
>>> deprecation of the legacy group windows has been voted already and
>>> discussed thouroughly. The FLIP can purely focus on the CDC topic.
>>>
>>> Cheers,
>>> Timo
>>>
>>>
>>> On 14.12.23 08:35, Xuyang wrote:
>>>> Hi, Timo, Sergey and Lincoln Lee. Thanks for your feedback.
>>>>
>>>>
>>>>> In my opinion the FLIP touches too many
>>>>> topics at the same time and should be split into multiple FLIPs. We > should stay focused on what is needed for Flink 2.0.
>>>> The main goal and topic of this Flip is to align the abilities between the legacy group window agg syntax and the new window tvf syntax,
>>>> and then we can say that the legacy window syntax will be deprecated. IMO, although there are many misalignments about these two
>>>> syntaxes, such as session window tvf, cdc support and so on,  they are all the subtasks we need to do in this flip. Another reason I'm not
>>>> spliting this flip is that all of these subtasks like session window tvf and cdc support do not change the public interface and the public
>>>> syntax, the implements of them will only be in modules table-planner and table-runtime.
>>>>
>>>>
>>>>> Can we postpone this discussion? Currently we should focus on user
>>>>> switching to Window TVFs before Flink 2.0. Early fire, late fire and > allow lateness have not exposed through public configuration. It can be > introduced after Flink 2.0 released.
>>>>
>>>>
>>>> Agree with you. This flip will not and should not expose these experimental flink conf to users. I list them in this flip just aims to show the
>>>> misalignments about these two window syntaxes.
>>>>
>>>>
>>>> Look for your thought.
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>>
>>>>       Best!
>>>>       Xuyang
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> At 2023-12-13 15:40:16, "Lincoln Lee" <li...@gmail.com> wrote:
>>>>> Thanks Xuyang driving this work! It's great that everyone agrees with the
>>>>> work itself in this flip[1]!
>>>>>
>>>>> Regarding whether to split the flip or adjust the scope of this flip, I'd
>>>>> like to share some thoughts:
>>>>>
>>>>> 1. About the title of this flip, what I want to say is that flip-145[2] had
>>>>> marked the legacy group window deprecated in the documentation but the
>>>>> functionality of the new syntax is not aligned with the legacy one.
>>>>> This is not a user-friendly deprecation, so the initiation of this flip, as
>>>>> I understand it, is for the formal deprecation of the legacy window, which
>>>>> requires us to complete the functionality alignment.
>>>>>
>>>>> 2. Agree with Timo that we can process the late-fire/early-fire features
>>>>> separately. These experimental parameters have not been officially opened
>>>>> to users.
>>>>> Considering the workload, we can focus more on this version.
>>>>>
>>>>> 3. I have no objection to splitting this flip if everyone feels that the
>>>>> work included is too much.
>>>>> Regarding the support of session tvf, it seems that the main problem is
>>>>> that this part of the description occupies a large part of the flip,
>>>>> causing some misunderstandings.
>>>>> This is indeed a predetermined task in FLIP-145, just adding more
>>>>> explanation about semantics. In addition, I saw the discussion history in
>>>>> FLINK-24024[3], thanks Sergey for being willing to help driving this work
>>>>> together.
>>>>>
>>>>> [1]
>>>>> https://cwiki.apache.org/confluence/display/FLINK/FLIP-392%3A+Deprecate+the+Legacy+Group+Window+Aggregation
>>>>> [2]
>>>>> https://cwiki.apache.org/confluence/display/FLINK/FLIP-145%3A+Support+SQL+windowing+table-valued+function
>>>>> [3] https://issues.apache.org/jira/browse/FLINK-24024
>>>>>
>>>>> Best,
>>>>> Lincoln Lee
>>>>>
>>>>>
>>>>> Sergey Nuyanzin <sn...@gmail.com> 于2023年12月13日周三 08:02写道:
>>>>>
>>>>>> thanks for summarising Timo
>>>>>>
>>>>>> +1 for splitting it in different FLIPs
>>>>>> and agree about having "SESSION Window TVF Aggregation" under FLIP-145
>>>>>> Moreover the task is already there, so no need to move it from one FLIP to
>>>>>> another
>>>>>>
>>>>>>> And actually Sergey Nuyanzin wanted to work
>>>>>>> in this if I remember correctly. Not sure if this is still the case.
>>>>>>
>>>>>> Yes, however it seems there is already an existing PR for that.
>>>>>> Anyway I'm happy to help here with the review as well and will reserve some
>>>>>> time for it in coming days.
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Tue, Dec 12, 2023 at 12:18 PM Timo Walther <tw...@apache.org> wrote:
>>>>>>
>>>>>>> Hi Xuyang,
>>>>>>>
>>>>>>> thanks for proposing this FLIP. In my opinion the FLIP touches too many
>>>>>>> topics at the same time and should be split into multiple FLIPs. We
>>>>>>> should stay focused on what is needed for Flink 2.0.
>>>>>>>
>>>>>>> Let me summarizing the topics:
>>>>>>>
>>>>>>> 1) SESSION Window TVF Aggregation
>>>>>>>
>>>>>>> This has been agreed in FLIP-145 already. We don't need another FLIP but
>>>>>>> someone that finally implements this after we have performed the Calcite
>>>>>>> upgrade a couple of months ago. The Calcite upgrade was important
>>>>>>> exactly for SESSION windows. And actually Sergey Nuyanzin wanted to work
>>>>>>> in this if I remember correctly. Not sure if this is still the case.
>>>>>>>
>>>>>>> 2) CDC support of Window TVFs
>>>>>>>
>>>>>>> This can be a FLIP on its own.
>>>>>>>
>>>>>>> 3) HOP window size with non-integer step length
>>>>>>>
>>>>>>> This can be a FLIP on its own.
>>>>>>>
>>>>>>> 4) Configurations such as early fire, late fire and allow lateness
>>>>>>>
>>>>>>> Can we postpone this discussion? Currently we should focus on user
>>>>>>> switching to Window TVFs before Flink 2.0. Early fire, late fire and
>>>>>>> allow lateness have not exposed through public configuration. It can be
>>>>>>> introduced after Flink 2.0 released.
>>>>>>>
>>>>>>> Regards,
>>>>>>> Timo
>>>>>>>
>>>>>>>
>>>>>>> On 12.12.23 08:01, Xuyang wrote:
>>>>>>>> Hi, Jim.
>>>>>>>> Thanks for your explaination.
>>>>>>>>> Ah, I mean to ask if you can contribute the new SESSION Table support
>>>>>>>>> without needing FLIP-392 completely settled.  I was trying to see if
>>>>>>> that
>>>>>>>>> is separate work which can be done or if there is some dependency on
>>>>>>> this
>>>>>>>>> FLIP.
>>>>>>>> The pr available about session window tvf belongs to this flip I think,
>>>>>>> and is part of the work about this flip. Actually the poc pr is not ready
>>>>>>> completely yet,
>>>>>>>> I'll try to update it to implement the session window tvf in window agg
>>>>>>> operator instead of using legacy group window agg operator.
>>>>>>>>> The tests should not be impacted.  Depending on what order our work
>>>>>>> lands
>>>>>>>>> in, one of the tests you've added/updated would likely move to the
>>>>>>>>> RestoreTests that Bonnie and I are working on.  Just mentioning that
>>>>>>> ahead
>>>>>>>>> of time
>>>>>>>>
>>>>>>>> Got it! I will pay attention to it.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>>
>>>>>>>>        Best!
>>>>>>>>        Xuyang
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> 在 2023-12-11 21:35:00,"Jim Hughes" <jh...@confluent.io.INVALID> 写道:
>>>>>>>>> Hi Xuyang,
>>>>>>>>>
>>>>>>>>> On Sun, Dec 10, 2023 at 10:41 PM Xuyang <xy...@163.com> wrote:
>>>>>>>>>
>>>>>>>>>> Hi, Jim.
>>>>>>>>>>> As a clarification, since FLINK-24204 is finishing up work from
>>>>>>>>>>> FLIP-145[1], do we need to discuss anything before you work out the
>>>>>>>>>> details
>>>>>>>>>>> of FLINK-24024 as a PR?
>>>>>>>>>> Which issue do you mean? It seems that FLINK-24204[1] is the issue
>>>>>> with
>>>>>>>>>> table api&sql type system.
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Ah, I mean to ask if you can contribute the new SESSION Table support
>>>>>>>>> without needing FLIP-392 completely settled.  I was trying to see if
>>>>>>> that
>>>>>>>>> is separate work which can be done or if there is some dependency on
>>>>>>> this
>>>>>>>>> FLIP.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>> I've got a PR up [3] for moving at least one of the classes you are
>>>>>>>>>> touching.
>>>>>>>>>> Nice work! Since we are not going to delete the legacy group window
>>>>>> agg
>>>>>>>>>> operator actually, the only compatibility issue
>>>>>>>>>> may be that when using flink sql, the legacy group window agg
>>>>>> operator
>>>>>>>>>> will be rewritten into new operators. Will these tests be affected
>>>>>>> about
>>>>>>>>>> this rewritten?
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>> The tests should not be impacted.  Depending on what order our work
>>>>>>> lands
>>>>>>>>> in, one of the tests you've added/updated would likely move to the
>>>>>>>>> RestoreTests that Bonnie and I are working on.  Just mentioning that
>>>>>>> ahead
>>>>>>>>> of time
>>>>>>>>>
>>>>>>>>> Cheers,
>>>>>>>>>
>>>>>>>>> Jim
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> [1] https://issues.apache.org/jira/browse/FLINK-24204
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>>
>>>>>>>>>>        Best!
>>>>>>>>>>        Xuyang
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> At 2023-12-09 06:25:30, "Jim Hughes" <jh...@confluent.io.INVALID>
>>>>>>> wrote:
>>>>>>>>>>> Hi Xuyang,
>>>>>>>>>>>
>>>>>>>>>>> As a clarification, since FLINK-24204 is finishing up work from
>>>>>>>>>>> FLIP-145[1], do we need to discuss anything before you work out the
>>>>>>>>>> details
>>>>>>>>>>> of FLINK-24024 as a PR?
>>>>>>>>>>>
>>>>>>>>>>> Relatedly, as that goes up for a PR, as part of FLINK-33421 [2],
>>>>>>> Bonnie
>>>>>>>>>> and
>>>>>>>>>>> I are working through migrating some of the JsonPlan Tests and
>>>>>>> ITCases to
>>>>>>>>>>> RestoreTests.  I've got a PR up [3] for moving at least one of the
>>>>>>> classes
>>>>>>>>>>> you are touching.  Let me know if I can share any details about that
>>>>>>> work.
>>>>>>>>>>>
>>>>>>>>>>> Cheers,
>>>>>>>>>>>
>>>>>>>>>>> Jim
>>>>>>>>>>>
>>>>>>>>>>> 1.
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>
>>>>>> https://cwiki.apache.org/confluence/display/FLINK/FLIP-145%3A+Support+SQL+windowing+table-valued+function#FLIP145:SupportSQLwindowingtablevaluedfunction-SessionWindows
>>>>>>>>>>>
>>>>>>>>>>> 2. https://issues.apache.org/jira/browse/FLINK-33421
>>>>>>>>>>> 3. https://github.com/apache/flink/pull/23886
>>>>>>>>>>> https://issues.apache.org/jira/browse/FLINK-33676
>>>>>>>>>>>
>>>>>>>>>>> On Tue, Nov 28, 2023 at 7:31 AM Xuyang <xy...@163.com> wrote:
>>>>>>>>>>>
>>>>>>>>>>>> Hi all.
>>>>>>>>>>>> I'd like to start a discussion of FLIP-392: Deprecate the Legacy
>>>>>>> Group
>>>>>>>>>>>> Window Aggregation.
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> Although the current Flink SQL Window Aggregation documentation[1]
>>>>>>>>>>>> indicates that the legacy Group Window Aggregation
>>>>>>>>>>>> syntax has been deprecated, the new Window TVF Aggregation syntax
>>>>>> has
>>>>>>>>>> not
>>>>>>>>>>>> fully covered all of the features of the legacy one.
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> Compared to Group Window Aggergation, Window TVF Aggergation has
>>>>>>> several
>>>>>>>>>>>> advantages, such as two-stage optimization,
>>>>>>>>>>>> support for standard GROUPING SET syntax, and so on. However, it
>>>>>>> needs
>>>>>>>>>> to
>>>>>>>>>>>> supplement and enrich the following features.
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> 1. Support for SESSION Window TVF Aggregation
>>>>>>>>>>>> 2. Support for consuming CDC stream
>>>>>>>>>>>> 3. Support for HOP window size with non-integer step length
>>>>>>>>>>>> 4. Support for configurations such as early fire, late fire and
>>>>>> allow
>>>>>>>>>>>> lateness
>>>>>>>>>>>> (which are internal experimental configurations in Group Window
>>>>>>>>>>>> Aggregation and not public to users yet.)
>>>>>>>>>>>> 5. Unification of the Window TVF Aggregation operator in runtime at
>>>>>>> the
>>>>>>>>>>>> implementation layer
>>>>>>>>>>>> (In the long term, the cost to maintain the operators about Window
>>>>>>> TVF
>>>>>>>>>>>> Aggregation and Group Window Aggregation is too expensive.)
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> This flip aims to continue the unfinished work in FLIP-145[2],
>>>>>> which
>>>>>>> is
>>>>>>>>>> to
>>>>>>>>>>>> fully enable the capabilities of Window TVF Aggregation
>>>>>>>>>>>>     and officially deprecate the legacy syntax Group Window
>>>>>>> Aggregation, to
>>>>>>>>>>>> prepare for the removal of the legacy one in Flink 2.0.
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> I have already done some preliminary POC to validate the
>>>>>> feasibility
>>>>>>> of
>>>>>>>>>>>> the related work in this flip as follows.
>>>>>>>>>>>> 1. POC for SESSION Window TVF Aggregation [3]
>>>>>>>>>>>> 2. POC for CUMULATE in Group Window Aggregation operator [4]
>>>>>>>>>>>> 3. POC for consuming CDC stream in Window Aggregation operator [5]
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> Looking forward to your feedback and thoughts!
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> [1]
>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>
>>>>>> https://nightlies.apache.org/flink/flink-docs-master/docs/dev/table/sql/queries/window-agg/
>>>>>>>>>>>>
>>>>>>>>>>>> [2]
>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>
>>>>>> https://cwiki.apache.org/confluence/display/FLINK/FLIP-145%3A+Support+SQL+windowing+table-valued+function#FLIP145:SupportSQLwindowingtablevaluedfunction-SessionWindows
>>>>>>>>>>>> [3] https://github.com/xuyangzhong/flink/tree/FLINK-24024
>>>>>>>>>>>> [4]
>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>
>>>>>> https://github.com/xuyangzhong/flink/tree/poc_legacy_group_window_agg_cumulate
>>>>>>>>>>>> [5]
>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>
>>>>>> https://github.com/xuyangzhong/flink/tree/poc_window_agg_consumes_cdc_stream
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> --
>>>>>>>>>>>>
>>>>>>>>>>>>        Best!
>>>>>>>>>>>>        Xuyang
>>>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> --
>>>>>> Best regards,
>>>>>> Sergey
>>>>>>


Re:Re:Re: [DISCUSS] FLIP-392: Deprecate the Legacy Group Window Aggregation

Posted by Xuyang <xy...@163.com>.
Hi, Timo. Sorry for this noise.
What do you think about splitting the flip like this?




--

    Best!
    Xuyang





At 2023-12-15 10:05:32, "Xuyang" <xy...@163.com> wrote:
>Hi, Timo, thanks for your advice.
>
>
>I am considering splitting the existing flip into two while leaving the existing flip (or without). 
>One of them points to the completion of the operator about window tvf to support CDC (there are several 
>small work items, such as window agg, window rank, window join, etc. Due to time constraints, 
>the 1.19 version takes priority to complete the window agg). The other points to the HOP window tvf
>supports a size that is a non-integer multiple of the step. Once these two flips are basically completed 
>in 1.19, we can consider officially deprecating the old group window agg syntax in the release note.
>
>
>WDYT?
>
>
>
>
>--
>
>    Best!
>    Xuyang
>
>
>
>
>
>At 2023-12-14 17:51:01, "Timo Walther" <tw...@apache.org> wrote:
>>Hi Xuyang,
>>
>> > I'm not spliting this flip is that all of these subtasks like session 
>>window tvf and cdc support do not change the public interface and the 
>>public syntax
>>
>>Given the length of this mailing list discussion and number of involved 
>>people I would strongly suggest to simplify the FLIP and give it a 
>>better title to make quicker progress. In general, we all seem to be on 
>>the same page in what we want. And both session TVF support and the 
>>deprecation of the legacy group windows has been voted already and 
>>discussed thouroughly. The FLIP can purely focus on the CDC topic.
>>
>>Cheers,
>>Timo
>>
>>
>>On 14.12.23 08:35, Xuyang wrote:
>>> Hi, Timo, Sergey and Lincoln Lee. Thanks for your feedback.
>>> 
>>> 
>>>> In my opinion the FLIP touches too many
>>>> topics at the same time and should be split into multiple FLIPs. We > should stay focused on what is needed for Flink 2.0.
>>> The main goal and topic of this Flip is to align the abilities between the legacy group window agg syntax and the new window tvf syntax,
>>> and then we can say that the legacy window syntax will be deprecated. IMO, although there are many misalignments about these two
>>> syntaxes, such as session window tvf, cdc support and so on,  they are all the subtasks we need to do in this flip. Another reason I'm not
>>> spliting this flip is that all of these subtasks like session window tvf and cdc support do not change the public interface and the public
>>> syntax, the implements of them will only be in modules table-planner and table-runtime.
>>> 
>>> 
>>>> Can we postpone this discussion? Currently we should focus on user
>>>> switching to Window TVFs before Flink 2.0. Early fire, late fire and > allow lateness have not exposed through public configuration. It can be > introduced after Flink 2.0 released.
>>> 
>>> 
>>> Agree with you. This flip will not and should not expose these experimental flink conf to users. I list them in this flip just aims to show the
>>> misalignments about these two window syntaxes.
>>> 
>>> 
>>> Look for your thought.
>>> 
>>> 
>>> 
>>> 
>>> --
>>> 
>>>      Best!
>>>      Xuyang
>>> 
>>> 
>>> 
>>> 
>>> 
>>> At 2023-12-13 15:40:16, "Lincoln Lee" <li...@gmail.com> wrote:
>>>> Thanks Xuyang driving this work! It's great that everyone agrees with the
>>>> work itself in this flip[1]!
>>>>
>>>> Regarding whether to split the flip or adjust the scope of this flip, I'd
>>>> like to share some thoughts:
>>>>
>>>> 1. About the title of this flip, what I want to say is that flip-145[2] had
>>>> marked the legacy group window deprecated in the documentation but the
>>>> functionality of the new syntax is not aligned with the legacy one.
>>>> This is not a user-friendly deprecation, so the initiation of this flip, as
>>>> I understand it, is for the formal deprecation of the legacy window, which
>>>> requires us to complete the functionality alignment.
>>>>
>>>> 2. Agree with Timo that we can process the late-fire/early-fire features
>>>> separately. These experimental parameters have not been officially opened
>>>> to users.
>>>> Considering the workload, we can focus more on this version.
>>>>
>>>> 3. I have no objection to splitting this flip if everyone feels that the
>>>> work included is too much.
>>>> Regarding the support of session tvf, it seems that the main problem is
>>>> that this part of the description occupies a large part of the flip,
>>>> causing some misunderstandings.
>>>> This is indeed a predetermined task in FLIP-145, just adding more
>>>> explanation about semantics. In addition, I saw the discussion history in
>>>> FLINK-24024[3], thanks Sergey for being willing to help driving this work
>>>> together.
>>>>
>>>> [1]
>>>> https://cwiki.apache.org/confluence/display/FLINK/FLIP-392%3A+Deprecate+the+Legacy+Group+Window+Aggregation
>>>> [2]
>>>> https://cwiki.apache.org/confluence/display/FLINK/FLIP-145%3A+Support+SQL+windowing+table-valued+function
>>>> [3] https://issues.apache.org/jira/browse/FLINK-24024
>>>>
>>>> Best,
>>>> Lincoln Lee
>>>>
>>>>
>>>> Sergey Nuyanzin <sn...@gmail.com> 于2023年12月13日周三 08:02写道:
>>>>
>>>>> thanks for summarising Timo
>>>>>
>>>>> +1 for splitting it in different FLIPs
>>>>> and agree about having "SESSION Window TVF Aggregation" under FLIP-145
>>>>> Moreover the task is already there, so no need to move it from one FLIP to
>>>>> another
>>>>>
>>>>>> And actually Sergey Nuyanzin wanted to work
>>>>>> in this if I remember correctly. Not sure if this is still the case.
>>>>>
>>>>> Yes, however it seems there is already an existing PR for that.
>>>>> Anyway I'm happy to help here with the review as well and will reserve some
>>>>> time for it in coming days.
>>>>>
>>>>>
>>>>>
>>>>> On Tue, Dec 12, 2023 at 12:18 PM Timo Walther <tw...@apache.org> wrote:
>>>>>
>>>>>> Hi Xuyang,
>>>>>>
>>>>>> thanks for proposing this FLIP. In my opinion the FLIP touches too many
>>>>>> topics at the same time and should be split into multiple FLIPs. We
>>>>>> should stay focused on what is needed for Flink 2.0.
>>>>>>
>>>>>> Let me summarizing the topics:
>>>>>>
>>>>>> 1) SESSION Window TVF Aggregation
>>>>>>
>>>>>> This has been agreed in FLIP-145 already. We don't need another FLIP but
>>>>>> someone that finally implements this after we have performed the Calcite
>>>>>> upgrade a couple of months ago. The Calcite upgrade was important
>>>>>> exactly for SESSION windows. And actually Sergey Nuyanzin wanted to work
>>>>>> in this if I remember correctly. Not sure if this is still the case.
>>>>>>
>>>>>> 2) CDC support of Window TVFs
>>>>>>
>>>>>> This can be a FLIP on its own.
>>>>>>
>>>>>> 3) HOP window size with non-integer step length
>>>>>>
>>>>>> This can be a FLIP on its own.
>>>>>>
>>>>>> 4) Configurations such as early fire, late fire and allow lateness
>>>>>>
>>>>>> Can we postpone this discussion? Currently we should focus on user
>>>>>> switching to Window TVFs before Flink 2.0. Early fire, late fire and
>>>>>> allow lateness have not exposed through public configuration. It can be
>>>>>> introduced after Flink 2.0 released.
>>>>>>
>>>>>> Regards,
>>>>>> Timo
>>>>>>
>>>>>>
>>>>>> On 12.12.23 08:01, Xuyang wrote:
>>>>>>> Hi, Jim.
>>>>>>> Thanks for your explaination.
>>>>>>>> Ah, I mean to ask if you can contribute the new SESSION Table support
>>>>>>>> without needing FLIP-392 completely settled.  I was trying to see if
>>>>>> that
>>>>>>>> is separate work which can be done or if there is some dependency on
>>>>>> this
>>>>>>>> FLIP.
>>>>>>> The pr available about session window tvf belongs to this flip I think,
>>>>>> and is part of the work about this flip. Actually the poc pr is not ready
>>>>>> completely yet,
>>>>>>> I'll try to update it to implement the session window tvf in window agg
>>>>>> operator instead of using legacy group window agg operator.
>>>>>>>> The tests should not be impacted.  Depending on what order our work
>>>>>> lands
>>>>>>>> in, one of the tests you've added/updated would likely move to the
>>>>>>>> RestoreTests that Bonnie and I are working on.  Just mentioning that
>>>>>> ahead
>>>>>>>> of time
>>>>>>>
>>>>>>> Got it! I will pay attention to it.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>>
>>>>>>>       Best!
>>>>>>>       Xuyang
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> 在 2023-12-11 21:35:00,"Jim Hughes" <jh...@confluent.io.INVALID> 写道:
>>>>>>>> Hi Xuyang,
>>>>>>>>
>>>>>>>> On Sun, Dec 10, 2023 at 10:41 PM Xuyang <xy...@163.com> wrote:
>>>>>>>>
>>>>>>>>> Hi, Jim.
>>>>>>>>>> As a clarification, since FLINK-24204 is finishing up work from
>>>>>>>>>> FLIP-145[1], do we need to discuss anything before you work out the
>>>>>>>>> details
>>>>>>>>>> of FLINK-24024 as a PR?
>>>>>>>>> Which issue do you mean? It seems that FLINK-24204[1] is the issue
>>>>> with
>>>>>>>>> table api&sql type system.
>>>>>>>>>
>>>>>>>>
>>>>>>>> Ah, I mean to ask if you can contribute the new SESSION Table support
>>>>>>>> without needing FLIP-392 completely settled.  I was trying to see if
>>>>>> that
>>>>>>>> is separate work which can be done or if there is some dependency on
>>>>>> this
>>>>>>>> FLIP.
>>>>>>>>
>>>>>>>>
>>>>>>>>> I've got a PR up [3] for moving at least one of the classes you are
>>>>>>>>> touching.
>>>>>>>>> Nice work! Since we are not going to delete the legacy group window
>>>>> agg
>>>>>>>>> operator actually, the only compatibility issue
>>>>>>>>> may be that when using flink sql, the legacy group window agg
>>>>> operator
>>>>>>>>> will be rewritten into new operators. Will these tests be affected
>>>>>> about
>>>>>>>>> this rewritten?
>>>>>>>>>
>>>>>>>>
>>>>>>>> The tests should not be impacted.  Depending on what order our work
>>>>>> lands
>>>>>>>> in, one of the tests you've added/updated would likely move to the
>>>>>>>> RestoreTests that Bonnie and I are working on.  Just mentioning that
>>>>>> ahead
>>>>>>>> of time
>>>>>>>>
>>>>>>>> Cheers,
>>>>>>>>
>>>>>>>> Jim
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>>
>>>>>>>>> [1] https://issues.apache.org/jira/browse/FLINK-24204
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>>
>>>>>>>>>       Best!
>>>>>>>>>       Xuyang
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> At 2023-12-09 06:25:30, "Jim Hughes" <jh...@confluent.io.INVALID>
>>>>>> wrote:
>>>>>>>>>> Hi Xuyang,
>>>>>>>>>>
>>>>>>>>>> As a clarification, since FLINK-24204 is finishing up work from
>>>>>>>>>> FLIP-145[1], do we need to discuss anything before you work out the
>>>>>>>>> details
>>>>>>>>>> of FLINK-24024 as a PR?
>>>>>>>>>>
>>>>>>>>>> Relatedly, as that goes up for a PR, as part of FLINK-33421 [2],
>>>>>> Bonnie
>>>>>>>>> and
>>>>>>>>>> I are working through migrating some of the JsonPlan Tests and
>>>>>> ITCases to
>>>>>>>>>> RestoreTests.  I've got a PR up [3] for moving at least one of the
>>>>>> classes
>>>>>>>>>> you are touching.  Let me know if I can share any details about that
>>>>>> work.
>>>>>>>>>>
>>>>>>>>>> Cheers,
>>>>>>>>>>
>>>>>>>>>> Jim
>>>>>>>>>>
>>>>>>>>>> 1.
>>>>>>>>>>
>>>>>>>>>
>>>>>>
>>>>> https://cwiki.apache.org/confluence/display/FLINK/FLIP-145%3A+Support+SQL+windowing+table-valued+function#FLIP145:SupportSQLwindowingtablevaluedfunction-SessionWindows
>>>>>>>>>>
>>>>>>>>>> 2. https://issues.apache.org/jira/browse/FLINK-33421
>>>>>>>>>> 3. https://github.com/apache/flink/pull/23886
>>>>>>>>>> https://issues.apache.org/jira/browse/FLINK-33676
>>>>>>>>>>
>>>>>>>>>> On Tue, Nov 28, 2023 at 7:31 AM Xuyang <xy...@163.com> wrote:
>>>>>>>>>>
>>>>>>>>>>> Hi all.
>>>>>>>>>>> I'd like to start a discussion of FLIP-392: Deprecate the Legacy
>>>>>> Group
>>>>>>>>>>> Window Aggregation.
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> Although the current Flink SQL Window Aggregation documentation[1]
>>>>>>>>>>> indicates that the legacy Group Window Aggregation
>>>>>>>>>>> syntax has been deprecated, the new Window TVF Aggregation syntax
>>>>> has
>>>>>>>>> not
>>>>>>>>>>> fully covered all of the features of the legacy one.
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> Compared to Group Window Aggergation, Window TVF Aggergation has
>>>>>> several
>>>>>>>>>>> advantages, such as two-stage optimization,
>>>>>>>>>>> support for standard GROUPING SET syntax, and so on. However, it
>>>>>> needs
>>>>>>>>> to
>>>>>>>>>>> supplement and enrich the following features.
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> 1. Support for SESSION Window TVF Aggregation
>>>>>>>>>>> 2. Support for consuming CDC stream
>>>>>>>>>>> 3. Support for HOP window size with non-integer step length
>>>>>>>>>>> 4. Support for configurations such as early fire, late fire and
>>>>> allow
>>>>>>>>>>> lateness
>>>>>>>>>>> (which are internal experimental configurations in Group Window
>>>>>>>>>>> Aggregation and not public to users yet.)
>>>>>>>>>>> 5. Unification of the Window TVF Aggregation operator in runtime at
>>>>>> the
>>>>>>>>>>> implementation layer
>>>>>>>>>>> (In the long term, the cost to maintain the operators about Window
>>>>>> TVF
>>>>>>>>>>> Aggregation and Group Window Aggregation is too expensive.)
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> This flip aims to continue the unfinished work in FLIP-145[2],
>>>>> which
>>>>>> is
>>>>>>>>> to
>>>>>>>>>>> fully enable the capabilities of Window TVF Aggregation
>>>>>>>>>>>    and officially deprecate the legacy syntax Group Window
>>>>>> Aggregation, to
>>>>>>>>>>> prepare for the removal of the legacy one in Flink 2.0.
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> I have already done some preliminary POC to validate the
>>>>> feasibility
>>>>>> of
>>>>>>>>>>> the related work in this flip as follows.
>>>>>>>>>>> 1. POC for SESSION Window TVF Aggregation [3]
>>>>>>>>>>> 2. POC for CUMULATE in Group Window Aggregation operator [4]
>>>>>>>>>>> 3. POC for consuming CDC stream in Window Aggregation operator [5]
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> Looking forward to your feedback and thoughts!
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> [1]
>>>>>>>>>>>
>>>>>>>>>
>>>>>>
>>>>> https://nightlies.apache.org/flink/flink-docs-master/docs/dev/table/sql/queries/window-agg/
>>>>>>>>>>>
>>>>>>>>>>> [2]
>>>>>>>>>>>
>>>>>>>>>
>>>>>>
>>>>> https://cwiki.apache.org/confluence/display/FLINK/FLIP-145%3A+Support+SQL+windowing+table-valued+function#FLIP145:SupportSQLwindowingtablevaluedfunction-SessionWindows
>>>>>>>>>>> [3] https://github.com/xuyangzhong/flink/tree/FLINK-24024
>>>>>>>>>>> [4]
>>>>>>>>>>>
>>>>>>>>>
>>>>>>
>>>>> https://github.com/xuyangzhong/flink/tree/poc_legacy_group_window_agg_cumulate
>>>>>>>>>>> [5]
>>>>>>>>>>>
>>>>>>>>>
>>>>>>
>>>>> https://github.com/xuyangzhong/flink/tree/poc_window_agg_consumes_cdc_stream
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> --
>>>>>>>>>>>
>>>>>>>>>>>       Best!
>>>>>>>>>>>       Xuyang
>>>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> --
>>>>> Best regards,
>>>>> Sergey
>>>>>

Re:Re: [DISCUSS] FLIP-392: Deprecate the Legacy Group Window Aggregation

Posted by Xuyang <xy...@163.com>.
Hi, Timo, thanks for your advice.


I am considering splitting the existing flip into two while leaving the existing flip (or without). 
One of them points to the completion of the operator about window tvf to support CDC (there are several 
small work items, such as window agg, window rank, window join, etc. Due to time constraints, 
the 1.19 version takes priority to complete the window agg). The other points to the HOP window tvf
supports a size that is a non-integer multiple of the step. Once these two flips are basically completed 
in 1.19, we can consider officially deprecating the old group window agg syntax in the release note.


WDYT?




--

    Best!
    Xuyang





At 2023-12-14 17:51:01, "Timo Walther" <tw...@apache.org> wrote:
>Hi Xuyang,
>
> > I'm not spliting this flip is that all of these subtasks like session 
>window tvf and cdc support do not change the public interface and the 
>public syntax
>
>Given the length of this mailing list discussion and number of involved 
>people I would strongly suggest to simplify the FLIP and give it a 
>better title to make quicker progress. In general, we all seem to be on 
>the same page in what we want. And both session TVF support and the 
>deprecation of the legacy group windows has been voted already and 
>discussed thouroughly. The FLIP can purely focus on the CDC topic.
>
>Cheers,
>Timo
>
>
>On 14.12.23 08:35, Xuyang wrote:
>> Hi, Timo, Sergey and Lincoln Lee. Thanks for your feedback.
>> 
>> 
>>> In my opinion the FLIP touches too many
>>> topics at the same time and should be split into multiple FLIPs. We > should stay focused on what is needed for Flink 2.0.
>> The main goal and topic of this Flip is to align the abilities between the legacy group window agg syntax and the new window tvf syntax,
>> and then we can say that the legacy window syntax will be deprecated. IMO, although there are many misalignments about these two
>> syntaxes, such as session window tvf, cdc support and so on,  they are all the subtasks we need to do in this flip. Another reason I'm not
>> spliting this flip is that all of these subtasks like session window tvf and cdc support do not change the public interface and the public
>> syntax, the implements of them will only be in modules table-planner and table-runtime.
>> 
>> 
>>> Can we postpone this discussion? Currently we should focus on user
>>> switching to Window TVFs before Flink 2.0. Early fire, late fire and > allow lateness have not exposed through public configuration. It can be > introduced after Flink 2.0 released.
>> 
>> 
>> Agree with you. This flip will not and should not expose these experimental flink conf to users. I list them in this flip just aims to show the
>> misalignments about these two window syntaxes.
>> 
>> 
>> Look for your thought.
>> 
>> 
>> 
>> 
>> --
>> 
>>      Best!
>>      Xuyang
>> 
>> 
>> 
>> 
>> 
>> At 2023-12-13 15:40:16, "Lincoln Lee" <li...@gmail.com> wrote:
>>> Thanks Xuyang driving this work! It's great that everyone agrees with the
>>> work itself in this flip[1]!
>>>
>>> Regarding whether to split the flip or adjust the scope of this flip, I'd
>>> like to share some thoughts:
>>>
>>> 1. About the title of this flip, what I want to say is that flip-145[2] had
>>> marked the legacy group window deprecated in the documentation but the
>>> functionality of the new syntax is not aligned with the legacy one.
>>> This is not a user-friendly deprecation, so the initiation of this flip, as
>>> I understand it, is for the formal deprecation of the legacy window, which
>>> requires us to complete the functionality alignment.
>>>
>>> 2. Agree with Timo that we can process the late-fire/early-fire features
>>> separately. These experimental parameters have not been officially opened
>>> to users.
>>> Considering the workload, we can focus more on this version.
>>>
>>> 3. I have no objection to splitting this flip if everyone feels that the
>>> work included is too much.
>>> Regarding the support of session tvf, it seems that the main problem is
>>> that this part of the description occupies a large part of the flip,
>>> causing some misunderstandings.
>>> This is indeed a predetermined task in FLIP-145, just adding more
>>> explanation about semantics. In addition, I saw the discussion history in
>>> FLINK-24024[3], thanks Sergey for being willing to help driving this work
>>> together.
>>>
>>> [1]
>>> https://cwiki.apache.org/confluence/display/FLINK/FLIP-392%3A+Deprecate+the+Legacy+Group+Window+Aggregation
>>> [2]
>>> https://cwiki.apache.org/confluence/display/FLINK/FLIP-145%3A+Support+SQL+windowing+table-valued+function
>>> [3] https://issues.apache.org/jira/browse/FLINK-24024
>>>
>>> Best,
>>> Lincoln Lee
>>>
>>>
>>> Sergey Nuyanzin <sn...@gmail.com> 于2023年12月13日周三 08:02写道:
>>>
>>>> thanks for summarising Timo
>>>>
>>>> +1 for splitting it in different FLIPs
>>>> and agree about having "SESSION Window TVF Aggregation" under FLIP-145
>>>> Moreover the task is already there, so no need to move it from one FLIP to
>>>> another
>>>>
>>>>> And actually Sergey Nuyanzin wanted to work
>>>>> in this if I remember correctly. Not sure if this is still the case.
>>>>
>>>> Yes, however it seems there is already an existing PR for that.
>>>> Anyway I'm happy to help here with the review as well and will reserve some
>>>> time for it in coming days.
>>>>
>>>>
>>>>
>>>> On Tue, Dec 12, 2023 at 12:18 PM Timo Walther <tw...@apache.org> wrote:
>>>>
>>>>> Hi Xuyang,
>>>>>
>>>>> thanks for proposing this FLIP. In my opinion the FLIP touches too many
>>>>> topics at the same time and should be split into multiple FLIPs. We
>>>>> should stay focused on what is needed for Flink 2.0.
>>>>>
>>>>> Let me summarizing the topics:
>>>>>
>>>>> 1) SESSION Window TVF Aggregation
>>>>>
>>>>> This has been agreed in FLIP-145 already. We don't need another FLIP but
>>>>> someone that finally implements this after we have performed the Calcite
>>>>> upgrade a couple of months ago. The Calcite upgrade was important
>>>>> exactly for SESSION windows. And actually Sergey Nuyanzin wanted to work
>>>>> in this if I remember correctly. Not sure if this is still the case.
>>>>>
>>>>> 2) CDC support of Window TVFs
>>>>>
>>>>> This can be a FLIP on its own.
>>>>>
>>>>> 3) HOP window size with non-integer step length
>>>>>
>>>>> This can be a FLIP on its own.
>>>>>
>>>>> 4) Configurations such as early fire, late fire and allow lateness
>>>>>
>>>>> Can we postpone this discussion? Currently we should focus on user
>>>>> switching to Window TVFs before Flink 2.0. Early fire, late fire and
>>>>> allow lateness have not exposed through public configuration. It can be
>>>>> introduced after Flink 2.0 released.
>>>>>
>>>>> Regards,
>>>>> Timo
>>>>>
>>>>>
>>>>> On 12.12.23 08:01, Xuyang wrote:
>>>>>> Hi, Jim.
>>>>>> Thanks for your explaination.
>>>>>>> Ah, I mean to ask if you can contribute the new SESSION Table support
>>>>>>> without needing FLIP-392 completely settled.  I was trying to see if
>>>>> that
>>>>>>> is separate work which can be done or if there is some dependency on
>>>>> this
>>>>>>> FLIP.
>>>>>> The pr available about session window tvf belongs to this flip I think,
>>>>> and is part of the work about this flip. Actually the poc pr is not ready
>>>>> completely yet,
>>>>>> I'll try to update it to implement the session window tvf in window agg
>>>>> operator instead of using legacy group window agg operator.
>>>>>>> The tests should not be impacted.  Depending on what order our work
>>>>> lands
>>>>>>> in, one of the tests you've added/updated would likely move to the
>>>>>>> RestoreTests that Bonnie and I are working on.  Just mentioning that
>>>>> ahead
>>>>>>> of time
>>>>>>
>>>>>> Got it! I will pay attention to it.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>>
>>>>>>       Best!
>>>>>>       Xuyang
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> 在 2023-12-11 21:35:00,"Jim Hughes" <jh...@confluent.io.INVALID> 写道:
>>>>>>> Hi Xuyang,
>>>>>>>
>>>>>>> On Sun, Dec 10, 2023 at 10:41 PM Xuyang <xy...@163.com> wrote:
>>>>>>>
>>>>>>>> Hi, Jim.
>>>>>>>>> As a clarification, since FLINK-24204 is finishing up work from
>>>>>>>>> FLIP-145[1], do we need to discuss anything before you work out the
>>>>>>>> details
>>>>>>>>> of FLINK-24024 as a PR?
>>>>>>>> Which issue do you mean? It seems that FLINK-24204[1] is the issue
>>>> with
>>>>>>>> table api&sql type system.
>>>>>>>>
>>>>>>>
>>>>>>> Ah, I mean to ask if you can contribute the new SESSION Table support
>>>>>>> without needing FLIP-392 completely settled.  I was trying to see if
>>>>> that
>>>>>>> is separate work which can be done or if there is some dependency on
>>>>> this
>>>>>>> FLIP.
>>>>>>>
>>>>>>>
>>>>>>>> I've got a PR up [3] for moving at least one of the classes you are
>>>>>>>> touching.
>>>>>>>> Nice work! Since we are not going to delete the legacy group window
>>>> agg
>>>>>>>> operator actually, the only compatibility issue
>>>>>>>> may be that when using flink sql, the legacy group window agg
>>>> operator
>>>>>>>> will be rewritten into new operators. Will these tests be affected
>>>>> about
>>>>>>>> this rewritten?
>>>>>>>>
>>>>>>>
>>>>>>> The tests should not be impacted.  Depending on what order our work
>>>>> lands
>>>>>>> in, one of the tests you've added/updated would likely move to the
>>>>>>> RestoreTests that Bonnie and I are working on.  Just mentioning that
>>>>> ahead
>>>>>>> of time
>>>>>>>
>>>>>>> Cheers,
>>>>>>>
>>>>>>> Jim
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>>
>>>>>>>> [1] https://issues.apache.org/jira/browse/FLINK-24204
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>>
>>>>>>>>       Best!
>>>>>>>>       Xuyang
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> At 2023-12-09 06:25:30, "Jim Hughes" <jh...@confluent.io.INVALID>
>>>>> wrote:
>>>>>>>>> Hi Xuyang,
>>>>>>>>>
>>>>>>>>> As a clarification, since FLINK-24204 is finishing up work from
>>>>>>>>> FLIP-145[1], do we need to discuss anything before you work out the
>>>>>>>> details
>>>>>>>>> of FLINK-24024 as a PR?
>>>>>>>>>
>>>>>>>>> Relatedly, as that goes up for a PR, as part of FLINK-33421 [2],
>>>>> Bonnie
>>>>>>>> and
>>>>>>>>> I are working through migrating some of the JsonPlan Tests and
>>>>> ITCases to
>>>>>>>>> RestoreTests.  I've got a PR up [3] for moving at least one of the
>>>>> classes
>>>>>>>>> you are touching.  Let me know if I can share any details about that
>>>>> work.
>>>>>>>>>
>>>>>>>>> Cheers,
>>>>>>>>>
>>>>>>>>> Jim
>>>>>>>>>
>>>>>>>>> 1.
>>>>>>>>>
>>>>>>>>
>>>>>
>>>> https://cwiki.apache.org/confluence/display/FLINK/FLIP-145%3A+Support+SQL+windowing+table-valued+function#FLIP145:SupportSQLwindowingtablevaluedfunction-SessionWindows
>>>>>>>>>
>>>>>>>>> 2. https://issues.apache.org/jira/browse/FLINK-33421
>>>>>>>>> 3. https://github.com/apache/flink/pull/23886
>>>>>>>>> https://issues.apache.org/jira/browse/FLINK-33676
>>>>>>>>>
>>>>>>>>> On Tue, Nov 28, 2023 at 7:31 AM Xuyang <xy...@163.com> wrote:
>>>>>>>>>
>>>>>>>>>> Hi all.
>>>>>>>>>> I'd like to start a discussion of FLIP-392: Deprecate the Legacy
>>>>> Group
>>>>>>>>>> Window Aggregation.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Although the current Flink SQL Window Aggregation documentation[1]
>>>>>>>>>> indicates that the legacy Group Window Aggregation
>>>>>>>>>> syntax has been deprecated, the new Window TVF Aggregation syntax
>>>> has
>>>>>>>> not
>>>>>>>>>> fully covered all of the features of the legacy one.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Compared to Group Window Aggergation, Window TVF Aggergation has
>>>>> several
>>>>>>>>>> advantages, such as two-stage optimization,
>>>>>>>>>> support for standard GROUPING SET syntax, and so on. However, it
>>>>> needs
>>>>>>>> to
>>>>>>>>>> supplement and enrich the following features.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> 1. Support for SESSION Window TVF Aggregation
>>>>>>>>>> 2. Support for consuming CDC stream
>>>>>>>>>> 3. Support for HOP window size with non-integer step length
>>>>>>>>>> 4. Support for configurations such as early fire, late fire and
>>>> allow
>>>>>>>>>> lateness
>>>>>>>>>> (which are internal experimental configurations in Group Window
>>>>>>>>>> Aggregation and not public to users yet.)
>>>>>>>>>> 5. Unification of the Window TVF Aggregation operator in runtime at
>>>>> the
>>>>>>>>>> implementation layer
>>>>>>>>>> (In the long term, the cost to maintain the operators about Window
>>>>> TVF
>>>>>>>>>> Aggregation and Group Window Aggregation is too expensive.)
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> This flip aims to continue the unfinished work in FLIP-145[2],
>>>> which
>>>>> is
>>>>>>>> to
>>>>>>>>>> fully enable the capabilities of Window TVF Aggregation
>>>>>>>>>>    and officially deprecate the legacy syntax Group Window
>>>>> Aggregation, to
>>>>>>>>>> prepare for the removal of the legacy one in Flink 2.0.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> I have already done some preliminary POC to validate the
>>>> feasibility
>>>>> of
>>>>>>>>>> the related work in this flip as follows.
>>>>>>>>>> 1. POC for SESSION Window TVF Aggregation [3]
>>>>>>>>>> 2. POC for CUMULATE in Group Window Aggregation operator [4]
>>>>>>>>>> 3. POC for consuming CDC stream in Window Aggregation operator [5]
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Looking forward to your feedback and thoughts!
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> [1]
>>>>>>>>>>
>>>>>>>>
>>>>>
>>>> https://nightlies.apache.org/flink/flink-docs-master/docs/dev/table/sql/queries/window-agg/
>>>>>>>>>>
>>>>>>>>>> [2]
>>>>>>>>>>
>>>>>>>>
>>>>>
>>>> https://cwiki.apache.org/confluence/display/FLINK/FLIP-145%3A+Support+SQL+windowing+table-valued+function#FLIP145:SupportSQLwindowingtablevaluedfunction-SessionWindows
>>>>>>>>>> [3] https://github.com/xuyangzhong/flink/tree/FLINK-24024
>>>>>>>>>> [4]
>>>>>>>>>>
>>>>>>>>
>>>>>
>>>> https://github.com/xuyangzhong/flink/tree/poc_legacy_group_window_agg_cumulate
>>>>>>>>>> [5]
>>>>>>>>>>
>>>>>>>>
>>>>>
>>>> https://github.com/xuyangzhong/flink/tree/poc_window_agg_consumes_cdc_stream
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>>
>>>>>>>>>>       Best!
>>>>>>>>>>       Xuyang
>>>>>>>>
>>>>>
>>>>>
>>>>
>>>> --
>>>> Best regards,
>>>> Sergey
>>>>

Re: [DISCUSS] FLIP-392: Deprecate the Legacy Group Window Aggregation

Posted by Timo Walther <tw...@apache.org>.
Hi Xuyang,

 > I'm not spliting this flip is that all of these subtasks like session 
window tvf and cdc support do not change the public interface and the 
public syntax

Given the length of this mailing list discussion and number of involved 
people I would strongly suggest to simplify the FLIP and give it a 
better title to make quicker progress. In general, we all seem to be on 
the same page in what we want. And both session TVF support and the 
deprecation of the legacy group windows has been voted already and 
discussed thouroughly. The FLIP can purely focus on the CDC topic.

Cheers,
Timo


On 14.12.23 08:35, Xuyang wrote:
> Hi, Timo, Sergey and Lincoln Lee. Thanks for your feedback.
> 
> 
>> In my opinion the FLIP touches too many
>> topics at the same time and should be split into multiple FLIPs. We > should stay focused on what is needed for Flink 2.0.
> The main goal and topic of this Flip is to align the abilities between the legacy group window agg syntax and the new window tvf syntax,
> and then we can say that the legacy window syntax will be deprecated. IMO, although there are many misalignments about these two
> syntaxes, such as session window tvf, cdc support and so on,  they are all the subtasks we need to do in this flip. Another reason I'm not
> spliting this flip is that all of these subtasks like session window tvf and cdc support do not change the public interface and the public
> syntax, the implements of them will only be in modules table-planner and table-runtime.
> 
> 
>> Can we postpone this discussion? Currently we should focus on user
>> switching to Window TVFs before Flink 2.0. Early fire, late fire and > allow lateness have not exposed through public configuration. It can be > introduced after Flink 2.0 released.
> 
> 
> Agree with you. This flip will not and should not expose these experimental flink conf to users. I list them in this flip just aims to show the
> misalignments about these two window syntaxes.
> 
> 
> Look for your thought.
> 
> 
> 
> 
> --
> 
>      Best!
>      Xuyang
> 
> 
> 
> 
> 
> At 2023-12-13 15:40:16, "Lincoln Lee" <li...@gmail.com> wrote:
>> Thanks Xuyang driving this work! It's great that everyone agrees with the
>> work itself in this flip[1]!
>>
>> Regarding whether to split the flip or adjust the scope of this flip, I'd
>> like to share some thoughts:
>>
>> 1. About the title of this flip, what I want to say is that flip-145[2] had
>> marked the legacy group window deprecated in the documentation but the
>> functionality of the new syntax is not aligned with the legacy one.
>> This is not a user-friendly deprecation, so the initiation of this flip, as
>> I understand it, is for the formal deprecation of the legacy window, which
>> requires us to complete the functionality alignment.
>>
>> 2. Agree with Timo that we can process the late-fire/early-fire features
>> separately. These experimental parameters have not been officially opened
>> to users.
>> Considering the workload, we can focus more on this version.
>>
>> 3. I have no objection to splitting this flip if everyone feels that the
>> work included is too much.
>> Regarding the support of session tvf, it seems that the main problem is
>> that this part of the description occupies a large part of the flip,
>> causing some misunderstandings.
>> This is indeed a predetermined task in FLIP-145, just adding more
>> explanation about semantics. In addition, I saw the discussion history in
>> FLINK-24024[3], thanks Sergey for being willing to help driving this work
>> together.
>>
>> [1]
>> https://cwiki.apache.org/confluence/display/FLINK/FLIP-392%3A+Deprecate+the+Legacy+Group+Window+Aggregation
>> [2]
>> https://cwiki.apache.org/confluence/display/FLINK/FLIP-145%3A+Support+SQL+windowing+table-valued+function
>> [3] https://issues.apache.org/jira/browse/FLINK-24024
>>
>> Best,
>> Lincoln Lee
>>
>>
>> Sergey Nuyanzin <sn...@gmail.com> 于2023年12月13日周三 08:02写道:
>>
>>> thanks for summarising Timo
>>>
>>> +1 for splitting it in different FLIPs
>>> and agree about having "SESSION Window TVF Aggregation" under FLIP-145
>>> Moreover the task is already there, so no need to move it from one FLIP to
>>> another
>>>
>>>> And actually Sergey Nuyanzin wanted to work
>>>> in this if I remember correctly. Not sure if this is still the case.
>>>
>>> Yes, however it seems there is already an existing PR for that.
>>> Anyway I'm happy to help here with the review as well and will reserve some
>>> time for it in coming days.
>>>
>>>
>>>
>>> On Tue, Dec 12, 2023 at 12:18 PM Timo Walther <tw...@apache.org> wrote:
>>>
>>>> Hi Xuyang,
>>>>
>>>> thanks for proposing this FLIP. In my opinion the FLIP touches too many
>>>> topics at the same time and should be split into multiple FLIPs. We
>>>> should stay focused on what is needed for Flink 2.0.
>>>>
>>>> Let me summarizing the topics:
>>>>
>>>> 1) SESSION Window TVF Aggregation
>>>>
>>>> This has been agreed in FLIP-145 already. We don't need another FLIP but
>>>> someone that finally implements this after we have performed the Calcite
>>>> upgrade a couple of months ago. The Calcite upgrade was important
>>>> exactly for SESSION windows. And actually Sergey Nuyanzin wanted to work
>>>> in this if I remember correctly. Not sure if this is still the case.
>>>>
>>>> 2) CDC support of Window TVFs
>>>>
>>>> This can be a FLIP on its own.
>>>>
>>>> 3) HOP window size with non-integer step length
>>>>
>>>> This can be a FLIP on its own.
>>>>
>>>> 4) Configurations such as early fire, late fire and allow lateness
>>>>
>>>> Can we postpone this discussion? Currently we should focus on user
>>>> switching to Window TVFs before Flink 2.0. Early fire, late fire and
>>>> allow lateness have not exposed through public configuration. It can be
>>>> introduced after Flink 2.0 released.
>>>>
>>>> Regards,
>>>> Timo
>>>>
>>>>
>>>> On 12.12.23 08:01, Xuyang wrote:
>>>>> Hi, Jim.
>>>>> Thanks for your explaination.
>>>>>> Ah, I mean to ask if you can contribute the new SESSION Table support
>>>>>> without needing FLIP-392 completely settled.  I was trying to see if
>>>> that
>>>>>> is separate work which can be done or if there is some dependency on
>>>> this
>>>>>> FLIP.
>>>>> The pr available about session window tvf belongs to this flip I think,
>>>> and is part of the work about this flip. Actually the poc pr is not ready
>>>> completely yet,
>>>>> I'll try to update it to implement the session window tvf in window agg
>>>> operator instead of using legacy group window agg operator.
>>>>>> The tests should not be impacted.  Depending on what order our work
>>>> lands
>>>>>> in, one of the tests you've added/updated would likely move to the
>>>>>> RestoreTests that Bonnie and I are working on.  Just mentioning that
>>>> ahead
>>>>>> of time
>>>>>
>>>>> Got it! I will pay attention to it.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>>
>>>>>       Best!
>>>>>       Xuyang
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> 在 2023-12-11 21:35:00,"Jim Hughes" <jh...@confluent.io.INVALID> 写道:
>>>>>> Hi Xuyang,
>>>>>>
>>>>>> On Sun, Dec 10, 2023 at 10:41 PM Xuyang <xy...@163.com> wrote:
>>>>>>
>>>>>>> Hi, Jim.
>>>>>>>> As a clarification, since FLINK-24204 is finishing up work from
>>>>>>>> FLIP-145[1], do we need to discuss anything before you work out the
>>>>>>> details
>>>>>>>> of FLINK-24024 as a PR?
>>>>>>> Which issue do you mean? It seems that FLINK-24204[1] is the issue
>>> with
>>>>>>> table api&sql type system.
>>>>>>>
>>>>>>
>>>>>> Ah, I mean to ask if you can contribute the new SESSION Table support
>>>>>> without needing FLIP-392 completely settled.  I was trying to see if
>>>> that
>>>>>> is separate work which can be done or if there is some dependency on
>>>> this
>>>>>> FLIP.
>>>>>>
>>>>>>
>>>>>>> I've got a PR up [3] for moving at least one of the classes you are
>>>>>>> touching.
>>>>>>> Nice work! Since we are not going to delete the legacy group window
>>> agg
>>>>>>> operator actually, the only compatibility issue
>>>>>>> may be that when using flink sql, the legacy group window agg
>>> operator
>>>>>>> will be rewritten into new operators. Will these tests be affected
>>>> about
>>>>>>> this rewritten?
>>>>>>>
>>>>>>
>>>>>> The tests should not be impacted.  Depending on what order our work
>>>> lands
>>>>>> in, one of the tests you've added/updated would likely move to the
>>>>>> RestoreTests that Bonnie and I are working on.  Just mentioning that
>>>> ahead
>>>>>> of time
>>>>>>
>>>>>> Cheers,
>>>>>>
>>>>>> Jim
>>>>>>
>>>>>>
>>>>>>
>>>>>>>
>>>>>>> [1] https://issues.apache.org/jira/browse/FLINK-24204
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>>
>>>>>>>       Best!
>>>>>>>       Xuyang
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> At 2023-12-09 06:25:30, "Jim Hughes" <jh...@confluent.io.INVALID>
>>>> wrote:
>>>>>>>> Hi Xuyang,
>>>>>>>>
>>>>>>>> As a clarification, since FLINK-24204 is finishing up work from
>>>>>>>> FLIP-145[1], do we need to discuss anything before you work out the
>>>>>>> details
>>>>>>>> of FLINK-24024 as a PR?
>>>>>>>>
>>>>>>>> Relatedly, as that goes up for a PR, as part of FLINK-33421 [2],
>>>> Bonnie
>>>>>>> and
>>>>>>>> I are working through migrating some of the JsonPlan Tests and
>>>> ITCases to
>>>>>>>> RestoreTests.  I've got a PR up [3] for moving at least one of the
>>>> classes
>>>>>>>> you are touching.  Let me know if I can share any details about that
>>>> work.
>>>>>>>>
>>>>>>>> Cheers,
>>>>>>>>
>>>>>>>> Jim
>>>>>>>>
>>>>>>>> 1.
>>>>>>>>
>>>>>>>
>>>>
>>> https://cwiki.apache.org/confluence/display/FLINK/FLIP-145%3A+Support+SQL+windowing+table-valued+function#FLIP145:SupportSQLwindowingtablevaluedfunction-SessionWindows
>>>>>>>>
>>>>>>>> 2. https://issues.apache.org/jira/browse/FLINK-33421
>>>>>>>> 3. https://github.com/apache/flink/pull/23886
>>>>>>>> https://issues.apache.org/jira/browse/FLINK-33676
>>>>>>>>
>>>>>>>> On Tue, Nov 28, 2023 at 7:31 AM Xuyang <xy...@163.com> wrote:
>>>>>>>>
>>>>>>>>> Hi all.
>>>>>>>>> I'd like to start a discussion of FLIP-392: Deprecate the Legacy
>>>> Group
>>>>>>>>> Window Aggregation.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Although the current Flink SQL Window Aggregation documentation[1]
>>>>>>>>> indicates that the legacy Group Window Aggregation
>>>>>>>>> syntax has been deprecated, the new Window TVF Aggregation syntax
>>> has
>>>>>>> not
>>>>>>>>> fully covered all of the features of the legacy one.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Compared to Group Window Aggergation, Window TVF Aggergation has
>>>> several
>>>>>>>>> advantages, such as two-stage optimization,
>>>>>>>>> support for standard GROUPING SET syntax, and so on. However, it
>>>> needs
>>>>>>> to
>>>>>>>>> supplement and enrich the following features.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> 1. Support for SESSION Window TVF Aggregation
>>>>>>>>> 2. Support for consuming CDC stream
>>>>>>>>> 3. Support for HOP window size with non-integer step length
>>>>>>>>> 4. Support for configurations such as early fire, late fire and
>>> allow
>>>>>>>>> lateness
>>>>>>>>> (which are internal experimental configurations in Group Window
>>>>>>>>> Aggregation and not public to users yet.)
>>>>>>>>> 5. Unification of the Window TVF Aggregation operator in runtime at
>>>> the
>>>>>>>>> implementation layer
>>>>>>>>> (In the long term, the cost to maintain the operators about Window
>>>> TVF
>>>>>>>>> Aggregation and Group Window Aggregation is too expensive.)
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> This flip aims to continue the unfinished work in FLIP-145[2],
>>> which
>>>> is
>>>>>>> to
>>>>>>>>> fully enable the capabilities of Window TVF Aggregation
>>>>>>>>>    and officially deprecate the legacy syntax Group Window
>>>> Aggregation, to
>>>>>>>>> prepare for the removal of the legacy one in Flink 2.0.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> I have already done some preliminary POC to validate the
>>> feasibility
>>>> of
>>>>>>>>> the related work in this flip as follows.
>>>>>>>>> 1. POC for SESSION Window TVF Aggregation [3]
>>>>>>>>> 2. POC for CUMULATE in Group Window Aggregation operator [4]
>>>>>>>>> 3. POC for consuming CDC stream in Window Aggregation operator [5]
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Looking forward to your feedback and thoughts!
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> [1]
>>>>>>>>>
>>>>>>>
>>>>
>>> https://nightlies.apache.org/flink/flink-docs-master/docs/dev/table/sql/queries/window-agg/
>>>>>>>>>
>>>>>>>>> [2]
>>>>>>>>>
>>>>>>>
>>>>
>>> https://cwiki.apache.org/confluence/display/FLINK/FLIP-145%3A+Support+SQL+windowing+table-valued+function#FLIP145:SupportSQLwindowingtablevaluedfunction-SessionWindows
>>>>>>>>> [3] https://github.com/xuyangzhong/flink/tree/FLINK-24024
>>>>>>>>> [4]
>>>>>>>>>
>>>>>>>
>>>>
>>> https://github.com/xuyangzhong/flink/tree/poc_legacy_group_window_agg_cumulate
>>>>>>>>> [5]
>>>>>>>>>
>>>>>>>
>>>>
>>> https://github.com/xuyangzhong/flink/tree/poc_window_agg_consumes_cdc_stream
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>>
>>>>>>>>>       Best!
>>>>>>>>>       Xuyang
>>>>>>>
>>>>
>>>>
>>>
>>> --
>>> Best regards,
>>> Sergey
>>>


Re:Re: [DISCUSS] FLIP-392: Deprecate the Legacy Group Window Aggregation

Posted by Xuyang <xy...@163.com>.
Hi, Timo, Sergey and Lincoln Lee. Thanks for your feedback.


> In my opinion the FLIP touches too many
> topics at the same time and should be split into multiple FLIPs. We > should stay focused on what is needed for Flink 2.0.
The main goal and topic of this Flip is to align the abilities between the legacy group window agg syntax and the new window tvf syntax, 
and then we can say that the legacy window syntax will be deprecated. IMO, although there are many misalignments about these two 
syntaxes, such as session window tvf, cdc support and so on,  they are all the subtasks we need to do in this flip. Another reason I'm not 
spliting this flip is that all of these subtasks like session window tvf and cdc support do not change the public interface and the public 
syntax, the implements of them will only be in modules table-planner and table-runtime.


> Can we postpone this discussion? Currently we should focus on user
> switching to Window TVFs before Flink 2.0. Early fire, late fire and > allow lateness have not exposed through public configuration. It can be > introduced after Flink 2.0 released.


Agree with you. This flip will not and should not expose these experimental flink conf to users. I list them in this flip just aims to show the 
misalignments about these two window syntaxes.


Look for your thought.




--

    Best!
    Xuyang





At 2023-12-13 15:40:16, "Lincoln Lee" <li...@gmail.com> wrote:
>Thanks Xuyang driving this work! It's great that everyone agrees with the
>work itself in this flip[1]!
>
>Regarding whether to split the flip or adjust the scope of this flip, I'd
>like to share some thoughts:
>
>1. About the title of this flip, what I want to say is that flip-145[2] had
>marked the legacy group window deprecated in the documentation but the
>functionality of the new syntax is not aligned with the legacy one.
>This is not a user-friendly deprecation, so the initiation of this flip, as
>I understand it, is for the formal deprecation of the legacy window, which
>requires us to complete the functionality alignment.
>
>2. Agree with Timo that we can process the late-fire/early-fire features
>separately. These experimental parameters have not been officially opened
>to users.
>Considering the workload, we can focus more on this version.
>
>3. I have no objection to splitting this flip if everyone feels that the
>work included is too much.
>Regarding the support of session tvf, it seems that the main problem is
>that this part of the description occupies a large part of the flip,
>causing some misunderstandings.
>This is indeed a predetermined task in FLIP-145, just adding more
>explanation about semantics. In addition, I saw the discussion history in
>FLINK-24024[3], thanks Sergey for being willing to help driving this work
>together.
>
>[1]
>https://cwiki.apache.org/confluence/display/FLINK/FLIP-392%3A+Deprecate+the+Legacy+Group+Window+Aggregation
>[2]
>https://cwiki.apache.org/confluence/display/FLINK/FLIP-145%3A+Support+SQL+windowing+table-valued+function
>[3] https://issues.apache.org/jira/browse/FLINK-24024
>
>Best,
>Lincoln Lee
>
>
>Sergey Nuyanzin <sn...@gmail.com> 于2023年12月13日周三 08:02写道:
>
>> thanks for summarising Timo
>>
>> +1 for splitting it in different FLIPs
>> and agree about having "SESSION Window TVF Aggregation" under FLIP-145
>> Moreover the task is already there, so no need to move it from one FLIP to
>> another
>>
>> >And actually Sergey Nuyanzin wanted to work
>> >in this if I remember correctly. Not sure if this is still the case.
>>
>> Yes, however it seems there is already an existing PR for that.
>> Anyway I'm happy to help here with the review as well and will reserve some
>> time for it in coming days.
>>
>>
>>
>> On Tue, Dec 12, 2023 at 12:18 PM Timo Walther <tw...@apache.org> wrote:
>>
>> > Hi Xuyang,
>> >
>> > thanks for proposing this FLIP. In my opinion the FLIP touches too many
>> > topics at the same time and should be split into multiple FLIPs. We
>> > should stay focused on what is needed for Flink 2.0.
>> >
>> > Let me summarizing the topics:
>> >
>> > 1) SESSION Window TVF Aggregation
>> >
>> > This has been agreed in FLIP-145 already. We don't need another FLIP but
>> > someone that finally implements this after we have performed the Calcite
>> > upgrade a couple of months ago. The Calcite upgrade was important
>> > exactly for SESSION windows. And actually Sergey Nuyanzin wanted to work
>> > in this if I remember correctly. Not sure if this is still the case.
>> >
>> > 2) CDC support of Window TVFs
>> >
>> > This can be a FLIP on its own.
>> >
>> > 3) HOP window size with non-integer step length
>> >
>> > This can be a FLIP on its own.
>> >
>> > 4) Configurations such as early fire, late fire and allow lateness
>> >
>> > Can we postpone this discussion? Currently we should focus on user
>> > switching to Window TVFs before Flink 2.0. Early fire, late fire and
>> > allow lateness have not exposed through public configuration. It can be
>> > introduced after Flink 2.0 released.
>> >
>> > Regards,
>> > Timo
>> >
>> >
>> > On 12.12.23 08:01, Xuyang wrote:
>> > > Hi, Jim.
>> > > Thanks for your explaination.
>> > >> Ah, I mean to ask if you can contribute the new SESSION Table support
>> > >> without needing FLIP-392 completely settled.  I was trying to see if
>> > that
>> > >> is separate work which can be done or if there is some dependency on
>> > this
>> > >> FLIP.
>> > > The pr available about session window tvf belongs to this flip I think,
>> > and is part of the work about this flip. Actually the poc pr is not ready
>> > completely yet,
>> > > I'll try to update it to implement the session window tvf in window agg
>> > operator instead of using legacy group window agg operator.
>> > >> The tests should not be impacted.  Depending on what order our work
>> > lands
>> > >> in, one of the tests you've added/updated would likely move to the
>> > >> RestoreTests that Bonnie and I are working on.  Just mentioning that
>> > ahead
>> > >> of time
>> > >
>> > > Got it! I will pay attention to it.
>> > >
>> > >
>> > >
>> > >
>> > > --
>> > >
>> > >      Best!
>> > >      Xuyang
>> > >
>> > >
>> > >
>> > >
>> > >
>> > > 在 2023-12-11 21:35:00,"Jim Hughes" <jh...@confluent.io.INVALID> 写道:
>> > >> Hi Xuyang,
>> > >>
>> > >> On Sun, Dec 10, 2023 at 10:41 PM Xuyang <xy...@163.com> wrote:
>> > >>
>> > >>> Hi, Jim.
>> > >>>> As a clarification, since FLINK-24204 is finishing up work from
>> > >>>> FLIP-145[1], do we need to discuss anything before you work out the
>> > >>> details
>> > >>>> of FLINK-24024 as a PR?
>> > >>> Which issue do you mean? It seems that FLINK-24204[1] is the issue
>> with
>> > >>> table api&sql type system.
>> > >>>
>> > >>
>> > >> Ah, I mean to ask if you can contribute the new SESSION Table support
>> > >> without needing FLIP-392 completely settled.  I was trying to see if
>> > that
>> > >> is separate work which can be done or if there is some dependency on
>> > this
>> > >> FLIP.
>> > >>
>> > >>
>> > >>> I've got a PR up [3] for moving at least one of the classes you are
>> > >>> touching.
>> > >>> Nice work! Since we are not going to delete the legacy group window
>> agg
>> > >>> operator actually, the only compatibility issue
>> > >>> may be that when using flink sql, the legacy group window agg
>> operator
>> > >>> will be rewritten into new operators. Will these tests be affected
>> > about
>> > >>> this rewritten?
>> > >>>
>> > >>
>> > >> The tests should not be impacted.  Depending on what order our work
>> > lands
>> > >> in, one of the tests you've added/updated would likely move to the
>> > >> RestoreTests that Bonnie and I are working on.  Just mentioning that
>> > ahead
>> > >> of time
>> > >>
>> > >> Cheers,
>> > >>
>> > >> Jim
>> > >>
>> > >>
>> > >>
>> > >>>
>> > >>> [1] https://issues.apache.org/jira/browse/FLINK-24204
>> > >>>
>> > >>>
>> > >>>
>> > >>>
>> > >>>
>> > >>>
>> > >>> --
>> > >>>
>> > >>>      Best!
>> > >>>      Xuyang
>> > >>>
>> > >>>
>> > >>>
>> > >>>
>> > >>>
>> > >>> At 2023-12-09 06:25:30, "Jim Hughes" <jh...@confluent.io.INVALID>
>> > wrote:
>> > >>>> Hi Xuyang,
>> > >>>>
>> > >>>> As a clarification, since FLINK-24204 is finishing up work from
>> > >>>> FLIP-145[1], do we need to discuss anything before you work out the
>> > >>> details
>> > >>>> of FLINK-24024 as a PR?
>> > >>>>
>> > >>>> Relatedly, as that goes up for a PR, as part of FLINK-33421 [2],
>> > Bonnie
>> > >>> and
>> > >>>> I are working through migrating some of the JsonPlan Tests and
>> > ITCases to
>> > >>>> RestoreTests.  I've got a PR up [3] for moving at least one of the
>> > classes
>> > >>>> you are touching.  Let me know if I can share any details about that
>> > work.
>> > >>>>
>> > >>>> Cheers,
>> > >>>>
>> > >>>> Jim
>> > >>>>
>> > >>>> 1.
>> > >>>>
>> > >>>
>> >
>> https://cwiki.apache.org/confluence/display/FLINK/FLIP-145%3A+Support+SQL+windowing+table-valued+function#FLIP145:SupportSQLwindowingtablevaluedfunction-SessionWindows
>> > >>>>
>> > >>>> 2. https://issues.apache.org/jira/browse/FLINK-33421
>> > >>>> 3. https://github.com/apache/flink/pull/23886
>> > >>>> https://issues.apache.org/jira/browse/FLINK-33676
>> > >>>>
>> > >>>> On Tue, Nov 28, 2023 at 7:31 AM Xuyang <xy...@163.com> wrote:
>> > >>>>
>> > >>>>> Hi all.
>> > >>>>> I'd like to start a discussion of FLIP-392: Deprecate the Legacy
>> > Group
>> > >>>>> Window Aggregation.
>> > >>>>>
>> > >>>>>
>> > >>>>> Although the current Flink SQL Window Aggregation documentation[1]
>> > >>>>> indicates that the legacy Group Window Aggregation
>> > >>>>> syntax has been deprecated, the new Window TVF Aggregation syntax
>> has
>> > >>> not
>> > >>>>> fully covered all of the features of the legacy one.
>> > >>>>>
>> > >>>>>
>> > >>>>> Compared to Group Window Aggergation, Window TVF Aggergation has
>> > several
>> > >>>>> advantages, such as two-stage optimization,
>> > >>>>> support for standard GROUPING SET syntax, and so on. However, it
>> > needs
>> > >>> to
>> > >>>>> supplement and enrich the following features.
>> > >>>>>
>> > >>>>>
>> > >>>>> 1. Support for SESSION Window TVF Aggregation
>> > >>>>> 2. Support for consuming CDC stream
>> > >>>>> 3. Support for HOP window size with non-integer step length
>> > >>>>> 4. Support for configurations such as early fire, late fire and
>> allow
>> > >>>>> lateness
>> > >>>>> (which are internal experimental configurations in Group Window
>> > >>>>> Aggregation and not public to users yet.)
>> > >>>>> 5. Unification of the Window TVF Aggregation operator in runtime at
>> > the
>> > >>>>> implementation layer
>> > >>>>> (In the long term, the cost to maintain the operators about Window
>> > TVF
>> > >>>>> Aggregation and Group Window Aggregation is too expensive.)
>> > >>>>>
>> > >>>>>
>> > >>>>> This flip aims to continue the unfinished work in FLIP-145[2],
>> which
>> > is
>> > >>> to
>> > >>>>> fully enable the capabilities of Window TVF Aggregation
>> > >>>>>   and officially deprecate the legacy syntax Group Window
>> > Aggregation, to
>> > >>>>> prepare for the removal of the legacy one in Flink 2.0.
>> > >>>>>
>> > >>>>>
>> > >>>>> I have already done some preliminary POC to validate the
>> feasibility
>> > of
>> > >>>>> the related work in this flip as follows.
>> > >>>>> 1. POC for SESSION Window TVF Aggregation [3]
>> > >>>>> 2. POC for CUMULATE in Group Window Aggregation operator [4]
>> > >>>>> 3. POC for consuming CDC stream in Window Aggregation operator [5]
>> > >>>>>
>> > >>>>>
>> > >>>>> Looking forward to your feedback and thoughts!
>> > >>>>>
>> > >>>>>
>> > >>>>>
>> > >>>>> [1]
>> > >>>>>
>> > >>>
>> >
>> https://nightlies.apache.org/flink/flink-docs-master/docs/dev/table/sql/queries/window-agg/
>> > >>>>>
>> > >>>>> [2]
>> > >>>>>
>> > >>>
>> >
>> https://cwiki.apache.org/confluence/display/FLINK/FLIP-145%3A+Support+SQL+windowing+table-valued+function#FLIP145:SupportSQLwindowingtablevaluedfunction-SessionWindows
>> > >>>>> [3] https://github.com/xuyangzhong/flink/tree/FLINK-24024
>> > >>>>> [4]
>> > >>>>>
>> > >>>
>> >
>> https://github.com/xuyangzhong/flink/tree/poc_legacy_group_window_agg_cumulate
>> > >>>>> [5]
>> > >>>>>
>> > >>>
>> >
>> https://github.com/xuyangzhong/flink/tree/poc_window_agg_consumes_cdc_stream
>> > >>>>>
>> > >>>>>
>> > >>>>>
>> > >>>>> --
>> > >>>>>
>> > >>>>>      Best!
>> > >>>>>      Xuyang
>> > >>>
>> >
>> >
>>
>> --
>> Best regards,
>> Sergey
>>

Re: [DISCUSS] FLIP-392: Deprecate the Legacy Group Window Aggregation

Posted by Lincoln Lee <li...@gmail.com>.
Thanks Xuyang driving this work! It's great that everyone agrees with the
work itself in this flip[1]!

Regarding whether to split the flip or adjust the scope of this flip, I'd
like to share some thoughts:

1. About the title of this flip, what I want to say is that flip-145[2] had
marked the legacy group window deprecated in the documentation but the
functionality of the new syntax is not aligned with the legacy one.
This is not a user-friendly deprecation, so the initiation of this flip, as
I understand it, is for the formal deprecation of the legacy window, which
requires us to complete the functionality alignment.

2. Agree with Timo that we can process the late-fire/early-fire features
separately. These experimental parameters have not been officially opened
to users.
Considering the workload, we can focus more on this version.

3. I have no objection to splitting this flip if everyone feels that the
work included is too much.
Regarding the support of session tvf, it seems that the main problem is
that this part of the description occupies a large part of the flip,
causing some misunderstandings.
This is indeed a predetermined task in FLIP-145, just adding more
explanation about semantics. In addition, I saw the discussion history in
FLINK-24024[3], thanks Sergey for being willing to help driving this work
together.

[1]
https://cwiki.apache.org/confluence/display/FLINK/FLIP-392%3A+Deprecate+the+Legacy+Group+Window+Aggregation
[2]
https://cwiki.apache.org/confluence/display/FLINK/FLIP-145%3A+Support+SQL+windowing+table-valued+function
[3] https://issues.apache.org/jira/browse/FLINK-24024

Best,
Lincoln Lee


Sergey Nuyanzin <sn...@gmail.com> 于2023年12月13日周三 08:02写道:

> thanks for summarising Timo
>
> +1 for splitting it in different FLIPs
> and agree about having "SESSION Window TVF Aggregation" under FLIP-145
> Moreover the task is already there, so no need to move it from one FLIP to
> another
>
> >And actually Sergey Nuyanzin wanted to work
> >in this if I remember correctly. Not sure if this is still the case.
>
> Yes, however it seems there is already an existing PR for that.
> Anyway I'm happy to help here with the review as well and will reserve some
> time for it in coming days.
>
>
>
> On Tue, Dec 12, 2023 at 12:18 PM Timo Walther <tw...@apache.org> wrote:
>
> > Hi Xuyang,
> >
> > thanks for proposing this FLIP. In my opinion the FLIP touches too many
> > topics at the same time and should be split into multiple FLIPs. We
> > should stay focused on what is needed for Flink 2.0.
> >
> > Let me summarizing the topics:
> >
> > 1) SESSION Window TVF Aggregation
> >
> > This has been agreed in FLIP-145 already. We don't need another FLIP but
> > someone that finally implements this after we have performed the Calcite
> > upgrade a couple of months ago. The Calcite upgrade was important
> > exactly for SESSION windows. And actually Sergey Nuyanzin wanted to work
> > in this if I remember correctly. Not sure if this is still the case.
> >
> > 2) CDC support of Window TVFs
> >
> > This can be a FLIP on its own.
> >
> > 3) HOP window size with non-integer step length
> >
> > This can be a FLIP on its own.
> >
> > 4) Configurations such as early fire, late fire and allow lateness
> >
> > Can we postpone this discussion? Currently we should focus on user
> > switching to Window TVFs before Flink 2.0. Early fire, late fire and
> > allow lateness have not exposed through public configuration. It can be
> > introduced after Flink 2.0 released.
> >
> > Regards,
> > Timo
> >
> >
> > On 12.12.23 08:01, Xuyang wrote:
> > > Hi, Jim.
> > > Thanks for your explaination.
> > >> Ah, I mean to ask if you can contribute the new SESSION Table support
> > >> without needing FLIP-392 completely settled.  I was trying to see if
> > that
> > >> is separate work which can be done or if there is some dependency on
> > this
> > >> FLIP.
> > > The pr available about session window tvf belongs to this flip I think,
> > and is part of the work about this flip. Actually the poc pr is not ready
> > completely yet,
> > > I'll try to update it to implement the session window tvf in window agg
> > operator instead of using legacy group window agg operator.
> > >> The tests should not be impacted.  Depending on what order our work
> > lands
> > >> in, one of the tests you've added/updated would likely move to the
> > >> RestoreTests that Bonnie and I are working on.  Just mentioning that
> > ahead
> > >> of time
> > >
> > > Got it! I will pay attention to it.
> > >
> > >
> > >
> > >
> > > --
> > >
> > >      Best!
> > >      Xuyang
> > >
> > >
> > >
> > >
> > >
> > > 在 2023-12-11 21:35:00,"Jim Hughes" <jh...@confluent.io.INVALID> 写道:
> > >> Hi Xuyang,
> > >>
> > >> On Sun, Dec 10, 2023 at 10:41 PM Xuyang <xy...@163.com> wrote:
> > >>
> > >>> Hi, Jim.
> > >>>> As a clarification, since FLINK-24204 is finishing up work from
> > >>>> FLIP-145[1], do we need to discuss anything before you work out the
> > >>> details
> > >>>> of FLINK-24024 as a PR?
> > >>> Which issue do you mean? It seems that FLINK-24204[1] is the issue
> with
> > >>> table api&sql type system.
> > >>>
> > >>
> > >> Ah, I mean to ask if you can contribute the new SESSION Table support
> > >> without needing FLIP-392 completely settled.  I was trying to see if
> > that
> > >> is separate work which can be done or if there is some dependency on
> > this
> > >> FLIP.
> > >>
> > >>
> > >>> I've got a PR up [3] for moving at least one of the classes you are
> > >>> touching.
> > >>> Nice work! Since we are not going to delete the legacy group window
> agg
> > >>> operator actually, the only compatibility issue
> > >>> may be that when using flink sql, the legacy group window agg
> operator
> > >>> will be rewritten into new operators. Will these tests be affected
> > about
> > >>> this rewritten?
> > >>>
> > >>
> > >> The tests should not be impacted.  Depending on what order our work
> > lands
> > >> in, one of the tests you've added/updated would likely move to the
> > >> RestoreTests that Bonnie and I are working on.  Just mentioning that
> > ahead
> > >> of time
> > >>
> > >> Cheers,
> > >>
> > >> Jim
> > >>
> > >>
> > >>
> > >>>
> > >>> [1] https://issues.apache.org/jira/browse/FLINK-24204
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>> --
> > >>>
> > >>>      Best!
> > >>>      Xuyang
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>> At 2023-12-09 06:25:30, "Jim Hughes" <jh...@confluent.io.INVALID>
> > wrote:
> > >>>> Hi Xuyang,
> > >>>>
> > >>>> As a clarification, since FLINK-24204 is finishing up work from
> > >>>> FLIP-145[1], do we need to discuss anything before you work out the
> > >>> details
> > >>>> of FLINK-24024 as a PR?
> > >>>>
> > >>>> Relatedly, as that goes up for a PR, as part of FLINK-33421 [2],
> > Bonnie
> > >>> and
> > >>>> I are working through migrating some of the JsonPlan Tests and
> > ITCases to
> > >>>> RestoreTests.  I've got a PR up [3] for moving at least one of the
> > classes
> > >>>> you are touching.  Let me know if I can share any details about that
> > work.
> > >>>>
> > >>>> Cheers,
> > >>>>
> > >>>> Jim
> > >>>>
> > >>>> 1.
> > >>>>
> > >>>
> >
> https://cwiki.apache.org/confluence/display/FLINK/FLIP-145%3A+Support+SQL+windowing+table-valued+function#FLIP145:SupportSQLwindowingtablevaluedfunction-SessionWindows
> > >>>>
> > >>>> 2. https://issues.apache.org/jira/browse/FLINK-33421
> > >>>> 3. https://github.com/apache/flink/pull/23886
> > >>>> https://issues.apache.org/jira/browse/FLINK-33676
> > >>>>
> > >>>> On Tue, Nov 28, 2023 at 7:31 AM Xuyang <xy...@163.com> wrote:
> > >>>>
> > >>>>> Hi all.
> > >>>>> I'd like to start a discussion of FLIP-392: Deprecate the Legacy
> > Group
> > >>>>> Window Aggregation.
> > >>>>>
> > >>>>>
> > >>>>> Although the current Flink SQL Window Aggregation documentation[1]
> > >>>>> indicates that the legacy Group Window Aggregation
> > >>>>> syntax has been deprecated, the new Window TVF Aggregation syntax
> has
> > >>> not
> > >>>>> fully covered all of the features of the legacy one.
> > >>>>>
> > >>>>>
> > >>>>> Compared to Group Window Aggergation, Window TVF Aggergation has
> > several
> > >>>>> advantages, such as two-stage optimization,
> > >>>>> support for standard GROUPING SET syntax, and so on. However, it
> > needs
> > >>> to
> > >>>>> supplement and enrich the following features.
> > >>>>>
> > >>>>>
> > >>>>> 1. Support for SESSION Window TVF Aggregation
> > >>>>> 2. Support for consuming CDC stream
> > >>>>> 3. Support for HOP window size with non-integer step length
> > >>>>> 4. Support for configurations such as early fire, late fire and
> allow
> > >>>>> lateness
> > >>>>> (which are internal experimental configurations in Group Window
> > >>>>> Aggregation and not public to users yet.)
> > >>>>> 5. Unification of the Window TVF Aggregation operator in runtime at
> > the
> > >>>>> implementation layer
> > >>>>> (In the long term, the cost to maintain the operators about Window
> > TVF
> > >>>>> Aggregation and Group Window Aggregation is too expensive.)
> > >>>>>
> > >>>>>
> > >>>>> This flip aims to continue the unfinished work in FLIP-145[2],
> which
> > is
> > >>> to
> > >>>>> fully enable the capabilities of Window TVF Aggregation
> > >>>>>   and officially deprecate the legacy syntax Group Window
> > Aggregation, to
> > >>>>> prepare for the removal of the legacy one in Flink 2.0.
> > >>>>>
> > >>>>>
> > >>>>> I have already done some preliminary POC to validate the
> feasibility
> > of
> > >>>>> the related work in this flip as follows.
> > >>>>> 1. POC for SESSION Window TVF Aggregation [3]
> > >>>>> 2. POC for CUMULATE in Group Window Aggregation operator [4]
> > >>>>> 3. POC for consuming CDC stream in Window Aggregation operator [5]
> > >>>>>
> > >>>>>
> > >>>>> Looking forward to your feedback and thoughts!
> > >>>>>
> > >>>>>
> > >>>>>
> > >>>>> [1]
> > >>>>>
> > >>>
> >
> https://nightlies.apache.org/flink/flink-docs-master/docs/dev/table/sql/queries/window-agg/
> > >>>>>
> > >>>>> [2]
> > >>>>>
> > >>>
> >
> https://cwiki.apache.org/confluence/display/FLINK/FLIP-145%3A+Support+SQL+windowing+table-valued+function#FLIP145:SupportSQLwindowingtablevaluedfunction-SessionWindows
> > >>>>> [3] https://github.com/xuyangzhong/flink/tree/FLINK-24024
> > >>>>> [4]
> > >>>>>
> > >>>
> >
> https://github.com/xuyangzhong/flink/tree/poc_legacy_group_window_agg_cumulate
> > >>>>> [5]
> > >>>>>
> > >>>
> >
> https://github.com/xuyangzhong/flink/tree/poc_window_agg_consumes_cdc_stream
> > >>>>>
> > >>>>>
> > >>>>>
> > >>>>> --
> > >>>>>
> > >>>>>      Best!
> > >>>>>      Xuyang
> > >>>
> >
> >
>
> --
> Best regards,
> Sergey
>

Re: [DISCUSS] FLIP-392: Deprecate the Legacy Group Window Aggregation

Posted by Sergey Nuyanzin <sn...@gmail.com>.
thanks for summarising Timo

+1 for splitting it in different FLIPs
and agree about having "SESSION Window TVF Aggregation" under FLIP-145
Moreover the task is already there, so no need to move it from one FLIP to
another

>And actually Sergey Nuyanzin wanted to work
>in this if I remember correctly. Not sure if this is still the case.

Yes, however it seems there is already an existing PR for that.
Anyway I'm happy to help here with the review as well and will reserve some
time for it in coming days.



On Tue, Dec 12, 2023 at 12:18 PM Timo Walther <tw...@apache.org> wrote:

> Hi Xuyang,
>
> thanks for proposing this FLIP. In my opinion the FLIP touches too many
> topics at the same time and should be split into multiple FLIPs. We
> should stay focused on what is needed for Flink 2.0.
>
> Let me summarizing the topics:
>
> 1) SESSION Window TVF Aggregation
>
> This has been agreed in FLIP-145 already. We don't need another FLIP but
> someone that finally implements this after we have performed the Calcite
> upgrade a couple of months ago. The Calcite upgrade was important
> exactly for SESSION windows. And actually Sergey Nuyanzin wanted to work
> in this if I remember correctly. Not sure if this is still the case.
>
> 2) CDC support of Window TVFs
>
> This can be a FLIP on its own.
>
> 3) HOP window size with non-integer step length
>
> This can be a FLIP on its own.
>
> 4) Configurations such as early fire, late fire and allow lateness
>
> Can we postpone this discussion? Currently we should focus on user
> switching to Window TVFs before Flink 2.0. Early fire, late fire and
> allow lateness have not exposed through public configuration. It can be
> introduced after Flink 2.0 released.
>
> Regards,
> Timo
>
>
> On 12.12.23 08:01, Xuyang wrote:
> > Hi, Jim.
> > Thanks for your explaination.
> >> Ah, I mean to ask if you can contribute the new SESSION Table support
> >> without needing FLIP-392 completely settled.  I was trying to see if
> that
> >> is separate work which can be done or if there is some dependency on
> this
> >> FLIP.
> > The pr available about session window tvf belongs to this flip I think,
> and is part of the work about this flip. Actually the poc pr is not ready
> completely yet,
> > I'll try to update it to implement the session window tvf in window agg
> operator instead of using legacy group window agg operator.
> >> The tests should not be impacted.  Depending on what order our work
> lands
> >> in, one of the tests you've added/updated would likely move to the
> >> RestoreTests that Bonnie and I are working on.  Just mentioning that
> ahead
> >> of time
> >
> > Got it! I will pay attention to it.
> >
> >
> >
> >
> > --
> >
> >      Best!
> >      Xuyang
> >
> >
> >
> >
> >
> > 在 2023-12-11 21:35:00,"Jim Hughes" <jh...@confluent.io.INVALID> 写道:
> >> Hi Xuyang,
> >>
> >> On Sun, Dec 10, 2023 at 10:41 PM Xuyang <xy...@163.com> wrote:
> >>
> >>> Hi, Jim.
> >>>> As a clarification, since FLINK-24204 is finishing up work from
> >>>> FLIP-145[1], do we need to discuss anything before you work out the
> >>> details
> >>>> of FLINK-24024 as a PR?
> >>> Which issue do you mean? It seems that FLINK-24204[1] is the issue with
> >>> table api&sql type system.
> >>>
> >>
> >> Ah, I mean to ask if you can contribute the new SESSION Table support
> >> without needing FLIP-392 completely settled.  I was trying to see if
> that
> >> is separate work which can be done or if there is some dependency on
> this
> >> FLIP.
> >>
> >>
> >>> I've got a PR up [3] for moving at least one of the classes you are
> >>> touching.
> >>> Nice work! Since we are not going to delete the legacy group window agg
> >>> operator actually, the only compatibility issue
> >>> may be that when using flink sql, the legacy group window agg operator
> >>> will be rewritten into new operators. Will these tests be affected
> about
> >>> this rewritten?
> >>>
> >>
> >> The tests should not be impacted.  Depending on what order our work
> lands
> >> in, one of the tests you've added/updated would likely move to the
> >> RestoreTests that Bonnie and I are working on.  Just mentioning that
> ahead
> >> of time
> >>
> >> Cheers,
> >>
> >> Jim
> >>
> >>
> >>
> >>>
> >>> [1] https://issues.apache.org/jira/browse/FLINK-24204
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>> --
> >>>
> >>>      Best!
> >>>      Xuyang
> >>>
> >>>
> >>>
> >>>
> >>>
> >>> At 2023-12-09 06:25:30, "Jim Hughes" <jh...@confluent.io.INVALID>
> wrote:
> >>>> Hi Xuyang,
> >>>>
> >>>> As a clarification, since FLINK-24204 is finishing up work from
> >>>> FLIP-145[1], do we need to discuss anything before you work out the
> >>> details
> >>>> of FLINK-24024 as a PR?
> >>>>
> >>>> Relatedly, as that goes up for a PR, as part of FLINK-33421 [2],
> Bonnie
> >>> and
> >>>> I are working through migrating some of the JsonPlan Tests and
> ITCases to
> >>>> RestoreTests.  I've got a PR up [3] for moving at least one of the
> classes
> >>>> you are touching.  Let me know if I can share any details about that
> work.
> >>>>
> >>>> Cheers,
> >>>>
> >>>> Jim
> >>>>
> >>>> 1.
> >>>>
> >>>
> https://cwiki.apache.org/confluence/display/FLINK/FLIP-145%3A+Support+SQL+windowing+table-valued+function#FLIP145:SupportSQLwindowingtablevaluedfunction-SessionWindows
> >>>>
> >>>> 2. https://issues.apache.org/jira/browse/FLINK-33421
> >>>> 3. https://github.com/apache/flink/pull/23886
> >>>> https://issues.apache.org/jira/browse/FLINK-33676
> >>>>
> >>>> On Tue, Nov 28, 2023 at 7:31 AM Xuyang <xy...@163.com> wrote:
> >>>>
> >>>>> Hi all.
> >>>>> I'd like to start a discussion of FLIP-392: Deprecate the Legacy
> Group
> >>>>> Window Aggregation.
> >>>>>
> >>>>>
> >>>>> Although the current Flink SQL Window Aggregation documentation[1]
> >>>>> indicates that the legacy Group Window Aggregation
> >>>>> syntax has been deprecated, the new Window TVF Aggregation syntax has
> >>> not
> >>>>> fully covered all of the features of the legacy one.
> >>>>>
> >>>>>
> >>>>> Compared to Group Window Aggergation, Window TVF Aggergation has
> several
> >>>>> advantages, such as two-stage optimization,
> >>>>> support for standard GROUPING SET syntax, and so on. However, it
> needs
> >>> to
> >>>>> supplement and enrich the following features.
> >>>>>
> >>>>>
> >>>>> 1. Support for SESSION Window TVF Aggregation
> >>>>> 2. Support for consuming CDC stream
> >>>>> 3. Support for HOP window size with non-integer step length
> >>>>> 4. Support for configurations such as early fire, late fire and allow
> >>>>> lateness
> >>>>> (which are internal experimental configurations in Group Window
> >>>>> Aggregation and not public to users yet.)
> >>>>> 5. Unification of the Window TVF Aggregation operator in runtime at
> the
> >>>>> implementation layer
> >>>>> (In the long term, the cost to maintain the operators about Window
> TVF
> >>>>> Aggregation and Group Window Aggregation is too expensive.)
> >>>>>
> >>>>>
> >>>>> This flip aims to continue the unfinished work in FLIP-145[2], which
> is
> >>> to
> >>>>> fully enable the capabilities of Window TVF Aggregation
> >>>>>   and officially deprecate the legacy syntax Group Window
> Aggregation, to
> >>>>> prepare for the removal of the legacy one in Flink 2.0.
> >>>>>
> >>>>>
> >>>>> I have already done some preliminary POC to validate the feasibility
> of
> >>>>> the related work in this flip as follows.
> >>>>> 1. POC for SESSION Window TVF Aggregation [3]
> >>>>> 2. POC for CUMULATE in Group Window Aggregation operator [4]
> >>>>> 3. POC for consuming CDC stream in Window Aggregation operator [5]
> >>>>>
> >>>>>
> >>>>> Looking forward to your feedback and thoughts!
> >>>>>
> >>>>>
> >>>>>
> >>>>> [1]
> >>>>>
> >>>
> https://nightlies.apache.org/flink/flink-docs-master/docs/dev/table/sql/queries/window-agg/
> >>>>>
> >>>>> [2]
> >>>>>
> >>>
> https://cwiki.apache.org/confluence/display/FLINK/FLIP-145%3A+Support+SQL+windowing+table-valued+function#FLIP145:SupportSQLwindowingtablevaluedfunction-SessionWindows
> >>>>> [3] https://github.com/xuyangzhong/flink/tree/FLINK-24024
> >>>>> [4]
> >>>>>
> >>>
> https://github.com/xuyangzhong/flink/tree/poc_legacy_group_window_agg_cumulate
> >>>>> [5]
> >>>>>
> >>>
> https://github.com/xuyangzhong/flink/tree/poc_window_agg_consumes_cdc_stream
> >>>>>
> >>>>>
> >>>>>
> >>>>> --
> >>>>>
> >>>>>      Best!
> >>>>>      Xuyang
> >>>
>
>

-- 
Best regards,
Sergey

Re: [DISCUSS] FLIP-392: Deprecate the Legacy Group Window Aggregation

Posted by Timo Walther <tw...@apache.org>.
Hi Xuyang,

thanks for proposing this FLIP. In my opinion the FLIP touches too many 
topics at the same time and should be split into multiple FLIPs. We 
should stay focused on what is needed for Flink 2.0.

Let me summarizing the topics:

1) SESSION Window TVF Aggregation

This has been agreed in FLIP-145 already. We don't need another FLIP but 
someone that finally implements this after we have performed the Calcite 
upgrade a couple of months ago. The Calcite upgrade was important 
exactly for SESSION windows. And actually Sergey Nuyanzin wanted to work 
in this if I remember correctly. Not sure if this is still the case.

2) CDC support of Window TVFs

This can be a FLIP on its own.

3) HOP window size with non-integer step length

This can be a FLIP on its own.

4) Configurations such as early fire, late fire and allow lateness

Can we postpone this discussion? Currently we should focus on user 
switching to Window TVFs before Flink 2.0. Early fire, late fire and 
allow lateness have not exposed through public configuration. It can be 
introduced after Flink 2.0 released.

Regards,
Timo


On 12.12.23 08:01, Xuyang wrote:
> Hi, Jim.
> Thanks for your explaination.
>> Ah, I mean to ask if you can contribute the new SESSION Table support
>> without needing FLIP-392 completely settled.  I was trying to see if that
>> is separate work which can be done or if there is some dependency on this
>> FLIP.
> The pr available about session window tvf belongs to this flip I think, and is part of the work about this flip. Actually the poc pr is not ready completely yet,
> I'll try to update it to implement the session window tvf in window agg operator instead of using legacy group window agg operator.
>> The tests should not be impacted.  Depending on what order our work lands
>> in, one of the tests you've added/updated would likely move to the
>> RestoreTests that Bonnie and I are working on.  Just mentioning that ahead
>> of time
> 
> Got it! I will pay attention to it.
> 
> 
> 
> 
> --
> 
>      Best!
>      Xuyang
> 
> 
> 
> 
> 
> 在 2023-12-11 21:35:00,"Jim Hughes" <jh...@confluent.io.INVALID> 写道:
>> Hi Xuyang,
>>
>> On Sun, Dec 10, 2023 at 10:41 PM Xuyang <xy...@163.com> wrote:
>>
>>> Hi, Jim.
>>>> As a clarification, since FLINK-24204 is finishing up work from
>>>> FLIP-145[1], do we need to discuss anything before you work out the
>>> details
>>>> of FLINK-24024 as a PR?
>>> Which issue do you mean? It seems that FLINK-24204[1] is the issue with
>>> table api&sql type system.
>>>
>>
>> Ah, I mean to ask if you can contribute the new SESSION Table support
>> without needing FLIP-392 completely settled.  I was trying to see if that
>> is separate work which can be done or if there is some dependency on this
>> FLIP.
>>
>>
>>> I've got a PR up [3] for moving at least one of the classes you are
>>> touching.
>>> Nice work! Since we are not going to delete the legacy group window agg
>>> operator actually, the only compatibility issue
>>> may be that when using flink sql, the legacy group window agg operator
>>> will be rewritten into new operators. Will these tests be affected about
>>> this rewritten?
>>>
>>
>> The tests should not be impacted.  Depending on what order our work lands
>> in, one of the tests you've added/updated would likely move to the
>> RestoreTests that Bonnie and I are working on.  Just mentioning that ahead
>> of time
>>
>> Cheers,
>>
>> Jim
>>
>>
>>
>>>
>>> [1] https://issues.apache.org/jira/browse/FLINK-24204
>>>
>>>
>>>
>>>
>>>
>>>
>>> --
>>>
>>>      Best!
>>>      Xuyang
>>>
>>>
>>>
>>>
>>>
>>> At 2023-12-09 06:25:30, "Jim Hughes" <jh...@confluent.io.INVALID> wrote:
>>>> Hi Xuyang,
>>>>
>>>> As a clarification, since FLINK-24204 is finishing up work from
>>>> FLIP-145[1], do we need to discuss anything before you work out the
>>> details
>>>> of FLINK-24024 as a PR?
>>>>
>>>> Relatedly, as that goes up for a PR, as part of FLINK-33421 [2], Bonnie
>>> and
>>>> I are working through migrating some of the JsonPlan Tests and ITCases to
>>>> RestoreTests.  I've got a PR up [3] for moving at least one of the classes
>>>> you are touching.  Let me know if I can share any details about that work.
>>>>
>>>> Cheers,
>>>>
>>>> Jim
>>>>
>>>> 1.
>>>>
>>> https://cwiki.apache.org/confluence/display/FLINK/FLIP-145%3A+Support+SQL+windowing+table-valued+function#FLIP145:SupportSQLwindowingtablevaluedfunction-SessionWindows
>>>>
>>>> 2. https://issues.apache.org/jira/browse/FLINK-33421
>>>> 3. https://github.com/apache/flink/pull/23886
>>>> https://issues.apache.org/jira/browse/FLINK-33676
>>>>
>>>> On Tue, Nov 28, 2023 at 7:31 AM Xuyang <xy...@163.com> wrote:
>>>>
>>>>> Hi all.
>>>>> I'd like to start a discussion of FLIP-392: Deprecate the Legacy Group
>>>>> Window Aggregation.
>>>>>
>>>>>
>>>>> Although the current Flink SQL Window Aggregation documentation[1]
>>>>> indicates that the legacy Group Window Aggregation
>>>>> syntax has been deprecated, the new Window TVF Aggregation syntax has
>>> not
>>>>> fully covered all of the features of the legacy one.
>>>>>
>>>>>
>>>>> Compared to Group Window Aggergation, Window TVF Aggergation has several
>>>>> advantages, such as two-stage optimization,
>>>>> support for standard GROUPING SET syntax, and so on. However, it needs
>>> to
>>>>> supplement and enrich the following features.
>>>>>
>>>>>
>>>>> 1. Support for SESSION Window TVF Aggregation
>>>>> 2. Support for consuming CDC stream
>>>>> 3. Support for HOP window size with non-integer step length
>>>>> 4. Support for configurations such as early fire, late fire and allow
>>>>> lateness
>>>>> (which are internal experimental configurations in Group Window
>>>>> Aggregation and not public to users yet.)
>>>>> 5. Unification of the Window TVF Aggregation operator in runtime at the
>>>>> implementation layer
>>>>> (In the long term, the cost to maintain the operators about Window TVF
>>>>> Aggregation and Group Window Aggregation is too expensive.)
>>>>>
>>>>>
>>>>> This flip aims to continue the unfinished work in FLIP-145[2], which is
>>> to
>>>>> fully enable the capabilities of Window TVF Aggregation
>>>>>   and officially deprecate the legacy syntax Group Window Aggregation, to
>>>>> prepare for the removal of the legacy one in Flink 2.0.
>>>>>
>>>>>
>>>>> I have already done some preliminary POC to validate the feasibility of
>>>>> the related work in this flip as follows.
>>>>> 1. POC for SESSION Window TVF Aggregation [3]
>>>>> 2. POC for CUMULATE in Group Window Aggregation operator [4]
>>>>> 3. POC for consuming CDC stream in Window Aggregation operator [5]
>>>>>
>>>>>
>>>>> Looking forward to your feedback and thoughts!
>>>>>
>>>>>
>>>>>
>>>>> [1]
>>>>>
>>> https://nightlies.apache.org/flink/flink-docs-master/docs/dev/table/sql/queries/window-agg/
>>>>>
>>>>> [2]
>>>>>
>>> https://cwiki.apache.org/confluence/display/FLINK/FLIP-145%3A+Support+SQL+windowing+table-valued+function#FLIP145:SupportSQLwindowingtablevaluedfunction-SessionWindows
>>>>> [3] https://github.com/xuyangzhong/flink/tree/FLINK-24024
>>>>> [4]
>>>>>
>>> https://github.com/xuyangzhong/flink/tree/poc_legacy_group_window_agg_cumulate
>>>>> [5]
>>>>>
>>> https://github.com/xuyangzhong/flink/tree/poc_window_agg_consumes_cdc_stream
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>>
>>>>>      Best!
>>>>>      Xuyang
>>>


Re:Re: Re: [DISCUSS] FLIP-392: Deprecate the Legacy Group Window Aggregation

Posted by Xuyang <xy...@163.com>.
Hi, Jim.
Thanks for your explaination.
>Ah, I mean to ask if you can contribute the new SESSION Table support
>without needing FLIP-392 completely settled.  I was trying to see if that
>is separate work which can be done or if there is some dependency on this
>FLIP.
The pr available about session window tvf belongs to this flip I think, and is part of the work about this flip. Actually the poc pr is not ready completely yet, 
I'll try to update it to implement the session window tvf in window agg operator instead of using legacy group window agg operator.
>The tests should not be impacted.  Depending on what order our work lands
>in, one of the tests you've added/updated would likely move to the
>RestoreTests that Bonnie and I are working on.  Just mentioning that ahead
>of time

Got it! I will pay attention to it.




--

    Best!
    Xuyang





在 2023-12-11 21:35:00,"Jim Hughes" <jh...@confluent.io.INVALID> 写道:
>Hi Xuyang,
>
>On Sun, Dec 10, 2023 at 10:41 PM Xuyang <xy...@163.com> wrote:
>
>> Hi, Jim.
>> >As a clarification, since FLINK-24204 is finishing up work from
>> >FLIP-145[1], do we need to discuss anything before you work out the
>> details
>> >of FLINK-24024 as a PR?
>> Which issue do you mean? It seems that FLINK-24204[1] is the issue with
>> table api&sql type system.
>>
>
>Ah, I mean to ask if you can contribute the new SESSION Table support
>without needing FLIP-392 completely settled.  I was trying to see if that
>is separate work which can be done or if there is some dependency on this
>FLIP.
>
>
>> I've got a PR up [3] for moving at least one of the classes you are
>> touching.
>> Nice work! Since we are not going to delete the legacy group window agg
>> operator actually, the only compatibility issue
>> may be that when using flink sql, the legacy group window agg operator
>> will be rewritten into new operators. Will these tests be affected about
>> this rewritten?
>>
>
>The tests should not be impacted.  Depending on what order our work lands
>in, one of the tests you've added/updated would likely move to the
>RestoreTests that Bonnie and I are working on.  Just mentioning that ahead
>of time
>
>Cheers,
>
>Jim
>
>
>
>>
>> [1] https://issues.apache.org/jira/browse/FLINK-24204
>>
>>
>>
>>
>>
>>
>> --
>>
>>     Best!
>>     Xuyang
>>
>>
>>
>>
>>
>> At 2023-12-09 06:25:30, "Jim Hughes" <jh...@confluent.io.INVALID> wrote:
>> >Hi Xuyang,
>> >
>> >As a clarification, since FLINK-24204 is finishing up work from
>> >FLIP-145[1], do we need to discuss anything before you work out the
>> details
>> >of FLINK-24024 as a PR?
>> >
>> >Relatedly, as that goes up for a PR, as part of FLINK-33421 [2], Bonnie
>> and
>> >I are working through migrating some of the JsonPlan Tests and ITCases to
>> >RestoreTests.  I've got a PR up [3] for moving at least one of the classes
>> >you are touching.  Let me know if I can share any details about that work.
>> >
>> >Cheers,
>> >
>> >Jim
>> >
>> >1.
>> >
>> https://cwiki.apache.org/confluence/display/FLINK/FLIP-145%3A+Support+SQL+windowing+table-valued+function#FLIP145:SupportSQLwindowingtablevaluedfunction-SessionWindows
>> >
>> >2. https://issues.apache.org/jira/browse/FLINK-33421
>> >3. https://github.com/apache/flink/pull/23886
>> >https://issues.apache.org/jira/browse/FLINK-33676
>> >
>> >On Tue, Nov 28, 2023 at 7:31 AM Xuyang <xy...@163.com> wrote:
>> >
>> >> Hi all.
>> >> I'd like to start a discussion of FLIP-392: Deprecate the Legacy Group
>> >> Window Aggregation.
>> >>
>> >>
>> >> Although the current Flink SQL Window Aggregation documentation[1]
>> >> indicates that the legacy Group Window Aggregation
>> >> syntax has been deprecated, the new Window TVF Aggregation syntax has
>> not
>> >> fully covered all of the features of the legacy one.
>> >>
>> >>
>> >> Compared to Group Window Aggergation, Window TVF Aggergation has several
>> >> advantages, such as two-stage optimization,
>> >> support for standard GROUPING SET syntax, and so on. However, it needs
>> to
>> >> supplement and enrich the following features.
>> >>
>> >>
>> >> 1. Support for SESSION Window TVF Aggregation
>> >> 2. Support for consuming CDC stream
>> >> 3. Support for HOP window size with non-integer step length
>> >> 4. Support for configurations such as early fire, late fire and allow
>> >> lateness
>> >> (which are internal experimental configurations in Group Window
>> >> Aggregation and not public to users yet.)
>> >> 5. Unification of the Window TVF Aggregation operator in runtime at the
>> >> implementation layer
>> >> (In the long term, the cost to maintain the operators about Window TVF
>> >> Aggregation and Group Window Aggregation is too expensive.)
>> >>
>> >>
>> >> This flip aims to continue the unfinished work in FLIP-145[2], which is
>> to
>> >> fully enable the capabilities of Window TVF Aggregation
>> >>  and officially deprecate the legacy syntax Group Window Aggregation, to
>> >> prepare for the removal of the legacy one in Flink 2.0.
>> >>
>> >>
>> >> I have already done some preliminary POC to validate the feasibility of
>> >> the related work in this flip as follows.
>> >> 1. POC for SESSION Window TVF Aggregation [3]
>> >> 2. POC for CUMULATE in Group Window Aggregation operator [4]
>> >> 3. POC for consuming CDC stream in Window Aggregation operator [5]
>> >>
>> >>
>> >> Looking forward to your feedback and thoughts!
>> >>
>> >>
>> >>
>> >> [1]
>> >>
>> https://nightlies.apache.org/flink/flink-docs-master/docs/dev/table/sql/queries/window-agg/
>> >>
>> >> [2]
>> >>
>> https://cwiki.apache.org/confluence/display/FLINK/FLIP-145%3A+Support+SQL+windowing+table-valued+function#FLIP145:SupportSQLwindowingtablevaluedfunction-SessionWindows
>> >> [3] https://github.com/xuyangzhong/flink/tree/FLINK-24024
>> >> [4]
>> >>
>> https://github.com/xuyangzhong/flink/tree/poc_legacy_group_window_agg_cumulate
>> >> [5]
>> >>
>> https://github.com/xuyangzhong/flink/tree/poc_window_agg_consumes_cdc_stream
>> >>
>> >>
>> >>
>> >> --
>> >>
>> >>     Best!
>> >>     Xuyang
>>

Re: Re: [DISCUSS] FLIP-392: Deprecate the Legacy Group Window Aggregation

Posted by Jim Hughes <jh...@confluent.io.INVALID>.
Hi Xuyang,

On Sun, Dec 10, 2023 at 10:41 PM Xuyang <xy...@163.com> wrote:

> Hi, Jim.
> >As a clarification, since FLINK-24204 is finishing up work from
> >FLIP-145[1], do we need to discuss anything before you work out the
> details
> >of FLINK-24024 as a PR?
> Which issue do you mean? It seems that FLINK-24204[1] is the issue with
> table api&sql type system.
>

Ah, I mean to ask if you can contribute the new SESSION Table support
without needing FLIP-392 completely settled.  I was trying to see if that
is separate work which can be done or if there is some dependency on this
FLIP.


> I've got a PR up [3] for moving at least one of the classes you are
> touching.
> Nice work! Since we are not going to delete the legacy group window agg
> operator actually, the only compatibility issue
> may be that when using flink sql, the legacy group window agg operator
> will be rewritten into new operators. Will these tests be affected about
> this rewritten?
>

The tests should not be impacted.  Depending on what order our work lands
in, one of the tests you've added/updated would likely move to the
RestoreTests that Bonnie and I are working on.  Just mentioning that ahead
of time

Cheers,

Jim



>
> [1] https://issues.apache.org/jira/browse/FLINK-24204
>
>
>
>
>
>
> --
>
>     Best!
>     Xuyang
>
>
>
>
>
> At 2023-12-09 06:25:30, "Jim Hughes" <jh...@confluent.io.INVALID> wrote:
> >Hi Xuyang,
> >
> >As a clarification, since FLINK-24204 is finishing up work from
> >FLIP-145[1], do we need to discuss anything before you work out the
> details
> >of FLINK-24024 as a PR?
> >
> >Relatedly, as that goes up for a PR, as part of FLINK-33421 [2], Bonnie
> and
> >I are working through migrating some of the JsonPlan Tests and ITCases to
> >RestoreTests.  I've got a PR up [3] for moving at least one of the classes
> >you are touching.  Let me know if I can share any details about that work.
> >
> >Cheers,
> >
> >Jim
> >
> >1.
> >
> https://cwiki.apache.org/confluence/display/FLINK/FLIP-145%3A+Support+SQL+windowing+table-valued+function#FLIP145:SupportSQLwindowingtablevaluedfunction-SessionWindows
> >
> >2. https://issues.apache.org/jira/browse/FLINK-33421
> >3. https://github.com/apache/flink/pull/23886
> >https://issues.apache.org/jira/browse/FLINK-33676
> >
> >On Tue, Nov 28, 2023 at 7:31 AM Xuyang <xy...@163.com> wrote:
> >
> >> Hi all.
> >> I'd like to start a discussion of FLIP-392: Deprecate the Legacy Group
> >> Window Aggregation.
> >>
> >>
> >> Although the current Flink SQL Window Aggregation documentation[1]
> >> indicates that the legacy Group Window Aggregation
> >> syntax has been deprecated, the new Window TVF Aggregation syntax has
> not
> >> fully covered all of the features of the legacy one.
> >>
> >>
> >> Compared to Group Window Aggergation, Window TVF Aggergation has several
> >> advantages, such as two-stage optimization,
> >> support for standard GROUPING SET syntax, and so on. However, it needs
> to
> >> supplement and enrich the following features.
> >>
> >>
> >> 1. Support for SESSION Window TVF Aggregation
> >> 2. Support for consuming CDC stream
> >> 3. Support for HOP window size with non-integer step length
> >> 4. Support for configurations such as early fire, late fire and allow
> >> lateness
> >> (which are internal experimental configurations in Group Window
> >> Aggregation and not public to users yet.)
> >> 5. Unification of the Window TVF Aggregation operator in runtime at the
> >> implementation layer
> >> (In the long term, the cost to maintain the operators about Window TVF
> >> Aggregation and Group Window Aggregation is too expensive.)
> >>
> >>
> >> This flip aims to continue the unfinished work in FLIP-145[2], which is
> to
> >> fully enable the capabilities of Window TVF Aggregation
> >>  and officially deprecate the legacy syntax Group Window Aggregation, to
> >> prepare for the removal of the legacy one in Flink 2.0.
> >>
> >>
> >> I have already done some preliminary POC to validate the feasibility of
> >> the related work in this flip as follows.
> >> 1. POC for SESSION Window TVF Aggregation [3]
> >> 2. POC for CUMULATE in Group Window Aggregation operator [4]
> >> 3. POC for consuming CDC stream in Window Aggregation operator [5]
> >>
> >>
> >> Looking forward to your feedback and thoughts!
> >>
> >>
> >>
> >> [1]
> >>
> https://nightlies.apache.org/flink/flink-docs-master/docs/dev/table/sql/queries/window-agg/
> >>
> >> [2]
> >>
> https://cwiki.apache.org/confluence/display/FLINK/FLIP-145%3A+Support+SQL+windowing+table-valued+function#FLIP145:SupportSQLwindowingtablevaluedfunction-SessionWindows
> >> [3] https://github.com/xuyangzhong/flink/tree/FLINK-24024
> >> [4]
> >>
> https://github.com/xuyangzhong/flink/tree/poc_legacy_group_window_agg_cumulate
> >> [5]
> >>
> https://github.com/xuyangzhong/flink/tree/poc_window_agg_consumes_cdc_stream
> >>
> >>
> >>
> >> --
> >>
> >>     Best!
> >>     Xuyang
>

Re: Re: Re: [DISCUSS] FLIP-392: Deprecate the Legacy Group Window Aggregation

Posted by Jane Chan <qi...@gmail.com>.
Hi Xuyang,

Thank you for the clarification. I now have a clear understanding of the
issue.

Actually the work that supports unaligned window in window agg operator is
> included in this flip. We will always try to implement
> features in window agg operator first and then consider falling back to
> legacy group window agg if there are too many problems.
>

Could you provide more details on this part? My initial concerns arose from
the fact that, aside from a brief mention, there seems to be a lack of
comprehensive exploration on this topic, and notably, it's also absent from
the PoC code.

Best,
Jane

On Tue, Dec 12, 2023 at 2:55 PM Xuyang <xy...@163.com> wrote:

> Hi, Jane.
>
>
> Thanks for your feedback.
>
>
> >1. Let's set aside the workload for a moment and clearly conceptualize the
> >ideal implementation in the end state, or at the very least, document the
>
> >current limitations in this FLIP to prevent them from being overlooked.
>
>
> Actually the work that supports unaligned window in window agg operator is
> included in this flip. We will always try to implement
> features in window agg operator first and then consider falling back to
> legacy group window agg if there are too many problems.
> >2. Can we consider maintaining consistency at the ExecNode level for the
> >session window TVF with other TVFs?
> You're right, thanks for your reminder. I'll move the logic about fallback
> to legacy legacy group window agg inside the exec node instead of physical
> node.
>
>
>
> --
>
>     Best!
>     Xuyang
>
>
>
>
>
> At 2023-12-11 20:38:25, "Jane Chan" <qi...@gmail.com> wrote:
> >Hi Xuyang,
> >
> >Thanks for driving this discussion.
> >
> >I briefly reviewed the first PoC code[1] you provided for implementing the
> >session window TVF, and I noticed a problem. In the `translateToExecNode`
> >method of `StreamPhysicalWindowAggregate`, the session window TVF is
> >translated into the legacy `StreamExecGroupWindowAggregate` instead of
> >`StreamExecWindowAggregate`. I can guess that the reason for this is
> >because we currently lack an operator that supports unaligned windows (and
> >session windows belong to this category), but this means that we are only
> >supporting session window TVF at the syntax level. My concern is that, if
> >we support it in this way, it will be very difficult to get rid of the
> >legacy implementation in forthcoming 2.0.
> >
> >Certainly, I understand that supporting it at the operator level would
> >significantly increase the scope of work for this FLIP. Here my cents:
> >
> >1. Let's set aside the workload for a moment and clearly conceptualize the
> >ideal implementation in the end state, or at the very least, document the
> >current limitations in this FLIP to prevent them from being overlooked.
> >
> >2. Can we consider maintaining consistency at the ExecNode level for the
> >session window TVF with other TVFs? By doing so, even if we introduce the
> >actual unaligned window operator in a future 2.x release, we could still
> >ensure that the session TVF from the version it is supported can be
> >successfully deserialized through the `CompiledPlan`.
> >
> >WDYT?
> >
> >Best,
> >Jane
> >
> >[1] https://github.com/xuyangzhong/flink/tree/FLINK-24024
> >
> >On Mon, Dec 11, 2023 at 11:41 AM Xuyang <xy...@163.com> wrote:
> >
> >> Hi, Jim.
> >> >As a clarification, since FLINK-24204 is finishing up work from
> >> >FLIP-145[1], do we need to discuss anything before you work out the
> >> details
> >> >of FLINK-24024 as a PR?
> >> Which issue do you mean? It seems that FLINK-24204[1] is the issue with
> >> table api&sql type system.
> >>
> >>
> >> > I've got a PR up [3] for moving at least one of the classes you are
> >> touching.
> >> Nice work! Since we are not going to delete the legacy group window agg
> >> operator actually, the only compatibility issue
> >> may be that when using flink sql, the legacy group window agg operator
> >> will be rewritten into new operators. Will these tests be affected about
> >> this rewritten?
> >>
> >>
> >>
> >>
> >> [1] https://issues.apache.org/jira/browse/FLINK-24204
> >>
> >>
> >>
> >>
> >>
> >>
> >> --
> >>
> >>     Best!
> >>     Xuyang
> >>
> >>
> >>
> >>
> >>
> >> At 2023-12-09 06:25:30, "Jim Hughes" <jh...@confluent.io.INVALID>
> wrote:
> >> >Hi Xuyang,
> >> >
> >> >As a clarification, since FLINK-24204 is finishing up work from
> >> >FLIP-145[1], do we need to discuss anything before you work out the
> >> details
> >> >of FLINK-24024 as a PR?
> >> >
> >> >Relatedly, as that goes up for a PR, as part of FLINK-33421 [2], Bonnie
> >> and
> >> >I are working through migrating some of the JsonPlan Tests and ITCases
> to
> >> >RestoreTests.  I've got a PR up [3] for moving at least one of the
> classes
> >> >you are touching.  Let me know if I can share any details about that
> work.
> >> >
> >> >Cheers,
> >> >
> >> >Jim
> >> >
> >> >1.
> >> >
> >>
> https://cwiki.apache.org/confluence/display/FLINK/FLIP-145%3A+Support+SQL+windowing+table-valued+function#FLIP145:SupportSQLwindowingtablevaluedfunction-SessionWindows
> >> >
> >> >2. https://issues.apache.org/jira/browse/FLINK-33421
> >> >3. https://github.com/apache/flink/pull/23886
> >> >https://issues.apache.org/jira/browse/FLINK-33676
> >> >
> >> >On Tue, Nov 28, 2023 at 7:31 AM Xuyang <xy...@163.com> wrote:
> >> >
> >> >> Hi all.
> >> >> I'd like to start a discussion of FLIP-392: Deprecate the Legacy
> Group
> >> >> Window Aggregation.
> >> >>
> >> >>
> >> >> Although the current Flink SQL Window Aggregation documentation[1]
> >> >> indicates that the legacy Group Window Aggregation
> >> >> syntax has been deprecated, the new Window TVF Aggregation syntax has
> >> not
> >> >> fully covered all of the features of the legacy one.
> >> >>
> >> >>
> >> >> Compared to Group Window Aggergation, Window TVF Aggergation has
> several
> >> >> advantages, such as two-stage optimization,
> >> >> support for standard GROUPING SET syntax, and so on. However, it
> needs
> >> to
> >> >> supplement and enrich the following features.
> >> >>
> >> >>
> >> >> 1. Support for SESSION Window TVF Aggregation
> >> >> 2. Support for consuming CDC stream
> >> >> 3. Support for HOP window size with non-integer step length
> >> >> 4. Support for configurations such as early fire, late fire and allow
> >> >> lateness
> >> >> (which are internal experimental configurations in Group Window
> >> >> Aggregation and not public to users yet.)
> >> >> 5. Unification of the Window TVF Aggregation operator in runtime at
> the
> >> >> implementation layer
> >> >> (In the long term, the cost to maintain the operators about Window
> TVF
> >> >> Aggregation and Group Window Aggregation is too expensive.)
> >> >>
> >> >>
> >> >> This flip aims to continue the unfinished work in FLIP-145[2], which
> is
> >> to
> >> >> fully enable the capabilities of Window TVF Aggregation
> >> >>  and officially deprecate the legacy syntax Group Window
> Aggregation, to
> >> >> prepare for the removal of the legacy one in Flink 2.0.
> >> >>
> >> >>
> >> >> I have already done some preliminary POC to validate the feasibility
> of
> >> >> the related work in this flip as follows.
> >> >> 1. POC for SESSION Window TVF Aggregation [3]
> >> >> 2. POC for CUMULATE in Group Window Aggregation operator [4]
> >> >> 3. POC for consuming CDC stream in Window Aggregation operator [5]
> >> >>
> >> >>
> >> >> Looking forward to your feedback and thoughts!
> >> >>
> >> >>
> >> >>
> >> >> [1]
> >> >>
> >>
> https://nightlies.apache.org/flink/flink-docs-master/docs/dev/table/sql/queries/window-agg/
> >> >>
> >> >> [2]
> >> >>
> >>
> https://cwiki.apache.org/confluence/display/FLINK/FLIP-145%3A+Support+SQL+windowing+table-valued+function#FLIP145:SupportSQLwindowingtablevaluedfunction-SessionWindows
> >> >> [3] https://github.com/xuyangzhong/flink/tree/FLINK-24024
> >> >> [4]
> >> >>
> >>
> https://github.com/xuyangzhong/flink/tree/poc_legacy_group_window_agg_cumulate
> >> >> [5]
> >> >>
> >>
> https://github.com/xuyangzhong/flink/tree/poc_window_agg_consumes_cdc_stream
> >> >>
> >> >>
> >> >>
> >> >> --
> >> >>
> >> >>     Best!
> >> >>     Xuyang
> >>
>

Re:Re: Re: [DISCUSS] FLIP-392: Deprecate the Legacy Group Window Aggregation

Posted by Xuyang <xy...@163.com>.
Hi, Jane.


Thanks for your feedback.


>1. Let's set aside the workload for a moment and clearly conceptualize the
>ideal implementation in the end state, or at the very least, document the

>current limitations in this FLIP to prevent them from being overlooked.


Actually the work that supports unaligned window in window agg operator is included in this flip. We will always try to implement 
features in window agg operator first and then consider falling back to legacy group window agg if there are too many problems.
>2. Can we consider maintaining consistency at the ExecNode level for the
>session window TVF with other TVFs?
You're right, thanks for your reminder. I'll move the logic about fallback to legacy legacy group window agg inside the exec node instead of physical node.



--

    Best!
    Xuyang





At 2023-12-11 20:38:25, "Jane Chan" <qi...@gmail.com> wrote:
>Hi Xuyang,
>
>Thanks for driving this discussion.
>
>I briefly reviewed the first PoC code[1] you provided for implementing the
>session window TVF, and I noticed a problem. In the `translateToExecNode`
>method of `StreamPhysicalWindowAggregate`, the session window TVF is
>translated into the legacy `StreamExecGroupWindowAggregate` instead of
>`StreamExecWindowAggregate`. I can guess that the reason for this is
>because we currently lack an operator that supports unaligned windows (and
>session windows belong to this category), but this means that we are only
>supporting session window TVF at the syntax level. My concern is that, if
>we support it in this way, it will be very difficult to get rid of the
>legacy implementation in forthcoming 2.0.
>
>Certainly, I understand that supporting it at the operator level would
>significantly increase the scope of work for this FLIP. Here my cents:
>
>1. Let's set aside the workload for a moment and clearly conceptualize the
>ideal implementation in the end state, or at the very least, document the
>current limitations in this FLIP to prevent them from being overlooked.
>
>2. Can we consider maintaining consistency at the ExecNode level for the
>session window TVF with other TVFs? By doing so, even if we introduce the
>actual unaligned window operator in a future 2.x release, we could still
>ensure that the session TVF from the version it is supported can be
>successfully deserialized through the `CompiledPlan`.
>
>WDYT?
>
>Best,
>Jane
>
>[1] https://github.com/xuyangzhong/flink/tree/FLINK-24024
>
>On Mon, Dec 11, 2023 at 11:41 AM Xuyang <xy...@163.com> wrote:
>
>> Hi, Jim.
>> >As a clarification, since FLINK-24204 is finishing up work from
>> >FLIP-145[1], do we need to discuss anything before you work out the
>> details
>> >of FLINK-24024 as a PR?
>> Which issue do you mean? It seems that FLINK-24204[1] is the issue with
>> table api&sql type system.
>>
>>
>> > I've got a PR up [3] for moving at least one of the classes you are
>> touching.
>> Nice work! Since we are not going to delete the legacy group window agg
>> operator actually, the only compatibility issue
>> may be that when using flink sql, the legacy group window agg operator
>> will be rewritten into new operators. Will these tests be affected about
>> this rewritten?
>>
>>
>>
>>
>> [1] https://issues.apache.org/jira/browse/FLINK-24204
>>
>>
>>
>>
>>
>>
>> --
>>
>>     Best!
>>     Xuyang
>>
>>
>>
>>
>>
>> At 2023-12-09 06:25:30, "Jim Hughes" <jh...@confluent.io.INVALID> wrote:
>> >Hi Xuyang,
>> >
>> >As a clarification, since FLINK-24204 is finishing up work from
>> >FLIP-145[1], do we need to discuss anything before you work out the
>> details
>> >of FLINK-24024 as a PR?
>> >
>> >Relatedly, as that goes up for a PR, as part of FLINK-33421 [2], Bonnie
>> and
>> >I are working through migrating some of the JsonPlan Tests and ITCases to
>> >RestoreTests.  I've got a PR up [3] for moving at least one of the classes
>> >you are touching.  Let me know if I can share any details about that work.
>> >
>> >Cheers,
>> >
>> >Jim
>> >
>> >1.
>> >
>> https://cwiki.apache.org/confluence/display/FLINK/FLIP-145%3A+Support+SQL+windowing+table-valued+function#FLIP145:SupportSQLwindowingtablevaluedfunction-SessionWindows
>> >
>> >2. https://issues.apache.org/jira/browse/FLINK-33421
>> >3. https://github.com/apache/flink/pull/23886
>> >https://issues.apache.org/jira/browse/FLINK-33676
>> >
>> >On Tue, Nov 28, 2023 at 7:31 AM Xuyang <xy...@163.com> wrote:
>> >
>> >> Hi all.
>> >> I'd like to start a discussion of FLIP-392: Deprecate the Legacy Group
>> >> Window Aggregation.
>> >>
>> >>
>> >> Although the current Flink SQL Window Aggregation documentation[1]
>> >> indicates that the legacy Group Window Aggregation
>> >> syntax has been deprecated, the new Window TVF Aggregation syntax has
>> not
>> >> fully covered all of the features of the legacy one.
>> >>
>> >>
>> >> Compared to Group Window Aggergation, Window TVF Aggergation has several
>> >> advantages, such as two-stage optimization,
>> >> support for standard GROUPING SET syntax, and so on. However, it needs
>> to
>> >> supplement and enrich the following features.
>> >>
>> >>
>> >> 1. Support for SESSION Window TVF Aggregation
>> >> 2. Support for consuming CDC stream
>> >> 3. Support for HOP window size with non-integer step length
>> >> 4. Support for configurations such as early fire, late fire and allow
>> >> lateness
>> >> (which are internal experimental configurations in Group Window
>> >> Aggregation and not public to users yet.)
>> >> 5. Unification of the Window TVF Aggregation operator in runtime at the
>> >> implementation layer
>> >> (In the long term, the cost to maintain the operators about Window TVF
>> >> Aggregation and Group Window Aggregation is too expensive.)
>> >>
>> >>
>> >> This flip aims to continue the unfinished work in FLIP-145[2], which is
>> to
>> >> fully enable the capabilities of Window TVF Aggregation
>> >>  and officially deprecate the legacy syntax Group Window Aggregation, to
>> >> prepare for the removal of the legacy one in Flink 2.0.
>> >>
>> >>
>> >> I have already done some preliminary POC to validate the feasibility of
>> >> the related work in this flip as follows.
>> >> 1. POC for SESSION Window TVF Aggregation [3]
>> >> 2. POC for CUMULATE in Group Window Aggregation operator [4]
>> >> 3. POC for consuming CDC stream in Window Aggregation operator [5]
>> >>
>> >>
>> >> Looking forward to your feedback and thoughts!
>> >>
>> >>
>> >>
>> >> [1]
>> >>
>> https://nightlies.apache.org/flink/flink-docs-master/docs/dev/table/sql/queries/window-agg/
>> >>
>> >> [2]
>> >>
>> https://cwiki.apache.org/confluence/display/FLINK/FLIP-145%3A+Support+SQL+windowing+table-valued+function#FLIP145:SupportSQLwindowingtablevaluedfunction-SessionWindows
>> >> [3] https://github.com/xuyangzhong/flink/tree/FLINK-24024
>> >> [4]
>> >>
>> https://github.com/xuyangzhong/flink/tree/poc_legacy_group_window_agg_cumulate
>> >> [5]
>> >>
>> https://github.com/xuyangzhong/flink/tree/poc_window_agg_consumes_cdc_stream
>> >>
>> >>
>> >>
>> >> --
>> >>
>> >>     Best!
>> >>     Xuyang
>>

Re: Re: [DISCUSS] FLIP-392: Deprecate the Legacy Group Window Aggregation

Posted by Jane Chan <qi...@gmail.com>.
Hi Xuyang,

Thanks for driving this discussion.

I briefly reviewed the first PoC code[1] you provided for implementing the
session window TVF, and I noticed a problem. In the `translateToExecNode`
method of `StreamPhysicalWindowAggregate`, the session window TVF is
translated into the legacy `StreamExecGroupWindowAggregate` instead of
`StreamExecWindowAggregate`. I can guess that the reason for this is
because we currently lack an operator that supports unaligned windows (and
session windows belong to this category), but this means that we are only
supporting session window TVF at the syntax level. My concern is that, if
we support it in this way, it will be very difficult to get rid of the
legacy implementation in forthcoming 2.0.

Certainly, I understand that supporting it at the operator level would
significantly increase the scope of work for this FLIP. Here my cents:

1. Let's set aside the workload for a moment and clearly conceptualize the
ideal implementation in the end state, or at the very least, document the
current limitations in this FLIP to prevent them from being overlooked.

2. Can we consider maintaining consistency at the ExecNode level for the
session window TVF with other TVFs? By doing so, even if we introduce the
actual unaligned window operator in a future 2.x release, we could still
ensure that the session TVF from the version it is supported can be
successfully deserialized through the `CompiledPlan`.

WDYT?

Best,
Jane

[1] https://github.com/xuyangzhong/flink/tree/FLINK-24024

On Mon, Dec 11, 2023 at 11:41 AM Xuyang <xy...@163.com> wrote:

> Hi, Jim.
> >As a clarification, since FLINK-24204 is finishing up work from
> >FLIP-145[1], do we need to discuss anything before you work out the
> details
> >of FLINK-24024 as a PR?
> Which issue do you mean? It seems that FLINK-24204[1] is the issue with
> table api&sql type system.
>
>
> > I've got a PR up [3] for moving at least one of the classes you are
> touching.
> Nice work! Since we are not going to delete the legacy group window agg
> operator actually, the only compatibility issue
> may be that when using flink sql, the legacy group window agg operator
> will be rewritten into new operators. Will these tests be affected about
> this rewritten?
>
>
>
>
> [1] https://issues.apache.org/jira/browse/FLINK-24204
>
>
>
>
>
>
> --
>
>     Best!
>     Xuyang
>
>
>
>
>
> At 2023-12-09 06:25:30, "Jim Hughes" <jh...@confluent.io.INVALID> wrote:
> >Hi Xuyang,
> >
> >As a clarification, since FLINK-24204 is finishing up work from
> >FLIP-145[1], do we need to discuss anything before you work out the
> details
> >of FLINK-24024 as a PR?
> >
> >Relatedly, as that goes up for a PR, as part of FLINK-33421 [2], Bonnie
> and
> >I are working through migrating some of the JsonPlan Tests and ITCases to
> >RestoreTests.  I've got a PR up [3] for moving at least one of the classes
> >you are touching.  Let me know if I can share any details about that work.
> >
> >Cheers,
> >
> >Jim
> >
> >1.
> >
> https://cwiki.apache.org/confluence/display/FLINK/FLIP-145%3A+Support+SQL+windowing+table-valued+function#FLIP145:SupportSQLwindowingtablevaluedfunction-SessionWindows
> >
> >2. https://issues.apache.org/jira/browse/FLINK-33421
> >3. https://github.com/apache/flink/pull/23886
> >https://issues.apache.org/jira/browse/FLINK-33676
> >
> >On Tue, Nov 28, 2023 at 7:31 AM Xuyang <xy...@163.com> wrote:
> >
> >> Hi all.
> >> I'd like to start a discussion of FLIP-392: Deprecate the Legacy Group
> >> Window Aggregation.
> >>
> >>
> >> Although the current Flink SQL Window Aggregation documentation[1]
> >> indicates that the legacy Group Window Aggregation
> >> syntax has been deprecated, the new Window TVF Aggregation syntax has
> not
> >> fully covered all of the features of the legacy one.
> >>
> >>
> >> Compared to Group Window Aggergation, Window TVF Aggergation has several
> >> advantages, such as two-stage optimization,
> >> support for standard GROUPING SET syntax, and so on. However, it needs
> to
> >> supplement and enrich the following features.
> >>
> >>
> >> 1. Support for SESSION Window TVF Aggregation
> >> 2. Support for consuming CDC stream
> >> 3. Support for HOP window size with non-integer step length
> >> 4. Support for configurations such as early fire, late fire and allow
> >> lateness
> >> (which are internal experimental configurations in Group Window
> >> Aggregation and not public to users yet.)
> >> 5. Unification of the Window TVF Aggregation operator in runtime at the
> >> implementation layer
> >> (In the long term, the cost to maintain the operators about Window TVF
> >> Aggregation and Group Window Aggregation is too expensive.)
> >>
> >>
> >> This flip aims to continue the unfinished work in FLIP-145[2], which is
> to
> >> fully enable the capabilities of Window TVF Aggregation
> >>  and officially deprecate the legacy syntax Group Window Aggregation, to
> >> prepare for the removal of the legacy one in Flink 2.0.
> >>
> >>
> >> I have already done some preliminary POC to validate the feasibility of
> >> the related work in this flip as follows.
> >> 1. POC for SESSION Window TVF Aggregation [3]
> >> 2. POC for CUMULATE in Group Window Aggregation operator [4]
> >> 3. POC for consuming CDC stream in Window Aggregation operator [5]
> >>
> >>
> >> Looking forward to your feedback and thoughts!
> >>
> >>
> >>
> >> [1]
> >>
> https://nightlies.apache.org/flink/flink-docs-master/docs/dev/table/sql/queries/window-agg/
> >>
> >> [2]
> >>
> https://cwiki.apache.org/confluence/display/FLINK/FLIP-145%3A+Support+SQL+windowing+table-valued+function#FLIP145:SupportSQLwindowingtablevaluedfunction-SessionWindows
> >> [3] https://github.com/xuyangzhong/flink/tree/FLINK-24024
> >> [4]
> >>
> https://github.com/xuyangzhong/flink/tree/poc_legacy_group_window_agg_cumulate
> >> [5]
> >>
> https://github.com/xuyangzhong/flink/tree/poc_window_agg_consumes_cdc_stream
> >>
> >>
> >>
> >> --
> >>
> >>     Best!
> >>     Xuyang
>

Re:Re: [DISCUSS] FLIP-392: Deprecate the Legacy Group Window Aggregation

Posted by Xuyang <xy...@163.com>.
Hi, Jim.
>As a clarification, since FLINK-24204 is finishing up work from
>FLIP-145[1], do we need to discuss anything before you work out the details
>of FLINK-24024 as a PR?
Which issue do you mean? It seems that FLINK-24204[1] is the issue with table api&sql type system.


> I've got a PR up [3] for moving at least one of the classes you are touching.
Nice work! Since we are not going to delete the legacy group window agg operator actually, the only compatibility issue
may be that when using flink sql, the legacy group window agg operator will be rewritten into new operators. Will these tests be affected about this rewritten?




[1] https://issues.apache.org/jira/browse/FLINK-24204






--

    Best!
    Xuyang





At 2023-12-09 06:25:30, "Jim Hughes" <jh...@confluent.io.INVALID> wrote:
>Hi Xuyang,
>
>As a clarification, since FLINK-24204 is finishing up work from
>FLIP-145[1], do we need to discuss anything before you work out the details
>of FLINK-24024 as a PR?
>
>Relatedly, as that goes up for a PR, as part of FLINK-33421 [2], Bonnie and
>I are working through migrating some of the JsonPlan Tests and ITCases to
>RestoreTests.  I've got a PR up [3] for moving at least one of the classes
>you are touching.  Let me know if I can share any details about that work.
>
>Cheers,
>
>Jim
>
>1.
>https://cwiki.apache.org/confluence/display/FLINK/FLIP-145%3A+Support+SQL+windowing+table-valued+function#FLIP145:SupportSQLwindowingtablevaluedfunction-SessionWindows
>
>2. https://issues.apache.org/jira/browse/FLINK-33421
>3. https://github.com/apache/flink/pull/23886
>https://issues.apache.org/jira/browse/FLINK-33676
>
>On Tue, Nov 28, 2023 at 7:31 AM Xuyang <xy...@163.com> wrote:
>
>> Hi all.
>> I'd like to start a discussion of FLIP-392: Deprecate the Legacy Group
>> Window Aggregation.
>>
>>
>> Although the current Flink SQL Window Aggregation documentation[1]
>> indicates that the legacy Group Window Aggregation
>> syntax has been deprecated, the new Window TVF Aggregation syntax has not
>> fully covered all of the features of the legacy one.
>>
>>
>> Compared to Group Window Aggergation, Window TVF Aggergation has several
>> advantages, such as two-stage optimization,
>> support for standard GROUPING SET syntax, and so on. However, it needs to
>> supplement and enrich the following features.
>>
>>
>> 1. Support for SESSION Window TVF Aggregation
>> 2. Support for consuming CDC stream
>> 3. Support for HOP window size with non-integer step length
>> 4. Support for configurations such as early fire, late fire and allow
>> lateness
>> (which are internal experimental configurations in Group Window
>> Aggregation and not public to users yet.)
>> 5. Unification of the Window TVF Aggregation operator in runtime at the
>> implementation layer
>> (In the long term, the cost to maintain the operators about Window TVF
>> Aggregation and Group Window Aggregation is too expensive.)
>>
>>
>> This flip aims to continue the unfinished work in FLIP-145[2], which is to
>> fully enable the capabilities of Window TVF Aggregation
>>  and officially deprecate the legacy syntax Group Window Aggregation, to
>> prepare for the removal of the legacy one in Flink 2.0.
>>
>>
>> I have already done some preliminary POC to validate the feasibility of
>> the related work in this flip as follows.
>> 1. POC for SESSION Window TVF Aggregation [3]
>> 2. POC for CUMULATE in Group Window Aggregation operator [4]
>> 3. POC for consuming CDC stream in Window Aggregation operator [5]
>>
>>
>> Looking forward to your feedback and thoughts!
>>
>>
>>
>> [1]
>> https://nightlies.apache.org/flink/flink-docs-master/docs/dev/table/sql/queries/window-agg/
>>
>> [2]
>> https://cwiki.apache.org/confluence/display/FLINK/FLIP-145%3A+Support+SQL+windowing+table-valued+function#FLIP145:SupportSQLwindowingtablevaluedfunction-SessionWindows
>> [3] https://github.com/xuyangzhong/flink/tree/FLINK-24024
>> [4]
>> https://github.com/xuyangzhong/flink/tree/poc_legacy_group_window_agg_cumulate
>> [5]
>> https://github.com/xuyangzhong/flink/tree/poc_window_agg_consumes_cdc_stream
>>
>>
>>
>> --
>>
>>     Best!
>>     Xuyang

Re: [DISCUSS] FLIP-392: Deprecate the Legacy Group Window Aggregation

Posted by Jim Hughes <jh...@confluent.io.INVALID>.
Hi Xuyang,

As a clarification, since FLINK-24204 is finishing up work from
FLIP-145[1], do we need to discuss anything before you work out the details
of FLINK-24024 as a PR?

Relatedly, as that goes up for a PR, as part of FLINK-33421 [2], Bonnie and
I are working through migrating some of the JsonPlan Tests and ITCases to
RestoreTests.  I've got a PR up [3] for moving at least one of the classes
you are touching.  Let me know if I can share any details about that work.

Cheers,

Jim

1.
https://cwiki.apache.org/confluence/display/FLINK/FLIP-145%3A+Support+SQL+windowing+table-valued+function#FLIP145:SupportSQLwindowingtablevaluedfunction-SessionWindows

2. https://issues.apache.org/jira/browse/FLINK-33421
3. https://github.com/apache/flink/pull/23886
https://issues.apache.org/jira/browse/FLINK-33676

On Tue, Nov 28, 2023 at 7:31 AM Xuyang <xy...@163.com> wrote:

> Hi all.
> I'd like to start a discussion of FLIP-392: Deprecate the Legacy Group
> Window Aggregation.
>
>
> Although the current Flink SQL Window Aggregation documentation[1]
> indicates that the legacy Group Window Aggregation
> syntax has been deprecated, the new Window TVF Aggregation syntax has not
> fully covered all of the features of the legacy one.
>
>
> Compared to Group Window Aggergation, Window TVF Aggergation has several
> advantages, such as two-stage optimization,
> support for standard GROUPING SET syntax, and so on. However, it needs to
> supplement and enrich the following features.
>
>
> 1. Support for SESSION Window TVF Aggregation
> 2. Support for consuming CDC stream
> 3. Support for HOP window size with non-integer step length
> 4. Support for configurations such as early fire, late fire and allow
> lateness
> (which are internal experimental configurations in Group Window
> Aggregation and not public to users yet.)
> 5. Unification of the Window TVF Aggregation operator in runtime at the
> implementation layer
> (In the long term, the cost to maintain the operators about Window TVF
> Aggregation and Group Window Aggregation is too expensive.)
>
>
> This flip aims to continue the unfinished work in FLIP-145[2], which is to
> fully enable the capabilities of Window TVF Aggregation
>  and officially deprecate the legacy syntax Group Window Aggregation, to
> prepare for the removal of the legacy one in Flink 2.0.
>
>
> I have already done some preliminary POC to validate the feasibility of
> the related work in this flip as follows.
> 1. POC for SESSION Window TVF Aggregation [3]
> 2. POC for CUMULATE in Group Window Aggregation operator [4]
> 3. POC for consuming CDC stream in Window Aggregation operator [5]
>
>
> Looking forward to your feedback and thoughts!
>
>
>
> [1]
> https://nightlies.apache.org/flink/flink-docs-master/docs/dev/table/sql/queries/window-agg/
>
> [2]
> https://cwiki.apache.org/confluence/display/FLINK/FLIP-145%3A+Support+SQL+windowing+table-valued+function#FLIP145:SupportSQLwindowingtablevaluedfunction-SessionWindows
> [3] https://github.com/xuyangzhong/flink/tree/FLINK-24024
> [4]
> https://github.com/xuyangzhong/flink/tree/poc_legacy_group_window_agg_cumulate
> [5]
> https://github.com/xuyangzhong/flink/tree/poc_window_agg_consumes_cdc_stream
>
>
>
> --
>
>     Best!
>     Xuyang