[
https://issues.apache.org/jira/browse/TRAFODION-2117?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15408170#comment-15408170
]
ASF GitHub Bot commented on TRAFODION-2117:
-------------------------------------------
Github user DaveBirdsall commented on a diff in the pull request:
https://github.com/apache/incubator-trafodion/pull/639#discussion_r73565055
--- Diff: core/sql/optimizer/BindRelExpr.cpp ---
@@ -3035,6 +3035,98 @@ RelExpr *Intersect::bindNode(BindWA *bindWA)
// LCOV_EXCL_STOP
// -----------------------------------------------------------------------
+// member functions for class Except
+// -----------------------------------------------------------------------
+
+// LCOV_EXCL_START - cnu
+RelExpr *Except::bindNode(BindWA *bindWA)
+{
+ if (nodeIsBound())
+ {
+ bindWA->getCurrentScope()->setRETDesc(getRETDesc());
+ return this;
+ }
+
+ // Bind the child nodes.
+ //
+ bindChildren(bindWA);
+ if (bindWA->errStatus()) return this;
+
+ // Check that there are an equal number of select items on both sides.
+ //
+ const RETDesc &leftTable = *child(0)->getRETDesc();
+ const RETDesc &rightTable = *child(1)->getRETDesc();
+ if (leftTable.getDegree() != rightTable.getDegree()) {
+ // 4014 The operands of an intersect must be of equal degree.
+ *CmpCommon::diags() << DgSqlCode(-4014);
+ bindWA->setErrStatus();
+ return this;
+ }
+
+ // Join the columns of both sides.
+ //
+ if(CmpCommon::getDefault(MODE_SPECIAL_4) != DF_ON)
+ {
+ *CmpCommon::diags() << DgSqlCode(-3022) // ## INTERSECT not yet
supported
+ << DgString0("EXCEPT"); // ##
+ bindWA->setErrStatus(); // ##
+ if (bindWA->errStatus()) return NULL; // ##
+ }
+ //
+ ItemExpr *predicate = intersectColumns(leftTable, rightTable, bindWA);
+ RelExpr *join = new (bindWA->wHeap())
+ Join(child(0)->castToRelExpr(),
+ child(1)->castToRelExpr(),
+ REL_ANTI_SEMIJOIN,
+ predicate);
+
+ // Bind the join.
+ //
+ join = join->bindNode(bindWA)->castToRelExpr();
+ if (bindWA->errStatus()) return join;
+
+ // Change the output of the join to just the left side.
+ //
+ delete join->getRETDesc();
+ join->setRETDesc(new (bindWA->wHeap()) RETDesc(bindWA, leftTable));
+ bindWA->getCurrentScope()->setRETDesc(join->getRETDesc());
+
+ // QSTUFF
+ NAString fmtdList1(bindWA->wHeap());
+ LIST(TableNameMap*) xtnmList1(bindWA->wHeap());
+ NAString fmtdList2(bindWA->wHeap());
+ LIST(TableNameMap*) xtnmList2(bindWA->wHeap());
+
+ leftTable.getTableList(xtnmList1, &fmtdList1);
+ rightTable.getTableList(xtnmList2, &fmtdList2);
+
+ if (child(0)->getGroupAttr()->isStream() &&
+ child(1)->getGroupAttr()->isStream()){
+ *CmpCommon::diags() << DgSqlCode(-4159)
+ << DgString0(fmtdList1) << DgString1(fmtdList2);
+ bindWA->setErrStatus();
+ return this;
+ }
+
+ // Needs to be removed when supporting get_next for INTERSECT
--- End diff --
Ditto
> add support of SQL extension 'EXCEPT'
> --------------------------------------
>
> Key: TRAFODION-2117
> URL: https://issues.apache.org/jira/browse/TRAFODION-2117
> Project: Apache Trafodion
> Issue Type: New Feature
> Reporter: liu ming
> Assignee: liu ming
>
> add syntax and basic functional support for 'EXCEPT', meet the requirement to
> run TPCDS as initial goal.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)