This is an automated email from the ASF dual-hosted git repository.

jiafengzheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris-website.git


The following commit(s) were added to refs/heads/master by this push:
     new 6268efabab7 add window funnel
6268efabab7 is described below

commit 6268efabab789deb5c0e5073382c7c1a476e762d
Author: jiafeng.zhang <zhang...@gmail.com>
AuthorDate: Thu Aug 25 14:36:46 2022 +0800

    add window funnel
---
 .../WINDOW-FUNCTION-WINDOW-FUNNEL.md               | 62 ++++++++++++++++++++++
 .../WINDOW-FUNCTION-WINDOW-FUNNEL.md               | 62 ++++++++++++++++++++++
 sidebars.json                                      |  3 +-
 3 files changed, 126 insertions(+), 1 deletion(-)

diff --git 
a/docs/sql-manual/sql-functions/window-functions/WINDOW-FUNCTION-WINDOW-FUNNEL.md
 
b/docs/sql-manual/sql-functions/window-functions/WINDOW-FUNCTION-WINDOW-FUNNEL.md
new file mode 100644
index 00000000000..92a19d06444
--- /dev/null
+++ 
b/docs/sql-manual/sql-functions/window-functions/WINDOW-FUNCTION-WINDOW-FUNNEL.md
@@ -0,0 +1,62 @@
+---
+{
+    "title": "WINDOW-FUNCTION-WINDOW-FUNNEL",
+    "language": "en"
+}
+---
+
+<!--  Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license agreements.  See the NOTICE file distributed with this work 
for additional information regarding copyright ownership.  The ASF licenses 
this file to you under the Apache License, Version 2.0 (the "License"); you may 
not use this file except in compliance with the License.  You may obtain a copy 
of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software 
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the 
License for the specific language governing permissions and limitations under 
the License. -->
+
+## WINDOW FUNCTION WINDOW_FUNNEL
+### description
+
+Searches the longest event chain happened in order (event1, event2, ... , 
eventN) along the timestamp_column with length of window.
+
+- window is the length of time window in seconds.
+- mode is reserved for future, not used for now.
+- timestamp_column specifies column of DATETIME type, sliding time window 
works on it.
+- evnetN is boolean expression like eventID = 1004.
+
+The function works according to the algorithm:
+
+- The function searches for data that triggers the first condition in the 
chain and sets the event counter to 1. This is the moment when the sliding 
window starts.
+- If events from the chain occur sequentially within the window, the counter 
is incremented. If the sequence of events is disrupted, the counter is not 
incremented.
+- If the data has multiple event chains at varying points of completion, the 
function will only output the size of the longest chain.
+
+```sql
+window_funnel(window, mode, timestamp_column, event1, event2, ... , eventN)
+```
+
+### example
+
+```sql
+CREATE TABLE windowfunnel_test (
+                `xwho` varchar(50) NULL COMMENT 'xwho',
+                `xwhen` datetime COMMENT 'xwhen',
+                `xwhat` int NULL COMMENT 'xwhat'
+                )
+DUPLICATE KEY(xwho)
+DISTRIBUTED BY HASH(xwho) BUCKETS 3
+PROPERTIES (
+    "replication_num" = "1"
+);
+
+INSERT into windowfunnel_test (xwho, xwhen, xwhat) values ('1', '2022-03-12 
10:41:00', 1),
+                                                   ('1', '2022-03-12 
13:28:02', 2),
+                                                   ('1', '2022-03-12 
16:15:01', 3),
+                                                   ('1', '2022-03-12 
19:05:04', 4);
+
+select window_funnel(3600 * 3, 'default', t.xwhen, t.xwhat = 1, t.xwhat = 2 ) 
AS level from windowfunnel_test t;
+
+| level |
+|---|
+| 2 |
+```
+
+### keywords
+
+    WINDOW,FUNCTION,WINDOW_FUNNEL
diff --git 
a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/window-functions/WINDOW-FUNCTION-WINDOW-FUNNEL.md
 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/window-functions/WINDOW-FUNCTION-WINDOW-FUNNEL.md
new file mode 100644
index 00000000000..a27ef486f9a
--- /dev/null
+++ 
b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/window-functions/WINDOW-FUNCTION-WINDOW-FUNNEL.md
@@ -0,0 +1,62 @@
+---
+{
+    "title": "WINDOW-FUNCTION-WINDOW-FUNNEL",
+    "language": "en"
+}
+---
+
+<!--  Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license agreements.  See the NOTICE file distributed with this work 
for additional information regarding copyright ownership.  The ASF licenses 
this file to you under the Apache License, Version 2.0 (the "License"); you may 
not use this file except in compliance with the License.  You may obtain a copy 
of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software 
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the 
License for the specific language governing permissions and limitations under 
the License. -->
+
+## WINDOW FUNCTION WINDOW_FUNNEL
+### description
+
+漏斗分析函数搜索滑动时间窗口内最大的发生的最大事件序列长度。
+
+- window :滑动时间窗口大小,单位为秒。
+- mode :保留,目前只支持default。
+- timestamp_column :指定时间列,类型为DATETIME, 滑动窗口沿着此列工作。
+- eventN :表示事件的布尔表达式。
+
+漏斗分析函数按照如下算法工作:
+
+- 搜索到满足满足条件的第一个事件,设置事件长度为1,此时开始滑动时间窗口计时。
+- 如果事件在时间窗口内按照指定的顺序发生,时间长度累计增加。如果事件没有按照指定的顺序发生,时间长度不增加。
+- 如果搜索到多个事件链,漏斗分析函数返回最大的长度。
+
+```sql
+window_funnel(window, mode, timestamp_column, event1, event2, ... , eventN)
+```
+
+### example
+
+```sql
+CREATE TABLE windowfunnel_test (
+                `xwho` varchar(50) NULL COMMENT 'xwho',
+                `xwhen` datetime COMMENT 'xwhen',
+                `xwhat` int NULL COMMENT 'xwhat'
+                )
+DUPLICATE KEY(xwho)
+DISTRIBUTED BY HASH(xwho) BUCKETS 3
+PROPERTIES (
+    "replication_num" = "1"
+);
+
+INSERT into windowfunnel_test (xwho, xwhen, xwhat) values ('1', '2022-03-12 
10:41:00', 1),
+                                                   ('1', '2022-03-12 
13:28:02', 2),
+                                                   ('1', '2022-03-12 
16:15:01', 3),
+                                                   ('1', '2022-03-12 
19:05:04', 4);
+
+select window_funnel(3600 * 3, 'default', t.xwhen, t.xwhat = 1, t.xwhat = 2 ) 
AS level from windowfunnel_test t;
+
+| level |
+|---|
+| 2 |
+```
+
+### keywords
+
+    WINDOW,FUNCTION,WINDOW_FUNNEL
diff --git a/sidebars.json b/sidebars.json
index c2c9381f24e..f1d8a7c35dc 100644
--- a/sidebars.json
+++ b/sidebars.json
@@ -484,7 +484,8 @@
                                 
"sql-manual/sql-functions/window-functions/WINDOW-FUNCTION-FIRST-VALUE",
                                 
"sql-manual/sql-functions/window-functions/WINDOW-FUNCTION-LAST-VALUE",
                                 
"sql-manual/sql-functions/window-functions/WINDOW-FUNCTION-ROW-NUMBER",
-                                
"sql-manual/sql-functions/window-functions/WINDOW-FUNCTION-NTILE"
+                                
"sql-manual/sql-functions/window-functions/WINDOW-FUNCTION-NTILE",
+                                
"sql-manual/sql-functions/window-functions/WINDOW-FUNCTION-WINDOW-FUNNEL"
                             ]
                         },
                         "sql-manual/sql-functions/cast",


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to