From cc0e58faec02f9ff6c6b96baf6c93225d4e40f87 Mon Sep 17 00:00:00 2001 From: 924060929 <924060929@qq.com> Date: Fri, 8 Mar 2024 18:16:46 +0800 Subject: [PATCH] [enhancement](regression-test) upgrade groovy to 4.x and enable run test by jdk17/21 (#31906) upgrade groovy to 4.x and enable run test by jdk17 / 21 --- .../apache/doris/analysis/DateLiteral.java | 3 + .../rules/OneRangePartitionEvaluator.java | 8 +- regression-test/framework/pom.xml | 89 ++++++------------- .../doris/regression/RegressionTest.groovy | 10 +++ .../regression/suite/ScriptSource.groovy | 2 +- .../doris/regression/util/DataUtils.groovy | 2 +- .../http_rest_api/post/test_query_stmt.groovy | 2 +- 7 files changed, 49 insertions(+), 67 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/DateLiteral.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/DateLiteral.java index dbc23437a6..e38b130ac4 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/analysis/DateLiteral.java +++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/DateLiteral.java @@ -648,6 +648,9 @@ public class DateLiteral extends LiteralExpr { int typeDiff = typeAsInt - thatTypeAsInt; if (typeDiff != 0) { return typeDiff; + } else if (typeAsInt == 0) { + // if all is date and equals date, then return + return 0; } long hourMinuteSecond = hour * 10000 + minute * 100 + second; diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/OneRangePartitionEvaluator.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/OneRangePartitionEvaluator.java index 88746275cf..d800900e13 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/OneRangePartitionEvaluator.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/OneRangePartitionEvaluator.java @@ -103,12 +103,12 @@ public class OneRangePartitionEvaluator PartitionRangeExpander expander = new PartitionRangeExpander(); this.partitionSlotTypes = expander.computePartitionSlotTypes(lowers, uppers); - this.slotToType = Maps.newHashMapWithExpectedSize(partitionSlots.size() * 2); + this.slotToType = Maps.newHashMapWithExpectedSize(16); for (int i = 0; i < partitionSlots.size(); i++) { slotToType.put(partitionSlots.get(i), partitionSlotTypes.get(i)); } - this.partitionSlotContainsNull = Maps.newHashMapWithExpectedSize(partitionSlots.size() * 2); + this.partitionSlotContainsNull = Maps.newHashMapWithExpectedSize(16); for (int i = 0; i < partitionSlots.size(); i++) { Slot slot = partitionSlots.get(i); if (!slot.nullable()) { @@ -612,7 +612,7 @@ public class OneRangePartitionEvaluator Map inputs) { Builder allColumnRangesBuilder = - ImmutableMap.builderWithExpectedSize(inputs.size() * 2); + ImmutableMap.builderWithExpectedSize(16); for (Entry entry : inputs.entrySet()) { allColumnRangesBuilder.put(entry.getKey(), entry.getValue().columnRanges.get(entry.getKey())); } @@ -620,7 +620,7 @@ public class OneRangePartitionEvaluator Map allColumnRanges = allColumnRangesBuilder.build(); Builder partitionSlotInputs = - ImmutableMap.builderWithExpectedSize(inputs.size() * 2); + ImmutableMap.builderWithExpectedSize(16); for (Slot slot : inputs.keySet()) { partitionSlotInputs.put(slot, new PartitionSlotInput(inputs.get(slot).result, allColumnRanges)); } diff --git a/regression-test/framework/pom.xml b/regression-test/framework/pom.xml index e16b178334..4c22fe22f1 100644 --- a/regression-test/framework/pom.xml +++ b/regression-test/framework/pom.xml @@ -71,9 +71,7 @@ under the License. 1.8 1.0-SNAPSHOT github - 3.0.7 - 3.0.7-01 - 3.7.0 + 4.0.19 4.9.3 2.8.0 15.0.0 @@ -86,33 +84,19 @@ under the License. 1.2.5 - org.apache.maven.plugins - maven-compiler-plugin - 3.9.0 - - groovy-eclipse-compiler - ${maven.compiler.source} - ${maven.compiler.target} - true - - - - org.codehaus.groovy - groovy-eclipse-compiler - ${groovy-eclipse-compiler.version} - - - org.codehaus.groovy - groovy-eclipse-batch - ${groovy-eclipse-batch.version} - - - - - org.codehaus.groovy - groovy-eclipse-compiler - ${groovy-eclipse-compiler.version} - true + org.codehaus.gmavenplus + gmavenplus-plugin + 3.0.2 + + + + addSources + addTestSources + compile + compileTests + + + org.apache.maven.plugins @@ -168,35 +152,6 @@ under the License. - - - - org.codehaus.mojo - flatten-maven-plugin - 1.2.5 - - true - bom - - - - flatten - process-resources - - flatten - - - - flatten.clean - clean - - clean - - - - - - @@ -212,7 +167,7 @@ under the License. 2.10.1 - org.codehaus.groovy + org.apache.groovy groovy-all ${groovy.version} pom @@ -301,11 +256,25 @@ under the License. org.apache.hadoop hadoop-mapreduce-client-core ${hadoop.version} + + + + jdk.tools + jdk.tools + + org.apache.hive hive-jdbc 2.3.7 + + + + jdk.tools + jdk.tools + + org.apache.arrow diff --git a/regression-test/framework/src/main/groovy/org/apache/doris/regression/RegressionTest.groovy b/regression-test/framework/src/main/groovy/org/apache/doris/regression/RegressionTest.groovy index d7eb682783..ec43e058e6 100644 --- a/regression-test/framework/src/main/groovy/org/apache/doris/regression/RegressionTest.groovy +++ b/regression-test/framework/src/main/groovy/org/apache/doris/regression/RegressionTest.groovy @@ -20,6 +20,7 @@ package org.apache.doris.regression import com.google.common.collect.Lists import groovy.transform.CompileStatic import jodd.util.Wildcard +import org.apache.doris.regression.suite.Suite import org.apache.doris.regression.suite.event.EventListener import org.apache.doris.regression.suite.GroovyFileSource import org.apache.doris.regression.suite.ScriptContext @@ -35,6 +36,8 @@ import groovy.util.logging.Slf4j import org.apache.commons.cli.* import org.apache.commons.lang3.concurrent.BasicThreadFactory; import org.codehaus.groovy.control.CompilerConfiguration +import org.codehaus.groovy.vmplugin.v8.IndyInterface +import org.slf4j.LoggerFactory import java.beans.Introspector import java.util.concurrent.Executors @@ -57,6 +60,13 @@ class RegressionTest { static final int cleanLoadedClassesThreshold = 20 static String nonConcurrentTestGroup = "nonConcurrent" + static { + ch.qos.logback.classic.Logger loggerOfSuite = + LoggerFactory.getLogger(Suite.class) as ch.qos.logback.classic.Logger + def context = loggerOfSuite.getLoggerContext() + context.getFrameworkPackages().add(IndyInterface.class.getPackage().getName()) + } + static void main(String[] args) { CommandLine cmd = ConfigOptions.initCommands(args) if (cmd == null) { diff --git a/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/ScriptSource.groovy b/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/ScriptSource.groovy index 4db9b7fce3..d73cf6afaf 100644 --- a/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/ScriptSource.groovy +++ b/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/ScriptSource.groovy @@ -76,11 +76,11 @@ class SqlFileSource implements ScriptSource { SuiteScript script = new SuiteScript() { @Override Object run() { + List sqls = getSqls(file.text) suite(suiteName, groupName) { String tag = suiteName String exceptionStr = "" boolean order = suiteName.endsWith("_order") - List sqls = getSqls(file.text) log.info("Try to execute group: ${groupName} suite: ${suiteName} with ${sqls.size()} stmts") for (int i = 0; i < sqls.size(); ++i) { String singleSql = sqls.get(i) diff --git a/regression-test/framework/src/main/groovy/org/apache/doris/regression/util/DataUtils.groovy b/regression-test/framework/src/main/groovy/org/apache/doris/regression/util/DataUtils.groovy index ec85ca645a..9d01acca00 100644 --- a/regression-test/framework/src/main/groovy/org/apache/doris/regression/util/DataUtils.groovy +++ b/regression-test/framework/src/main/groovy/org/apache/doris/regression/util/DataUtils.groovy @@ -24,7 +24,7 @@ class DataUtils { // null first, order by column.toString asc static List> sortByToString(List> originData) { def comparator = Comparator.naturalOrder() - originData.sort(false, { row1, row2 -> + originData.sort(false, { List row1, List row2 -> for (int i = 0; i < row1.size(); ++i) { Object column1 = row1[i] Object column2 = row2[i] diff --git a/regression-test/suites/http_rest_api/post/test_query_stmt.groovy b/regression-test/suites/http_rest_api/post/test_query_stmt.groovy index bcf6e23984..c306e75fc8 100644 --- a/regression-test/suites/http_rest_api/post/test_query_stmt.groovy +++ b/regression-test/suites/http_rest_api/post/test_query_stmt.groovy @@ -21,7 +21,7 @@ import groovy.json.JsonSlurper * @Params url is "/xxx", data is request body * @Return response body */ -def http_post(url, data = null) { +def http_post = { url, data = null -> def dst = "http://"+ context.config.feHttpAddress def conn = new URL(dst + url).openConnection() conn.setRequestMethod("POST")