Github user cloud-fan commented on the pull request:

    https://github.com/apache/spark/pull/2405#issuecomment-67432312
  
    Hi, @marmbrus ,the key point why I want to introduce `UnResolvedGetField` 
is that: for something like `a.b[0].c.d`, we first parse it to 
`GetField(GetField(GetItem(Unresolved("a.b"), 0), "c"), "d")`. Then in 
`LogicalPlan#resolve`, we resolve `"a.b"` and build a `GetField` chain from 
bottom(the relation). But for the 2 outer `GetFiled`, we have to resolve them 
in `Analyzer`, check data type of child, search needed field, etc. which is 
similar to what we have done in `LogicalPlan#resolve`.
    
    At first, everything is good as `GetField` is quite simple. But when 
`GetFiled` get more complex, such as add resolver logic, support array type, 
etc. there will be more and more duplicated code in `LogicalPlan#resolve` and 
`Analyzer` and `GetField`.
    
    For now, the searching field logic is duplicated in 
`LogicalPlan#resolveNesting` and `GetField#field`, but **not  consistent**. In 
`resolveNesting`, we check ambiguous reference using `fields.filter`; in 
`GetField#field`, we are not.
    
    So I think we need extract the logic of resolving `GetField` to prevent 
further trouble. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to