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 #1397: [TRAFODION-2904] optionally add leading space ...
Date Sun, 14 Jan 2018 20:41:18 GMT
Github user DaveBirdsall commented on a diff in the pull request:

    https://github.com/apache/trafodion/pull/1397#discussion_r161409312
  
    --- Diff: core/sql/optimizer/BindItemExpr.cpp ---
    @@ -3654,12 +3654,10 @@ ItemExpr *Concat::bindNode(BindWA *bindWA)
             else if (convType == 2)
               {
                 Parser parser(bindWA->currentCmpContext());
    -            char buf[1000];
    +            char buf[128];
                 
    -            // right justify the string representation of numeric operand 
    -            // and then do the concat
    -            sprintf(buf, "CAST(SPACE(%d - CHAR_LENGTH(CAST(@A1 AS VARCHAR(%d)))) || CAST(@A1
AS VARCHAR(%d)) AS VARCHAR(%d))",
    -                    dLen, dLen, dLen, dLen);
    +            sprintf(buf, "CAST(CAST(@A1 AS VARCHAR(%d)) AS VARCHAR(%d))",
    --- End diff --
    
    Just curious: Why do we need two casts? Would one be enough? (Looks like we use the same
length for both.)


---

Mime
View raw message