[
https://issues.apache.org/jira/browse/AVRO-1710?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15945587#comment-15945587
]
Cliff Sun commented on AVRO-1710:
---------------------------------
I've seen this 'issue' in the 1.8.1 too. Since there hasn't been any activity
on it in a while I'm not sure if the developers see this as a bug. If not, I do
think the documentation should be updated to mention that it returns a relative
position (rather than absolute).
The good thing is that the position returned by sync() simply just returns the
relative byte position in the file. If you have access to the file itself and
you've used appendTo (to append to an existing Avro file) you can just do a
combination of file.length() + position (the value returned by sync) to get the
absolute position.
We use this for indexing so we can do fast lookups on the data file later on.
> sync() returns wrong value if DataFileWriter.appendTo() is used to initialize
> the DataFileWriter
> ------------------------------------------------------------------------------------------------
>
> Key: AVRO-1710
> URL: https://issues.apache.org/jira/browse/AVRO-1710
> Project: Avro
> Issue Type: Bug
> Components: java
> Affects Versions: 1.7.7
> Reporter: Christopher Ng
> Labels: starter
>
> If you append to an existing file using DataFileWriter.appendTo(), sync()
> returns the wrong values as it doesn't take into account the position in the
> existing file.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)