trafodion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lium...@apache.org
Subject [3/5] incubator-trafodion git commit: Merge branch 'master' of git://git.apache.org/incubator-trafodion into TRAFODION-2229
Date Tue, 08 Nov 2016 09:25:10 GMT
Merge branch 'master' of git://git.apache.org/incubator-trafodion into TRAFODION-2229

Conflicts:
	core/sql/exp/exp_clause.h


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/ece38ae9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/ece38ae9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/ece38ae9

Branch: refs/heads/master
Commit: ece38ae9b9b17384457adbd9af5d235fe6f24f59
Parents: 79d36dc 9c712a4
Author: Liu Ming <ovis_poly@sina.com>
Authored: Thu Nov 3 06:25:26 2016 -0400
Committer: Liu Ming <ovis_poly@sina.com>
Committed: Thu Nov 3 06:25:26 2016 -0400

----------------------------------------------------------------------
 .gitignore                                      |    1 +
 .rat-excludes                                   |    1 +
 core/Makefile                                   |   54 +-
 core/conn/odb/build.bat                         |    7 +-
 core/conn/odb/odb/odb.rc                        |  Bin 0 -> 5124 bytes
 core/conn/odb/odb/odb.vcxproj                   |    4 +
 core/conn/odb/odb/odb.vcxproj.filters           |    8 +
 core/conn/odbc/src/odbc/Makefile                |    2 -
 core/conn/odbc/src/odbc/nsksrvr/SrvrConnect.cpp |   26 +
 .../odbc/src/odbc/nsksrvrcore/srvrothers.cpp    |    1 +
 core/rest/src/main/asciidoc/_chapters/apis.adoc |  182 +-
 .../main/asciidoc/_chapters/architecture.adoc   |    6 +-
 .../main/asciidoc/_chapters/configuration.adoc  |   26 +-
 .../asciidoc/_chapters/troubleshooting.adoc     |    6 +-
 core/rest/src/main/asciidoc/index.adoc          |    4 +-
 .../main/java/org/trafodion/rest/Constants.java |    2 +-
 core/sqf/conf/log4cxx.trafodion.tm.config       |    2 +-
 core/sqf/monitor/linux/cluster.cxx              |  106 +-
 core/sqf/monitor/linux/internal.h               |    3 +-
 core/sqf/monitor/linux/monitor.cxx              |    1 +
 core/sqf/monitor/linux/pnode.cxx                |    2 -
 core/sqf/monitor/linux/pnode.h                  |    7 +-
 core/sqf/monitor/linux/zclient.cxx              |   41 +
 core/sqf/sqenvcom.sh                            |   12 +-
 core/sqf/sql/scripts/cleanlogs                  |    8 +
 core/sqf/sql/scripts/dcscheck                   |   22 +-
 core/sqf/sql/scripts/install_local_hadoop       |   20 +-
 core/sqf/sql/scripts/install_traf_components    |    3 +-
 core/sqf/sql/scripts/pstat                      |    2 +-
 core/sqf/sql/scripts/sqcheck                    |    6 +-
 core/sqf/sql/scripts/sqgen                      |   15 +-
 .../sqf/sql/scripts/traf_coprocessor.properties |   26 -
 core/sqf/sql/scripts/trafodion-site.xml         |   38 +
 core/sqf/src/seatrans/hbase-trx/Makefile        |    6 +-
 .../sqf/src/seatrans/hbase-trx/pom.xml.apache10 |    2 +-
 .../sqf/src/seatrans/hbase-trx/pom.xml.apache11 |    2 +-
 .../sqf/src/seatrans/hbase-trx/pom.xml.apache12 |    2 +-
 .../hbase/client/transactional/RMInterface.java |   14 +-
 .../transactional/TransactionManager.java       |  607 ++++---
 .../client/transactional/TransactionState.java  |  120 +-
 .../transactional/TrxRegionEndpoint.java.tmpl   |    2 +-
 .../java/org/trafodion/dtm/HBaseTxClient.java   |   33 +-
 .../java/org/trafodion/dtm/TmAuditTlog.java     |   11 +-
 .../main/java/org/trafodion/dtm/TrafInfo.java   |    4 +-
 .../org/trafodion/sql/TrafConfiguration.java    |    1 +
 core/sqf/src/tm/tmmsg.h                         |   21 +-
 core/sqf/src/tm/tmtx.cpp                        |    4 +-
 core/sql/arkcmp/CmpContext.cpp                  |   73 +-
 core/sql/arkcmp/CmpContext.h                    |   15 +-
 core/sql/arkcmp/CmpSqlSession.h                 |    2 +-
 core/sql/arkcmp/CmpStatement.cpp                |   39 +
 core/sql/arkcmp/CmpStatement.h                  |   33 +-
 core/sql/bin/SqlciErrors.txt                    |    4 +
 core/sql/cli/Cli.cpp                            |   57 +-
 core/sql/cli/Cli.h                              |    9 +-
 core/sql/cli/CliExpExchange.cpp                 |    4 +-
 core/sql/cli/CliExtern.cpp                      |   82 +-
 core/sql/cli/Context.cpp                        |  208 ++-
 core/sql/cli/Context.h                          |   31 +-
 core/sql/cli/SQLCLIdev.h                        |    7 +
 core/sql/cli/Statement.cpp                      |   11 +-
 core/sql/comexe/ComTdbExeUtil.cpp               |   15 +
 core/sql/comexe/ComTdbExeUtil.h                 |   36 +-
 core/sql/comexe/ComTdbHashGrby.h                |    4 +
 core/sql/comexe/ComTdbHdfsScan.h                |    8 +-
 core/sql/comexe/ComTdbSortGrby.h                |    2 +
 core/sql/common/ComSecurityKey.cpp              |   82 +
 core/sql/common/ComSecurityKey.h                |    5 +
 core/sql/common/ComSmallDefs.h                  |    4 +-
 core/sql/common/ComSqlId.cpp                    |    4 +-
 core/sql/common/ComSqlId.h                      |    4 +-
 core/sql/common/NAType.cpp                      |   17 +-
 core/sql/common/NAType.h                        |    4 +-
 core/sql/common/OperTypeEnum.h                  |    5 +
 core/sql/executor/ExExeUtil.h                   |    9 +-
 core/sql/executor/ExExeUtilMisc.cpp             |   18 +
 core/sql/executor/ExExeUtilVolTab.cpp           |  110 +-
 core/sql/executor/ExHbaseAccess.cpp             |   70 +-
 core/sql/executor/ExHbaseAccess.h               |    3 +
 core/sql/executor/ExHdfsScan.cpp                |  170 +-
 core/sql/executor/ExHdfsScan.h                  |    7 +
 core/sql/executor/ex_hash_grby.cpp              |   38 +-
 core/sql/executor/ex_hash_grby.h                |    8 +-
 core/sql/executor/ex_sort_grby.cpp              |  126 +-
 core/sql/executor/ex_sort_grby.h                |   11 +-
 core/sql/exp/ExpPCodeExpGen.cpp                 |    6 +-
 core/sql/exp/ExpPackDefs.cpp                    |    4 +
 core/sql/exp/exp_aggregate.cpp                  |  105 ++
 core/sql/exp/exp_attrs.cpp                      |    4 +-
 core/sql/exp/exp_attrs.h                        |   16 +-
 core/sql/exp/exp_clause.cpp                     |   18 +
 core/sql/exp/exp_clause.h                       |   12 +-
 core/sql/exp/exp_clause_derived.h               |   37 +
 core/sql/exp/exp_conv.cpp                       |    2 +-
 core/sql/exp/exp_eval.cpp                       |   41 +-
 core/sql/exp/exp_expr.cpp                       |   17 +-
 core/sql/exp/exp_expr.h                         |   38 +-
 core/sql/exp/exp_fixup.cpp                      |    7 +
 core/sql/exp/exp_function.cpp                   |   52 +-
 core/sql/exp/exp_tuple_desc.cpp                 |   21 +-
 core/sql/generator/GenExpGenerator.cpp          |   87 +-
 core/sql/generator/GenExpGenerator.h            |   17 +-
 core/sql/generator/GenExplain.cpp               |    4 -
 core/sql/generator/GenItemFunc.cpp              |   25 +
 core/sql/generator/GenPreCode.cpp               |  124 +-
 core/sql/generator/GenRelExeUtil.cpp            |   31 +-
 core/sql/generator/GenRelMisc.cpp               |   11 +
 core/sql/generator/GenRelScan.cpp               |   34 +-
 core/sql/generator/GenRelUpdate.cpp             |    4 +-
 core/sql/generator/Generator.cpp                |    2 +
 core/sql/generator/Generator.h                  |   19 +-
 .../lib_mgmt/src/main/resources/init_libmgmt.sh |    2 +-
 core/sql/nskgmake/arkcmplib/Makefile            |    4 -
 core/sql/optimizer/BindItemExpr.cpp             |    1 +
 core/sql/optimizer/BindRelExpr.cpp              |  195 ++-
 core/sql/optimizer/BindWA.cpp                   |    1 +
 core/sql/optimizer/BindWA.h                     |    9 +-
 core/sql/optimizer/CacheWA.h                    |    2 +-
 core/sql/optimizer/GroupAttr.cpp                |    5 +-
 core/sql/optimizer/GroupAttr.h                  |    2 +
 core/sql/optimizer/HDFSHook.cpp                 |   35 +-
 core/sql/optimizer/HDFSHook.h                   |   13 +-
 core/sql/optimizer/ItemColRef.h                 |    1 +
 core/sql/optimizer/ItemExpr.cpp                 |   77 +-
 core/sql/optimizer/ItemFunc.h                   |   44 +-
 core/sql/optimizer/MVCandidates.cpp             |    1 -
 core/sql/optimizer/NARoutine.cpp                |   26 +-
 core/sql/optimizer/NATable.cpp                  |   70 +-
 core/sql/optimizer/NATable.h                    |    2 +-
 core/sql/optimizer/NormRelExpr.cpp              | 1359 ++++++++++++++-
 core/sql/optimizer/NormWA.h                     |   10 +-
 core/sql/optimizer/ObjectNames.cpp              |    7 +
 core/sql/optimizer/ObjectNames.h                |    1 +
 core/sql/optimizer/OptLogRelExpr.cpp            |   94 +-
 core/sql/optimizer/OptimizerSimulator.cpp       |   36 +-
 core/sql/optimizer/OptimizerSimulator.h         |    1 -
 core/sql/optimizer/RelExeUtil.cpp               |    8 +-
 core/sql/optimizer/RelExeUtil.h                 |   13 +-
 core/sql/optimizer/RelExpr.cpp                  |  331 +++-
 core/sql/optimizer/RelExpr.h                    |   44 +
 core/sql/optimizer/RelFastTransport.cpp         |  115 ++
 core/sql/optimizer/RelFastTransport.h           |   33 +-
 core/sql/optimizer/RelGrby.h                    |    8 +
 core/sql/optimizer/RelJoin.h                    |    8 +
 core/sql/optimizer/RelMisc.h                    |  355 +++-
 core/sql/optimizer/RelScan.h                    |   46 +-
 core/sql/optimizer/RelSequence.cpp              |    3 +
 core/sql/optimizer/RelSet.h                     |    9 +
 core/sql/optimizer/SynthType.cpp                |   35 +-
 core/sql/optimizer/TableDesc.cpp                |   71 +-
 core/sql/optimizer/TableDesc.h                  |   11 +
 core/sql/optimizer/TransRule.cpp                |   55 +-
 core/sql/optimizer/TransRule.h                  |   19 +
 core/sql/optimizer/ValueDesc.cpp                |  171 +-
 core/sql/optimizer/ValueDesc.h                  |   17 +-
 core/sql/parser/ParKeyWords.cpp                 |    1 +
 core/sql/parser/sqlparser.y                     |   69 +-
 core/sql/qmscommon/QRLogger.cpp                 |    3 +
 core/sql/regress/compGeneral/EXPECTED005        |    6 -
 core/sql/regress/compGeneral/EXPECTED023        |   50 +-
 core/sql/regress/compGeneral/EXPECTED042        |   74 +-
 core/sql/regress/compGeneral/EXPECTED045        | 1610 ++++++++++++++++++
 core/sql/regress/compGeneral/TEST005            |    2 -
 core/sql/regress/compGeneral/TEST045            | 1281 ++++++++++++++
 core/sql/regress/core/EXPECTED004.SB            |   66 +-
 core/sql/regress/executor/DIFF107.KNOWN.SB      |   16 -
 core/sql/regress/executor/DIFF107.KNOWN.SB.OS   |   14 -
 core/sql/regress/executor/EXPECTED107           |  565 ++++++
 core/sql/regress/executor/EXPECTED107.LINUX     |  574 -------
 core/sql/regress/executor/TEST107               |   51 +-
 core/sql/regress/hive/EXPECTED018               |    6 +-
 core/sql/regress/privs1/TEST120                 |    4 +
 core/sql/regress/privs2/EXPECTED144             |  Bin 0 -> 59408 bytes
 core/sql/regress/privs2/LOG144                  |  Bin 0 -> 17980 bytes
 core/sql/regress/privs2/TEST144                 |  242 +++
 core/sql/regress/privs2/udfs.cpp                |  174 ++
 core/sql/regress/seabase/EXPECTED016            |   14 -
 core/sql/regress/seabase/EXPECTED018            |    6 +-
 core/sql/regress/seabase/EXPECTED027            |   86 +-
 core/sql/regress/seabase/EXPECTED033            |  280 ++-
 core/sql/regress/seabase/TEST027                |    4 +-
 core/sql/regress/seabase/TEST033                |   73 +-
 core/sql/regress/tools/runregr_compGeneral.ksh  |    2 +-
 core/sql/regress/udr/TEST103                    |    2 +-
 core/sql/sort/SortTopN.cpp                      |    8 +
 core/sql/sqlcomp/CmpDescribe.cpp                |    6 +-
 core/sql/sqlcomp/CmpMain.cpp                    |   45 +-
 core/sql/sqlcomp/CmpMain.h                      |    1 -
 core/sql/sqlcomp/CmpSeabaseDDL.h                |   10 +-
 core/sql/sqlcomp/CmpSeabaseDDLauth.cpp          |   18 +
 core/sql/sqlcomp/CmpSeabaseDDLauth.h            |    6 +-
 core/sql/sqlcomp/CmpSeabaseDDLtable.cpp         |  218 ++-
 core/sql/sqlcomp/DefaultConstants.h             |    9 +
 core/sql/sqlcomp/nadefaults.cpp                 |   18 +-
 core/sql/sqlcomp/parser.cpp                     |    3 +
 core/sql/sqludr/SqlUdrPredefLogReader.cpp       |  482 +++++-
 .../org/trafodion/sql/CoprocessorUtils.java     |  104 --
 .../java/org/trafodion/sql/HBaseClient.java     |   29 +-
 .../java/org/trafodion/sql/HTableClient.java    |   38 +-
 .../org/trafodion/sql/TrafConfiguration.java    |   70 +
 .../java/org/trafodion/sql/TrafRegionStats.java |    4 +-
 core/trafodion.spec                             |  114 ++
 .../main/asciidoc/_chapters/configuration.adoc  |   17 +-
 .../asciidoc/_chapters/troubleshooting.adoc     |   18 +-
 dcs/src/main/resources/dcs-default.xml          |    2 +-
 .../src/asciidoc/_chapters/requirements.adoc    |    2 +-
 206 files changed, 10839 insertions(+), 2554 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/ece38ae9/core/sql/common/OperTypeEnum.h
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/ece38ae9/core/sql/exp/ExpPackDefs.cpp
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/ece38ae9/core/sql/exp/exp_clause.cpp
----------------------------------------------------------------------
diff --cc core/sql/exp/exp_clause.cpp
index 8fe135d,f4b9114..2f8f9be
--- a/core/sql/exp/exp_clause.cpp
+++ b/core/sql/exp/exp_clause.cpp
@@@ -338,18 -338,6 +338,19 @@@ ex_clause::ex_clause(clause_type type
  	case ITM_CURR_TRANSID:
  	  setClassID(FUNC_CURR_TRANSID_ID);
  	  break;
 +        case ITM_SHA:
++        case ITM_SHA1:
 +          setClassID(FUNC_SHA_ID);
 +          break;
 +        case ITM_SHA2:
 +          setClassID(FUNC_SHA2_ID);
 +          break;
 +        case ITM_MD5:
 +          setClassID(FUNC_MD5_ID);
 +          break; 
 +        case ITM_CRC32:
 +          setClassID(FUNC_CRC32_ID);
 +          break; 
  	case ITM_ISIPV4:
  	case ITM_ISIPV6:
  	  setClassID(FUNC_ISIP_ID);

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/ece38ae9/core/sql/exp/exp_clause.h
----------------------------------------------------------------------
diff --cc core/sql/exp/exp_clause.h
index defad8b,c8b079b..1e9b926
--- a/core/sql/exp/exp_clause.h
+++ b/core/sql/exp/exp_clause.h
@@@ -203,12 -203,7 +203,12 @@@ public
      FUNC_ISIP_ID             = 118,
      FUNC_INETATON_ID         = 119,
      FUNC_INETNTOA_ID         = 120,
-     FUNC_CRC32_ID            = 121,
-     FUNC_MD5_ID              = 122,
-     FUNC_SHA1_ID             = 123,
-     FUNC_SHA2_ID             = 124,
-     FUNC_SHA_ID              = 125
- 
 -    AGGR_GROUPING_ID         = 121
++    AGGR_GROUPING_ID         = 121,
++    FUNC_CRC32_ID            = 122,
++    FUNC_MD5_ID              = 123,
++    FUNC_SHA1_ID             = 124,
++    FUNC_SHA2_ID             = 125,
++    FUNC_SHA_ID              = 126
    };
  
    // max number of operands (including result) in a clause.

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/ece38ae9/core/sql/exp/exp_function.cpp
----------------------------------------------------------------------
diff --cc core/sql/exp/exp_function.cpp
index de36408,e0134de..439e944
--- a/core/sql/exp/exp_function.cpp
+++ b/core/sql/exp/exp_function.cpp
@@@ -7936,126 -7900,6 +7936,114 @@@ ex_expr::exp_return_type ExFunctionInet
     return ex_expr::EXPR_OK;
  }
  
 +ex_expr::exp_return_type ExFunctionCrc32::eval(char * op_data[],
 +                                                        CollHeap *heap,
 +                                                        ComDiagsArea **diags)
 +{
 +  Attributes *resultAttr   = getOperand(0);
 +  Attributes *srcAttr   = getOperand(1);
 +
 +  Lng32 slen = srcAttr->getLength(op_data[-MAX_OPERANDS+1]);
 +  Lng32 rlen = resultAttr->getLength();
 +
-     *(ULng32*)op_data[0] = 0; 
-     ULng32 crc = crc32(0L, Z_NULL, 0);
-     crc = crc32 (crc, (const Bytef*)op_data[1], slen);
-     *(ULng32*)op_data[0] = crc; 
-     return ex_expr::EXPR_OK;
++  *(ULng32*)op_data[0] = 0; 
++  ULng32 crc = crc32(0L, Z_NULL, 0);
++  crc = crc32 (crc, (const Bytef*)op_data[1], slen);
++  *(ULng32*)op_data[0] = crc; 
++  return ex_expr::EXPR_OK;
 +}
 +
