Skip to content

Commit

Permalink
[feat] Upgrade Gradle to 7.3 and fixs interval and extract function
Browse files Browse the repository at this point in the history
  • Loading branch information
wt0530 committed Feb 21, 2025
1 parent cb9633f commit 4ef37af
Show file tree
Hide file tree
Showing 28 changed files with 578 additions and 130 deletions.
9 changes: 6 additions & 3 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@
import com.squareup.javapoet.TypeName;
import com.squareup.javapoet.TypeSpec;
import io.dingodb.expr.common.type.IntervalDayType;
import io.dingodb.expr.common.type.IntervalHourType;
import io.dingodb.expr.common.type.IntervalMinuteType;
import io.dingodb.expr.common.type.IntervalMonthType;
import io.dingodb.expr.common.type.IntervalSecondType;
import io.dingodb.expr.common.type.IntervalWeekType;
import io.dingodb.expr.common.type.IntervalYearType;
import org.apache.commons.lang3.StringUtils;
import org.checkerframework.checker.nullness.qual.NonNull;
Expand Down Expand Up @@ -168,6 +172,14 @@ private static String getType(@NonNull TypeName typeName) {
return "MONTH";
} else if (typeName.equals(TypeName.get(IntervalDayType.IntervalDay.class))) {
return "DAY";
} else if (typeName.equals(TypeName.get(IntervalWeekType.IntervalWeek.class))) {
return "WEEK";
} else if (typeName.equals(TypeName.get(IntervalHourType.IntervalHour.class))) {
return "HOUR";
} else if (typeName.equals(TypeName.get(IntervalMinuteType.IntervalMinute.class))) {
return "MINUTE";
} else if (typeName.equals(TypeName.get(IntervalSecondType.IntervalSecond.class))) {
return "SECOND";
}
return "ANY";
}
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/groovy/java-conventions.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ plugins {

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(8))
languageVersion.set(JavaLanguageVersion.of(17))
}
withSourcesJar()
withJavadocJar()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,25 @@

package io.dingodb.expr.common.type;

import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import org.checkerframework.checker.nullness.qual.NonNull;

