Skip to content

Commit 3a0040f

Browse files
committed
[SPARK-8301] changed call of UTF8String.set to UTF8String.from
1 parent e4530d2 commit 3a0040f

File tree

1 file changed

+3
-3
lines changed
  • sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions

1 file changed

+3
-3
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -437,17 +437,17 @@ case class Cast(child: Expression, dataType: DataType) extends UnaryExpression w
437437

438438
case (BinaryType, StringType) =>
439439
defineCodeGen (ctx, ev, c =>
440-
s"new ${ctx.stringType}().set($c)")
440+
s"new ${ctx.stringType}().fromString($c)")
441441
case (DateType, StringType) =>
442442
defineCodeGen(ctx, ev, c =>
443-
s"""new ${ctx.stringType}().set(
443+
s"""new ${ctx.stringType}().fromString(
444444
org.apache.spark.sql.catalyst.util.DateUtils.toString($c))""")
445445
// Special handling required for timestamps in hive test cases since the toString function
446446
// does not match the expected output.
447447
case (TimestampType, StringType) =>
448448
super.genCode(ctx, ev)
449449
case (_, StringType) =>
450-
defineCodeGen(ctx, ev, c => s"new ${ctx.stringType}().set(String.valueOf($c))")
450+
defineCodeGen(ctx, ev, c => s"new ${ctx.stringType}().fromString(String.valueOf($c))")
451451

452452
// fallback for DecimalType, this must be before other numeric types
453453
case (_, dt: DecimalType) =>

0 commit comments

Comments
 (0)