Github user zlei929 commented on a diff in the pull request:
https://github.com/apache/trafodion/pull/1658#discussion_r206795654
--- Diff: core/sql/generator/GenPreCode.cpp ---
@@ -7518,6 +7518,98 @@ ItemExpr * AggrMinMax::preCodeGen(Generator *
generator)
return this;
} // AggrMinMax::preCodeGen()
+ItemExpr *Overlaps::preCodeGen(Generator *generator)
+{
+ if (nodeIsPreCodeGenned())
+ return getReplacementExpr();
+
+ for (Int32 i = 0; i < getArity(); ++i)
+ {
+ if (child(i))
+ {
+ const NAType &type =
+ child(i)->getValueId().getType();
+ const DatetimeType *operand = (DatetimeType *)&type;
+
+ if (type.getTypeQualifier() == NA_DATETIME_TYPE
+ && (operand->getPrecision() == SQLDTCODE_DATE))
+ {
+ child(i) = new (generator->wHeap())
+ Cast(child(i), new (generator->wHeap())
+ SQLTimestamp(generator->wHeap(), TRUE));
+
+ child(i)->bindNode(generator->getBindWA());
+ }
+ }
+ }
+
--- End diff --
This time iâm strictly in accordance with the ANSI standard to implement
the OVERLAPS predicate. maybe that would be easier to understand than the logic
that preceded it.
---