Skip to content

Commit

Permalink
fix fortmat of cast varchar
Browse files Browse the repository at this point in the history
  • Loading branch information
rui-mo committed Jul 13, 2021
1 parent 5d80831 commit 431b447
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions cpp/src/gandiva/precompiled/arithmetic_ops.cc
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,14 @@ CAST_UNARY_UTF8(castVARCHAR, int8, utf8, "%d", NOFMT, nothing)
CAST_UNARY_UTF8(castVARCHAR, int16, utf8, "%d", NOFMT, nothing)
CAST_UNARY_UTF8(castVARCHAR, int32, utf8, "%d", NOFMT, nothing)
CAST_UNARY_UTF8(castVARCHAR, int64, utf8, "%ld", NOFMT, nothing)
// CAST_UNARY_UTF8(castVARCHAR, float32, utf8, "%.*f", FMT, FLT_DIG)
// CAST_UNARY_UTF8(castVARCHAR, float64, utf8, "%.*f", FMT, DBL_DIG)
CAST_UNARY_UTF8(castVARCHAR, float32, utf8, "%g", NOFMT, nothing)
CAST_UNARY_UTF8(castVARCHAR, float64, utf8, "%g", NOFMT, nothing)
// We set to display the full precision of Float/Double, but this may still behave
// differently with vanilla spark.
CAST_UNARY_UTF8(castVARCHAR, float32, utf8, "%.*f", FMT, FLT_DIG)
CAST_UNARY_UTF8(castVARCHAR, float64, utf8, "%.*f", FMT, DBL_DIG)
// %g means converting floating-point number depending on the value and the precision.
// It bahaves similar to the shortest representation.
// CAST_UNARY_UTF8(castVARCHAR, float32, utf8, "%g", NOFMT, nothing)
// CAST_UNARY_UTF8(castVARCHAR, float64, utf8, "%g", NOFMT, nothing)

#undef CAST_UNARY_UTF8

Expand Down

0 comments on commit 431b447

Please sign in to comment.