Skip to content

Feature request: inferSchema do not infer digit strings that start with 0 as integer #55884

@jxu

Description

@jxu

Version: Spark 3.5

Usually, if a data source has a string like "000123", this is an ID of fixed number of digits where the leading zeros are important, so this should not be cast into an integer like 123. An example is zip codes. There should be an option to be safe and keep as a string. Otherwise I have to turn off inferSchema and manually specify the whole schema or cast afterwards.

Same request here https://stackoverflow.com/questions/50299192/pyspark-inferschema-numbers-that-start-with-0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions