[opt](Nereids) let DataType toSql same with legacy planner (#26576)
This commit is contained in:
@ -104,7 +104,7 @@ public class MapType extends DataType {
|
||||
|
||||
@Override
|
||||
public String toSql() {
|
||||
return "MAP<" + keyType.toSql() + ", " + valueType.toSql() + ">";
|
||||
return "MAP<" + keyType.toSql() + "," + valueType.toSql() + ">";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -43,7 +43,7 @@ public class StringType extends CharacterType {
|
||||
|
||||
@Override
|
||||
public String simpleString() {
|
||||
return "string";
|
||||
return "text";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -19,6 +19,7 @@ package org.apache.doris.nereids.types;
|
||||
|
||||
import org.apache.doris.nereids.util.Utils;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
@ -38,7 +39,7 @@ public class StructField {
|
||||
* @param nullable Indicates if values of this field can be `null` values
|
||||
*/
|
||||
public StructField(String name, DataType dataType, boolean nullable, String comment) {
|
||||
this.name = Objects.requireNonNull(name, "name should not be null");
|
||||
this.name = Objects.requireNonNull(name, "name should not be null").toLowerCase(Locale.ROOT);
|
||||
this.dataType = Objects.requireNonNull(dataType, "dataType should not be null");
|
||||
this.nullable = nullable;
|
||||
this.comment = Objects.requireNonNull(comment, "comment should not be null");
|
||||
@ -82,7 +83,7 @@ public class StructField {
|
||||
|
||||
public String toSql() {
|
||||
return name + ":" + dataType.toSql()
|
||||
+ (nullable ? " " : " NOT NULL")
|
||||
+ (nullable ? "" : " NOT NULL")
|
||||
+ (comment.isEmpty() ? "" : " COMMENT " + comment);
|
||||
}
|
||||
|
||||
|
||||
@ -119,11 +119,11 @@ public class StructType extends DataType {
|
||||
|
||||
@Override
|
||||
public String toSql() {
|
||||
return "STRUCT<" + fields.stream().map(StructField::toSql).collect(Collectors.joining(", ")) + ">";
|
||||
return "STRUCT<" + fields.stream().map(StructField::toSql).collect(Collectors.joining(",")) + ">";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "STRUCT<" + fields.stream().map(StructField::toString).collect(Collectors.joining(", ")) + ">";
|
||||
return "STRUCT<" + fields.stream().map(StructField::toString).collect(Collectors.joining(",")) + ">";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user