[ https://issues.apache.org/jira/browse/TRAFODION-1673?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15379733#comment-15379733 ]
ASF GitHub Bot commented on TRAFODION-1673: ------------------------------------------- Github user DaveBirdsall commented on a diff in the pull request: https://github.com/apache/incubator-trafodion/pull/577#discussion_r71010430 --- Diff: core/sql/parser/sqlparser.y --- @@ -13333,14 +13396,41 @@ query_specification : select_token set_quantifier query_spec_body ColReference(new (PARSERHEAP()) ColRefName(TRUE, PARSERHEAP())) ) ); - assert($3->getOperatorType() == REL_ROOT); + assert($3->getOperatorType() == REL_ROOT); + RelRoot *root1 = (RelRoot *) $$; + RelRoot *root2 = (RelRoot *) $3; + root1->assignmentStTree() = root2->assignmentStTree(); + root2->assignmentStTree() = NULL; + } + else + $$ = $3; + + if (CmpCommon::getDefault(MVQR_LOG_QUERY_DESCRIPTORS) == DF_DUMP || + CmpCommon::getDefault(MVQR_LOG_QUERY_DESCRIPTORS) == DF_DUMP_MV) + ((RelRoot*)$$)->setAnalyzeOnly(); + + } + +/* type relx */ +query_specification :with_clause select_token set_quantifier query_spec_body + { + if ($3) { + $$ = new (PARSERHEAP()) + RelRoot(new (PARSERHEAP()) + GroupByAgg($4 --- End diff -- I don't understand why we stick a GroupByAgg node here. > Implement the WITH clause in Trafodion SQL for simple use cases > --------------------------------------------------------------- > > Key: TRAFODION-1673 > URL: https://issues.apache.org/jira/browse/TRAFODION-1673 > Project: Apache Trafodion > Issue Type: New Feature > Components: sql-cmp > Reporter: Hans Zeller > Assignee: liu ming > > We keep running into queries that use a WITH clause to define a temporary > view that can be used once or multiple times in a FROM clause in the query. > For non-recursive queries, the WITH clause could probably be handled very > similar to a view. When it is defined, we create an in-memory view > descriptor, containing the name and the definition. When it is used in a FROM > clause, we could go through a code path similar to that of a view - bind the > (temporary) view text and substitute it in the query. The fix could probably > be handled entirely in the binder. > This JIRA is *not* about recursive queries, those would require a lot more > effort, involving many components in addition to the binder. -- This message was sent by Atlassian JIRA (v6.3.4#6332)