++//only support SHA 256 for this version
++//TBD: add 224 and 384, 512 in next version
 +ex_expr::exp_return_type ExFunctionSha2::eval(char * op_data[],
 +                                                        CollHeap *heap,
 +                                                        ComDiagsArea **diags)
 +{
 +
-   unsigned char sha[SHA_DIGEST_LENGTH + 1]={0};  
++  unsigned char sha[SHA256_DIGEST_LENGTH+ 1]={0};  
 +
 +  Attributes *resultAttr   = getOperand(0);
 +  Attributes *srcAttr   = getOperand(1);
 +
 +  Lng32 slen = srcAttr->getLength(op_data[-MAX_OPERANDS+1]);
 +  Lng32 rlen = resultAttr->getLength();
 +
-   if(rlen < 40)
-   {
-     //ExRaiseSqlError(heap, diagsArea, EXE_GETBIT_ERROR);
-     return ex_expr::EXPR_ERROR;
-   }
++  memset(op_data[0], 0, rlen);
 +
-   SHA_CTX  sha_ctx;
++  SHA256_CTX  sha_ctx;
 +
-   SHA_Init(&sha_ctx);  
-   SHA_Update(&sha_ctx, op_data[1], slen);
-   SHA_Final((unsigned char*) sha,&sha_ctx); 
++  SHA256_Init(&sha_ctx);  
++  SHA256_Update(&sha_ctx, op_data[1], slen);
++  SHA256_Final((unsigned char*) sha,&sha_ctx); 
 +  char tmp[2];
-   for(int i=0; i < SHA_DIGEST_LENGTH ; i++ )
++  for(int i=0; i < SHA256_DIGEST_LENGTH; i++ )
 +  {
 +    tmp[0]=tmp[1]='0';
 +    sprintf(tmp, "%.2x", (int)sha[i]);
 +    memcpy(op_data[0]+i*2, tmp, 2);
 +  }
 +   
 +  return ex_expr::EXPR_OK;
 +}
 +
 +ex_expr::exp_return_type ExFunctionSha::eval(char * op_data[],
 +                                                        CollHeap *heap,
 +                                                        ComDiagsArea **diags)
 +{
 +
 +  unsigned char sha[SHA_DIGEST_LENGTH + 1]={0};  
 +
 +  Attributes *resultAttr   = getOperand(0);
 +  Attributes *srcAttr   = getOperand(1);
- 
 +  Lng32 slen = srcAttr->getLength(op_data[-MAX_OPERANDS+1]);
 +  Lng32 rlen = resultAttr->getLength();
- 
-   if(rlen < 40)
-   {
-     //ExRaiseSqlError(heap, diagsArea, EXE_GETBIT_ERROR);
-     return ex_expr::EXPR_ERROR;
-   }
++  memset(op_data[0], 0, rlen);
 +
 +  SHA_CTX  sha_ctx;
 +
-   SHA_Init(&sha_ctx);  
-   SHA_Update(&sha_ctx, op_data[1], slen);
-   SHA_Final((unsigned char*) sha,&sha_ctx); 
++  SHA1_Init(&sha_ctx);  
++  SHA1_Update(&sha_ctx, op_data[1], slen);
++  SHA1_Final((unsigned char*) sha,&sha_ctx); 
 +  char tmp[2];
 +  for(int i=0; i < SHA_DIGEST_LENGTH ; i++ )
 +  {
 +    tmp[0]=tmp[1]='0';
 +    sprintf(tmp, "%.2x", (int)sha[i]);
 +    memcpy(op_data[0]+i*2, tmp, 2);
 +  }
 +   
 +  return ex_expr::EXPR_OK;
 +}
