Skip to content

Implement Spark-compatible CAST float/double to string #312

@andygrove

Description

@andygrove

What is the problem the feature request solves?

We currently delegate to DataFusion when casting float/double to string and there are some differences in behavior compared to Spark.

  • Spark uses Infinity and -Infinity and DataFusion uses inf and -inf
  • Spark uses E for exponent and DataFusion uses e

There can also be differences in formatting but where the values are semantically equivalent. For example, for the input 1.0499721536516571E-4:

Spark produces "1.0499721536516571E-4"
DataFusion produces: "0.00010499721536516571"

We should create a compatibility guide and include this information.

Here are some suggested values to test:

val testData = Seq(Float.NegativeInfinity, Float.PositiveInfinity,
      Float.MinPositiveValue, Float.MinValue, Float.MaxValue, Float.NaN, -0.0f, 0.0f)

Describe the potential solution

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions