I'm using spark.read.parquet() to read from a folder where parquet files are organized in partitions. The result will be wrong when the partition name ends with f or d. Apparently, Spark will interpret them as number instead of string. I have created a minimal test case as below to reproduce the problem.
df = spark.createDataFrame([
('9q', 1),
('3k', 2),
('6f', 3),
('7f', 4),
('7d', 5),
],
schema='foo string, id integer'
)
df.write.partitionBy('foo').parquet('./tmp_parquet', mode='overwrite')
read_back_df = spark.read.parquet('./tmp_parquet')
read_back_df.show()
The read_back_df will be
+---+---+
| id|foo|
+---+---+
| 1| 9q|
| 4|7.0|
| 3|6.0|
| 2| 3k|
| 5|7.0|
+---+---+
Notice partition 6f/7f/7d becomes 6.0/7.0/7.0.
The spark version is 2.4.3.