[fix](compatibility) type toSql should return lowercase string (#38012) (#38517)

pick from master #38012

revert #25951
This commit is contained in:
morrySnow
2024-08-09 11:35:42 +08:00
committed by GitHub
parent e2f45225d6
commit 3c535e80dd
130 changed files with 2496 additions and 2504 deletions

View File

@ -207,7 +207,7 @@ public enum ExpressionFunctions {
Method method, FEFunction annotation) {
if (annotation != null) {
String name = annotation.name();
Type returnType = Type.fromPrimitiveType(PrimitiveType.valueOf(annotation.returnType()));
Type returnType = Type.fromPrimitiveType(PrimitiveType.valueOf(annotation.returnType().toUpperCase()));
List<Type> argTypes = new ArrayList<>();
for (String type : annotation.argTypes()) {
argTypes.add(ScalarType.createType(type));

View File

@ -192,7 +192,7 @@ public abstract class ColumnType {
}
public static Type read(DataInput in) throws IOException {
PrimitiveType primitiveType = PrimitiveType.valueOf(Text.readString(in));
PrimitiveType primitiveType = PrimitiveType.valueOf(Text.readString(in).toUpperCase());
if (primitiveType == PrimitiveType.ARRAY) {
Type itermType = read(in);
boolean containsNull = in.readBoolean();

View File

@ -396,11 +396,11 @@ public class PartitionKey implements Comparable<PartitionKey>, Writable {
public void readFields(DataInput in) throws IOException {
int count = in.readInt();
for (int i = 0; i < count; i++) {
PrimitiveType type = PrimitiveType.valueOf(Text.readString(in));
PrimitiveType type = PrimitiveType.valueOf(Text.readString(in).toUpperCase());
boolean isMax = in.readBoolean();
if (type == PrimitiveType.NULL_TYPE) {
String realType = StringLiteral.read(in).getStringValue();
type = PrimitiveType.valueOf(realType);
type = PrimitiveType.valueOf(realType.toUpperCase());
types.add(type);
keys.add(NullLiteral.create(Type.fromPrimitiveType(type)));
continue;

View File

@ -115,7 +115,7 @@ public class Histogram {
JsonObject histogramJson = JsonParser.parseString(json).getAsJsonObject();
String typeStr = histogramJson.get("data_type").getAsString();
Type dataType = Type.fromPrimitiveType(PrimitiveType.valueOf(typeStr));
Type dataType = Type.fromPrimitiveType(PrimitiveType.valueOf(typeStr.toUpperCase()));
histogramBuilder.setDataType(dataType);
float sampleRate = histogramJson.get("sample_rate").getAsFloat();