Class MetadataPathUtils
java.lang.Object
org.apache.drill.exec.store.parquet.metadata.MetadataPathUtils
Util class that contains helper methods for converting paths in the table and directory metadata structures
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
checkForMetadataFile
(String basePath, String table) Helper method for checking the metadata file existencestatic List<org.apache.hadoop.fs.Path>
convertToAbsolutePaths
(List<org.apache.hadoop.fs.Path> paths, String baseDir) Helper method that converts a list of relative paths to absolute onesstatic List<? extends MetadataBase.ParquetFileMetadata>
convertToFilesWithAbsolutePaths
(List<? extends MetadataBase.ParquetFileMetadata> files, String baseDir) Convert a list of files with relative paths to files with absolute onescreateMetadataWithRelativePaths
(Metadata_V4.ParquetTableMetadata_v4 tableMetadataWithAbsolutePaths, org.apache.hadoop.fs.Path baseDir) Creates a new parquet table metadata from thetableMetadataWithAbsolutePaths
parquet table.static org.apache.hadoop.fs.Path
relativize
(org.apache.hadoop.fs.Path baseDir, org.apache.hadoop.fs.Path childPath) Constructs relative path from child full path and base path.
-
Constructor Details
-
MetadataPathUtils
public MetadataPathUtils()
-
-
Method Details
-
convertToAbsolutePaths
public static List<org.apache.hadoop.fs.Path> convertToAbsolutePaths(List<org.apache.hadoop.fs.Path> paths, String baseDir) Helper method that converts a list of relative paths to absolute ones- Parameters:
paths
- list of relative pathsbaseDir
- base parent directory- Returns:
- list of absolute paths
-
convertToFilesWithAbsolutePaths
public static List<? extends MetadataBase.ParquetFileMetadata> convertToFilesWithAbsolutePaths(List<? extends MetadataBase.ParquetFileMetadata> files, String baseDir) Convert a list of files with relative paths to files with absolute ones- Parameters:
files
- list of files with relative pathsbaseDir
- base parent directory- Returns:
- list of files with absolute paths
-
createMetadataWithRelativePaths
public static Metadata_V4.ParquetTableMetadata_v4 createMetadataWithRelativePaths(Metadata_V4.ParquetTableMetadata_v4 tableMetadataWithAbsolutePaths, org.apache.hadoop.fs.Path baseDir) Creates a new parquet table metadata from thetableMetadataWithAbsolutePaths
parquet table. A new parquet table will contain relative paths for the files and directories.- Parameters:
tableMetadataWithAbsolutePaths
- parquet table metadata with absolute paths for the files and directoriesbaseDir
- base parent directory- Returns:
- parquet table metadata with relative paths for the files and directories
-
relativize
public static org.apache.hadoop.fs.Path relativize(org.apache.hadoop.fs.Path baseDir, org.apache.hadoop.fs.Path childPath) Constructs relative path from child full path and base path. Or return child path if the last one is already relative- Parameters:
childPath
- full absolute pathbaseDir
- base path (the part of the Path, which should be cut off from child path)- Returns:
- relative path
-
checkForMetadataFile
Helper method for checking the metadata file existence- Parameters:
basePath
- base path containing tables to be checked for metadata filestable
- table name or table path
-