public final class IntervalHourType extends ScalarType {
import java.math.BigDecimal;

public class IntervalHourType extends IntervalType {

@NoArgsConstructor
@AllArgsConstructor
public static class IntervalHour extends IntervalHourType {
public BigDecimal value;
public Type elementType;

@Override
public boolean equals(Object obj) {
return obj instanceof IntervalHour;
}
}

public static final String NAME = "INTERVAL_HOUR";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,26 @@

package io.dingodb.expr.common.type;

import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import org.checkerframework.checker.nullness.qual.NonNull;

public final class IntervalMinuteType extends ScalarType {
import java.math.BigDecimal;

public class IntervalMinuteType extends IntervalType {

@NoArgsConstructor
@AllArgsConstructor
public static class IntervalMinute extends IntervalMinuteType {
public BigDecimal value;
public Type elementType;

@Override
public boolean equals(Object obj) {
return obj instanceof IntervalMinute;
}
}


public static final String NAME = "INTERVAL_MINUTE";
private static final int CODE = 205;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,25 @@

package io.dingodb.expr.common.type;

import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import org.checkerframework.checker.nullness.qual.NonNull;

public final class IntervalSecondType extends ScalarType {
import java.math.BigDecimal;

public class IntervalSecondType extends IntervalType {

@NoArgsConstructor
@AllArgsConstructor
public static class IntervalSecond extends IntervalSecondType {
public BigDecimal value;
public Type elementType;

@Override
public boolean equals(Object obj) {
return obj instanceof IntervalSecond;
}
}

public static final String NAME = "INTERVAL_SECOND";
private static final int CODE = 206;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
* Copyright 2021 DataCanvas
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package io.dingodb.expr.common.type;

import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import org.checkerframework.checker.nullness.qual.NonNull;

import java.math.BigDecimal;

public class IntervalWeekType extends IntervalType {

@NoArgsConstructor
@AllArgsConstructor
public static class IntervalWeek extends IntervalWeekType {
public BigDecimal value;
public Type elementType;

@Override
public boolean equals(Object obj) {
return obj instanceof IntervalWeek;
}
}

public static final String NAME = "INTERVAL_WEEK";
private static final int CODE = 207;

IntervalWeekType() {
super();
}

@Override
public <R, T> R accept(@NonNull TypeVisitor<R, T> visitor, T obj) {
return visitor.visitIntervalWeekType(this, obj);
}

@Override
public int hashCode() {
return CODE * 31;
}

@Override
public boolean equals(Object obj) {
return obj instanceof IntervalWeekType;
}

@Override
public String toString() {
return NAME;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ public interface TypeVisitor<R, T> {

R visitIntervalDayType(@NonNull IntervalDayType type, T obj);

R visitIntervalWeekType(@NonNull IntervalWeekType type, T obj);

R visitIntervalHourType(@NonNull IntervalHourType type, T obj);

R visitIntervalMinuteType(@NonNull IntervalMinuteType type, T obj);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,11 @@ public R visitIntervalDayType(@NonNull IntervalDayType type, T obj) {
return null;
}

@Override
public R visitIntervalWeekType(@NonNull IntervalWeekType type, T obj) {
return null;
}

@Override
public R visitIntervalHourType(@NonNull IntervalHourType type, T obj) {
return null;
Expand Down
5 changes: 5 additions & 0 deletions common/src/main/java/io/dingodb/expr/common/type/Types.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,14 @@ public final class Types {
public static final IntervalMonthType.IntervalMonth MONTH = new IntervalMonthType.IntervalMonth();
public static final IntervalDayType INTERVAL_DAY = new IntervalDayType();
public static final IntervalDayType.IntervalDay DAY = new IntervalDayType.IntervalDay();
public static final IntervalWeekType INTERVAL_WEEK = new IntervalWeekType();
public static final IntervalWeekType.IntervalWeek WEEK = new IntervalWeekType.IntervalWeek();
public static final IntervalHourType INTERVAL_HOUR = new IntervalHourType();
public static final IntervalHourType.IntervalHour HOUR = new IntervalHourType.IntervalHour();
public static final IntervalMinuteType INTERVAL_MINUTE = new IntervalMinuteType();
public static final IntervalMinuteType.IntervalMinute MINUTE = new IntervalMinuteType.IntervalMinute();
public static final IntervalSecondType INTERVAL_SECOND = new IntervalSecondType();
public static final IntervalSecondType.IntervalSecond SECOND = new IntervalSecondType.IntervalSecond();
public static final IntervalDayTimeType INTERVAL_DAY_TIME = new IntervalDayTimeType();

public static final ArrayType ARRAY_INT = new ArrayType(INT);
Expand Down
2 changes: 1 addition & 1 deletion console/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ plugins {
}

application {
mainClass = 'io.dingodb.expr.console.DingoExprConsole'
getMainClass().set('io.dingodb.expr.console.DingoExprConsole')
}

dependencies {
Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ VERSION=2.0.0-SNAPSHOT
jackson.version=2.13.4

# facilities
lombok.version=1.18.16
lombok.version=1.18.30
javapoet.version=1.13.0
mapstruct.version=1.5.5.Final
antlr.version=4.9.3

# google
auto-service.version=1.0
guava.version=31.1-jre
guava.version=33.4.0-jre

# apache commons
commons-lang.version=2.6
Expand All @@ -64,7 +64,7 @@ logback.version=1.2.3
checkerframework.version=3.12.0
checkstyle.version=8.30

gradleGitPropertiesVersion=2.4.1
gradleGitPropertiesVersion=2.4.2

#
# For release script. These are not the real credentials.
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 4ef37af

Please sign in to comment.