Files
doris/regression-test/data/query_p0/subquery
morrySnow b91a3b5a72 [fix](planner) should not bind slot on brother's tuple in subquery (#17813)
consider the query like this:
```sql
SELECT
    k3, k4
FROM
    test
WHERE
    EXISTS( SELECT
            d.*
        FROM
            (SELECT
                k1 AS _1234, SUM(k2)
            FROM
                `test` d
            GROUP BY _1234) d
                LEFT JOIN
            (SELECT
                k1 AS _1234,
                    SUM(k2)
            FROM
                `test`
            GROUP BY _1234) temp ON d._1234 = temp._1234) 
ORDER BY k3, k4
```

when we analyze group by exprs in `temp` inline view. we bind the `_1234` on `d._1234` by mistake.
that because, when we do analyze in a **SUB-QUERY**, we will resolve SlotRef by itself **AND** parent's tuple. in the meanwhile, we register child's tuple to parent's analyzer. So, in a **SUB-QUERY**, the brother's tuple will affect the resolve result of current inlineview's slot.

This PR:

1. add a flag on the function `resolveColumnRef` in `Analyzer`
```java
private TupleDescriptor resolveColumnRef(String colName, boolean requestFromChild);
private TupleDescriptor resolveColumnRef(TableName tblName, String colName, boolean requestByChild);
``` 

2. add a flag to specify whether the tuple is from child.
```java
// alias name -> <from child, tupleDesc>
private final Multimap<String, Pair<Boolean, TupleDescriptor>> tupleByAlias;
```

when `requestByChild == true`, we **SKIP** the tuple from other child to avoid resolve error.
2023-03-22 11:00:55 +08:00
..
2023-02-10 11:00:01 +08:00