Skip to content

Commit

Permalink
Fix AggStateCombinatorTest test performance
Browse files Browse the repository at this point in the history
Signed-off-by: shuming.li <[email protected]>
  • Loading branch information
LiShuMing committed Dec 26, 2024
1 parent bbc9b1c commit 5f1cf0e
Showing 1 changed file with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -221,14 +221,23 @@ private String buildAggFuncArgs(String funcName,
private void buildTableT1(List<String> funcNames,
Map<String, String> colTypes,
List<List<String>> aggArgTypes) {
buildTableT1(funcNames, colTypes, aggArgTypes, Lists.newArrayList(), Lists.newArrayList());
buildTableT1(funcNames, colTypes, aggArgTypes, Lists.newArrayList(), Lists.newArrayList(), -1);
}

private void buildTableT1(List<String> funcNames,
Map<String, String> colTypes,
List<List<String>> aggArgTypes,
List<String> aggStateColumns,
List<String> aggStateColNames) {
buildTableT1(funcNames, colTypes, aggArgTypes, aggStateColumns, aggStateColNames, -1);
}

private void buildTableT1(List<String> funcNames,
Map<String, String> colTypes,
List<List<String>> aggArgTypes,
List<String> aggStateColumns,
List<String> aggStateColNames,
int size) {
String define = "c0 boolean,\n" +
"c1 tinyint(4),\n" +
"c2 smallint(6),\n" +
Expand Down Expand Up @@ -273,6 +282,9 @@ private void buildTableT1(List<String> funcNames,
continue;
}

if (size != -1 && i > size) {
break;
}
List<Type> argTypes = Stream.of(aggFunc.getArgs()).map(this::mockType).collect(Collectors.toList());
List<String> argTypeStr = argTypes.stream().map(this::mockType).map(Type::toSql).collect(Collectors.toList());
aggArgTypes.add(argTypeStr);
Expand Down Expand Up @@ -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<String> stateColumns = Lists.newArrayList();
List<String> argTypes = aggArgTypes.get(k);
String fnName = funcNames.get(k);
Expand All @@ -611,6 +626,9 @@ public void testCreateAggStateTable3() throws Exception {
// test _state
List<String> 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<String> argTypes = aggArgTypes.get(k);
String arg = buildAggFuncArgs(fnName, argTypes, colTypes);
Expand Down Expand Up @@ -880,7 +898,7 @@ public void testGenerateSqlTesterTestsTotal() throws Exception {
List<List<String>> aggArgTypes = Lists.newArrayList();
List<String> columns = Lists.newArrayList();
List<String> 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" +
Expand Down

0 comments on commit 5f1cf0e

Please sign in to comment.