Skip to content

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

Closed

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

Activity

  1. added
    enhancement
    good first issue
    help wanted
    on Apr 24, 2024
  2. mattharder91 commented on Apr 27, 2024

    @mattharder91
    Contributor

    Can I try this one out?

  3. viirya commented on Apr 27, 2024

    @viirya
    Member

    Of course. Thanks @mattharder91. Please let us know if you have any question.

  4. mattharder91 commented on Apr 29, 2024

    @mattharder91
    Contributor

    Here you go #346

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementgood first issuehelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions