Repository: incubator-trafodion Updated Branches: refs/heads/master 140769281 -> bc1b2e120
[TRAFODION-1978] Report a nice error when attempting UPD STATS on LOBs Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/18e0a358 Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/18e0a358 Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/18e0a358 Branch: refs/heads/master Commit: 18e0a35804c1d9798155d3a364eb57b06f400a27 Parents: d79ef12 Author: Dave Birdsall <[email protected]> Authored: Fri May 6 22:06:15 2016 +0000 Committer: Dave Birdsall <[email protected]> Committed: Fri May 6 22:06:15 2016 +0000 ---------------------------------------------------------------------- core/sql/bin/SqlciErrors.txt | 2 ++ core/sql/ustat/hs_const.h | 1 + core/sql/ustat/hs_la.cpp | 13 +++++++++++++ core/sql/ustat/hs_parser.cpp | 5 ++++- 4 files changed, 20 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/18e0a358/core/sql/bin/SqlciErrors.txt ---------------------------------------------------------------------- diff --git a/core/sql/bin/SqlciErrors.txt b/core/sql/bin/SqlciErrors.txt index 979b012..198a5d9 100644 --- a/core/sql/bin/SqlciErrors.txt +++ b/core/sql/bin/SqlciErrors.txt @@ -1875,6 +1875,8 @@ drop the default context 9242 ZZZZZ 99999 BEGINNER MAJOR DBADMIN Unable to create schema for Hive statistics. 9243 ZZZZZ 99999 BEGINNER MAJOR DBADMIN This UPDATE STATISTICS command may take too long. It is recommended to use the SAMPLE clause instead. If you wish to do this without a SAMPLE clause, specify NO SAMPLE explicitly. 9244 ZZZZZ 99999 BEGINNER MAJOR DBADMIN UPDATE STATISTICS is not allowed in a user transaction. +9245 ZZZZZ 99999 UUUUUUUU UUUUU UUUUUUU ---- unused ---- +9246 ZZZZZ 99999 BEGINNER MAJOR DBADMIN UPDATE STATISTICS is not supported on LOB columns. Column $0~String0 is a LOB column. 9250 ZZZZZ 99999 UUUUUUUU UUUUU UUUUUUU Last UPDATE STATISTICS error. 10000 ZZZZZ 99999 UUUUUUUU UUUUU UUUUUUU Sort Error: First Sort error 10001 ZZZZZ 99999 ADVANCED MAJOR DIALOUT Sort Error : No error text defined. Unexpected error. $0~String0 http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/18e0a358/core/sql/ustat/hs_const.h ---------------------------------------------------------------------- diff --git a/core/sql/ustat/hs_const.h b/core/sql/ustat/hs_const.h index 3143a1a..0942330 100644 --- a/core/sql/ustat/hs_const.h +++ b/core/sql/ustat/hs_const.h @@ -168,6 +168,7 @@ enum USTAT_ERROR_CODES {UERR_SYNTAX_ERROR = 15001, UERR_CANT_CREATE_HIVE_STATS_SCHEMA = 9242, UERR_YOU_WILL_LIKELY_BE_SORRY = 9243, UERR_USER_TRANSACTION = 9244, + UERR_LOB_STATS_NOT_SUPPORTED = 9246, UERR_NO_ERROR = 9250, UERR_LAST_ERROR = 9250 }; http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/18e0a358/core/sql/ustat/hs_la.cpp ---------------------------------------------------------------------- diff --git a/core/sql/ustat/hs_la.cpp b/core/sql/ustat/hs_la.cpp index 68b32e9..61c66dc 100644 --- a/core/sql/ustat/hs_la.cpp +++ b/core/sql/ustat/hs_la.cpp @@ -652,6 +652,19 @@ Lng32 HSTableDef::getColNum(const char *colName, NABoolean errIfNotFound) const if ((&colInfo_[i] != NULL) && (ansiForm == *colInfo_[i].colname)) { + // raise an error when a LOB column is explicitly specified + if (DFS2REC::isLOB(colInfo_[i].datatype)) + { + if (LM->LogNeeded()) + { + sprintf(LM->msg, "***[ERROR]: Column (%s) is a LOB column.", colName); + LM->Log(LM->msg); + } + HSFuncMergeDiags(-UERR_LOB_STATS_NOT_SUPPORTED, colName); + HSHandleError(retcode); + return retcode; + } + return i; } } http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/18e0a358/core/sql/ustat/hs_parser.cpp ---------------------------------------------------------------------- diff --git a/core/sql/ustat/hs_parser.cpp b/core/sql/ustat/hs_parser.cpp index 8da5e79..ffc1ea4 100644 --- a/core/sql/ustat/hs_parser.cpp +++ b/core/sql/ustat/hs_parser.cpp @@ -1108,10 +1108,13 @@ Lng32 AddEveryColumn(const char *startColumn, const char *endColumn) LM->Log(LM->msg); } } - else // add to single-column group list + else if (!DFS2REC::isLOB(hs_globals->objDef->getColInfo(colNumber).datatype)) { + // add to single-column group list retcode = AddSingleColumn(colNumber); } + // else it's a LOB column; silently exclude it (the column was only + // implicitly referenced) } if (!startColumn && // ON EVERY COLUMN causes key groups to be added as well
