[ 
https://issues.apache.org/jira/browse/PIG-4046?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Shinichi Yamashita updated PIG-4046:
------------------------------------
    Status: Patch Available  (was: Open)

> 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
>         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)

Reply via email to