You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-issues@hadoop.apache.org by "Qi Liu (JIRA)" <ji...@apache.org> on 2010/03/03 20:14:27 UTC

[jira] Commented: (HDFS-246) Add a method to get file length for Seekable, FSDataInputStream and libhdfs

    [ https://issues.apache.org/jira/browse/HDFS-246?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12840814#action_12840814 ] 

Qi Liu commented on HDFS-246:
-----------------------------

I believe HDFS-814 is not good for general application use. DFSDataInputStream is a concrete sub-class while FSDataInputStream is an abstract parent class. FileSystem.open returns an instance of FSDataInputStream instead of DFSDataInputStream. Explicitly cast FSDataInputStream to DFSDataInputStream is simply not safe. What if in future or in some cases, FileSystem.open returns an instance other than DFSDataInputStream? I still believe the proper way to implement this would be adding a public method to FSDataInputStream abstract class, and add such method to all implementations.

> Add a method to get file length for Seekable, FSDataInputStream and libhdfs
> ---------------------------------------------------------------------------
>
>                 Key: HDFS-246
>                 URL: https://issues.apache.org/jira/browse/HDFS-246
>             Project: Hadoop HDFS
>          Issue Type: New Feature
>            Reporter: Qi Liu
>            Assignee: Qi Liu
>             Fix For: 0.22.0
>
>         Attachments: HADOOP-5143-2.patch, HADOOP-5143.patch, hadoop.patch
>
>
> When open any seekable file, it should be able to get the length of the file via Seekable interface, since the seek method should be able to detect seeking beyond the end of file. Such interface can benefit distributed file systems by saving a network round-trip of FileSystem.getFileStatus(Path).getLen() for any open file.
> In libhdfs, such interface should also be exposed to make native program taking advantage of this change.
> I have the changes locally for all FSInputStream concrete classes. The change can be considered trivial, since some of the FSInputStream classes already have a method named getFileLength(), or a member field named size/length/end.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.