AngersZhuuuu commented on PR #5627:
URL: https://github.com/apache/kyuubi/pull/5627#issuecomment-1825225602

   > why do they not fail after this change
   
   This PR is just a supplement to some special plan cases. Make sure we get 
all the projection list.
   
   For below plan
   ```
   GlobalLimit 1
   +- LocalLimit 1
      +- Project [cast(id#22 as string) AS id#30, cast(scope#23 as string) AS 
scope#31]
         +- MapInPandas mapInPandasUDF(id#17, scope#18)#21, [id#22, scope#23]
            +- HiveTableRelation [`spark_catalog`.`default`.`table1`, 
org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe, Data Cols: [id#17, 
scope#18], Partition Cols: []]
   ```
   if we only extract the `Projection`'s projectionList, it's clear that we 
miss some column since `Project`'s projectionList's exprId is not the same as 
the `HiveRelation`, we better collect all node's input to make avoid miss 
connection.
   
   About below change
   <img width="1047" alt="截屏2023-11-24 下午2 56 25" 
src="https://github.com/apache/kyuubi/assets/46485123/bd1b9b06-05b5-4ac5-b283-839d84a9acec";>
   
   We can see plan
   ```
   
   Aggregate [count(id#1483) AS count(id)#1486L]
   +- Filter (id#1483 > 1)
      +- PermanentViewMarker `spark_catalog`.`default`.`view1`, 
org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe, [id, scope], false
         +- Project [id#1483]
            +- HiveTableRelation [`spark_catalog`.`default`.`table1`, 
org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe, Data Cols: [id#1483, 
scope#1484], Partition Cols: []]
   ```
   `Aggregate` and `Filter`'s attribute all add to conditionList, but we judge 
` if (projectionList.isEmpty) ` in `mergeProjection`. 
   So without this change will cause extracting wrong column.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to