You are viewing a plain text version of this content. The canonical link for it is here.
Posted to codereview@trafodion.apache.org by anoopsharma00 <gi...@git.apache.org> on 2017/04/19 23:36:57 UTC

[GitHub] incubator-trafodion pull request #1069: JIRA 2485,2540,2582,2591, plus other...

GitHub user anoopsharma00 opened a pull request:

    https://github.com/apache/incubator-trafodion/pull/1069

    JIRA 2485,2540,2582,2591, plus other bug fixes

    [TRAFODION-2485]   Add support for REVERSE function
         (OperTypeEnum.h, exp/*, sqlparser.y,
          BindItemExpr.cpp, ItemExpr.cpp, SynthType.cpp,
          GenItemFunc.cpp)
    
    [TRAFODION-2540]   Alter Drop column on table with identity
                     "generated always" fails
                     (file CmpSeabaseDDLtable.cpp)
    
    [TRAFODION-2582]   "timestamp - timestamp" returns "days" instead of "seconds"
                     (file: BindItemExpr.cpp)
    
    [TRAFODION-2591]   Create index on added column returns incorrect results.
                     (file generator/GenRelScan.cpp)
    
    Bug: Invalid "set transaction" stmt syntax no longer causes assertion failure
                  or abend. An error is issued instead.
                     (file BindRelExpr.cpp)
    
    Bug: Hive inserts with mismatched tgt/src datatypes would sometimes do not
         insert or insert incorrect values.
                     (file GenFastTransport.cpp)
    
    Bug: an error indication is now returned if buildEncodeTree method is
        called to encode a "NULL" value for a non-null column.
                      (file EncodedKeyValue.cpp)
    
    hive/TEST007 now does initialize auth and register user

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/anoopsharma00/incubator-trafodion ansharma_trafr22_br

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-trafodion/pull/1069.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1069
    
----
commit a7148eb1e79e181c0a8ab4d9bfd60bf457d1dd6c
Author: Anoop Sharma <an...@esgyn.com>
Date:   2017-04-19T23:35:39Z

    JIRA 2485,2540,2582,2591, plus other bug fixes
    
    [TRAFODION-2485]   Add support for REVERSE function
         (OperTypeEnum.h, exp/*, sqlparser.y,
          BindItemExpr.cpp, ItemExpr.cpp, SynthType.cpp,
          GenItemFunc.cpp)
    
    [TRAFODION-2540]   Alter Drop column on table with identity
                     "generated always" fails
                     (file CmpSeabaseDDLtable.cpp)
    
    [TRAFODION-2582]   "timestamp - timestamp" returns "days" instead of "seconds"
                     (file: BindItemExpr.cpp)
    
    [TRAFODION-2591]   Create index on added column returns incorrect results.
                     (file generator/GenRelScan.cpp)
    
    Bug: Invalid "set transaction" stmt syntax no longer causes assertion failure
                  or abend. An error is issued instead.
                     (file BindRelExpr.cpp)
    
    Bug: Hive inserts with mismatched tgt/src datatypes would sometimes do not
         insert or insert incorrect values.
                     (file GenFastTransport.cpp)
    
    Bug: an error indication is now returned if buildEncodeTree method is
        called to encode a "NULL" value for a non-null column.
                      (file EncodedKeyValue.cpp)
    
    hive/TEST007 now does initialize auth and register user

----


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-trafodion pull request #1069: JIRA 2485,2540,2582,2591, plus other...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/incubator-trafodion/pull/1069


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-trafodion pull request #1069: JIRA 2485,2540,2582,2591, plus other...

Posted by DaveBirdsall <gi...@git.apache.org>.
Github user DaveBirdsall commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/1069#discussion_r112583946
  
    --- Diff: core/sql/exp/exp_function.cpp ---
    @@ -2484,6 +2491,79 @@ ex_expr::exp_return_type ExFunctionTokenStr::eval(char *op_data[],
     
       return ex_expr::EXPR_OK;
     };
    +
    +ex_expr::exp_return_type ExFunctionReverseStr::eval(char *op_data[],
    +                                                    CollHeap* heap,
    +                                                    ComDiagsArea** diagsArea)
    +{
    +  CharInfo::CharSet cs = ((SimpleType *)getOperand(1))->getCharSet();
    +  Lng32 len1 = getOperand(1)->getLength(op_data[-MAX_OPERANDS+1]);
    +
    +  char * tgt = op_data[0];
    +  char * src = op_data[1];
    +  Lng32 srcPos = 0;
    +  Lng32 tgtPos = 0;
    +  if (cs == CharInfo::ISO88591)
    +    {
    +      tgtPos = len1 - 1;
    +      for (srcPos = 0; srcPos < len1; srcPos++)
    +        {
    +          tgt[tgtPos--] = src[srcPos];
    +        }
    +    }
    +  else if (cs == CharInfo::UCS2)
    +    {
    +      Lng32 bpc = unicode_char_set::bytesPerChar();
    +      srcPos = 0;
    +      tgtPos = len1 - bpc;
    +      while (srcPos < len1)
    +        {
    +          str_cpy_all(&tgt[tgtPos], &src[srcPos], bpc);
    +          tgtPos -= bpc;
    +          srcPos += bpc;
    +        }
    +    }
    +  else if (cs == CharInfo::UTF8)
    +    {
    +      UInt32 UCS4value;
    +      
    +      cnv_charset charset = convertCharsetEnum(cs);
    +      Lng32 charLen;
    +      srcPos = 0;
    +      tgtPos = len1;
    +      while(srcPos < len1)
    +        {
    +          charLen = LocaleCharToUCS4(&op_data[1][srcPos],
    +                                     len1 - srcPos,
    +                                     &UCS4value,
    +                                     charset);
    +          if (charLen < 0)
    +            {
    +              const char *csname = CharInfo::getCharSetName(cs);
    +              ExRaiseSqlError(heap, diagsArea, EXE_INVALID_CHARACTER);
    +              *(*diagsArea) << DgString0(csname) << DgString1("REVERSE FUNCTION"); 
    +              return ex_expr::EXPR_ERROR;
    +            }
    +
    +          tgtPos -= charLen;
    +          str_cpy_all(&tgt[tgtPos], &src[srcPos], charLen);
    +          srcPos += charLen;
    +        }
    +    }
    +  else
    +    {
    +      const char *csname = CharInfo::getCharSetName(cs);
    +      ExRaiseSqlError(heap, diagsArea, EXE_INVALID_CHARACTER);
    --- End diff --
    
    Is this the error you want? Looks like it is error 8433 with text, "Invalid $0~string0 character encountered in $1~string1." But the error here is an invalid character set.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---