public final class LocationUtils extends Object
Path objects:
A Path fetched from the hive metastore are assumed stored encoded e.g.:
table.getSd().getLocation() partition.getSd().getLocation() Will have url encoded string, e.g. /folder/a_percent_%25_encoded/Strings that are encoded can be turned into a Path like this:
new Path(String). Calling
new Path(String).toUri() on such a path will return a double encoded URI.
Calling new Path(String).toString() on such a path will return the correct path representation(single
encoded).
The Hadoop DistributedFileSystem expects to have a double encoded URI as it does
path.toURI().getPath() to get the unencoded path (without scheme) back. For all our purposes in Circus
Train code we can always create Paths with the new Path(String) constructor. We can get the string
representation back by calling path.toString().
| Modifier and Type | Method and Description |
|---|---|
static boolean |
hasLocation(org.apache.hadoop.hive.metastore.api.Partition partition) |
static boolean |
hasLocation(org.apache.hadoop.hive.metastore.api.Table table) |
static org.apache.hadoop.fs.Path |
locationAsPath(org.apache.hadoop.hive.metastore.api.Partition partition) |
static org.apache.hadoop.fs.Path |
locationAsPath(org.apache.hadoop.hive.metastore.api.Table table) |
static URI |
locationAsUri(org.apache.hadoop.hive.metastore.api.Partition partition) |
static URI |
locationAsUri(org.apache.hadoop.hive.metastore.api.Table table) |
public static boolean hasLocation(org.apache.hadoop.hive.metastore.api.Table table)
table - true if the table has location, false otherwisepublic static boolean hasLocation(org.apache.hadoop.hive.metastore.api.Partition partition)
partition - true if the partition has location, false otherwisepublic static URI locationAsUri(org.apache.hadoop.hive.metastore.api.Table table)
table - URI (correctly URL encoded)public static URI locationAsUri(org.apache.hadoop.hive.metastore.api.Partition partition)
partition - URI (correctly URL encoded)public static org.apache.hadoop.fs.Path locationAsPath(org.apache.hadoop.hive.metastore.api.Table table)
table - Path (correctly URL encoded)public static org.apache.hadoop.fs.Path locationAsPath(org.apache.hadoop.hive.metastore.api.Partition partition)
partition - Path (correctly URL encoded)Copyright © 2018–2020 Hotels.com (Data Platform Team). All rights reserved.