Hi Jingsong,

## The way to declare aggregate functions

Considering possible sql parsing problem,  I aggree with your idea.


## Supported functions
It is better to keep consistent with Flink Table, which is more relevant with 
our project, and PostgreSQL, whose grammar is widely accepted.


## Default function && Changelog support
I have update FLIP to illustrate the default value of correspongding agg 
function and its support for changelog/retraction messages [1].


[1] 
https://nightlies.apache.org/flink/flink-docs-master/docs/dev/table/concepts/dynamic_tables/


------------------ ???????? ------------------
??????:                                                                         
                                               "dev"                            
                                                        
<jingsongl...@gmail.com&gt;;
????????:&nbsp;2022??8??3??(??????) ????5:14
??????:&nbsp;"dev"<dev@flink.apache.org&gt;;

????:&nbsp;Re: [Phishing Risk] [External] [DISCUSS] FLIP-255 Introduce 
pre-aggregated merge to Table Store



Hi Nathan,

Thanks for the reply.

## Aggregate functions

I think `'fields.sum_field1.function'='sum'` is a safe one, I am more
worried about using complex json, which will affect the sql parsing.

## Supported functions

I think it is better to be consistent with Flink Table [1] and PostgreSQL [2].
- replace -&gt; last_value
- replace_if_not_null -&gt; last_non_null_value
- concatenate -&gt; listagg
- or -&gt; bool_or
- and -&gt; bool_and

## Default function

You can update the FLIP to clarify the default value of the
corresponding agg function.

## Changelog support

Can you also specify whether functions support changelog/retraction messages?

[1] 
https://nightlies.apache.org/flink/flink-docs-release-1.15/docs/dev/table/functions/systemfunctions/#aggregate-functions
[2] https://www.postgresql.org/docs/9.5/functions-aggregate.html

Best,
Jingsong

On Tue, Aug 2, 2022 at 11:41 PM Hannan Kan <hannan...@foxmail.com&gt; wrote:
&gt;
&gt; Thank you for reviewing FLIP-255.
&gt;
&gt; That indeed is a typo. I will correct it immediately.
&gt;
&gt;
&gt; Best,
&gt; Nathan
&gt;
&gt;
&gt;
&gt;
&gt; ------------------&amp;nbsp;????????&amp;nbsp;------------------
&gt; 
??????:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 &nbsp; <liguo...@bytedance.com&amp;gt;;
&gt; ????????:&amp;nbsp;2022??8??2??(??????) ????11:09
&gt; ??????:&amp;nbsp;"dev"<dev@flink.apache.org&amp;gt;;
&gt;
&gt; ????:&amp;nbsp;Re: [Phishing Risk] [External] [DISCUSS] FLIP-255 Introduce 
pre-aggregated merge to Table Store
&gt;
&gt;
&gt;
&gt; Hi Nathan,
&gt;
&gt;
&gt; Seems a great proposal for table store aggregation.
&gt; In the example, I think the 'max_field1' should be 1 instead of 2 after 
the max aggregation in the output result.
&gt; And there may be a minor typo in the WITH clause, 'max_field2' -&amp;gt; 
'max_field1'.
&gt;
&gt;
&gt;
&gt; Best,
&gt; Guojun
&gt;
&gt;
&gt;
&gt; From: "Hannan Kan"<hannan...@foxmail.com&amp;gt;
&gt; Date:&nbsp; Mon, Aug 1, 2022, 11:35 PM
&gt; Subject:&nbsp; [Phishing Risk] [External] [DISCUSS] FLIP-255 Introduce 
pre-aggregated merge to Table Store
&gt; To: "dev"<dev@flink.apache.org&amp;gt;
&gt; Cc: "lzljs3620320"<lzljs3620...@apache.org&amp;gt;
&gt;
&gt;
&gt;
&gt; Hi everyone, I would like to open a discussion on&amp;amp;nbsp;FLIP-255 
Introduce pre-aggregated merge to table store&amp;amp;nbsp;[1]. Pre-aggregation 
mechanism has been adopted by many big data systems (such as Apache 
Doris,&amp;amp;nbsp; Apache Kylin , Druid etc.)&amp;amp;nbsp;to save storage 
and accelerate the aggregate query. FLIP-255 proposes to introduce 
pre-aggregated merge into Flink Table Store to acquire the same 
benefit.&amp;amp;nbsp; Supported aggregate functions include&amp;amp;nbsp;sum, 
max/min, count, replace_if_not_null, replace,&amp;amp;nbsp; concatenate, 
or/and. Looking forward to your feedback. 
[1]&amp;amp;nbsp;https://cwiki.apache.org/confluence/display/FLINK/FLIP-255+Introduce+pre-aggregated+merge+to+table+store
 Best, Nathan Kan (Hongnan Gan)

Reply via email to