damiencarol/jsr203-hadoop

Relative Path Handling

Closed this issue · 3 comments

I'm opening this issue for discussion purposes.

I started writing some tests related to relative paths, and the behavior is unexpected. Then I stumbled on this line of code in HadoopPath.toAbsolutePath:

            byte[] defaultdir = "/".getBytes(); //this.hdfs.getDefaultDir().path;

This led me to believe that handling of relative paths hadn't been addressed yet. After doing some reading on the jsr203 API and looking at the hadoop FileSystem API, I think that getDefaultDir() should be implemented something like this:

    HadoopPath getDefaultDir() {
        // TODO : add charset management
        // TODO: simplify getting bytes from the working directory path
        return new HadoopPath(this, this.fs.getWorkingDirectory().toUri().getPath().getBytes());
    }

Thoughts?

Need to check something again before make a comment.

I found an annoying bug that breaks relativize/resolve methods: #7
I think it's the reason why you had some strange behavior with relative paths.
#7 is fixed now.

Also @jbunting could you describe some use cases?

Closing this after no feedback.

@jbunting feel free to open a new issue if you have the same pb again.