-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-4861][SQL] Refactory command in spark sql #3712
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
Conversation
|
Test build #24500 has started for PR 3712 at commit
|
|
Test build #24500 has finished for PR 3712 at commit
|
|
Test FAILed. |
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.
Can't we get rid of strategy entirely and just have this single line added to BasicOperators. That was kind of my goal with this refactoring.
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 will try, maybe we can add a rule to translate logical.XXXCommand to RunnableCommand in analyzer.
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 don think it needs to be in the Analyzer. I think just this single line in the BasicOperators Strategy should be sufficient.
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.
But for set command, catalyst first parse it as logical.SetCommand, when to make it as execution.SetCommand (RunnableCommand)?
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.
We can not avoid this step to translate logical.XXXCommand to RunnableCommand, so keep CommandStrategy here.
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.
Okay, I see the problem now. These commands still live inside of catalyst and thus cannot be RunnableCommands. I would argue that that should be changed. My whole goal here was to eliminate boilerplate from the planner and this still seems to have a bunch of it. That said, this could be done in a follow up 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.
yes, i think we can parse command in sql/core instead of parsing in catalyst in the follow up PR
|
Test build #24544 has started for PR 3712 at commit
|
|
Test build #24544 has finished for PR 3712 at commit
|
|
Test FAILed. |
|
Test build #24546 has started for PR 3712 at commit
|
|
Test build #24547 has started for PR 3712 at commit
|
|
Test build #24546 has finished for PR 3712 at commit
|
|
Test PASSed. |
|
Test build #24547 has finished for PR 3712 at commit
|
|
Test PASSed. |
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.
Its a little odd to have a var named sc that is not a SparkContext, also I think we should try and eliminate this since we get the SQLContext in the run method. Can we just move metastoreRelation into the run method?
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.
Can we just move this to the place in the unit tests where we need it?
|
Okay, I think this is getting pretty close. Thanks for working on this! |
|
Test build #24567 has started for PR 3712 at commit
|
|
Test build #24567 has finished for PR 3712 at commit
|
|
Test FAILed. |
|
Test build #24584 has started for PR 3712 at commit
|
|
Test build #24584 has finished for PR 3712 at commit
|
|
Test PASSed. |
|
Updated. @marmbrus is this ok to go ? |
|
Thanks! Merged to master. |
Follow up for #3712. This PR finally remove ```CommandStrategy``` and make all commands follow ```RunnableCommand``` so they can go with ```case r: RunnableCommand => ExecutedCommand(r) :: Nil```. One exception is the ```DescribeCommand``` of hive, which is a special case and need to distinguish hive table and temporary table, so still keep ```HiveCommandStrategy``` here. Author: scwf <wangfei1@huawei.com> Closes #3948 from scwf/followup-SPARK-4861 and squashes the following commits: 6b48e64 [scwf] minor style fix 2c62e9d [scwf] fix for hive module 5a7a819 [scwf] Refactory command in spark sql
Remove
Commandand useRunnableCommandinstead.