@Test void getTablePathFromFilePath() throws IOException { Option<Path> inferredTablePath = TablePathUtils.getTablePath(fs, filePath1); assertEquals(tablePath, inferredTablePath.get()); inferredTablePath = TablePathUtils.getTablePath(fs, filePath2); assertEquals(tablePath, inferredTablePath.get()); }
public static Option<Path> getTablePath(FileSystem fs, Path path) throws HoodieException, IOException { LOG.info("Getting table path from path : " + path); FileStatus fileStatus = fs.getFileStatus(path); Path directory = fileStatus.isFile() ? fileStatus.getPath().getParent() : fileStatus.getPath(); if (TablePathUtils.hasTableMetadataFolder(fs, directory)) { return Option.of(directory); } Option<Path> tablePath = getTablePathFromTableMetadataPath(fs, directory); if (tablePath.isPresent()) { return tablePath; } return getTablePathFromPartitionPath(fs, directory); }
TablePathUtils { public static Option<Path> getTablePath(FileSystem fs, Path path) throws HoodieException, IOException { LOG.info("Getting table path from path : " + path); FileStatus fileStatus = fs.getFileStatus(path); Path directory = fileStatus.isFile() ? fileStatus.getPath().getParent() : fileStatus.getPath(); if (TablePathUtils.hasTableMetadataFolder(fs, directory)) { return Option.of(directory); } Option<Path> tablePath = getTablePathFromTableMetadataPath(fs, directory); if (tablePath.isPresent()) { return tablePath; } return getTablePathFromPartitionPath(fs, directory); } }
TablePathUtils { public static Option<Path> getTablePath(FileSystem fs, Path path) throws HoodieException, IOException { LOG.info("Getting table path from path : " + path); FileStatus fileStatus = fs.getFileStatus(path); Path directory = fileStatus.isFile() ? fileStatus.getPath().getParent() : fileStatus.getPath(); if (TablePathUtils.hasTableMetadataFolder(fs, directory)) { return Option.of(directory); } Option<Path> tablePath = getTablePathFromTableMetadataPath(fs, directory); if (tablePath.isPresent()) { return tablePath; } return getTablePathFromPartitionPath(fs, directory); }  }
TablePathUtils { public static Option<Path> getTablePath(FileSystem fs, Path path) throws HoodieException, IOException { LOG.info("Getting table path from path : " + path); FileStatus fileStatus = fs.getFileStatus(path); Path directory = fileStatus.isFile() ? fileStatus.getPath().getParent() : fileStatus.getPath(); if (TablePathUtils.hasTableMetadataFolder(fs, directory)) { return Option.of(directory); } Option<Path> tablePath = getTablePathFromTableMetadataPath(fs, directory); if (tablePath.isPresent()) { return tablePath; } return getTablePathFromPartitionPath(fs, directory); }  static Option<Path> getTablePath(FileSystem fs, Path path); }
TablePathUtils { public static Option<Path> getTablePath(FileSystem fs, Path path) throws HoodieException, IOException { LOG.info("Getting table path from path : " + path); FileStatus fileStatus = fs.getFileStatus(path); Path directory = fileStatus.isFile() ? fileStatus.getPath().getParent() : fileStatus.getPath(); if (TablePathUtils.hasTableMetadataFolder(fs, directory)) { return Option.of(directory); } Option<Path> tablePath = getTablePathFromTableMetadataPath(fs, directory); if (tablePath.isPresent()) { return tablePath; } return getTablePathFromPartitionPath(fs, directory); }  static Option<Path> getTablePath(FileSystem fs, Path path);  }