[
https://issues.apache.org/jira/browse/PIG-4046?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Daniel Dai updated PIG-4046:
----------------------------
Resolution: Fixed
Fix Version/s: 0.14.0
Assignee: Shinichi Yamashita
Hadoop Flags: Reviewed
Status: Resolved (was: Patch Available)
Patch committed to trunk. Thanks Shinichi, Timothy!
> 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
> Assignee: Shinichi Yamashita
> Priority: Minor
> Fix For: 0.14.0
>
> Attachments: PIG-4046.001.patch
>
>
> 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.3.4#6332)