TJX2014 opened a new pull request #28882:
URL: https://github.com/apache/spark/pull/28882
<!--
Thanks for sending a pull request! Here are some tips for you:
1. If this is your first time, please read our contributor guidelines:
https://spark.apache.org/contributing.html
2. Ensure you have added or run the appropriate tests for your PR:
https://spark.apache.org/developer-tools.html
3. If the PR is unfinished, add '[WIP]' in your PR title, e.g.,
'[WIP][SPARK-XXXX] Your PR title ...'.
4. Be sure to keep the PR description updated to reflect all changes.
5. Please write your PR title to summarize what this PR proposes.
6. If possible, provide a concise example to reproduce the issue for a
faster review.
7. If you want to add a new configuration, please read the guideline first
for naming configurations in
'core/src/main/scala/org/apache/spark/internal/config/ConfigEntry.scala'.
-->
### What changes were proposed in this pull request?
1.`FOLLOW_HIVE_TABLE_LOCATION_ENABLED` in
`org.apache.spark.sql.internal.StaticSQLConf`
2. `FOLLOW_HIVE_TABLE_LOCATION_ENABLED` judge condition branch in
`org.apache.spark.sql.hive.HiveExternalCatalog#getLocationFromStorageProps`
### Why are the changes needed?
**Step 1**,When hive support is enabled and we use sparksql create and save
hive table as fellow:
`df = spark.createDataFrame([{"a": "x", "b": "y", "c": "3"}])`
`df.write.format("orc").option("compression",
"ZLIB").mode("overwrite").saveAsTable('test_spark');`
**Step 2**,When we alter table name through hive interface not spark like
below:
`alter table test_spark rename to test_spark2;`
The location of `test_spark` is changed to `test_spark2` but spark maintain
the path serde `test_spark`,this lead to spark read `test_spark` while
`test_spark2` is expected.
**Step 3**, In order to compatible with historical behavior:
we can use `FOLLOW_HIVE_TABLE_LOCATION_ENABLED` to decide if we need to
follow hive table location.
### Does this PR introduce _any_ user-facing change?
Yes,if we need to follow hive table
location,`spark.sql.follow.hive.table.location` could be set to `true` in
`conf/spark-defaults.conf`
### How was this patch tested?
Manual test.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]