Github user HyukjinKwon commented on the issue:
https://github.com/apache/spark/pull/16365
This is actually the message users face in some cases. Isn't it :)?
```scala
val df1 = spark.range(10).selectExpr("id as intcol", "cast(id as int) as
longcol")
df1.write.parquet("/tmp/a")
val df2 = spark.range(10).selectExpr("id as intcol", "id as longcol")
df2.write.parquet("/tmp/b")
spark.read.option("mergeSchema", true).parquet("/tmp/a", "/tmp/b").show()
```
**Before**
```
...
Caused by: org.apache.spark.SparkException: Failed to merge field longcol:
Failed to merge incompatible data types IntegerType and LongType
at
org.apache.spark.sql.types.StructType$$anonfun$merge$1$$anonfun$apply$3.apply(StructType.scala:480)
at
org.apache.spark.sql.types.StructType$$anonfun$merge$1$$anonfun$apply$3.apply(StructType.scala:471)
at scala.Option.map(Option.scala:146)
...
```
**After**
```
...
Caused by: org.apache.spark.SparkException: Failed to merge incompatible
data types IntegerType and LongType
at org.apache.spark.sql.types.StructType$.merge(StructType.scala:515)
at
org.apache.spark.sql.types.StructType$$anonfun$merge$1$$anonfun$apply$3.apply(StructType.scala:473)
at
org.apache.spark.sql.types.StructType$$anonfun$merge$1$$anonfun$apply$3.apply(StructType.scala:471)
...
```
BTW, it looks the test in `DataTypeSuite` was not added by mistake.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]