-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-14346][SQL] Native SHOW CREATE TABLE for Hive tables/views #13079
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
[SPARK-14346][SQL] Native SHOW CREATE TABLE for Hive tables/views #13079
Conversation
|
cc @yhuai @cloud-fan |
|
test this please |
| } | ||
| builder ++= metadata.viewOriginalText.mkString(" AS\n", "", "\n") | ||
| } else { | ||
| showHiveTableDataColumns(metadata, builder) |
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.
Should there be table comment clause generated here, after the data column list? COMMENT '.....'
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.
Thanks.
|
Test build #58504 has finished for PR 13079 at commit
|
| * Note that Hive's metastore also tracks skewed columns. We should consider adding that in the | ||
| * future once we have a better understanding of how we want to handle skewed columns. | ||
| * | ||
| * Field `fullyMapped` is used to indicate whether all table metadata entries retrieved from the |
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.
you can use @param here
|
Test build #58697 has finished for PR 13079 at commit
|
| throw new UnsupportedOperationException( | ||
| s"Failed to execute SHOW CREATE TABLE against table ${metadata.identifier.quotedString}, " + | ||
| "because it contains table structure(s) (e.g. skewed columns) that Spark SQL doesn't " + | ||
| "support yet." |
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.
I think we need to explicitly say that the table was created by Hive with keywords that we do not support.
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.
Do you mean we should mention the exact keywords, or just saying that the table is created by Hive?
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.
Replaced hasUnsupportedFeatures: Boolean with unsupportedFeatures: Seq[String], which holds string descriptions of unsupported features, so that we can list them in the exception message.
|
LGTM. I am merging this to master and 2.0. Let's change the error message and exception class in a separate pr. |
## What changes were proposed in this pull request? This is a follow-up of #12781. It adds native `SHOW CREATE TABLE` support for Hive tables and views. A new field `hasUnsupportedFeatures` is added to `CatalogTable` to indicate whether all table metadata retrieved from the concrete underlying external catalog (i.e. Hive metastore in this case) can be mapped to fields in `CatalogTable`. This flag is useful when the target Hive table contains structures that can't be handled by Spark SQL, e.g., skewed columns and storage handler, etc.. ## How was this patch tested? New test cases are added in `ShowCreateTableSuite` to do round-trip tests. Author: Cheng Lian <[email protected]> Closes #13079 from liancheng/spark-14346-show-create-table-for-hive-tables. (cherry picked from commit b674e67) Signed-off-by: Yin Huai <[email protected]>
|
|
||
| require(metadata.identifier.database == Some(databaseName), | ||
| require( | ||
| metadata.identifier.database.contains(databaseName), |
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.
contains is not in scala 2.10. Let me fixing the build.
## What changes were proposed in this pull request? Scala 2.10 build was broken by #13079. I am reverting the change of that line. Author: Yin Huai <[email protected]> Closes #13157 from yhuai/SPARK-14346-fix-scala2.10. (cherry picked from commit 2a5db9c) Signed-off-by: Yin Huai <[email protected]>
## What changes were proposed in this pull request? Scala 2.10 build was broken by #13079. I am reverting the change of that line. Author: Yin Huai <[email protected]> Closes #13157 from yhuai/SPARK-14346-fix-scala2.10.
…LE output ## What changes were proposed in this pull request? This PR is a follow-up of #13079. It replaces `hasUnsupportedFeatures: Boolean` in `CatalogTable` with `unsupportedFeatures: Seq[String]`, which contains unsupported Hive features of the underlying Hive table. In this way, we can accurately report all unsupported Hive features in the exception message. ## How was this patch tested? Updated existing test case to check exception message. Author: Cheng Lian <[email protected]> Closes #13173 from liancheng/spark-14346-follow-up.
…LE output ## What changes were proposed in this pull request? This PR is a follow-up of #13079. It replaces `hasUnsupportedFeatures: Boolean` in `CatalogTable` with `unsupportedFeatures: Seq[String]`, which contains unsupported Hive features of the underlying Hive table. In this way, we can accurately report all unsupported Hive features in the exception message. ## How was this patch tested? Updated existing test case to check exception message. Author: Cheng Lian <[email protected]> Closes #13173 from liancheng/spark-14346-follow-up. (cherry picked from commit 6ac1c3a) Signed-off-by: Andrew Or <[email protected]>
What changes were proposed in this pull request?
This is a follow-up of #12781. It adds native
SHOW CREATE TABLEsupport for Hive tables and views. A new fieldhasUnsupportedFeaturesis added toCatalogTableto indicate whether all table metadata retrieved from the concrete underlying external catalog (i.e. Hive metastore in this case) can be mapped to fields inCatalogTable. This flag is useful when the target Hive table contains structures that can't be handled by Spark SQL, e.g., skewed columns and storage handler, etc..How was this patch tested?
New test cases are added in
ShowCreateTableSuiteto do round-trip tests.