This is an automated email from the ASF dual-hosted git repository. yiguolei pushed a commit to branch branch-2.1 in repository https://gitbox.apache.org/repos/asf/doris.git
commit cc0e58faec02f9ff6c6b96baf6c93225d4e40f87 Author: 924060929 <[email protected]> AuthorDate: Fri Mar 8 18:16:46 2024 +0800 [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 --- .../org/apache/doris/analysis/DateLiteral.java | 3 + .../rules/OneRangePartitionEvaluator.java | 8 +- regression-test/framework/pom.xml | 89 +++++++--------------- .../apache/doris/regression/RegressionTest.groovy | 10 +++ .../doris/regression/suite/ScriptSource.groovy | 2 +- .../apache/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 dbc23437a66..e38b130ac4f 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 88746275cf9..d800900e134 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<Slot, PartitionSlotInput> inputs) { Builder<Slot, ColumnRange> allColumnRangesBuilder = - ImmutableMap.builderWithExpectedSize(inputs.size() * 2); + ImmutableMap.builderWithExpectedSize(16); for (Entry<Slot, PartitionSlotInput> entry : inputs.entrySet()) { allColumnRangesBuilder.put(entry.getKey(), entry.getValue().columnRanges.get(entry.getKey())); } @@ -620,7 +620,7 @@ public class OneRangePartitionEvaluator Map<Slot, ColumnRange> allColumnRanges = allColumnRangesBuilder.build(); Builder<Slot, PartitionSlotInput> 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 e16b178334d..4c22fe22f13 100644 --- a/regression-test/framework/pom.xml +++ b/regression-test/framework/pom.xml @@ -71,9 +71,7 @@ under the License. <maven.compiler.target>1.8</maven.compiler.target> <revision>1.0-SNAPSHOT</revision> <project.scm.id>github</project.scm.id> - <groovy.version>3.0.7</groovy.version> - <groovy-eclipse-batch.version>3.0.7-01</groovy-eclipse-batch.version> - <groovy-eclipse-compiler.version>3.7.0</groovy-eclipse-compiler.version> + <groovy.version>4.0.19</groovy.version> <antlr.version>4.9.3</antlr.version> <hadoop.version>2.8.0</hadoop.version> <arrow.version>15.0.0</arrow.version> @@ -86,33 +84,19 @@ under the License. <version>1.2.5</version> </plugin> <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <version>3.9.0</version> - <configuration> - <compilerId>groovy-eclipse-compiler</compilerId> - <source>${maven.compiler.source}</source> - <target>${maven.compiler.target}</target> - <fork>true</fork> - </configuration> - <dependencies> - <dependency> - <groupId>org.codehaus.groovy</groupId> - <artifactId>groovy-eclipse-compiler</artifactId> - <version>${groovy-eclipse-compiler.version}</version> - </dependency> - <dependency> - <groupId>org.codehaus.groovy</groupId> - <artifactId>groovy-eclipse-batch</artifactId> - <version>${groovy-eclipse-batch.version}</version> - </dependency> - </dependencies> - </plugin> - <plugin> - <groupId>org.codehaus.groovy</groupId> - <artifactId>groovy-eclipse-compiler</artifactId> - <version>${groovy-eclipse-compiler.version}</version> - <extensions>true</extensions> + <groupId>org.codehaus.gmavenplus</groupId> + <artifactId>gmavenplus-plugin</artifactId> + <version>3.0.2</version> + <executions> + <execution> + <goals> + <goal>addSources</goal> + <goal>addTestSources</goal> + <goal>compile</goal> + <goal>compileTests</goal> + </goals> + </execution> + </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> @@ -168,35 +152,6 @@ under the License. </configuration> </plugin> </plugins> - <pluginManagement> - <plugins> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>flatten-maven-plugin</artifactId> - <version>1.2.5</version> - <configuration> - <updatePomFile>true</updatePomFile> - <flattenMode>bom</flattenMode> - </configuration> - <executions> - <execution> - <id>flatten</id> - <phase>process-resources</phase> - <goals> - <goal>flatten</goal> - </goals> - </execution> - <execution> - <id>flatten.clean</id> - <phase>clean</phase> - <goals> - <goal>clean</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </pluginManagement> </build> <dependencies> @@ -212,7 +167,7 @@ under the License. <version>2.10.1</version> </dependency> <dependency> - <groupId>org.codehaus.groovy</groupId> + <groupId>org.apache.groovy</groupId> <artifactId>groovy-all</artifactId> <version>${groovy.version}</version> <type>pom</type> @@ -301,11 +256,25 @@ under the License. <groupId>org.apache.hadoop</groupId> <artifactId>hadoop-mapreduce-client-core</artifactId> <version>${hadoop.version}</version> + <exclusions> + <!-- exclude jdk7 jar --> + <exclusion> + <groupId>jdk.tools</groupId> + <artifactId>jdk.tools</artifactId> + </exclusion> + </exclusions> </dependency> <dependency> <groupId>org.apache.hive</groupId> <artifactId>hive-jdbc</artifactId> <version>2.3.7</version> + <exclusions> + <!-- exclude jdk7 jar --> + <exclusion> + <groupId>jdk.tools</groupId> + <artifactId>jdk.tools</artifactId> + </exclusion> + </exclusions> </dependency> <dependency> <groupId>org.apache.arrow</groupId> 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 d7eb6827831..ec43e058e63 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 4db9b7fce38..d73cf6afaf6 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<String> sqls = getSqls(file.text) suite(suiteName, groupName) { String tag = suiteName String exceptionStr = "" boolean order = suiteName.endsWith("_order") - List<String> 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 ec85ca645a6..9d01acca00a 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<List<Object>> sortByToString(List<List<Object>> originData) { def comparator = Comparator.<String>naturalOrder() - originData.sort(false, { row1, row2 -> + originData.sort(false, { List<Object> row1, List<Object> 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 bcf6e23984c..c306e75fc87 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") --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
