-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-31828][SQL] Retain table properties at CreateTableLikeCommand #28647
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
Closed
Closed
Changes from 2 commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
61dfe05
init
ulysses-you 37ba3b3
fix
ulysses-you 594a1bb
update doc
ulysses-you b30d62c
remove metastore proerties
ulysses-you 29aba43
update doc
ulysses-you 162627a
add comment
ulysses-you 9eacf1e
add meta test
ulysses-you 175d0e2
fix view
ulysses-you ed0877e
fix
ulysses-you dd04dcc
fix
ulysses-you 4507e7f
fix
ulysses-you bc52948
fix
ulysses-you 6b523e1
fix
ulysses-you 0e79ed3
update doc
ulysses-you 46d7a7b
fix comment
ulysses-you 1edc619
Merge branch 'master' of https://github.com/apache/spark into SPARK-3…
ulysses-you 78ff34f
update reserved properties
ulysses-you 2251181
revert last commit
ulysses-you 5c63477
check format
ulysses-you 183c209
fix
ulysses-you fcc8b3b
update doc
ulysses-you 006ec47
update doc
ulysses-you 319fbfb
update doc and comment
ulysses-you 7f9f685
remove useless properties in HiveClientImpl
ulysses-you 93a0c75
add view test
ulysses-you 3e8af07
add test
ulysses-you 0a3b1cf
fix
ulysses-you 1e1349f
fix
ulysses-you 19f398b
update constants
ulysses-you 03966ae
add using hive
ulysses-you dc00260
Merge branch 'master' of https://github.com/apache/spark into SPARK-3…
ulysses-you 2d470fc
minor
ulysses-you 4b55575
Merge branch 'master' of https://github.com/apache/spark into SPARK-3…
ulysses-you c45489a
Merge branch 'master' of https://github.com/apache/spark into SPARK-3…
ulysses-you File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2632,7 +2632,6 @@ class HiveDDLSuite | |
| assert(source.properties("a") == "apple") | ||
| sql("CREATE TABLE t LIKE s STORED AS parquet TBLPROPERTIES('f'='foo', 'b'='bar')") | ||
| val table = catalog.getTableMetadata(TableIdentifier("t")) | ||
| assert(table.properties.get("a") === None) | ||
| assert(table.properties("f") == "foo") | ||
| assert(table.properties("b") == "bar") | ||
| } | ||
|
|
@@ -2720,4 +2719,23 @@ class HiveDDLSuite | |
| checkAnswer(sql("SHOW PARTITIONS ta_part"), Row("ts=10") :: Nil) | ||
| } | ||
| } | ||
|
|
||
| test("SPARK-31828: Retain table properties at CreateTableLikeCommand") { | ||
| val catalog = spark.sessionState.catalog | ||
| withTable("t1", "t2", "t3") { | ||
| sql("CREATE TABLE t1(c1 int) TBLPROPERTIES('k1'='v1', 'k2'='v2')") | ||
|
||
| val t1 = catalog.getTableMetadata(TableIdentifier("t1")) | ||
| assert(t1.properties("k1") == "v1") | ||
| assert(t1.properties("k2") == "v2") | ||
| sql("CREATE TABLE t2 LIKE t1 TBLPROPERTIES('k2'='v3', 'k4'='v4')") | ||
| val t2 = catalog.getTableMetadata(TableIdentifier("t2")) | ||
| assert(t2.properties("k1") == "v1") | ||
| assert(t2.properties("k2") == "v3") | ||
| assert(t2.properties("k4") == "v4") | ||
| sql("CREATE TABLE t3 LIKE t1") | ||
| val t3 = catalog.getTableMetadata(TableIdentifier("t3")) | ||
| assert(t3.properties("k1") == "v1") | ||
| assert(t3.properties("k2") == "v2") | ||
cloud-fan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
| } | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Seems like we intentionally don't keep the table properties from the original table. @maropu @dongjoon-hyun @viirya are you OK with the behavior change proposed by this PR?
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.
Based on the description of
CreateTableLikeCommand:So we don't say table properties are copied from source table too. Not sure about why we didn't copy table properties.
I feel it is OK as seems copying original table properties should not be harmful. And we already copy storage properties.
But we should update the doc together.
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.
hm, I have the same opinion with @viirya; I couldn't find any strong reason not to copy the properites. Rather, is this a kind of bugs? Anyway, yea, we should clearly descibe the behaivour in our doc...