Github user sureshsubbiah commented on a diff in the pull request:
https://github.com/apache/trafodion/pull/1688#discussion_r221817558
--- 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
--- End diff --
From Oracle doc "In a hierarchical query, one expression in condition must
be qualified with the PRIOR operator to refer to the parent row". Is this check
done later?---
