Github user gatorsmile commented on the issue:
https://github.com/apache/spark/pull/14148
```
Seq("parquet", "json", "orc").foreach { fileFormat =>
withTable("t1") {
withTempPath { dir =>
val path = dir.getCanonicalPath
spark.range(1).write.format(fileFormat).save(path)
sql(s"CREATE TABLE t1(a int, b int) USING $fileFormat OPTIONS
(PATH '$path') ")
sql("select * from t1").show(false)
}
}
}
```
If users specify an unmatched schema, we did not do the check. I think at
least we should report an error as early as possible. For the formats `parquet`
and `json`, the outputs are
```
+----+----+
|a |b |
+----+----+
|null|null|
+----+----+
```
For the format `orc`, we got an stage failure.
```
Job aborted due to stage failure: Task 0 in stage 5.0 failed 1 times, most
recent failure: Lost task 0.0 in stage 5.0 (TID 5, localhost):
java.lang.IllegalArgumentException: Field "a" does not exist.
```
Because this is another issue, will submit a separate PR for it.
---
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]