trafodion-codereview mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kakaxi3019 <...@git.apache.org>
Subject [GitHub] trafodion pull request #1622: [TRAFODION-3118] Improve on parts of EXTRACT
Date Thu, 05 Jul 2018 06:21:32 GMT
Github user kakaxi3019 commented on a diff in the pull request:

    https://github.com/apache/trafodion/pull/1622#discussion_r200242748
  
    --- Diff: core/sql/optimizer/SynthType.cpp ---
    @@ -4470,15 +4489,31 @@ const NAType *Extract::synthesizeType()
       else if (getExtractField() == REC_DATE_YEARWEEK_EXTRACT ||
                getExtractField() == REC_DATE_YEARWEEK_D_EXTRACT)
         prec = 6;					// YEARMWEEK is yyyyww
    +  else if (getExtractField() == REC_DATE_DECADE ||
    +           getExtractField() == REC_DATE_DOY)
    +    prec = 3;
    +  else if (getExtractField() == REC_DATE_QUARTER ||
    +           getExtractField() == REC_DATE_DOW)
    +    prec = 1;
    +  else if (getExtractField() == REC_DATE_EPOCH)
    +    prec = 10;
       else
         prec = 2;					// else max of 12, 31, 24, 59
       if (getExtractField() == REC_DATE_SECOND) {
         prec  += dti.getFractionPrecision();
         scale += dti.getFractionPrecision();
       }
    +  if (getExtractField() == REC_DATE_EPOCH)
    +    {
    +      prec  += dti.getFractionPrecision();
    +      scale += dti.getFractionPrecision();
    +    }
    +  NABoolean bNegValue = FALSE;
    +  if ( getExtractField() >= REC_DATE_CENTURY && extractStartField <= REC_DATE_WOM
)
    +    bNegValue = TRUE;
    --- End diff --
    
    Thanks Dave, there are some problems here.
    options DECADE,QUARTER,EPOCH can be negative values


---

Mime
View raw message