public static String getPathWithoutScheme(Path path) {
    return path.toUri().getPath();
  }
@Test
  public void testGetPathWithoutSchemaFromHDFSURI() {
    final Path path = new Path(URI.create("hdfs://localhost:1234/foo/bar/baz?please=dont&show=up"));

    final String output = HadoopUtils.getPathWithoutScheme(path);
    assertEquals("/foo/bar/baz", output);
  }