Repository: incubator-trafodion
Updated Branches:
refs/heads/master 75aebedcb -> 2547fb1e9
JIRA TRAFODION-2084 Handling of invalid data inserts into hive tables
cqd hive_insert_error_mode '<val>' has been added to control
insert behavior.
if 0, datatype error check is not done during inserts into hive tables.
Invalid values may get inserted.
This is the behavior prior to this JIRA fix.
if 1, error check done, row is not inserted if conversion error.
Insertion stops. This is new default behavior.
if 2, error check done, row is not inserted if conversion error.
Insertion continues with next row
if 3, null inserted if conversion error.
Insertion processing continues. This is hive behavior.
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit:
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/392c6088
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/392c6088
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/392c6088
Branch: refs/heads/master
Commit: 392c60889cb437e08e3718a3fc54c244cbfb123b
Parents: 75aebed
Author: Anoop Sharma <[email protected]>
Authored: Wed Jun 22 20:19:59 2016 +0000
Committer: Anoop Sharma <[email protected]>
Committed: Wed Jun 22 20:19:59 2016 +0000
----------------------------------------------------------------------
core/sql/comexe/ComTdbFastTransport.h | 8 +-
core/sql/executor/ExFastTransport.cpp | 16 ++-
core/sql/generator/GenFastTransport.cpp | 74 ++++++++++-
core/sql/regress/hive/EXPECTED005 | 177 ++++++++++++++++++++++++--
core/sql/regress/hive/TEST005 | 42 ++++++
core/sql/regress/hive/TEST005_a.hive.sql | 7 +
core/sql/regress/seabase/EXPECTED011 | 2 +-
core/sql/sqlcomp/DefaultConstants.h | 9 ++
core/sql/sqlcomp/DefaultValidator.cpp | 15 +++
core/sql/sqlcomp/nadefaults.cpp | 22 +++-
10 files changed, 352 insertions(+), 20 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/392c6088/core/sql/comexe/ComTdbFastTransport.h
----------------------------------------------------------------------
diff --git a/core/sql/comexe/ComTdbFastTransport.h
b/core/sql/comexe/ComTdbFastTransport.h
index 98e93eb..4b4146c 100644
--- a/core/sql/comexe/ComTdbFastTransport.h
+++ b/core/sql/comexe/ComTdbFastTransport.h
@@ -72,7 +72,8 @@ public:
PRINT_DIAGS = 0x0100,
HDFS_COMPRESSED = 0x0200,
SKIP_WRITING_TO_FILES = 0x0400,
- BYPASS_LIBHDFS = 0x0800
+ BYPASS_LIBHDFS = 0x0800,
+ CONTINUE_ON_ERROR = 0x1000
};
ComTdbFastExtract ()
@@ -365,6 +366,11 @@ public:
return ((flags_ & BYPASS_LIBHDFS) != 0);
}
+ void setContinueOnError(NABoolean value)
+ { value ? flags_ |= CONTINUE_ON_ERROR : flags_ &= ~CONTINUE_ON_ERROR; }
+ NABoolean getContinueOnError() const
+ { return ((flags_ & CONTINUE_ON_ERROR) != 0); }
+
NA_EIDPROC inline const char *getTargetName() const { return targetName_; }
NA_EIDPROC inline const char *getHdfsHostName() const { return
hdfsHostName_; }
NA_EIDPROC inline const Int32 getHdfsPortNum() const {return
(Int32)hdfsPortNum_;}
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/392c6088/core/sql/executor/ExFastTransport.cpp
----------------------------------------------------------------------
diff --git a/core/sql/executor/ExFastTransport.cpp
b/core/sql/executor/ExFastTransport.cpp
index 2ebba4b..52d10d2 100644
--- a/core/sql/executor/ExFastTransport.cpp
+++ b/core/sql/executor/ExFastTransport.cpp
@@ -986,9 +986,19 @@ ExWorkProcRetcode ExHdfsFastExtractTcb::work()
if (expStatus == ex_expr::EXPR_ERROR)
{
- updateWorkATPDiagsArea(centry);
- pstate.step_ = EXTRACT_ERROR;
- break;
+ if (myTdb().getContinueOnError())
+ {
+ // ignore this row and continue to the next row
+ if (workAtp_->getDiagsArea())
+ workAtp_->getDiagsArea()->clear();
+ break;
+ }
+ else
+ {
+ updateWorkATPDiagsArea(centry);
+ pstate.step_ = EXTRACT_ERROR;
+ break;
+ }
}
} // if (myTdb().getChildDataExpr())
///////////////////////
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/392c6088/core/sql/generator/GenFastTransport.cpp
----------------------------------------------------------------------
diff --git a/core/sql/generator/GenFastTransport.cpp
b/core/sql/generator/GenFastTransport.cpp
index 6a4b4e7..60929b8 100644
--- a/core/sql/generator/GenFastTransport.cpp
+++ b/core/sql/generator/GenFastTransport.cpp
@@ -303,6 +303,24 @@ static short ft_codegen(Generator *generator,
ValueIdList cnvChildDataVids;
const ValueIdList& childVals = fastExtract->getSelectList();
+ const NATable *hiveNATable = NULL;
+ const NAColumnArray *hiveNAColArray = NULL;
+
+ // hiveInsertErrMode:
+ // if 0, do not do error checks.
+ // if 1, do error check and return error.
+ // if 2, do error check and ignore row, if error
+ // if 3, insert null if an error occurs
+ Lng32 hiveInsertErrMode = 0;
+ if ((fastExtract) && (fastExtract->isHiveInsert()) &&
+ (fastExtract->getHiveTableDesc()) &&
+ (fastExtract->getHiveTableDesc()->getNATable()) &&
+ ((hiveInsertErrMode =
CmpCommon::getDefaultNumeric(HIVE_INSERT_ERROR_MODE)) > 0))
+ {
+ hiveNATable = fastExtract->getHiveTableDesc()->getNATable();
+ hiveNAColArray = &hiveNATable->getNAColumnArray();
+ }
+
for (i = 0; i < childVals.entries(); i++)
{
ItemExpr &inputExpr = *(childVals[i].getItemExpr());
@@ -311,7 +329,41 @@ static short ft_codegen(Generator *generator,
ItemExpr *lmExpr2 = NULL;
int res;
- lmExpr = &inputExpr; //CreateCastExpr(inputExpr,
*inputExpr.getValueId().getType().newCopy(), cmpContext);
+ lmExpr = &inputExpr;
+ lmExpr = lmExpr->bindNode(generator->getBindWA());
+ if (!lmExpr || generator->getBindWA()->errStatus())
+ {
+ GenAssert(0, "lmExpr->bindNode failed");
+ }
+
+ // Hive insert converts child data into string format and inserts
+ // it into target table.
+ // If child type can into an error during conversion, then
+ // add a Cast to convert from child type to target type before
+ // converting to string format to be inserted.
+ if (hiveNAColArray)
+ {
+ const NAColumn *hiveNACol = (*hiveNAColArray)[i];
+ const NAType *hiveNAType = hiveNACol->getType();
+ // if tgt type was a hive 'string', do not return a conversion err
+ if ((lmExpr->getValueId().getType().errorsCanOccur(*hiveNAType)) &&
+ (NOT ((DFS2REC::isSQLVarChar(hiveNAType->getFSDatatype())) &&
+ (((SQLVarChar*)hiveNAType)->wasHiveString()))))
+ {
+ ItemExpr *newExpr =
+ new(generator->wHeap()) Cast(lmExpr, hiveNAType);
+ newExpr = newExpr->bindNode(generator->getBindWA());
+ if (!newExpr || generator->getBindWA()->errStatus())
+ {
+ GenAssert(0, "newExpr->bindNode failed");
+ }
+
+ if (hiveInsertErrMode == 3)
+ ((Cast*)newExpr)->setConvertNullWhenError(TRUE);
+
+ lmExpr = newExpr;
+ }
+ }
res = CreateAllCharsExpr(formalType, // [IN] Child output type
*lmExpr, // [IN] Actual input value
@@ -322,7 +374,6 @@ static short ft_codegen(Generator *generator,
GenAssert(res == 0 && lmExpr != NULL,
"Error building expression tree for LM child Input value");
- lmExpr->bindNode(generator->getBindWA());
childDataVids.insert(lmExpr->getValueId());
if (lmExpr2)
{
@@ -336,6 +387,16 @@ static short ft_codegen(Generator *generator,
if (childDataVids.entries() > 0 &&
cnvChildDataVids.entries()>0) //-- convertedChildDataVids
{
+ UInt16 pcm = exp_gen->getPCodeMode();
+ if ((hiveNAColArray) &&
+ (hiveInsertErrMode == 3))
+ {
+ // if error mode is 3 (mode null when error), disable pcode.
+ // this feature is currently not being handled by pcode.
+ // (added as part of JIRA 1920 in FileScan::codeGenForHive).
+ exp_gen->setPCodeMode(ex_expr::PCODE_NONE);
+ }
+
exp_gen->generateContiguousMoveExpr (
childDataVids, //childDataVids// [IN] source
ValueIds
TRUE, // [IN] add convert nodes?
@@ -348,6 +409,8 @@ static short ft_codegen(Generator *generator,
ExpTupleDesc::LONG_FORMAT // [optional IN] target desc format
);
+ exp_gen->setPCodeMode(pcm);
+
exp_gen->processValIdList (
cnvChildDataVids, // [IN] ValueIdList
ExpTupleDesc::SQLARK_EXPLODED_FORMAT, // [IN] tuple data format
@@ -419,6 +482,13 @@ static short ft_codegen(Generator *generator,
tdb->setSkipWritingToFiles(CmpCommon::getDefault(TRAF_UNLOAD_SKIP_WRITING_TO_FILES)
== DF_ON);
tdb->setBypassLibhdfs(CmpCommon::getDefault(TRAF_UNLOAD_BYPASS_LIBHDFS) ==
DF_ON);
+
+ if ((hiveNAColArray) &&
+ (hiveInsertErrMode == 2))
+ {
+ tdb->setContinueOnError(TRUE);
+ }
+
generator->initTdbFields(tdb);
// Generate EXPLAIN info.
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/392c6088/core/sql/regress/hive/EXPECTED005
----------------------------------------------------------------------
diff --git a/core/sql/regress/hive/EXPECTED005
b/core/sql/regress/hive/EXPECTED005
index 0ad92b1..e2d51ae 100644
--- a/core/sql/regress/hive/EXPECTED005
+++ b/core/sql/regress/hive/EXPECTED005
@@ -2,6 +2,7 @@
>>set schema hive.hive;
--- SQL operation complete.
+>>
>>set terminal_charset utf8;
>>
>>cqd AUTO_QUERY_RETRY_WARNINGS 'ON';
@@ -16,6 +17,7 @@
>>cqd HIST_ROWCOUNT_REQUIRING_STATS '50000';
--- SQL operation complete.
+>>
>>------------------------------------------------------------
>>-- Testing query plan invalidation in the compiler, but
>>-- not the executor. Perform DML/DDL operations on a
@@ -548,16 +550,16 @@ C1 C2
>>select * from tbl_bad;
C1 C2 C3 C4
C5 C6 C7 C8
------------ -------------------- ------------------------- ---------------
------ -------------------------- ------------------------- ------
+----------- -------------------- ------------------------- ---------------
------ -------------------------- ------------------------- ----
- ? ? c ?
? ? ? ?
- ? ? c ?
? 2017-01-01 10:10:10.000000 1.01000000000000000E+000 1
- ? ? ?
? ? ? ?
- 1 1 averylongstring -1.0000000E+000
0 2017-01-01 10:10:10.000000 1.00010000000000000E+002 1
- 2 2 good 1.1000000E+000
2 2017-01-01 10:10:10.000000 2.00000000000000000E+002 100
- 3 3 good 1.0000000E+000
2 2017-01-01 10:10:10.000000 2.10000000000000000E+002 10
- ? 4294967295 good 3.3999999E+038
? 2017-01-01 10:10:10.000000 1.69999999999999968E+308 10
- 0 9999999999 bad ?
? ? ? ?
+ ? ? c ?
? ? ? ?
+ ? ? c ?
? 2017-01-01 10:10:10.000000 1.01000000000000000E+000 1
+ ? ? ?
? ? ? ?
+ 1 1 averylongstring -1.0000000E+000
0 2017-01-01 10:10:10.000000 1.00010000000000000E+002 1
+ 2 2 good 1.1000000E+000
2 2017-01-01 10:10:10.000000 2.00000000000000000E+002 100
+ 3 3 good 1.0000000E+000
2 2017-01-01 10:10:10.000000 2.10000000000000000E+002 10
+ ? 4294967295 good 3.3999999E+038
? 2017-01-01 10:10:10.000000 1.69999999999999968E+308 10
+ 0 9999999999 bad ?
? ? ? ?
--- 8 row(s) selected.
>>cqd HIVE_SCAN_SPECIAL_MODE reset;
@@ -809,7 +811,7 @@ t005part.a t005part.b t005part.c
*** ERROR[8442] Unable to access HDFS interface. Call to
ExpLOBInterfaceEmptyDirectory returned error LOB_DIR_NAME_ERROR(535). Error
detail 0.
-*** ERROR[8034] Truncation of hive table failed. Reason: specified partition
does not exist
+*** ERROR[8035] Truncation of hive table failed. Reason: specified partition
does not exist
--- SQL operation failed with errors.
>>
@@ -822,4 +824,159 @@ t005part.a t005part.b t005part.c
*** ERROR[8822] The statement was not prepared.
>>
+>>-- tests for hive insert error modes
+>>invoke hive.hive.thive_insert_smallint;
+
+-- Definition of hive table THIVE_INSERT_SMALLINT
+-- Definition current Wed Jun 22 18:14:29 2016
+
+ (
+ A SMALLINT
+ )
+ /* stored as textfile */
+
+--- SQL operation complete.
+>>showddl hive.hive.thive_insert_smallint;
+
+/* Hive DDL */
+CREATE TABLE THIVE_INSERT_SMALLINT
+ (
+ A smallint
+ )
+ stored as textfile
+;
+
+--- SQL operation complete.
+>>
+>>truncate hive.hive.thive_insert_smallint;
+
+--- SQL operation complete.
+>>cqd hive_insert_error_mode '0';
+
+--- SQL operation complete.
+>>insert into hive.hive.thive_insert_smallint values (10), (11111111), (21),
++> (22222222);
+
+--- 4 row(s) inserted.
+>>select * from hive.hive.thive_insert_smallint;
+
+A
+------
+
+ 10
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation
or data conversion. Conversion of Source Type:VARCHAR(REC_BYTE_V_ASCII,8
BYTES,ISO88591) Source Value:11111111 to Target Type:SMALLINT
SIGNED(REC_BIN16_SIGNED).
+
+--- 1 row(s) selected.
+>>
+>>truncate hive.hive.thive_insert_smallint;
+
+--- SQL operation complete.
+>>cqd hive_insert_error_mode '1';
+
+--- SQL operation complete.
+>>insert into hive.hive.thive_insert_smallint values (10), (11111111), (21),
++> (22222222);
+
+*** ERROR[8411] A numeric overflow occurred during an arithmetic computation
or data conversion. Source Type:INTEGER SIGNED(MBIN32S) Source Value:11111111
Target Type:LARGEINT(IBIN64S) Max Target Value:32767.
Instruction:RANGE_HIGH_S32S64 Operation:RANGE_HIGH.
+
+--- 0 row(s) inserted.
+>>select * from hive.hive.thive_insert_smallint;
+
+--- 0 row(s) selected.
+>>
+>>truncate hive.hive.thive_insert_smallint;
+
+--- SQL operation complete.
+>>cqd hive_insert_error_mode '2';
+
+--- SQL operation complete.
+>>insert into hive.hive.thive_insert_smallint values (10), (11111111), (21),
++> (22222222);
+
+--- 2 row(s) inserted.
+>>select * from hive.hive.thive_insert_smallint;
+
+A
+------
+
+ 10
+ 21
+
+--- 2 row(s) selected.
+>>
+>>truncate hive.hive.thive_insert_smallint;
+
+--- SQL operation complete.
+>>cqd hive_insert_error_mode '3';
+
+--- SQL operation complete.
+>>insert into hive.hive.thive_insert_smallint values (10), (11111111), (21),
++> (22222222);
+
+--- 4 row(s) inserted.
+>>select * from hive.hive.thive_insert_smallint;
+
+A
+------
+
+ 10
+ ?
+ 21
+ ?
+
+--- 4 row(s) selected.
+>>
+>>cqd hive_max_string_length_in_bytes '2';
+
+--- SQL operation complete.
+>>invoke hive.hive.thive_insert_varchar;
+
+-- Definition of hive table THIVE_INSERT_VARCHAR
+-- Definition current Wed Jun 22 18:14:36 2016
+
+ (
+ A VARCHAR(1 CHAR) CHARACTER SET UTF8 COLLATE
+ DEFAULT
+ , B VARCHAR(2 BYTES) CHARACTER SET UTF8
+ COLLATE DEFAULT
+ )
+ /* stored as textfile */
+
+--- SQL operation complete.
+>>showddl hive.hive.thive_insert_varchar;
+
+/* Hive DDL */
+CREATE TABLE THIVE_INSERT_VARCHAR
+ (
+ A varchar(1)
+ , B string
+ )
+ stored as textfile
+;
+
+--- SQL operation complete.
+>>cqd hive_insert_error_mode '1';
+
+--- SQL operation complete.
+>>truncate hive.hive.thive_insert_varchar;
+
+--- SQL operation complete.
+>>insert into hive.hive.thive_insert_varchar values ('abcddcba','efghijkl');
+
+--- 1 row(s) inserted.
+>>
+>>cqd hive_max_string_length_in_bytes '20';
+
+--- SQL operation complete.
+>>select * from hive.hive.thive_insert_varchar;
+
+A B
+---- --------------------
+
+abcd efghijkl
+
+--- 1 row(s) selected.
+>>
+>>
>>log;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/392c6088/core/sql/regress/hive/TEST005
----------------------------------------------------------------------
diff --git a/core/sql/regress/hive/TEST005 b/core/sql/regress/hive/TEST005
index a2402ce..cf1cd5c 100644
--- a/core/sql/regress/hive/TEST005
+++ b/core/sql/regress/hive/TEST005
@@ -46,6 +46,7 @@ sh regrhadoop.ksh fs -rm /user/hive/exttables/tbl_bad/*;
--- setup Hive tables
sh regrhive.ksh -v -f $REGRTSTDIR/TEST005_a.hive.sql;
+
sh regrhadoop.ksh fs -put $REGRTSTDIR/tbl_utf8.data
/user/hive/exttables/tbl_utf8;
sh regrhadoop.ksh fs -put $REGRTSTDIR/tbl_type.data
/user/hive/exttables/tbl_type;
sh regrhadoop.ksh fs -put $REGRTSTDIR/tbl_gbk.data
/user/hive/exttables/tbl_gbk;
@@ -56,12 +57,14 @@ sh regrhadoop.ksh fs -put $REGRTSTDIR/tbl_bad.data
/user/hive/exttables/tbl_bad;
log LOG005 clear;
set schema hive.hive;
+
set terminal_charset utf8;
cqd AUTO_QUERY_RETRY_WARNINGS 'ON';
cqd HIVE_MAX_STRING_LENGTH '25' ;
cqd mode_seahive 'ON';
cqd HIST_ROWCOUNT_REQUIRING_STATS '50000';
+
------------------------------------------------------------
-- Testing query plan invalidation in the compiler, but
-- not the executor. Perform DML/DDL operations on a
@@ -370,4 +373,43 @@ truncate hive.hive.t005part partition ('b=12');
-- should return error
purgedata hive.hive.thive;
+-- tests for hive insert error modes
+invoke hive.hive.thive_insert_smallint;
+showddl hive.hive.thive_insert_smallint;
+
+truncate hive.hive.thive_insert_smallint;
+cqd hive_insert_error_mode '0';
+insert into hive.hive.thive_insert_smallint values (10), (11111111), (21),
+ (22222222);
+select * from hive.hive.thive_insert_smallint;
+
+truncate hive.hive.thive_insert_smallint;
+cqd hive_insert_error_mode '1';
+insert into hive.hive.thive_insert_smallint values (10), (11111111), (21),
+ (22222222);
+select * from hive.hive.thive_insert_smallint;
+
+truncate hive.hive.thive_insert_smallint;
+cqd hive_insert_error_mode '2';
+insert into hive.hive.thive_insert_smallint values (10), (11111111), (21),
+ (22222222);
+select * from hive.hive.thive_insert_smallint;
+
+truncate hive.hive.thive_insert_smallint;
+cqd hive_insert_error_mode '3';
+insert into hive.hive.thive_insert_smallint values (10), (11111111), (21),
+ (22222222);
+select * from hive.hive.thive_insert_smallint;
+
+cqd hive_max_string_length_in_bytes '2';
+invoke hive.hive.thive_insert_varchar;
+showddl hive.hive.thive_insert_varchar;
+cqd hive_insert_error_mode '1';
+truncate hive.hive.thive_insert_varchar;
+insert into hive.hive.thive_insert_varchar values ('abcddcba','efghijkl');
+
+cqd hive_max_string_length_in_bytes '20';
+select * from hive.hive.thive_insert_varchar;
+
+
log;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/392c6088/core/sql/regress/hive/TEST005_a.hive.sql
----------------------------------------------------------------------
diff --git a/core/sql/regress/hive/TEST005_a.hive.sql
b/core/sql/regress/hive/TEST005_a.hive.sql
index ebdbdff..b151a79 100644
--- a/core/sql/regress/hive/TEST005_a.hive.sql
+++ b/core/sql/regress/hive/TEST005_a.hive.sql
@@ -201,3 +201,10 @@ ROW FORMAT DELIMITED
FIELDS TERMINATED BY '|'
LOCATION
'/user/hive/exttables/tbl_bad';
+
+drop table thive_insert_smallint;
+create table thive_insert_smallint (a smallint);
+drop table thive_insert_varchar;
+create table thive_insert_varchar (a varchar(1), b string);
+
+
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/392c6088/core/sql/regress/seabase/EXPECTED011
----------------------------------------------------------------------
diff --git a/core/sql/regress/seabase/EXPECTED011
b/core/sql/regress/seabase/EXPECTED011
index 3afc2ae..16b1055 100644
--- a/core/sql/regress/seabase/EXPECTED011
+++ b/core/sql/regress/seabase/EXPECTED011
@@ -1249,7 +1249,7 @@ a bbbbbbbbbb c
dddd
>>-- negative test
>>create table t011t5 (a char(200000), b varchar(200000), c char(200000 bytes)
>>character set utf8, d varchar(1000001 bytes) character set utf8);
-*** ERROR[4247] Specified size in bytes (1000001) exceeds the maximum size
allowed (1000000) for column D.
+*** ERROR[4247] Specified size in bytes (1000001) exceeds the maximum size
allowed (200000) for column D.
--- SQL operation failed with errors.
>>
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/392c6088/core/sql/sqlcomp/DefaultConstants.h
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/DefaultConstants.h
b/core/sql/sqlcomp/DefaultConstants.h
index 0dfaeeb..5776a00 100644
--- a/core/sql/sqlcomp/DefaultConstants.h
+++ b/core/sql/sqlcomp/DefaultConstants.h
@@ -3833,6 +3833,15 @@ enum DefaultConstants
// use info from external table created on this hive table
HIVE_USE_EXT_TABLE_ATTRS,
+ // if 0, datatype error check is not done during inserts into hive tables.
+ // Invalid values may get inserted.
+ // if 1, error check done, row is not inserted if conversion error,
+ // and further processing stops.
+ // if 2, error check done, row is not inserted if conversion error,
+ // and further processing continues.
+ // if 3, null inserted if conversion error, and processing continues.
+ HIVE_INSERT_ERROR_MODE,
+
// This enum constant must be the LAST one in the list; it's a count,
// not an Attribute (it's not IN DefaultDefaults; it's the SIZE of it)!
__NUM_DEFAULT_ATTRIBUTES
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/392c6088/core/sql/sqlcomp/DefaultValidator.cpp
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/DefaultValidator.cpp
b/core/sql/sqlcomp/DefaultValidator.cpp
index c167dbb..425ecf4 100644
--- a/core/sql/sqlcomp/DefaultValidator.cpp
+++ b/core/sql/sqlcomp/DefaultValidator.cpp
@@ -706,6 +706,21 @@ Int32 ValidateNumericRange::validate( const char *value,
sprintf(minbuf, "%g", min_);
sprintf(maxbuf, "%g", max_);
}
+
+ switch (attrEnum)
+ {
+ case HIVE_INSERT_ERROR_MODE:
+ {
+ sprintf(minbuf, "%u", 0);
+ sprintf(maxbuf, "%u", 3);
+ }
+ break;
+ default:
+ {
+ // do nothing
+ }
+ }
+
NAString range = NAString("[") + minbuf + "," + maxbuf + "]";
*CmpCommon::diags() << DgSqlCode(ERRWARN(2056)) << DgString0(range);
}
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/392c6088/core/sql/sqlcomp/nadefaults.cpp
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/nadefaults.cpp b/core/sql/sqlcomp/nadefaults.cpp
index c77b954..7b139cd 100644
--- a/core/sql/sqlcomp/nadefaults.cpp
+++ b/core/sql/sqlcomp/nadefaults.cpp
@@ -1961,6 +1961,7 @@ SDDkwd__(EXE_DIAGNOSTIC_EVENTS, "OFF"),
DD_____(HIVE_FILE_CHARSET, ""),
DD_____(HIVE_FILE_NAME, "/hive/tpcds/customer/customer.dat" ),
DD_____(HIVE_HDFS_STATS_LOG_FILE, ""),
+ DDui___(HIVE_INSERT_ERROR_MODE, "1"),
DDint__(HIVE_LIB_HDFS_PORT_OVERRIDE, "-1"),
DDint__(HIVE_LOCALITY_BALANCE_LEVEL, "0"),
DDui___(HIVE_MAX_ESPS, "9999"),
@@ -4825,7 +4826,21 @@ Int32 NADefaults::validateFloat(const char *value, float
&result,
{
Int32 n = -1; // NT's scanf("%n") is not quite correct; hence this
code-around
sscanf(value, "%g%n", &result, &n);
- if (n > 0 && value[n] == '\0') return TRUE; // a valid float
+ if (n > 0 && value[n] == '\0')
+ {
+ switch (attrEnum)
+ {
+ case HIVE_INSERT_ERROR_MODE:
+ {
+ Lng32 v = str_atoi(value, str_len(value));
+ if (v >= 0 && v <= 3)
+ return TRUE;
+ }
+ break;
+ default:
+ return TRUE; // a valid float
+ }
+ }
NAString v(value);
NABoolean silentIf = (errOrWarn == SilentIfSYSTEM);
@@ -6578,12 +6593,13 @@ DefaultToken NADefaults::token(Int32 attrEnum,
case '3': return DF_MAXIMUM;
}
// HBASE_FILTER_PREDS
- if ((attrEnum == HBASE_FILTER_PREDS) && value.length()==1)
+ if ((attrEnum == HBASE_FILTER_PREDS) && value.length()==1)
switch (*value.data()){
case '0': return DF_OFF;
case '1': return DF_MINIMUM;
case '2': return DF_MEDIUM;
- // in the future add DF_HIGH and DF_MAXIMUM when we implement more
pushdown capabilities
+ // in the future add DF_HIGH and DF_MAXIMUM when we implement more
+ // pushdown capabilities
}
if ( attrEnum == TEMPORARY_TABLE_HASH_PARTITIONS ||
attrEnum == MVQR_REWRITE_CANDIDATES ||