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
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