Github user zellerh commented on a diff in the pull request:

    https://github.com/apache/trafodion/pull/1658#discussion_r206737740
  
    --- Diff: core/sql/generator/GenPreCode.cpp ---
    @@ -7518,6 +7518,53 @@ 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());
    +      }
    +
    +    }
    +  }
    +
    +  ItemExpr *newExpr = 
    +    generator->getExpGenerator()->createExprTree(
    --- End diff --
    
    Hi, @zlei929, it is interesting that the standard says this in General Rule 
1:
    
    > If the value of <row value predicand 1> is the null value or the value of 
<row value predicand 2> is the null value, then the result of the <overlaps 
predicate> is Unknown and no further General Rules of this Subclause are 
applied.
    
    That sounds like any null value would immediately return a null result, but 
the other general rules very carefully describe what happens with null values. 
Therefore, I think this first rule only applies if the value passed in is 
```(null, null)```. Maybe others can comment as well on whether that makes 
sense.


---

Reply via email to