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

    https://github.com/apache/incubator-trafodion/pull/257#discussion_r49533889
  
    --- Diff: core/sql/exp/exp_conv.cpp ---
    @@ -9321,6 +9321,32 @@ convDoIt(char * source,
       };
       break;
     
    +// gb2312 -> utf8
    +  case CONV_GBK_F_UTF8_V:
    +  {
    +    char * targetbuf = new char[sourceLen*4+1];
    +    size_t sl = sourceLen;
    +    int convLen = gbkToUtf8( source, sl, targetbuf, sl*4);
    +    int copyLen = 0;
    +    if (convLen > 0) {
    +      copyLen = (convLen< targetLen) ? convLen: targetLen;
    --- End diff --
    
    The new commit check the copyLen and targetLen. If targetLen is not enough, 
instead of doing truncate, it will raise a SQL Error. 
    This task is primarily designed to support bulk data loading of GBK data 
source. If the Trafodion do implicit truncation, it may not be a good idea. For 
example, a 8 char string will become 7 chars after loading, and may cause very 
hard to detect issue later.
    And it is also complex to implement UTF8 truncate method, thanks Hans point 
out the two APIs , I will study them carefully.
    However, given the 'raise error' handling, I think we don't need to care 
about Truncate in the Middle issue. Just report error and stop data loading.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to