From 55543f7cfc970a3ebbbd67899b26c82d6ceb23f4 Mon Sep 17 00:00:00 2001 From: "shuming.li" Date: Thu, 26 Dec 2024 15:42:47 +0800 Subject: [PATCH] [UT] Fix AggStateCombinatorTest test performance (#54375) Signed-off-by: shuming.li --- .../combinator/AggStateCombinatorTest.java | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/fe/fe-core/src/test/java/com/starrocks/catalog/combinator/AggStateCombinatorTest.java b/fe/fe-core/src/test/java/com/starrocks/catalog/combinator/AggStateCombinatorTest.java index 8b9ff91030c8a..ed76bcb95f9e5 100644 --- a/fe/fe-core/src/test/java/com/starrocks/catalog/combinator/AggStateCombinatorTest.java +++ b/fe/fe-core/src/test/java/com/starrocks/catalog/combinator/AggStateCombinatorTest.java @@ -221,7 +221,7 @@ private String buildAggFuncArgs(String funcName, private void buildTableT1(List funcNames, Map colTypes, List> aggArgTypes) { - buildTableT1(funcNames, colTypes, aggArgTypes, Lists.newArrayList(), Lists.newArrayList()); + buildTableT1(funcNames, colTypes, aggArgTypes, Lists.newArrayList(), Lists.newArrayList(), -1); } private void buildTableT1(List funcNames, @@ -229,6 +229,15 @@ private void buildTableT1(List funcNames, List> aggArgTypes, List aggStateColumns, List aggStateColNames) { + buildTableT1(funcNames, colTypes, aggArgTypes, aggStateColumns, aggStateColNames, -1); + } + + private void buildTableT1(List funcNames, + Map colTypes, + List> aggArgTypes, + List aggStateColumns, + List aggStateColNames, + int size) { String define = "c0 boolean,\n" + "c1 tinyint(4),\n" + "c2 smallint(6),\n" + @@ -273,6 +282,9 @@ private void buildTableT1(List funcNames, continue; } + if (size != -1 && i > size) { + break; + } List argTypes = Stream.of(aggFunc.getArgs()).map(this::mockType).collect(Collectors.toList()); List argTypeStr = argTypes.stream().map(this::mockType).map(Type::toSql).collect(Collectors.toList()); aggArgTypes.add(argTypeStr); @@ -587,6 +599,9 @@ public void testCreateAggStateTable2() throws Exception { // test _state for (int k = 0; k < funcNames.size(); k++) { + if (k > MAX_AGG_FUNC_NUM_IN_TEST) { + break; + } List stateColumns = Lists.newArrayList(); List argTypes = aggArgTypes.get(k); String fnName = funcNames.get(k); @@ -611,6 +626,9 @@ public void testCreateAggStateTable3() throws Exception { // test _state List stateColumns = Lists.newArrayList(); for (int k = 0; k < funcNames.size(); k++) { + if (k > MAX_AGG_FUNC_NUM_IN_TEST) { + break; + } String fnName = funcNames.get(k); List argTypes = aggArgTypes.get(k); String arg = buildAggFuncArgs(fnName, argTypes, colTypes); @@ -880,7 +898,7 @@ public void testGenerateSqlTesterTestsTotal() throws Exception { List> aggArgTypes = Lists.newArrayList(); List columns = Lists.newArrayList(); List colNames = Lists.newArrayList(); - buildTableT1(funcNames, colTypes, aggArgTypes, columns, colNames); + buildTableT1(funcNames, colTypes, aggArgTypes, columns, colNames, MAX_AGG_FUNC_NUM_IN_TEST); String sql = " CREATE TABLE test_agg_state_table ( \n" + "k1 date, \n" +