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 @@ -113,7 +113,7 @@ public static Expression substringVarcharIntInt(StringLikeLiteral first,
*/
@ExecFunction(name = "length")
public static Expression lengthVarchar(StringLikeLiteral first) {
return new IntegerLiteral(first.getValue().length());
return new IntegerLiteral(first.getValue().getBytes(StandardCharsets.UTF_8).length);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ suite("fold_constant_string_arithmatic") {
testFoldConst("SELECT Concat_Ws('-', '2024', '09', '02')")
testFoldConst("SELECT Char(65)")
testFoldConst("SELECT Character_Length('Hello World')")
testFoldConst("SELECT Length('你')")
testFoldConst("SELECT Initcap('hello world')")
testFoldConst("SELECT Md5('Hello World')")
testFoldConst("SELECT Md5Sum('Hello World')")
Expand Down
Loading