[TRAFODION-3009] Streamline error handling in Executor utility commands

Fix for hive/TEST007 failure

Merge branch 'master' of github.com:apache/trafodion into trafodion-3009_1

Conflicts:
        core/sql/executor/ExExeUtilGet.cpp


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

Branch: refs/heads/master
Commit: 5623b7df82adc37e15d8cfe25c39eb33f506b333
Parents: 37702da 052f7fa
Author: selvaganesang <selva.govindara...@esgyn.com>
Authored: Fri Apr 6 01:53:27 2018 +0000
Committer: selvaganesang <selva.govindara...@esgyn.com>
Committed: Fri Apr 6 01:53:27 2018 +0000

----------------------------------------------------------------------
 core/sql/bin/SqlciErrors.txt                |   2 +-
 core/sql/comexe/ComTdbExeUtil.h             |  32 +-
 core/sql/common/BaseTypes.cpp               |   3 +-
 core/sql/common/CharType.cpp                |   2 +-
 core/sql/common/CharType.h                  |  27 +-
 core/sql/common/ComResWords.cpp             |   2 -
 core/sql/common/NAType.cpp                  |  12 +-
 core/sql/common/NAType.h                    |   3 +-
 core/sql/common/OperTypeEnum.h              |   1 +
 core/sql/executor/ExExeUtil.h               |  12 +-
 core/sql/executor/ExExeUtilGet.cpp          | 119 +++--
 core/sql/executor/sql_buffer.cpp            |   3 +-
 core/sql/exp/ExpLOBaccess.cpp               |  27 +-
 core/sql/exp/ExpLOBinterface.cpp            |   5 +-
 core/sql/exp/ExpPCodeClauseGen.cpp          |   4 +
 core/sql/exp/exp_attrs.cpp                  |  12 +-
 core/sql/exp/exp_attrs.h                    |   6 +-
 core/sql/exp/exp_function.cpp               | 249 +++++++---
 core/sql/exp/exp_function.h                 |  30 +-
 core/sql/generator/GenExpGenerator.cpp      |   7 +-
 core/sql/generator/GenItemFunc.cpp          |   6 +-
 core/sql/generator/GenRelExeUtil.cpp        |   5 +-
 core/sql/generator/GenRelJoin.cpp           |   8 +-
 core/sql/generator/GenRelPackedRows.cpp     |   7 +-
 core/sql/generator/Generator.h              |   1 +
 core/sql/optimizer/BindItemExpr.cpp         | 312 +++++++++---
 core/sql/optimizer/ItemCache.cpp            |   8 +
 core/sql/optimizer/ItemExpr.cpp             |   7 +-
 core/sql/optimizer/ItemFunc.h               |  46 +-
 core/sql/optimizer/ObjectNames.cpp          |   2 +-
 core/sql/optimizer/SynthType.cpp            |  49 +-
 core/sql/optimizer/ValueDesc.cpp            |  57 ++-
 core/sql/parser/sqlparser.y                 |  45 +-
 core/sql/qmscommon/QRLogger.cpp             |   2 +-
 core/sql/regress/compGeneral/EXPECTED006.SB |  10 +-
 core/sql/regress/compGeneral/EXPECTED042    | 139 +++---
 core/sql/regress/core/EXPECTED038.LINUX     |  26 +-
 core/sql/regress/executor/EXPECTED012       | 598 ++++++++++++++++++++++-
 core/sql/regress/executor/TEST012           | 103 +++-
 core/sql/regress/hive/EXPECTED005           | 112 ++---
 core/sql/regress/seabase/EXPECTED002        | 288 ++++++-----
 core/sql/regress/seabase/EXPECTED030        |  14 +
 core/sql/regress/seabase/EXPECTED031        |  44 +-
 core/sql/regress/seabase/TEST002            |  41 +-
 core/sql/regress/seabase/TEST030            |   4 +
 core/sql/regress/seabase/TEST031            |  10 +
 core/sql/sqlcomp/CmpMain.cpp                |   8 +-
 core/sql/sqlcomp/nadefaults.cpp             |  68 +--
 48 files changed, 1901 insertions(+), 677 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafodion/blob/5623b7df/core/sql/bin/SqlciErrors.txt
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/trafodion/blob/5623b7df/core/sql/executor/ExExeUtil.h
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/trafodion/blob/5623b7df/core/sql/executor/ExExeUtilGet.cpp
----------------------------------------------------------------------
diff --cc core/sql/executor/ExExeUtilGet.cpp
index c77260e,4428998..3493024
--- a/core/sql/executor/ExExeUtilGet.cpp
+++ b/core/sql/executor/ExExeUtilGet.cpp
@@@ -5782,24 -5833,39 +5820,39 @@@ short ExExeUtilHiveMDaccessTcb::work(
              str_cpy(infoCol->colName, 
                      (hcd ? hcd->name_ : hpd->name_), 256, ' ');
  
-             infoCol->fsDatatype = 
-               getFSTypeFromHiveColType(hcd ? hcd->type_ : hpd->type_);
- 
-           if (infoCol->fsDatatype < 0)
+             Lng32 fstype = -1;
+             Lng32 length = -1;
+             Lng32 precision = -1;
+             Lng32 scale = -1;
+             char sqlType[50];
+             char displayType[100];
+             char charset[50];
+             retcode = 
+               getTypeAttrsFromHiveColType(hcd ? hcd->type_ : hpd->type_,
+                                           htd->getSDs()->isOrcFile(),
+                                           fstype, length, precision, scale,
+                                           sqlType, displayType, charset);
+                  
+           if (retcode < 0)
              {
+                 // add a warning and continue.
                char strP[300];
-               sprintf(strP, "Datatype %s is not supported.", 
-                         (hcd ? hcd->type_ : hpd->type_));
-                 ExRaiseSqlError(getHeap(), &diagsArea_, 
-CLI_GET_METADATA_INFO_ERROR,
+               sprintf(strP, "Datatype %s for column '%s' in table %s.%s.%s is 
not supported. This table will be ignored.", 
+                         (hcd ? hcd->type_ : hpd->type_),
+                         (hcd ? hcd->name_ : hpd->name_),
+                         hiveCat_, hiveSch_, htd->tblName_);
 -              *diags << DgSqlCode(CLI_GET_METADATA_INFO_ERROR)
 -                     << DgString0(strP);
 -
++              ExRaiseSqlError(getHeap(), &diagsArea_, 
-CLI_GET_METADATA_INFO_ERROR,
 +                      NULL, NULL, NULL,
 +                      strP);
-               step_ = HANDLE_ERROR_;
-               break;
+                 step_ = ADVANCE_ROW_;
+                 break;
              }
            
-           const char * sdtStr = 
-               Descriptor::ansiTypeStrFromFSType(infoCol->fsDatatype);
-           str_cpy(infoCol->sqlDatatype, sdtStr, 32, ' ');
+             infoCol->fsDatatype = fstype;
+ 
+           str_cpy(infoCol->sqlDatatype, sqlType, 32, ' ');
+ 
+           str_cpy(infoCol->displayDatatype, displayType, 96, ' ');
  
              str_cpy(infoCol->hiveDatatype, (hcd ? hcd->type_ : hpd->type_), 
                      32, ' ');

http://git-wip-us.apache.org/repos/asf/trafodion/blob/5623b7df/core/sql/exp/ExpLOBinterface.cpp
----------------------------------------------------------------------
diff --cc core/sql/exp/ExpLOBinterface.cpp
index 8e73864,8e73864..730d4b7
--- a/core/sql/exp/ExpLOBinterface.cpp
+++ b/core/sql/exp/ExpLOBinterface.cpp
@@@ -310,8 -310,8 +310,11 @@@ Lng32 ExpLOBinterfaceDataModCheck(ExLob
  
        return 1;
      }
--  else if (err != LOB_OPER_OK)
++  else if (err != LOB_OPER_OK) {
++    failedLocBuf[0] = '\0';
++    failedLocBufLen = 0;
      return -err;
++  }
    else
      return 0;
  }

Reply via email to