[ 
https://issues.apache.org/jira/browse/TRAFODION-2119?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15410379#comment-15410379
 ] 

ASF GitHub Bot commented on TRAFODION-2119:
-------------------------------------------

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

    https://github.com/apache/incubator-trafodion/pull/642#discussion_r73778733
  
    --- Diff: core/sql/common/CharType.cpp ---
    @@ -1217,7 +1217,7 @@ void CharType::minMaxRepresentableValue(void* bufPtr,
       if (stringLiteral)
         {
           NABoolean isNull = FALSE;
    -      NABoolean res = createSQLLiteral((const char *) bufPtr, 
*stringLiteral, isNull, h);
    +      NABoolean res = createSQLLiteral((const char *) bufPtr  - 
getSQLnullHdrSize(), *stringLiteral, isNull, h);
    --- End diff --
    
    The calling to type->minRepresentableValue should pass the buf address that 
take null indicator buffer into account, good examples are in:
    -EncodedValue::minMaxValue()
    -ConstValue::ConstValue()
    
    As you can see in above two functions, the buffer ptr is set to the postion:
    buffer_start + null_header_len
    
    a buffer should like
    [nullHeader][VCHARLEN]Data  
    
    inside minRepresentableValue , it will treat the VCHARLEN, so it seems the 
agreement is the nullHeader is already bypassed.
    
    So the starting position of bufPtr is
    [nullHeader][VCHARLEN]Data  
                       ^
    
    However, in the createSQLLiteral() , it will again bypass the nullHeader:
      const char *valPtr = buf + getSQLnullHdrSize();
    
    So I did this change. As you correctly pointed out, this is dangerous... 
    A better way is to change createSQLLiteral, but there are some other places 
call   createSQLLiteral() which has different assumption of the starting 
position of the buffer ptr, ConstValue::getConstStr() for example, so I choose 
the simplest way, I am more nervous to change many other code which I don't 
understand where will be invoked. But yes, it is not good. 
    A better change is to fix in createSQLLiteral semantics, the input buffer 
ptr will be the position after nullHeader, but that will involve more changes 
which I feel not confident, but I will try.


> create table report strange WARNING when using store by and 
> allow_nullable_unique_key_constraint CQD
> ----------------------------------------------------------------------------------------------------
>
>                 Key: TRAFODION-2119
>                 URL: https://issues.apache.org/jira/browse/TRAFODION-2119
>             Project: Apache Trafodion
>          Issue Type: Bug
>            Reporter: liu ming
>            Assignee: liu ming
>
> cqd allow_nullable_unique_key_constraint 'on' ; 
> create table T_RH_DZSP
> (
>   s_orgcode       CHAR(12) character set utf8,
>   s_applydate     CHAR(8) character set utf8,
>   s_packno        varchar(8) character set utf8,
>   s_trecode       CHAR(10) character set utf8,
>   s_trename       varchar(60) character set utf8,
>   s_taxorgcode    varchar(12) character set utf8,
>   s_paybnkno      varchar(12) character set utf8,
>   s_trano         varchar(8) character set utf8,
>   s_orimsgno      CHAR(4) character set utf8,
>   f_traamt        numeric(18,2),
>   s_payeropnbnkno varchar(12) character set utf8,
>   payeropbkname   varchar(60) character set utf8,
>   s_handorgname   varchar(200) character set utf8,
>   s_payacct       varchar(32) character set utf8,
>   s_taxvouno      varchar(20) character set utf8,
>   s_billdate      CHAR(8) character set utf8,
>   s_taxpaycode    varchar(20) character set utf8,
>   s_taxpayname    varchar(200) character set utf8,
>   c_budgettype    CHAR(1) character set utf8,
>   c_trimflag      CHAR(1) character set utf8,
>   s_etpcode       varchar(20) character set utf8,
>   s_etpname       varchar(200) character set utf8,
>   s_etptype       varchar(20) character set utf8,
>   s_bdgsbtcode    varchar(30) character set utf8,
>   s_bdgsbtname    varchar(60) character set utf8,
>   s_limit         CHAR(8) character set utf8,
>   s_taxtypecode   CHAR(10) character set utf8,
>   s_taxkindname   varchar(60) character set utf8,
>   c_bdglevel      CHAR(1) character set utf8,
>   c_bdglevelname  varchar(60) character set utf8,
>   s_taxstartdate  CHAR(8) character set utf8,
>   s_taxenddate    CHAR(8) character set utf8,
>   s_astflag       varchar(35) character set utf8,
>   c_taxtype       CHAR(1) character set utf8,
>   s_acct          CHAR(8) character set utf8,
>   s_trastate      CHAR(2) character set utf8,
>   s_remark        varchar(60) character set utf8,
>   s_remark1       varchar(60) character set utf8,
>   s_remark2       varchar(60) character set utf8,
>   s_inputerid     varchar(18) character set utf8,
>   ts_sysupdate    varchar(100) character set utf8,
>   s_seq           varchar(100) character set utf8
> )
> store by (S_APPLYDATE)
> salt using 48 partitions on (S_APPLYDATE)
> ATTRIBUTES ALIGNED FORMAT
> HBASE_OPTIONS
> (
>   DATA_BLOCK_ENCODING = 'FAST_DIFF',
>  -- COMPRESSION = 'SNAPPY',
>   MEMSTORE_FLUSH_SIZE = '1073741824'
> );
> *** WARNING[8402] A string overflow occurred during the evaluation of a 
> character expression.
> *** WARNING[8402] A string overflow occurred during the evaluation of a 
> character expression.
> *** WARNING[8402] A string overflow occurred during the evaluation of a 
> character expression.
> *** WARNING[8402] A string overflow occurred during the evaluation of a 
> character expression.
> *** WARNING[8402] A string overflow occurred during the evaluation of a 
> character expression.
> *** WARNING[8402] A string overflow occurred during the evaluation of a 
> character expression.
> *** WARNING[8402] A string overflow occurred during the evaluation of a 
> character expression.
> *** WARNING[8402] A string overflow occurred during the evaluation of a 
> character expression.
> *** WARNING[8402] A string overflow occurred during the evaluation of a 
> character expression.
> *** WARNING[8402] A string overflow occurred during the evaluation of a 
> character expression.
> *** WARNING[8402] A string overflow occurred during the evaluation of a 
> character expression.
> *** WARNING[8402] A string overflow occurred during the evaluation of a 
> character expression.
> *** WARNING[8402] A string overflow occurred during the evaluation of a 
> character expression.
> *** WARNING[8402] A string overflow occurred during the evaluation of a 
> character expression.
> *** WARNING[8402] A string overflow occurred during the evaluation of a 
> character expression.
> *** WARNING[8402] A string overflow occurred during the evaluation of a 
> character expression.
> *** WARNING[8402] A string overflow occurred during the evaluation of a 
> character expression.
> *** WARNING[8402] A string overflow occurred during the evaluation of a 
> character expression.
> *** WARNING[8402] A string overflow occurred during the evaluation of a 
> character expression.
> *** WARNING[8402] A string overflow occurred during the evaluation of a 
> character expression.
> *** WARNING[8402] A string overflow occurred during the evaluation of a 
> character expression.
> *** WARNING[8402] A string overflow occurred during the evaluation of a 
> character expression.
> *** WARNING[8402] A string overflow occurred during the evaluation of a 
> character expression.
> *** WARNING[8402] A string overflow occurred during the evaluation of a 
> character expression.
> *** WARNING[8402] A string overflow occurred during the evaluation of a 
> character expression.
> *** WARNING[8402] A string overflow occurred during the evaluation of a 
> character expression.
> *** WARNING[8402] A string overflow occurred during the evaluation of a 
> character expression.
> *** WARNING[8402] A string overflow occurred during the evaluation of a 
> character expression.
> *** WARNING[8402] A string overflow occurred during the evaluation of a 
> character expression.
> *** WARNING[8402] A string overflow occurred during the evaluation of a 
> character expression.
> --- SQL operation complete.
> >>



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to