Skip to content
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

[bug] push filter error #517

Closed
zhyass opened this issue Nov 7, 2019 · 2 comments
Closed

[bug] push filter error #517

zhyass opened this issue Nov 7, 2019 · 2 comments
Assignees
Labels
type: bug Something isn't working
Milestone

Comments

@zhyass
Copy link
Contributor

zhyass commented Nov 7, 2019

t1.b+3 need push into the selectexpr but lost :

mysql> explain select t1.a from t1 join t3 on t1.b+1=t3.b left join tst on tst.b=t1.b+3 where t1.a=1 and t3.a=2 and tst.a=3;     
+------------------------------------------------------------------------------------+
| EXPLAIN         
+------------------------------------------------------------------------------------+
| {
        "RawQuery": " select t1.a from t1 join t3 on t1.b+1=t3.b left join tst on tst.b=t1.b+3 where t1.a=1 and t3.a=2 and tst.a=3",
        "Project": "a",
        "Partitions": [
                {
                        "Query": "select t1.a, t1.b + 1 as tmpo_0 from zzq.t1_0035 as t1 where t1.a = 1 order by tmpo_0 asc",
                        "Backend": "backend2",
                        "Range": "[2261-2325)"
                },
                {
                        "Query": "select t3.b from zzq.t3_0060 as t3 where t3.a = 2 order by t3.b asc",
                        "Backend": "backend3",
                        "Range": "[3882-3946)"
                },
                {
                        "Query": "select tst.b from zzq.tst_0023 as tst where tst.a = 3 order by tst.b asc",
                        "Backend": "backend2",
                        "Range": "[1493-1557)"
                }
        ],
        "Join": {
                "Type": "LEFT JOIN",
                "Strategy": "Sort Merge Join"
        }
} |
+------------------------------------------------------------------------------------+

tmpc_0 is repeat.

mysql> explain select t1.a from t1 left join t3 on t1.b=t3.b and t1.b<3 left join tst on tst.b=t1.b and t1.b >1 where t1.a=1 and t3.a=2 and tst.a=3;
+------------------------------------------------------------------------------------+
| EXPLAIN         
+------------------------------------------------------------------------------------+
| {
        "RawQuery": " select t1.a from t1 left join t3 on t1.b=t3.b and t1.b<3 left join tst on tst.b=t1.b and t1.b >1 where t1.a=1 and t3.a=2 and tst.a=3",
        "Project": "a",
        "Partitions": [
                {
                        "Query": "select t1.a, t1.b, t1.b, t1.b < 3 as tmpc_0, t1.b > 1 as tmpc_0 from zzq.t1_0035 as t1 where t1.a = 1 order by t1.b asc",
                        "Backend": "backend2",
                        "Range": "[2261-2325)"
                },
                {
                        "Query": "select t3.b from zzq.t3_0060 as t3 where t3.a = 2 order by t3.b asc",
                        "Backend": "backend3",
                        "Range": "[3882-3946)"
                },
                {
                        "Query": "select tst.b from zzq.tst_0023 as tst where tst.a = 3 order by tst.b asc",
                        "Backend": "backend2",
                        "Range": "[1493-1557)"
                }
        ],
        "Join": {
                "Type": "LEFT JOIN",
                "Strategy": "Sort Merge Join"
        }
} |
+------------------------------------------------------------------------------------+
1 row in set (0.01 sec)
@zhyass zhyass added the type: bug Something isn't working label Nov 7, 2019
@zhyass zhyass added this to the v1.0.8 milestone Nov 7, 2019
@zhyass zhyass self-assigned this Nov 7, 2019
@zhyass
Copy link
Contributor Author

zhyass commented Nov 7, 2019

The right result should be:

mysql> explain select t1.a from t1 join t3 on t1.b+1=t3.b left join tst on tst.b=t1.b+3 where t1.a=1 and t3.a=2 and tst.a=3;     
+------------------------------------------------------------------------------------+
| EXPLAIN         
+------------------------------------------------------------------------------------+
| {
        "RawQuery": " select t1.a from t1 join t3 on t1.b+1=t3.b left join tst on tst.b=t1.b+3 where t1.a=1 and t3.a=2 and tst.a=3",
        "Project": "a",
        "Partitions": [
                {
                        "Query": "select t1.a, t1.b + 1 as tmpc_0, t1.b + 3 as tmpc_1 from zzq.t1_0035 as t1 where t1.a = 1 order by tmpc_0 asc",
                        "Backend": "backend2",
                        "Range": "[2261-2325)"
                },
                {
                        "Query": "select t3.b from zzq.t3_0060 as t3 where t3.a = 2 order by t3.b asc",
                        "Backend": "backend3",
                        "Range": "[3882-3946)"
                },
                {
                        "Query": "select tst.b from zzq.tst_0023 as tst where tst.a = 3 order by tst.b asc",
                        "Backend": "backend2",
                        "Range": "[1493-1557)"
                }
        ],
        "Join": {
                "Type": "LEFT JOIN",
                "Strategy": "Sort Merge Join"
        }
} |
+------------------------------------------------------------------------------------+
mysql> explain select t1.a from t1 left join t3 on t1.b=t3.b and t1.b<3 left join tst on tst.b=t1.b and t1.b >1 where t1.a=1 and t3.a=2 and tst.a=3;
+------------------------------------------------------------------------------------+
| EXPLAIN         
+------------------------------------------------------------------------------------+
| {
        "RawQuery": " select t1.a from t1 left join t3 on t1.b=t3.b and t1.b<3 left join tst on tst.b=t1.b and t1.b >1 where t1.a=1 and t3.a=2 and tst.a=3",
        "Project": "a",
        "Partitions": [
                {
                        "Query": "select t1.a, t1.b, t1.b, t1.b < 3 as tmpc_0, t1.b > 1 as tmpc_1 from zzq.t1_0035 as t1 where t1.a = 1 order by t1.b asc",
                        "Backend": "backend2",
                        "Range": "[2261-2325)"
                },
                {
                        "Query": "select t3.b from zzq.t3_0060 as t3 where t3.a = 2 order by t3.b asc",
                        "Backend": "backend3",
                        "Range": "[3882-3946)"
                },
                {
                        "Query": "select tst.b from zzq.tst_0023 as tst where tst.a = 3 order by tst.b asc",
                        "Backend": "backend2",
                        "Range": "[1493-1557)"
                }
        ],
        "Join": {
                "Type": "LEFT JOIN",
                "Strategy": "Sort Merge Join"
        }
} |
+------------------------------------------------------------------------------------+
1 row in set (0.33 sec)

zhyass added a commit to zhyass/radon that referenced this issue Nov 7, 2019
[summary]
Make full use of the info parameter in selectTuple. Remove the idx in JoinNode instead of aliasIndex in mergenode, because the index may repeat.
[test case]
src/planner/builder/builder_test.go
src/planner/builder/from_test.go
src/planner/select_plan_test.go
[patch codecov]
src/planner/builder 97.9%
zhyass added a commit to zhyass/radon that referenced this issue Nov 7, 2019
[summary]
Make full use of the info parameter in selectTuple. Remove the idx in JoinNode instead of aliasIndex in mergenode, because the index may repeat.
[test case]
src/planner/builder/builder_test.go
src/planner/builder/from_test.go
src/planner/select_plan_test.go
[patch codecov]
src/planner/builder 97.9%
zhyass added a commit to zhyass/radon that referenced this issue Nov 7, 2019
[summary]
Make full use of the info parameter in selectTuple. Remove the idx in JoinNode instead of aliasIndex in mergenode, because the index may repeat.
[test case]
src/planner/builder/builder_test.go
src/planner/builder/from_test.go
src/planner/select_plan_test.go
[patch codecov]
src/planner/builder 97.9%
zhyass added a commit to zhyass/radon that referenced this issue Nov 7, 2019
[summary]
Make full use of the info parameter in selectTuple. Remove the idx in JoinNode instead of aliasIndex in mergenode, because the index may repeat.
[test case]
src/planner/builder/builder_test.go
src/planner/builder/from_test.go
src/planner/select_plan_test.go
[patch codecov]
src/planner/builder 97.9%
zhyass added a commit to zhyass/radon that referenced this issue Nov 7, 2019
[summary]
Make full use of the info parameter in selectTuple. Remove the idx in JoinNode instead of aliasIndex in mergenode, because the index may repeat.
[test case]
src/planner/builder/builder_test.go
src/planner/builder/from_test.go
src/planner/select_plan_test.go
[patch codecov]
src/planner/builder 97.9%
BohuTANG pushed a commit that referenced this issue Nov 7, 2019
[summary]
Make full use of the info parameter in selectTuple. Remove the idx in JoinNode instead of aliasIndex in mergenode, because the index may repeat.
[test case]
src/planner/builder/builder_test.go
src/planner/builder/from_test.go
src/planner/select_plan_test.go
[patch codecov]
src/planner/builder 97.9%
@BohuTANG
Copy link
Contributor

BohuTANG commented Nov 7, 2019

ACK

@zhyass zhyass closed this as completed Nov 7, 2019
@andyli029 andyli029 added type: feature type: bug Something isn't working and removed type: bug Something isn't working type: feature labels Dec 6, 2019
zhyass added a commit to zhyass/radon that referenced this issue Dec 11, 2019
[summary]
Make full use of the info parameter in selectTuple. Remove the idx in JoinNode instead of aliasIndex in mergenode, because the index may repeat.
[test case]
src/planner/builder/builder_test.go
src/planner/builder/from_test.go
src/planner/select_plan_test.go
[patch codecov]
src/planner/builder 97.9%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants