Github user hvanhovell commented on the pull request:

    https://github.com/apache/spark/pull/12134#issuecomment-204958652
  
    @gatorsmile good catch!
    
    Let me try to explain why this happens.  All `visit*` functions in the 
ANTLR4 generated visitor use the  `AbstractParseTreeVisitor.visitChildren(...)` 
function for the default implementation. See: 
https://github.com/antlr/antlr4/blob/master/runtime/Java/src/org/antlr/v4/runtime/tree/AbstractParseTreeVisitor.java#L61-L75
    
    This has both advantages and disadvantages. The disadvantage is that this 
will select the result of the last defined context child. In the create table 
example you give, the last child is `TBLPROPERTIES('prop1Key '= "prop1Val", ' 
`prop2Key` '= "prop2Val")`, this makes the visitor return a `Map[String, 
String]` instead of a `LogicalPlan`. The advantage is that this provides a very 
nice default implementation for rules with exclusive ORs (the `statement` rule 
for instance).
    
    The current approach of excluding every illegal option is error prone and 
is quite code intense. I think it is easier to improve the visitors default 
behavior by limiting the 'visitChildren' to one and only one child.



---
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 [email protected] or file a JIRA ticket
with INFRA.
---

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

Reply via email to