++
 +ex_expr::exp_return_type ExFunctionMd5::eval(char * op_data[],
 +                                                        CollHeap *heap,
 +                                                        ComDiagsArea **diags)
 +{
 +  unsigned char md5[17]={0};  
 +
 +  Attributes *resultAttr   = getOperand(0);
 +  Attributes *srcAttr   = getOperand(1);
 +
 +  Lng32 slen = srcAttr->getLength(op_data[-MAX_OPERANDS+1]);
 +  Lng32 rlen = resultAttr->getLength();
 +
-   if(rlen < 32)
-   {
-     //ExRaiseSqlError(heap, diagsArea, EXE_GETBIT_ERROR);
-     return ex_expr::EXPR_ERROR;
-   }
- 
++  memset(op_data[0], 0, rlen);
 +  MD5_CTX  md5_ctx;
 +
 +  MD5_Init(&md5_ctx);  
 +  MD5_Update(&md5_ctx, op_data[1], slen);
 +  MD5_Final((unsigned char*) md5,&md5_ctx); 
 +  char tmp[2];
 +  for(int i=0; i < 16; i++ )
 +  {
 +    tmp[0]=tmp[1]='0';
 +    sprintf(tmp, "%.2x", (int)md5[i]);
 +    memcpy(op_data[0]+i*2, tmp, 2);
 +  }
 +   
 +  return ex_expr::EXPR_OK;
 +}
 +
  ex_expr::exp_return_type ExFunctionIsIP::eval(char * op_data[],
                                                          CollHeap *heap,
                                                          ComDiagsArea **diags)

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/ece38ae9/core/sql/generator/GenItemFunc.cpp
----------------------------------------------------------------------
diff --cc core/sql/generator/GenItemFunc.cpp
index f1a6ec3,81e23ff..685fa6f
--- a/core/sql/generator/GenItemFunc.cpp
+++ b/core/sql/generator/GenItemFunc.cpp
@@@ -218,42 -218,6 +218,43 @@@ short BuiltinFunction::codeGen(Generato
        
        break;
  
 +   case ITM_SHA:
++   case ITM_SHA1:
 +      {
 +         function_clause =
 +           new(generator->getSpace()) ExFunctionSha(getOperatorType(),
 +                                                         attr, space);
 +      }
 +     
 +      break;
 +
 +   case ITM_SHA2:
 +      {
 +         function_clause =
 +           new(generator->getSpace()) ExFunctionSha2(getOperatorType(),
 +                                                         attr, space);
 +      }
 +     
 +      break;
 +
 +   case ITM_MD5:
 +      {
 +         function_clause =
 +           new(generator->getSpace()) ExFunctionMd5(getOperatorType(),
 +                                                         attr, space);
 +      }
 +     
 +      break;
 +
 +   case ITM_CRC32:
 +      {
 +         function_clause =
 +           new(generator->getSpace()) ExFunctionCrc32(getOperatorType(),
 +                                                         attr, space);
 +      }
 +     
 +      break;
 +
     case ITM_ISIPV4:
     case ITM_ISIPV6:
        {

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/ece38ae9/core/sql/optimizer/BindItemExpr.cpp
----------------------------------------------------------------------
diff --cc core/sql/optimizer/BindItemExpr.cpp
index 32f84c4,af6a46d..f24f318
--- a/core/sql/optimizer/BindItemExpr.cpp
+++ b/core/sql/optimizer/BindItemExpr.cpp
@@@ -3163,10 -3163,6 +3163,11 @@@ ItemExpr *BuiltinFunction::bindNode(Bin
      {
      case ITM_ISIPV4:
      case ITM_ISIPV6:
 +    case ITM_MD5:
 +    case ITM_CRC32:
++    case ITM_SHA:
 +    case ITM_SHA1:
 +    case ITM_SHA2:
        {
           break;
        }

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/ece38ae9/core/sql/optimizer/SynthType.cpp
----------------------------------------------------------------------
diff --cc core/sql/optimizer/SynthType.cpp
index de4abd4,c0cca73..7373d3c
--- a/core/sql/optimizer/SynthType.cpp
+++ b/core/sql/optimizer/SynthType.cpp
@@@ -1010,64 -1010,7 +1010,65 @@@ const NAType *BuiltinFunction::synthesi
  	    SQLChar(maxLength, typ1.supportsSQLnull());
        }
      break;
 - 
 +    case ITM_SHA:
++    case ITM_SHA1:
 +    case ITM_SHA2:
 +      {
 +        // type cast any params
 +        ValueId vid1 = child(0)->getValueId();
 +        SQLChar c1(ComSqlId::MAX_QUERY_ID_LEN);
 +        vid1.coerceType(c1, NA_CHARACTER_TYPE);
 +        //input type must be string
 +        const NAType &typ1 = child(0)->getValueId().getType();
 +
 +        if (typ1.getTypeQualifier() != NA_CHARACTER_TYPE)
 +          {
- 	    *CmpCommon::diags() << DgSqlCode(-4045) << DgString0("IS_IP");
++	    *CmpCommon::diags() << DgSqlCode(-4067) << DgString0("SHA");
 +	    return NULL;
 +          }
 +
 +        retType = new HEAP
-            SQLVarChar(40, FALSE);
++           SQLChar(128, FALSE);
 +	if (typ1.supportsSQLnull())
 +	  {
 +	    retType->setNullable(TRUE);
 +	  }
 +      }
 +    break;
 +    case ITM_MD5:
 +      {
 +        // type cast any params
 +        ValueId vid1 = child(0)->getValueId();
 +        SQLChar c1(ComSqlId::MAX_QUERY_ID_LEN);
 +        vid1.coerceType(c1, NA_CHARACTER_TYPE);
 +        //input type must be string
 +        const NAType &typ1 = child(0)->getValueId().getType();
 +
 +        if (typ1.getTypeQualifier() != NA_CHARACTER_TYPE)
 +          {
- 	    *CmpCommon::diags() << DgSqlCode(-4045) << DgString0("IS_IP");
++	    *CmpCommon::diags() << DgSqlCode(-4067) << DgString0("MD5");
 +	    return NULL;
 +          }
 +
 +        retType = new HEAP
-            SQLVarChar(33, FALSE);
++           SQLChar(32, FALSE);
 +	if (typ1.supportsSQLnull())
 +	  {
 +	    retType->setNullable(TRUE);
 +	  }
 +      }
 +    break;
 +    case ITM_CRC32:
 +      {
 +        const NAType &typ1 = child(0)->getValueId().getType();
 +        retType = new HEAP
 +           SQLInt(FALSE, FALSE); //unsigned int
 +        if (typ1.supportsSQLnull())
 +          {
 +            retType->setNullable(TRUE);
 +          }
 +      } 
 +    break;
      case ITM_ISIPV4:
      case ITM_ISIPV6:
        {
@@@ -1080,7 -1023,7 +1081,7 @@@
  
          if (typ1.getTypeQualifier() != NA_CHARACTER_TYPE)
            {
--	    *CmpCommon::diags() << DgSqlCode(-4045) << DgString0("IS_IP");
++	    *CmpCommon::diags() << DgSqlCode(-4067) << DgString0("IS_IP");
  	    return NULL;
            }
          retType = new HEAP
@@@ -1103,7 -1046,7 +1104,7 @@@
  
          if (typ1.getTypeQualifier() != NA_CHARACTER_TYPE)
            {
--	    *CmpCommon::diags() << DgSqlCode(-4045) << DgString0("INET_ATON");
++	    *CmpCommon::diags() << DgSqlCode(-4067) << DgString0("INET_ATON");
  	    return NULL;
            }
          retType = new HEAP

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/ece38ae9/core/sql/parser/ParKeyWords.cpp
----------------------------------------------------------------------
diff --cc core/sql/parser/ParKeyWords.cpp
index c996b0c,c838bf7..03b1c60
--- a/core/sql/parser/ParKeyWords.cpp
+++ b/core/sql/parser/ParKeyWords.cpp
@@@ -972,8 -970,6 +972,9 @@@ ParKeyWord ParKeyWords::keyWords_[] = 
    ParKeyWord("SET",                TOK_SET,         ANS_|RESWORD_|MPWORD_),
    ParKeyWord("SETS",               TOK_SETS,        COMPAQ_|RESWORD_),
    ParKeyWord("SG_TABLE",           TOK_SG_TABLE,    NONRESTOKEN_),
++  ParKeyWord("SHA",                TOK_SHA,         NONRESTOKEN_),
 +  ParKeyWord("SHA1",               TOK_SHA1,        NONRESTOKEN_),
 +  ParKeyWord("SHA2",               TOK_SHA2,        NONRESTOKEN_),
    ParKeyWord("SHAPE",              TOK_SHAPE,       NONRESTOKEN_),
    ParKeyWord("SHARE",              TOK_SHARE,       NONRESTOKEN_),
    ParKeyWord("SHARED",             TOK_SHARED,      NONRESTOKEN_),

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/ece38ae9/core/sql/parser/sqlparser.y
----------------------------------------------------------------------
diff --cc core/sql/parser/sqlparser.y
index 10261d4,beea4d8..399f9fb
--- a/core/sql/parser/sqlparser.y
+++ b/core/sql/parser/sqlparser.y
@@@ -9638,55 -9671,6 +9676,62 @@@ misc_function 
  				  $$ = $2;
  				}
  
 +     | TOK_SHA  '(' value_expression ')'
 +                {
 +                    $$ = new (PARSERHEAP())
-                     BuiltinFunction(ITM_SHA,
++                    BuiltinFunction(ITM_SHA1,
++                            CmpCommon::statementHeap(),
++                            1, $3);
++                }
++     | TOK_SHA1  '(' value_expression ')'
++                {
++                    $$ = new (PARSERHEAP())
++                    BuiltinFunction(ITM_SHA1,
 +                            CmpCommon::statementHeap(),
 +                            1, $3);
 +                }
 +
 +     | TOK_SHA2 '(' value_expression ')'
 +                {
 +                    $$ = new (PARSERHEAP())
 +                    BuiltinFunction(ITM_SHA2,
 +                            CmpCommon::statementHeap(),
 +                            1, $3);
 +                }
 +
 +     | TOK_MD5 '(' value_expression ')'
 +                {
 +                    $$ = new (PARSERHEAP())
 +                    BuiltinFunction(ITM_MD5,
 +                            CmpCommon::statementHeap(),
 +                            1, $3);
 +                }
 +
 +     | TOK_CRC32 '(' value_expression ')'
 +                {
 +                    $$ = new (PARSERHEAP())
 +                    BuiltinFunction(ITM_CRC32,
 +                            CmpCommon::statementHeap(),
 +                            1, $3);
 +                }
 +
 +
 +     | TOK_SHA1 '(' value_expression ')'
 +                {
 +                    $$ = new (PARSERHEAP())
 +                    BuiltinFunction(ITM_SHA1,
 +                            CmpCommon::statementHeap(),
 +                            1, $3);
 +                }
 +
 +     | TOK_SHA2 '(' value_expression ')'
 +                {
 +                    $$ = new (PARSERHEAP())
 +                    BuiltinFunction(ITM_SHA2,
 +                            CmpCommon::statementHeap(),
 +                            1, $3);
 +                }
 +
       | TOK_GREATEST '(' value_expression ',' value_expression ')'
                    {
                      $$ = new (PARSERHEAP())


Mime
View raw message