Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 0 additions & 36 deletions fe/fe-common/src/main/java/org/apache/doris/catalog/ArrayType.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import com.google.common.collect.Lists;
import com.google.gson.annotations.SerializedName;

import java.util.Map;
import java.util.Objects;

/**
Expand Down Expand Up @@ -95,31 +94,6 @@ public boolean matchesType(Type t) {
return itemType.matchesType(((ArrayType) t).itemType);
}

@Override
public boolean hasTemplateType() {
return itemType.hasTemplateType();
}

@Override
public Type specializeTemplateType(Type specificType, Map<String, Type> specializedTypeMap,
boolean useSpecializedType, boolean enableDecimal256) throws TypeException {
ArrayType specificArrayType = null;
if (specificType instanceof ArrayType) {
specificArrayType = (ArrayType) specificType;
} else if (!useSpecializedType) {
throw new TypeException(specificType + " is not ArrayType");
}

Type newItemType = itemType;
if (itemType.hasTemplateType()) {
newItemType = itemType.specializeTemplateType(
specificArrayType != null ? specificArrayType.itemType : specificType,
specializedTypeMap, useSpecializedType, enableDecimal256);
}

return new ArrayType(newItemType);
}

public static ArrayType create() {
return new ArrayType();
}
Expand Down Expand Up @@ -153,16 +127,6 @@ public boolean equals(Object other) {
return otherArrayType.itemType.equals(itemType) && otherArrayType.containsNull == containsNull;
}

public static boolean canCastTo(ArrayType type, ArrayType targetType) {
if (!targetType.containsNull && type.containsNull) {
return false;
}
if (targetType.getItemType().isStringType() && type.getItemType().isStringType()) {
return true;
}
return Type.canCastTo(type.getItemType(), targetType.getItemType());
}

public static Type getAssignmentCompatibleType(
ArrayType t1, ArrayType t2, boolean strict, boolean enableDecimal256) {
Type itemCompatibleType = Type.getAssignmentCompatibleType(t1.getItemType(), t2.getItemType(), strict,
Expand Down
45 changes: 0 additions & 45 deletions fe/fe-common/src/main/java/org/apache/doris/catalog/MapType.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import com.google.common.collect.Lists;
import com.google.gson.annotations.SerializedName;

import java.util.Map;
import java.util.Objects;

/**
Expand Down Expand Up @@ -137,43 +136,6 @@ public boolean matchesType(Type t) {
&& (valueType.matchesType(((MapType) t).valueType));
}

@Override
public boolean hasTemplateType() {
return keyType.hasTemplateType() || valueType.hasTemplateType();
}

@Override
public Type specializeTemplateType(Type specificType, Map<String, Type> specializedTypeMap,
boolean useSpecializedType, boolean enableDecimal256) throws TypeException {
MapType specificMapType = null;
if (specificType instanceof MapType) {
specificMapType = (MapType) specificType;
} else if (!useSpecializedType) {
throw new TypeException(specificType + " is not MapType");
}

Type newKeyType = keyType;
if (keyType.hasTemplateType()) {
newKeyType = keyType.specializeTemplateType(
specificMapType != null ? specificMapType.keyType : specificType,
specializedTypeMap, useSpecializedType, enableDecimal256);
}
Type newValueType = valueType;
if (valueType.hasTemplateType()) {
newValueType = valueType.specializeTemplateType(
specificMapType != null ? specificMapType.valueType : specificType,
specializedTypeMap, useSpecializedType, enableDecimal256);
}

Type newMapType = new MapType(newKeyType, newValueType);
if (Type.canCastTo(specificType, newMapType)
|| (useSpecializedType && !(specificType instanceof MapType))) {
return newMapType;
} else {
throw new TypeException(specificType + " can not cast to specialize type " + newMapType);
}
}

@Override
public String toString() {
return String.format("map<%s,%s>",
Expand All @@ -193,13 +155,6 @@ protected String prettyPrint(int lpad) {
return String.format("%sMAP<%s,%s>", leftPadding, keyType.toSql(), structStr);
}

public static boolean canCastTo(MapType type, MapType targetType) {
return (targetType.getKeyType().isStringType() && type.getKeyType().isStringType()
|| Type.canCastTo(type.getKeyType(), targetType.getKeyType()))
&& (Type.canCastTo(type.getValueType(), targetType.getValueType())
|| targetType.getValueType().isStringType() && type.getValueType().isStringType());
}

public static Type getAssignmentCompatibleType(MapType t1, MapType t2, boolean strict, boolean enableDecimal256) {
Type keyCompatibleType = Type.getAssignmentCompatibleType(t1.getKeyType(), t2.getKeyType(), strict,
enableDecimal256);
Expand Down
Loading
Loading