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
Add exchange for union with TableScan and Values #207
Conversation
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please submit the signed CLA to cla@prestosql.io. If you are contributing on behalf of someone else (e.g., your employer), the individual CLA may not be sufficient and your employer may need the Corporate CLA signed. |
|
||
/** | ||
* These are plan tests similar to what we have for other optimizers (e.g. {@link io.prestosql.sql.planner.TestPredicatePushdown}) | ||
* They test that the plan for a query after the optimizer runs is as expected. |
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.
The above 2 lines are useless, i would remove the whole javadoc
* These are separate from {@link TestAddExchanges} because those are unit tests for | ||
* how layouts get chosen. | ||
*/ | ||
public class TestAddExchangesPlans |
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.
Why is it separate from TestLogicalPlanner
?
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 they are mean to test that specific code in AddExchanges
triggers, which is fine by me.
I've reviewed the original code, landing |
This prevents queries like SELECT nationkey FROM nation UNION SELECT 1 from executing on a single node. Plan before change: Fragment 0 [SINGLE] Output layout: [nationkey_4] Output partitioning: SINGLE [] Grouped Execution: false - Output[nationkey] => [nationkey_4:bigint] nationkey := nationkey_4 - Aggregate(FINAL)[nationkey_4] => [nationkey_4:bigint] - LocalExchange[HASH][$hashvalue] ("nationkey_4") => nationkey_4:bigint, $hashvalue:bigint - Project[] => [nationkey_4:bigint, $hashvalue_9:bigint] $hashvalue_9 := "combine_hash"(bigint '0', COALESCE("$operator$hash_code"("nationkey_4"), 0)) - Project[] => [nationkey_4:bigint, $hashvalue_7:bigint] nationkey_4 := "nationkey" - RemoteSource[1] => [nationkey:bigint, $hashvalue_7:bigint] - Project[] => [nationkey_4:bigint, $hashvalue_11:bigint] $hashvalue_11 := "combine_hash"(bigint '0', COALESCE("$operator$hash_code"("nationkey_4"), 0)) - Project[] => [nationkey_4:bigint, $hashvalue_10:bigint] nationkey_4 := "expr_3" $hashvalue_10 := "combine_hash"(bigint '0', COALESCE("$operator$hash_code"("expr_3"), 0)) - Aggregate(PARTIAL)[expr_3] => [expr_3:bigint] - Project[] => [expr_3:bigint] Cost: {rows: 1 (9B), cpu: 9.00, memory: 0.00, network: 0.00} expr_3 := BIGINT '1' - LocalExchange[ROUND_ROBIN] () => Cost: {rows: 1 (0B), cpu: 0.00, memory: 0.00, network: 0.00} - Values => [] Cost: {rows: 1 (0B), cpu: 0.00, memory: 0.00, network: 0.00} () Fragment 1 [SOURCE] Output layout: [nationkey, $hashvalue_8] Output partitioning: SINGLE [] Grouped Execution: false - Project[] => [nationkey:bigint, $hashvalue_8:bigint] $hashvalue_8 := "combine_hash"(bigint '0', COALESCE("$operator$hash_code"("nationkey"), 0)) - Aggregate(PARTIAL)[nationkey] => [nationkey:bigint] - TableScan[tpch:tpch:nation:sf1.0, grouped = false] => [nationkey:bigint] Cost: {rows: 25 (225B), cpu: 225.00, memory: 0.00, network: 0.00} nationkey := tpch:nationkey Plan after change: Fragment 0 [SINGLE] Output layout: [nationkey_4] Output partitioning: SINGLE [] Grouped Execution: false - Output[nationkey] => [nationkey_4:bigint] nationkey := nationkey_4 - RemoteSource[1] => [nationkey_4:bigint] Fragment 1 [HASH] Output layout: [nationkey_4] Output partitioning: SINGLE [] Grouped Execution: false - Aggregate(FINAL)[nationkey_4] => [nationkey_4:bigint] - LocalExchange[HASH][$hashvalue] ("nationkey_4") => nationkey_4:bigint, $hashvalue:bigint - Project[] => [nationkey_4:bigint, $hashvalue_9:bigint] $hashvalue_9 := "combine_hash"(bigint '0', COALESCE("$operator$hash_code"("nationkey_4"), 0)) - Project[] => [nationkey_4:bigint, $hashvalue_7:bigint] nationkey_4 := "nationkey" - RemoteSource[2] => [nationkey:bigint, $hashvalue_7:bigint] - Project[] => [nationkey_4:bigint, $hashvalue_12:bigint] $hashvalue_12 := "combine_hash"(bigint '0', COALESCE("$operator$hash_code"("nationkey_4"), 0)) - Project[] => [nationkey_4:bigint, $hashvalue_10:bigint] nationkey_4 := "expr_3" - RemoteSource[3] => [expr_3:bigint, $hashvalue_10:bigint] Fragment 2 [SOURCE] Output layout: [nationkey, $hashvalue_8] Output partitioning: HASH [nationkey][$hashvalue_8] Grouped Execution: false - Project[] => [nationkey:bigint, $hashvalue_8:bigint] $hashvalue_8 := "combine_hash"(bigint '0', COALESCE("$operator$hash_code"("nationkey"), 0)) - Aggregate(PARTIAL)[nationkey] => [nationkey:bigint] - TableScan[tpch:tpch:nation:sf1.0, grouped = false] => [nationkey:bigint] Cost: {rows: 25 (225B), cpu: 225.00, memory: 0.00, network: 0.00} nationkey := tpch:nationkey Fragment 3 [SINGLE] Output layout: [expr_3, $hashvalue_11] Output partitioning: HASH [expr_3][$hashvalue_11] Grouped Execution: false - Project[] => [expr_3:bigint, $hashvalue_11:bigint] $hashvalue_11 := "combine_hash"(bigint '0', COALESCE("$operator$hash_code"("expr_3"), 0)) - Aggregate(PARTIAL)[expr_3] => [expr_3:bigint] - Project[] => [expr_3:bigint] Cost: {rows: 1 (9B), cpu: 9.00, memory: 0.00, network: 0.00} expr_3 := BIGINT '1' - LocalExchange[ROUND_ROBIN] () => Cost: {rows: 1 (0B), cpu: 0.00, memory: 0.00, network: 0.00} - Values => [] Cost: {rows: 1 (0B), cpu: 0.00, memory: 0.00, network: 0.00} () Extracted-From: prestodb/presto#11957
The plannedChildren variable wasn't doing anything useful anymore so it was just a layer of indirection. Extracted-From: prestodb/presto#11957
a6459fb
to
698ac21
Compare
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please submit the signed CLA to cla@prestosql.io. If you are contributing on behalf of someone else (e.g., your employer), the individual CLA may not be sufficient and your employer may need the Corporate CLA signed. |
Extracted-From: prestodb/presto#11957