Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ public static ScalarType createHllType() {
public String toString() {
if (type == PrimitiveType.CHAR) {
if (isWildcardChar()) {
return "CHARACTER";
return "CHARACTER(" + MAX_CHAR_LENGTH + ")";
}
return "CHAR(" + len + ")";
} else if (type == PrimitiveType.DECIMALV2) {
Expand Down Expand Up @@ -614,7 +614,7 @@ public String toSql(int depth) {
switch (type) {
case CHAR:
if (isWildcardChar()) {
stringBuilder.append("CHARACTER");
stringBuilder.append("CHARACTER").append("(").append(MAX_CHAR_LENGTH).append(")");
} else if (Strings.isNullOrEmpty(lenStr)) {
stringBuilder.append("CHAR").append("(").append(len).append(")");
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ public void testCreateGlobalFunction() throws Exception {
testFunctionQuery(ctx, queryStr, true);

queryStr = "select to_char(k1, 4) from db2.tbl1;";
Assert.assertTrue(dorisAssert.query(queryStr).explainQuery().contains("CAST(`k1` AS CHARACTER)"));
Assert.assertTrue(dorisAssert.query(queryStr).explainQuery().contains("CAST(`k1` AS CHARACTER(255))"));
}

private void testFunctionQuery(ConnectContext ctx, String queryStr, Boolean isStringLiteral) throws Exception {
Expand Down