Timothy Friest created PIG-4046:
-----------------------------------
Summary: PiggyBank DBStorage DATETIME should use setTimestamp with
java.sql.Timestamp
Key: PIG-4046
URL: https://issues.apache.org/jira/browse/PIG-4046
Project: Pig
Issue Type: Bug
Components: piggybank
Affects Versions: 0.12.1
Environment: CentOS 6.5
Reporter: Timothy Friest
Priority: Minor
In Pig 0.12.1 PiggyBank DBStorage
(contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/storage/DBStorage.java),
the code uses the wrong setter and Java data type for the SQL DATETIME
datatype.
DATETIME has both date and time, so should use java.sql.Timestamp instead of
java.sql.Date (which zeros the time fields).
replace line 121
case DataType.DATETIME:
- ps.setDate(sqlPos, new Date(((DateTime) field).getMillis()));
sqlPos++;
break;
with
case DataType.DATETIME:
+ ps.setTimestamp(sqlPos, new Timestamp(((DateTime) field).getMillis(
)));
sqlPos++;
break;
--
This message was sent by Atlassian JIRA
(v6.2#6252)