[
https://issues.apache.org/jira/browse/ORC-163?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15928722#comment-15928722
]
Douglas Drinka edited comment on ORC-163 at 3/16/17 7:48 PM:
-------------------------------------------------------------
Here's the java reader code:
{code:title=TreeReaderFactory.java|borderStyle=solid}
private static int parseNanos(long serialized) {
int zeros = 7 & (int) serialized;
int result = (int) (serialized >>> 3);
if (zeros != 0) {
for (int i = 0; i <= zeros; ++i) {
result *= 10;
}
}
return result;
}
{code}
That i<=zeros means 1 is times 100, 2 is times 1000, which matches the java
writer.
was (Author: ddrinka):
Here's the java reader code:
{code:title=TreeReaderFactory.java|borderStyle=solid}
private static int parseNanos(long serialized) {
int zeros = 7 & (int) serialized;
int result = (int) (serialized >>> 3);
if (zeros != 0) {
for (int i = 0; i <= zeros; ++i) {
result *= 10;
}
}
return result;
}
{code}
> Timestamp problems in java tools
> --------------------------------
>
> Key: ORC-163
> URL: https://issues.apache.org/jira/browse/ORC-163
> Project: ORC
> Issue Type: Bug
> Components: Java, tools
> Reporter: Douglas Drinka
>
> I'll keep digging in the source as to what's happening here, but something is
> wrong with nanoseconds in java.
> Take a timestamp `03/16/2017 12:03:31.4319875+00`.
> That's 69552211 seconds and 431987500 nanoseconds, which is serialized as
> 34559002.
> C++ orc-contents prints it as ` "Timestamp": "2017-03-16 00:03:31.4319875"`
> Java "orc-tools data" prints it as `"Timestamp":"2017-03-16
> 00:03:31.024907704"` and then crashes after a few rows.
> Additionally, "orc-tools meta" is giving me dates in the 1970s for the
> statistics.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)