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

    https://github.com/apache/trafodion/pull/1584#discussion_r191595555
  
    --- Diff: core/sql/optimizer/ValueDesc.cpp ---
    @@ -6382,7 +6382,32 @@ void ValueIdList::convertToTextKey(const 
ValueIdList& keyList, NAString& result)
         {
                short vLen = val.length();
     
    -      if ((constType->getTypeQualifier()  == NA_NUMERIC_TYPE) &&
    +      if (constType->getTypeQualifier() == NA_INTERVAL_TYPE)
    +        {
    +          // In some code paths, the text may have "INTERVAL 'xxx' 
<qualifier>"
    +          // junk around it so we have to strip that off. (Example: An 
equality
    +          // predicate when query caching has been turned off via 
    +          // CQD QUERY_CACHE '0'. Another example happens with BETWEEN, 
whether 
    +          // or not query caching is turned off. See JIRA TRAFODION-3088 
for
    +          // that example.)
    +          Lng32 start = val.index("'");
    +          Lng32 minus = val.index("-");
    +          if (start > 0)
    +            {
    +              Lng32 end = val.index("'", start+1);
    +              if (end > 0)
    +                {
    +                  val = val(start+1, (end-start-1));
    +                  if (minus > 0)
    --- End diff --
    
    Should this also check for minus < start? Could we encounter year-month 
intervals with a '-' inside the literal, such as interval '1-1' year to month?


---

Reply via email to