[feature](Nereids) support datev1 and datetimev1 (#28581)
This commit is contained in:
@ -216,6 +216,9 @@ public abstract class DataType {
|
||||
case "date":
|
||||
dataType = DateType.INSTANCE;
|
||||
break;
|
||||
case "datev1":
|
||||
dataType = DateType.NOT_CONVERSION;
|
||||
break;
|
||||
case "datev2":
|
||||
dataType = DateV2Type.INSTANCE;
|
||||
break;
|
||||
@ -234,6 +237,17 @@ public abstract class DataType {
|
||||
throw new AnalysisException("Nereids do not support type: " + type);
|
||||
}
|
||||
break;
|
||||
case "datetimev1":
|
||||
switch (types.size()) {
|
||||
case 1:
|
||||
dataType = DateTimeType.NOT_CONVERSION;
|
||||
break;
|
||||
case 2:
|
||||
throw new AnalysisException("Nereids do not support datetimev1 type with precision");
|
||||
default:
|
||||
throw new AnalysisException("Nereids do not support type: " + type);
|
||||
}
|
||||
break;
|
||||
case "datetimev2":
|
||||
switch (types.size()) {
|
||||
case 1:
|
||||
|
||||
@ -31,15 +31,23 @@ import java.time.temporal.ChronoUnit;
|
||||
public class DateTimeType extends DateLikeType {
|
||||
|
||||
public static final DateTimeType INSTANCE = new DateTimeType();
|
||||
public static final DateTimeType NOT_CONVERSION = new DateTimeType(false);
|
||||
|
||||
private static final int WIDTH = 16;
|
||||
|
||||
private final boolean shouldConversion;
|
||||
|
||||
private DateTimeType() {
|
||||
this.shouldConversion = true;
|
||||
}
|
||||
|
||||
private DateTimeType(boolean shouldConversion) {
|
||||
this.shouldConversion = shouldConversion;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataType conversion() {
|
||||
if (Config.enable_date_conversion) {
|
||||
if (Config.enable_date_conversion && shouldConversion) {
|
||||
return DateTimeV2Type.SYSTEM_DEFAULT;
|
||||
}
|
||||
return this;
|
||||
|
||||
@ -31,15 +31,23 @@ import java.time.temporal.ChronoUnit;
|
||||
public class DateType extends DateLikeType {
|
||||
|
||||
public static final DateType INSTANCE = new DateType();
|
||||
public static final DateType NOT_CONVERSION = new DateType(false);
|
||||
|
||||
private static final int WIDTH = 16;
|
||||
|
||||
private final boolean shouldConversion;
|
||||
|
||||
private DateType() {
|
||||
this.shouldConversion = true;
|
||||
}
|
||||
|
||||
private DateType(boolean shouldConversion) {
|
||||
this.shouldConversion = shouldConversion;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataType conversion() {
|
||||
if (Config.enable_date_conversion) {
|
||||
if (Config.enable_date_conversion && shouldConversion) {
|
||||
return DateV2Type.INSTANCE;
|
||||
}
|
||||
return this;
|
||||
|
||||
Reference in New Issue
Block a user