|
571 | 571 | ]
|
572 | 572 | }
|
573 | 573 | },
|
| 574 | + { |
| 575 | + "comment": "using HAVING inside a derived table still produces viable plans", |
| 576 | + "query": "select id from (select id from user group by id having (count(user.id) = 2) limit 2 offset 0) subquery_for_limit", |
| 577 | + "plan": { |
| 578 | + "QueryType": "SELECT", |
| 579 | + "Original": "select id from (select id from user group by id having (count(user.id) = 2) limit 2 offset 0) subquery_for_limit", |
| 580 | + "Instructions": { |
| 581 | + "OperatorType": "Limit", |
| 582 | + "Count": "INT64(2)", |
| 583 | + "Offset": "INT64(0)", |
| 584 | + "Inputs": [ |
| 585 | + { |
| 586 | + "OperatorType": "Route", |
| 587 | + "Variant": "Scatter", |
| 588 | + "Keyspace": { |
| 589 | + "Name": "user", |
| 590 | + "Sharded": true |
| 591 | + }, |
| 592 | + "FieldQuery": "select id from (select id, count(`user`.id) = 2 from `user` where 1 != 1 group by id) as subquery_for_limit where 1 != 1", |
| 593 | + "Query": "select id from (select id, count(`user`.id) = 2 from `user` group by id having count(`user`.id) = 2) as subquery_for_limit limit :__upper_limit", |
| 594 | + "Table": "`user`" |
| 595 | + } |
| 596 | + ] |
| 597 | + }, |
| 598 | + "TablesUsed": [ |
| 599 | + "user.user" |
| 600 | + ] |
| 601 | + } |
| 602 | + }, |
574 | 603 | {
|
575 | 604 | "comment": "sum with distinct no unique vindex",
|
576 | 605 | "query": "select col1, sum(distinct col2) from user group by col1",
|
|
3613 | 3642 | "QueryType": "SELECT",
|
3614 | 3643 | "Original": "select * from (select id from user having count(*) = 1) s",
|
3615 | 3644 | "Instructions": {
|
3616 |
| - "OperatorType": "Filter", |
3617 |
| - "Predicate": "count(*) = 1", |
3618 |
| - "ResultColumns": 1, |
| 3645 | + "OperatorType": "SimpleProjection", |
| 3646 | + "Columns": [ |
| 3647 | + 0 |
| 3648 | + ], |
3619 | 3649 | "Inputs": [
|
3620 | 3650 | {
|
3621 |
| - "OperatorType": "Aggregate", |
3622 |
| - "Variant": "Scalar", |
3623 |
| - "Aggregates": "any_value(0) AS id, sum_count_star(1) AS count(*)", |
| 3651 | + "OperatorType": "Projection", |
| 3652 | + "Expressions": [ |
| 3653 | + "[COLUMN 0] as id", |
| 3654 | + "[COLUMN 1] = [COLUMN 2] as count(*) = 1" |
| 3655 | + ], |
3624 | 3656 | "Inputs": [
|
3625 | 3657 | {
|
3626 |
| - "OperatorType": "Route", |
3627 |
| - "Variant": "Scatter", |
3628 |
| - "Keyspace": { |
3629 |
| - "Name": "user", |
3630 |
| - "Sharded": true |
3631 |
| - }, |
3632 |
| - "FieldQuery": "select id, count(*) from `user` where 1 != 1", |
3633 |
| - "Query": "select id, count(*) from `user`", |
3634 |
| - "Table": "`user`" |
| 3658 | + "OperatorType": "Filter", |
| 3659 | + "Predicate": "count(*) = 1", |
| 3660 | + "Inputs": [ |
| 3661 | + { |
| 3662 | + "OperatorType": "Aggregate", |
| 3663 | + "Variant": "Scalar", |
| 3664 | + "Aggregates": "any_value(0) AS id, sum_count_star(1) AS count(*), any_value(2)", |
| 3665 | + "Inputs": [ |
| 3666 | + { |
| 3667 | + "OperatorType": "Route", |
| 3668 | + "Variant": "Scatter", |
| 3669 | + "Keyspace": { |
| 3670 | + "Name": "user", |
| 3671 | + "Sharded": true |
| 3672 | + }, |
| 3673 | + "FieldQuery": "select id, count(*), 1 from `user` where 1 != 1", |
| 3674 | + "Query": "select id, count(*), 1 from `user`", |
| 3675 | + "Table": "`user`" |
| 3676 | + } |
| 3677 | + ] |
| 3678 | + } |
| 3679 | + ] |
3635 | 3680 | }
|
3636 | 3681 | ]
|
3637 | 3682 | }
|
|
0 commit comments