[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
This commit is contained in:
924060929
2024-03-08 18:16:46 +08:00
committed by yiguolei
parent 5f9eb5eb52
commit cc0e58faec
7 changed files with 49 additions and 67 deletions

View File

@ -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;

View File

@ -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));
}

View File

@ -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>

View File

@ -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) {

View File

@ -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)

View File

@ -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]

View File

@ -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")