trafodion-codereview mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sureshsubbiah <...@git.apache.org>
Subject [GitHub] trafodion pull request #1688: [TRAFODION-3034] Support Oracle Hierarchy Quer...
Date Tue, 02 Oct 2018 04:55:24 GMT
Github user sureshsubbiah commented on a diff in the pull request:

    https://github.com/apache/trafodion/pull/1688#discussion_r221817891
  
    --- Diff: core/sql/parser/sqlparser.y ---
    @@ -13280,13 +13288,130 @@ table_expression : from_clause where_clause sample_clause
     		                                 SqlParser_CurrentParser->topHasOlapFunctions());
                          SqlParser_CurrentParser->setTopHasTDFunctions(FALSE);
     		   }
    +            | from_clause startwith_clause where_clause 
    +                   {
    +                     if($1->getOperatorType() == REL_JOIN)
    +                      {
    +		     $$ = 
    +		       getTableExpressionRelExpr($1, 
    +		                                 $3, 
    +		                                 NULL, 
    +		                                 NULL, 
    +		                                 NULL, 
    +		                                 NULL, 
    +		                                 NULL,
    +		                                 NULL,
    +		                                 FALSE,
    +		                                 SqlParser_CurrentParser->topHasOlapFunctions());
    +                       }
    +                     else
    +                     $$ =
    +                       getTableExpressionRelExpr($1,
    +                                                 NULL,
    +                                                 NULL,
    +                                                 NULL,
    +                                                 NULL,
    +                                                 NULL,
    +                                                 NULL,
    +                                                 NULL,
    +                                                 FALSE,
    +                                                 SqlParser_CurrentParser->topHasOlapFunctions());
     
    +                   SqlParser_CurrentParser->setTopHasTDFunctions(FALSE);
    +                   ((BiConnectBy*)$2)->where_clause = $3;
    +                   $$->setBiConnectBy( $2);
    +                   $$->setHasConnectByFlag(TRUE);
    +                  }
    +            | from_clause TOK_WHERE search_condition startwith_clause
    +           {
    +                     if($1->getOperatorType() == REL_JOIN)
    +		     $$ = 
    +		       getTableExpressionRelExpr($1, 
    +		                                 $3, 
    +		                                 NULL, 
    +		                                 NULL, 
    +		                                 NULL, 
    +		                                 NULL, 
    +		                                 NULL,
    +		                                 NULL,
    +		                                 FALSE,
    +		                                 SqlParser_CurrentParser->topHasOlapFunctions());
    +                     else
    +                     $$ =
    +                       getTableExpressionRelExpr($1,
    +                                                 NULL,
    +                                                 NULL,
    +                                                 NULL,
    +                                                 NULL,
    +                                                 NULL,
    +                                                 NULL,
    +                                                 NULL,
    +                                                 FALSE,
    +                                                 SqlParser_CurrentParser->topHasOlapFunctions());
    +                   SqlParser_CurrentParser->setTopHasTDFunctions(FALSE);
    +                   ((BiConnectBy*)$4)->where_clause = $3;
    +                   //((BiConnectBy*)$3)->order_siblings_by_clause = $4;
    +                   $$->setBiConnectBy( $4);
    +                   $$->setHasConnectByFlag(TRUE);
    +           }
     /* type relx */
     from_clause : TOK_FROM global_hint table_reference { $$ = $3; }
     	    | from_clause ',' table_reference
     			      {
     				$$ = new (PARSERHEAP()) Join($1, $3, REL_JOIN);
    -			      }
    +		      }
    +startwith_clause :TOK_START_WITH search_condition CONNECT_IDENTIFIER TOK_BY search_condition
    +                    {
    +                      $$ = new (PARSERHEAP())BiConnectBy ((BiRelat*)$2, (BiRelat*)$5);
    +                      //save the predicate text
    +                      $2->unparse(((BiConnectBy*)$$)->startWithString_, PARSER_PHASE,
USER_FORMAT);
    +                    }
    +                   |TOK_START_WITH search_condition CONNECT_IDENTIFIER TOK_BY TOK_NOCYCLE
search_condition 
    --- End diff --
    
    Could this rule be merged with the previous by adding an optional_nocycle rule? This rule
will have 2 possibilities, one of them being "empty".  Maybe doing it this way will increase
conflicts?


---

Mime
View raw message