You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by db...@apache.org on 2016/02/23 00:48:56 UTC
[4/5] incubator-trafodion git commit: JIRA TRAFODION-1825. Fix for
core caused by input datetime values.
JIRA TRAFODION-1825. Fix for core caused by input datetime values.
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/44fb4f56
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/44fb4f56
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/44fb4f56
Branch: refs/heads/master
Commit: 44fb4f562fc98e274c0a7d30fd6fba7b7b0737ca
Parents: 152367d
Author: Cloud User <ce...@ansharma-3.novalocal>
Authored: Fri Feb 19 15:31:30 2016 +0000
Committer: Cloud User <ce...@ansharma-3.novalocal>
Committed: Fri Feb 19 15:31:30 2016 +0000
----------------------------------------------------------------------
core/sql/cli/CliExpExchange.cpp | 2 +
core/sql/exp/exp_datetime.cpp | 30 +-
core/sql/regress/executor/EXPECTED022.LINUX | 9365 ---------------------
core/sql/regress/executor/EXPECTED022.SB | 9467 ++++++++++++++++++++++
core/sql/regress/executor/TEST022 | 12 +
core/sql/sqlci/Param.cpp | 8 +-
core/sql/sqlci/SqlCmd.cpp | 37 +-
7 files changed, 9535 insertions(+), 9386 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/44fb4f56/core/sql/cli/CliExpExchange.cpp
----------------------------------------------------------------------
diff --git a/core/sql/cli/CliExpExchange.cpp b/core/sql/cli/CliExpExchange.cpp
index 24853a3..b313040 100644
--- a/core/sql/cli/CliExpExchange.cpp
+++ b/core/sql/cli/CliExpExchange.cpp
@@ -4095,6 +4095,8 @@ InputOutputExpr::inputValues(atp_struct *atp,
sourceType = REC_BYTE_F_ASCII;
sourcePrecision = 0; // TBD $$$$ add source max chars later
sourceScale = SQLCHARSETCODE_ISO88591; // assume target charset is ASCII-compatible
+
+ convFlags |= CONV_NO_HADOOP_DATE_FIX;
}
}
else if ((sourceType == targetType) &&
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/44fb4f56/core/sql/exp/exp_datetime.cpp
----------------------------------------------------------------------
diff --git a/core/sql/exp/exp_datetime.cpp b/core/sql/exp/exp_datetime.cpp
index a1cff3c..781f2dd 100644
--- a/core/sql/exp/exp_datetime.cpp
+++ b/core/sql/exp/exp_datetime.cpp
@@ -1759,6 +1759,7 @@ scanField(char *&src,
ULng32 flags)
{
NABoolean noDatetimeValidation = (flags & CONV_NO_DATETIME_VALIDATION) != 0;
+ NABoolean noHadoopDateFix = (flags & CONV_NO_HADOOP_DATE_FIX) != 0;
// The maximum lengths of the various fields. Since the value of
// REC_DATE_YEAR is 1, the first entry is just a place holder.
@@ -1846,10 +1847,17 @@ scanField(char *&src,
//
if (len < maxLens[field] && field != REC_DATE_FRACTION_MP) {
- // An unknown character was encountered in the string.
- //
- ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_STRING_ERROR);
- return FALSE;
+ if ((NOT noHadoopDateFix) &&
+ (field >= REC_DATE_HOUR)) {
+ // extend with zeroes
+ value = 0;
+ }
+ else {
+ // An unknown character was encountered in the string.
+ //
+ ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_STRING_ERROR);
+ return FALSE;
+ }
} else if (src < srcEnd && isDigit8859_1(*src)) {
return FALSE;
}
@@ -1879,7 +1887,6 @@ ExpDatetime::convAsciiToDatetime(char *srcData,
{
NABoolean noDatetimeValidation = (flags & CONV_NO_DATETIME_VALIDATION) != 0;
- NABoolean noHadoopDateFix = (flags & CONV_NO_HADOOP_DATE_FIX) != 0;
// skip leading and trailing blanks and adjust srcData and srcLen
// accordingly
@@ -1908,19 +1915,6 @@ ExpDatetime::convAsciiToDatetime(char *srcData,
srcLen--;
}
- char hadoopDateFix[20];
- if ((srcLen == 10) &&
- (NOT noHadoopDateFix))
- {
- memcpy(hadoopDateFix, srcData, 10);
- hadoopDateFix[10] = '\0';
- strcat(hadoopDateFix, " 00:00:00");
- srcLen = 19;
- srcData = hadoopDateFix;
-
- dstEndField = REC_DATE_SECOND;
- }
-
// Indicates if an " AM" or " PM" strings appears at the end of the
// source.
// 0 - means no AM/PM indicator