public final class MagicCommitPaths extends Object
Modifier and Type | Method and Description |
---|---|
static List<String> |
basePathChildren(List<String> elements)
Get any child path elements under any
__base path,
or an empty list if there is either: no __base path element,
or no child entries under it. |
static boolean |
containsBasePath(List<String> elements)
Does the list of magic elements contain a base path marker?
|
static String |
elementsToKey(List<String> elements)
Take a list of elements and create an S3 key by joining them
with "/" between each one.
|
static String |
filename(List<String> elements)
Get the filename of a path: the last element.
|
static List<String> |
finalDestination(List<String> elements)
Calculates the final destination of a file.
|
static boolean |
isMagicPath(List<String> elements)
Is a path in the magic tree?
|
static String |
lastElement(List<String> strings)
Last element of a (non-empty) list.
|
static int |
magicElementIndex(List<String> elements)
Get the index of the magic path element.
|
static List<String> |
magicPathChildren(List<String> elements)
Get the child path elements under the magic path.
|
static List<String> |
magicPathParents(List<String> elements)
Get the parent path elements of the magic path.
|
static org.apache.hadoop.fs.Path |
magicSubdir(org.apache.hadoop.fs.Path destDir)
Get the magic subdirectory of a destination directory.
|
static List<String> |
splitPathToElements(org.apache.hadoop.fs.Path path)
Take an absolute path, split it into a list of elements.
|
public static List<String> splitPathToElements(org.apache.hadoop.fs.Path path)
path
- input pathIllegalArgumentException
- if the path is invalid -relative, empty...public static boolean isMagicPath(List<String> elements)
elements
- element listpublic static boolean containsBasePath(List<String> elements)
elements
- element list, already stripped out
from the magic tree.public static int magicElementIndex(List<String> elements)
elements
- full path element listIllegalArgumentException
- if there is no magic elementpublic static List<String> magicPathParents(List<String> elements)
elements
- full path element listpublic static List<String> magicPathChildren(List<String> elements)
elements
- full path element listpublic static List<String> basePathChildren(List<String> elements)
__base
path,
or an empty list if there is either: no __base
path element,
or no child entries under it.
The list may be immutable or may be a view of the underlying list.
Both the parameter list and the returned list MUST NOT be modified.elements
- full path element listpublic static String elementsToKey(List<String> elements)
elements
- path elementspublic static String filename(List<String> elements)
elements
- element list.public static String lastElement(List<String> strings)
strings
- strings inpublic static org.apache.hadoop.fs.Path magicSubdir(org.apache.hadoop.fs.Path destDir)
destDir
- the destination directorypublic static List<String> finalDestination(List<String> elements)
__magic
element, and the filename
of the path. That is: all intermediate child path elements are discarded.
Why so? paths under the magic path include job attempt and task attempt
subdirectories, which need to be skipped.
If there is a __base
directory in the children, then it becomes
a base for unflattened paths, that is: all its children are pulled into
the final destination.elements
- element list.Copyright © 2008–2020 Apache Software Foundation. All rights reserved.