Skip to content

Commit de3f5ea

Browse files
committed
non-ascii char
1 parent cf9c936 commit de3f5ea

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/math.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ case class Hex(child: Expression)
327327
* Converts every character in s to two hex digits.
328328
*/
329329
private def hex(str: UTF8String): UTF8String = {
330-
doHex(str.getBytes, str.length())
330+
hex(str.getBytes)
331331
}
332332

333333
private def hex(bytes: Array[Byte]): UTF8String = {

sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/MathFunctionsSuite.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ class MathFunctionsSuite extends SparkFunSuite with ExpressionEvalHelper {
232232
checkEvaluation(Hex(Literal(-100800200404L)), "FFFFFFE887D7012C")
233233
checkEvaluation(Hex(Literal("helloHex")), "68656C6C6F486578")
234234
checkEvaluation(Hex(Literal("helloHex".getBytes())), "68656C6C6F486578")
235+
checkEvaluation(Hex(Literal("三重的")), "E4B889E9878DE79A84")
235236
}
236237

237238
test("hypot") {

0 commit comments

Comments
 (0)