findColFromNaturalUsingJoin is used to recursively find the column from the underlying natural-using-join. e.g. For SQL like `select t2.a from t1 join t2 using(a) where t2.a > 0`, the plan will be `join->selection->projection`. The schema of the `selection` will be `[t1.a]`, thus we need to recursiv
(p base.LogicalPlan, col *expression.Column)
| 1252 | // will be `[t1.a]`, thus we need to recursively retrieve the `t2.a` from the |
| 1253 | // underlying join. |
| 1254 | func findColFromNaturalUsingJoin(p base.LogicalPlan, col *expression.Column) (name *types.FieldName) { |
| 1255 | switch x := p.(type) { |
| 1256 | case *logicalop.LogicalLimit, *logicalop.LogicalSelection, *logicalop.LogicalTopN, *logicalop.LogicalSort, *logicalop.LogicalMaxOneRow: |
| 1257 | return findColFromNaturalUsingJoin(p.Children()[0], col) |
| 1258 | case *logicalop.LogicalJoin: |
| 1259 | if x.FullSchema != nil { |
| 1260 | idx := x.FullSchema.ColumnIndex(col) |
| 1261 | return x.FullNames[idx] |
| 1262 | } |
| 1263 | } |
| 1264 | return nil |
| 1265 | } |
| 1266 | |
| 1267 | type resolveGroupingTraverseAction struct { |
| 1268 | CurrentBlockExpand *logicalop.LogicalExpand |
no test coverage detected