Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions go/vt/vtgate/planbuilder/filtering.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ func planFilter(pb *primitiveBuilder, input logicalPlan, filter sqlparser.Expr,
}
node.UpdatePlan(pb, filter)
return node, nil
case *pulloutSubquery:
return planFilter(pb, node.underlying, filter, whereType, origin)
case *vindexFunc:
return filterVindexFunc(node, filter)
case *subquery:
Expand Down
43 changes: 43 additions & 0 deletions go/vt/vtgate/planbuilder/testdata/filter_cases.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1843,3 +1843,46 @@ Gen4 plan same as above
"SysTableTableSchema": "VARBINARY(\"ks\")"
}
}

# pullout sq after pullout sq
"select id from user where not id in (select user_extra.col from user_extra where user_extra.user_id = 42) and id in (select user_extra.col from user_extra where user_extra.user_id = 411)"
{
"QueryType": "SELECT",
"Original": "select id from user where not id in (select user_extra.col from user_extra where user_extra.user_id = 42) and id in (select user_extra.col from user_extra where user_extra.user_id = 411)",
"Instructions": {
"OperatorType": "Subquery",
"Variant": "PulloutIn",
"Inputs": [
{
"OperatorType": "Route",
"Variant": "SelectEqualUnique",
"Keyspace": {
"Name": "user",
"Sharded": true
},
"FieldQuery": "select user_extra.col from user_extra where 1 != 1",
"Query": "select user_extra.col from user_extra where user_extra.user_id = 42",
"Table": "user_extra",
"Values": [
42
],
"Vindex": "user_index"
},
{
"OperatorType": "Route",
"Variant": "SelectIN",
"Keyspace": {
"Name": "user",
"Sharded": true
},
"FieldQuery": "select id from `user` where 1 != 1",
"Query": "select id from `user` where :__sq_has_values1 = 1 and id in ::__vals and not (:__sq_has_values2 = 1 and id in ::__sq2)",
"Table": "`user`",
"Values": [
"::__sq1"
],
"Vindex": "user_index"
}
]
}
}