Skip to content

Commit

Permalink
[Bug](function)window funnel function should support datetimev2 type …
Browse files Browse the repository at this point in the history
…get scale
  • Loading branch information
zhangstar333 committed Nov 21, 2024
1 parent f663443 commit c19552f
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ public class WindowFunnel extends NullableAggregateFunction

public static final List<FunctionSignature> SIGNATURES = ImmutableList.of(
FunctionSignature.ret(IntegerType.INSTANCE)
.varArgs(BigIntType.INSTANCE, StringType.INSTANCE, DateTimeType.INSTANCE, BooleanType.INSTANCE)
.varArgs(BigIntType.INSTANCE, StringType.INSTANCE, DateTimeType.INSTANCE, BooleanType.INSTANCE),
FunctionSignature.ret(IntegerType.INSTANCE)
.varArgs(BigIntType.INSTANCE, StringType.INSTANCE, DateTimeV2Type.SYSTEM_DEFAULT,
BooleanType.INSTANCE)
);

/**
Expand Down
3 changes: 3 additions & 0 deletions regression-test/data/nereids_p0/aggregate/window_funnel.out
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,6 @@
100126 2
100127 2

-- !window_funnel_datetimev2 --
2

21 changes: 21 additions & 0 deletions regression-test/suites/nereids_p0/aggregate/window_funnel.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -720,4 +720,25 @@ suite("window_funnel") {
order BY user_id
"""

sql """ DROP TABLE IF EXISTS windowfunnel_test_1 """
sql """
CREATE TABLE windowfunnel_test_1 (
`xwho` varchar(50) NULL COMMENT 'xwho',
`xwhen` datetime(3) COMMENT 'xwhen',
`xwhat` int NULL COMMENT 'xwhat'
) DUPLICATE KEY(xwho)
DISTRIBUTED BY HASH(xwho) BUCKETS 3
PROPERTIES ("replication_num" = "1");
"""
sql """ INSERT INTO windowfunnel_test_1 (xwho, xwhen, xwhat) VALUES
('1', '2022-03-12 10:41:00.111', 1),
('1', '2022-03-12 10:41:00.888', 2),
('1', '2022-03-12 13:28:02.177', 3),
('1', '2022-03-12 16:15:01.444', 4); """
explain {
sql("""select window_funnel(3600 * 3, 'deduplication', t.xwhen, t.xwhat = 1, t.xwhat = 2 ) AS level from windowfunnel_test_1 t;""")
notContains("cast")
}

qt_window_funnel_datetimev2 """select window_funnel(3600 * 3, 'deduplication', t.xwhen, t.xwhat = 1, t.xwhat = 2 ) AS level from windowfunnel_test_1 t; """
}

0 comments on commit c19552f

Please sign in to comment.