-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-21617][SQL] Store correct table metadata when altering schema in Hive metastore. #18849
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
aae3abd
2350b10
7ccf474
40ebc96
2f57a3c
0b27209
6824e35
7b777ed
abd6cf1
4a05b55
3c8a6bb
b63539d
cef66ac
c41683a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -907,14 +907,13 @@ private[hive] object HiveClientImpl { | |
| val (partCols, schema) = table.schema.map(toHiveColumn).partition { c => | ||
| table.partitionColumnNames.contains(c.getName) | ||
| } | ||
| // after SPARK-19279, it is not allowed to create a hive table with an empty schema, | ||
| // so here we should not add a default col schema | ||
| // | ||
| // Because HiveExternalCatalog sometimes writes back "raw" tables that have not been | ||
| // completely translated to Spark's view, the provider information needs to be looked | ||
| // up in two places. | ||
| val provider = table.provider.orElse( | ||
|
||
| table.properties.get(HiveExternalCatalog.DATASOURCE_PROVIDER)) | ||
| // after SPARK-19279, it is not allowed to create a hive table with an empty schema, | ||
| // so here we should not add a default col schema | ||
| if (schema.isEmpty && provider != Some(DDLUtils.HIVE_PROVIDER)) { | ||
| // This is a hack to preserve existing behavior. Before Spark 2.0, we do not | ||
| // set a default serde here (this was done in Hive), and so if the user provides | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change would have fixed the second exception in the bug (about storing an empty schema); but the code was just ending up in that situation because of the other problems this PR is fixing. This change shouldn't be needed for the fix, but I included it for further correctness.