trafodion-codereview mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From DaveBirdsall <...@git.apache.org>
Subject [GitHub] trafodion pull request #1642: [TRAFODION-3136] New featrue: improve on split...
Date Mon, 16 Jul 2018 22:17:27 GMT
Github user DaveBirdsall commented on a diff in the pull request:

    https://github.com/apache/trafodion/pull/1642#discussion_r202839688
  
    --- Diff: core/sql/optimizer/SynthType.cpp ---
    @@ -7139,3 +7139,79 @@ const NAType * ItmLeadOlapFunction::synthesizeType()
        return result;
     }
     
    +const NAType * SplitPart::synthesizeType()
    +{
    +  ValueId vid1 = child(0)->getValueId(); 
    +  ValueId vid2 = child(1)->getValueId();
    +  ValueId vid3 = child(2)->getValueId();
    +  vid1.coerceType(NA_CHARACTER_TYPE);
    +  vid2.coerceType(NA_CHARACTER_TYPE);
    +  SQLInt si(NULL);
    +  vid3.coerceType(NA_NUMERIC_TYPE);
    +
    +  const NAType *operand1 = &child(0)->getValueId().getType();
    +  const NAType *operand2 = &child(1)->getValueId().getType();
    +  const NAType *operand3 = &child(2)->getValueId().getType();
    +
    +  if ((operand1->getTypeQualifier() != NA_CHARACTER_TYPE) 
    +      && (operand1->getFSDatatype() != REC_CLOB))
    +  {
    +    //4051 The first operand of a split_part function must be character.
    +    *CmpCommon::diags()<<DgSqlCode(-4051) << DgString0(getTextUpper());
    +    return NULL;
    +  }
    +  if ((operand2->getTypeQualifier() != NA_CHARACTER_TYPE)
    +      && (operand1->getFSDatatype() != REC_CLOB))
    +  {
    +    //4051 The second operand of a split_part function must be character.
    +    *CmpCommon::diags()<<DgSqlCode(-4051) << DgString0(getTextUpper());
    --- End diff --
    
    You'll need to add a new error message here. Error 4051 reads, "The first operand of function
xxxx must be character." Alternatively, you could change error 4051 to parameterize "first".
That's not too hard; I only see five or six references to this message elsewhere. 


---

Mime
View raw message