-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-26388][SQL][WIP]_implement_hive_ddl_alter_table_replace_columns #24780
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
emanuelebardelli
wants to merge
13
commits into
apache:master
from
emanuelebardelli:SPARK-26388_SQL_implement_hive_ddl_alter_table_replace_columns
Closed
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
a99e362
enable 'alter table replace columns' command in sql parser
manu-olx b20dc95
create abstract class for add/replace columns classes
manu-olx 4f52b94
extract method verifying feasibility of add/replace columns operation…
manu-olx 59332d0
add AlterTableReplaceColumnsCommand class
manu-olx 01ce36c
fix failing tests
manu-olx 8ba07c9
refactor basic alter table add/replace tests
manu-olx e680632
remove safety net preventing to drop columns
manu-olx d75509e
add alter table replace columns tests
manu-olx aa6026f
refactor verifyAlterTableAddReplaceColumn
manu-olx 0c3bc55
rebase and implement #24776 changes
manu-olx 8b6da23
prevent replacing existing column with a different data type
manu-olx 5915c88
align replace columns tests to new changes
manu-olx 30641eb
fix 2 hive tests failing
manu-olx 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
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
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
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
Oops, something went wrong.
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.
I am fine to add this syntax, but this only supports changing column comments, right?
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.
Dropping the column is still risky to us. When you adding the columns back, we might see the unexpected values.
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.
@gatorsmile the idea is actually to implement
alter table replace colu�mnsfully:I believe this is a much needed feature to be able to manage meta-stores fully from Spark; however I understand the complexity and risks of this operation, so please let’s take the time to ensure it’s the right thing to do and all possibile ramifications.
I tried to make the commit history as clean and as descriptive as possibile and just added some more details in the PR description
known issuessection.I've also added an extra validation step to prevent columns to be replaced if the data type doesn't match (8b6da23)
Let me know if anything isn’t clear and I'll be happy add more details.
Thanks!
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.
Let me give a typical scenario. For an existing table, if we drop the column
col1, the data will not be visible to the end users. This is expected. However, if we addcol1back, the previous values of the columncol1should not be visible to the end users too. This is how the other database systems work. What is your thought?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 understand your point, it makes total sense and i would completely agree if hive was like the other dbms. according to your scenario, also the below should not be possibile, but it is:
do you agree it's the same behaviour you explained in the "drop / re-create column" example?
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.
@gatorsmile any thoughts about my previous comment?
i was wandering if this could be just a miscommunication issue as you are referring to the behaviour of
alter table replace columnswith "normal tables", while i'm manly talking about "external tables"?maybe
replace columnscould be enabled only forexternal tables? would that be acceptable / less risky in your opinion?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.
@gatorsmile any thoughts about my previous comment?
i was wandering if this could be just a miscommunication issue as you are referring to the behaviour of
alter table replace columnswith "normal tables", while i'm manly talking about "external tables"?maybe
replace columnscould be enabled only forexternal tables? would that be acceptable / less risky in your opinion?