You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pig.apache.org by "Adam Szita (JIRA)" <ji...@apache.org> on 2017/02/02 16:38:52 UTC

[jira] [Commented] (PIG-4748) DateTimeWritable forgets Chronology

    [ https://issues.apache.org/jira/browse/PIG-4748?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15850147#comment-15850147 ] 

Adam Szita commented on PIG-4748:
---------------------------------

I upgraded the patch for this, see [^PIG-4748.2.patch].
DateTimeWritables now write (long,int,int) corresponding to the DateTime instant (millis), offsetInMillis, position in the zone ID list respectively.
Zone list itself is carried along to backends via JobConf. For some inputs we can only rely on offsetInMillis (e.g. +01:00), on others we rely on ZoneID (e.g. America/Los_Angeles).

> DateTimeWritable forgets Chronology
> -----------------------------------
>
>                 Key: PIG-4748
>                 URL: https://issues.apache.org/jira/browse/PIG-4748
>             Project: Pig
>          Issue Type: Bug
>          Components: impl
>    Affects Versions: 0.16.0
>            Reporter: Martin Junghanns
>            Assignee: Adam Szita
>             Fix For: 0.17.0
>
>         Attachments: PIG-4748.2.patch, PIG-4748.patch
>
>
> The following test fails:
> {code}
> @Test
> public void foo() throws IOException {
>     DateTime nowIn = DateTime.now();
>     DateTimeWritable in = new DateTimeWritable(nowIn);
>     ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
>     DataOutputStream dataOut = new DataOutputStream(outputStream);
>     in.write(dataOut);
>     dataOut.flush();
>     // read from byte[]
>     DateTimeWritable out = new DateTimeWritable();
>     ByteArrayInputStream inputStream = new ByteArrayInputStream(
>       outputStream.toByteArray());
>     DataInputStream dataIn = new DataInputStream(inputStream);
>     out.readFields(dataIn);
>     assertEquals(in.get(), out.get());
> }
> {code}
> In equals(), the original instance has
> {code}
> ISOChronology[Europe/Berlin]
> {code}
> while the deserialized instance has
> {code}
> ISOChronology[+01:00]
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)