Github user traflm commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/577#discussion_r70736959
  
    --- Diff: core/sql/parser/sqlparser.y ---
    @@ -14684,6 +14759,11 @@ optional_limit_spec : TOK_LIMIT 
NUMERIC_LITERAL_EXACT_NO_SCALE
     
     dml_statement : dml_query { $$ = $1; }
     
    +               | with_clause_list dml_query
    --- End diff --
    
    I found a way to avoid the reduce/shift and reduce/reduce error by add 
with_clause down to the underlying rules of non_join_query_expression, instead 
of add it at same level of non_join_query_expression. non_join_query_expression 
can represent many different styles of query expression, including utilities, 
which we don't want a with_clause as prefix, so in the underlying rules, only 
add with_clause before those SELECT syntax, and it solve the problem.
    
    And it seems if use redundant rule explicitly (looks annoying) , we can 
avoid the error. 
    For example:
      A : b  | c
    is better to change to 
      A : b 
      A : c
    I am still trying to understand this.
    
    I checked with PostgreSQL parser, they are doing similar things, comments 
from postgresql parser:
    
     * This rule parses the equivalent of the standard's <query expression>.
     * The duplicative productions are annoying, but hard to get rid of without
     * creating shift/reduce conflicts.


---
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.
---

Reply via email to