Package org.apache.iceberg.util
Class LocationUtil
java.lang.Object
org.apache.iceberg.util.LocationUtil
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanReturns true if the location contains a URI scheme (e.g.static StringrelativizeLocation(String tableLocation, String location) Relativizes a location against a table location.static StringresolveLocation(String tableLocation, String location) Resolves a location against a table location.static StringstripTrailingSlash(String path) static StringtableLocation(TableIdentifier tableIdentifier, boolean useUniqueLocation) Returns a path component derived from thetableIdentifier, used as part of the table location URI.
-
Field Details
-
PATH_SEPARATOR
- See Also:
-
-
Method Details
-
stripTrailingSlash
-
tableLocation
Returns a path component derived from thetableIdentifier, used as part of the table location URI.If
useUniqueLocationistrue, the returned component will include a random UUID suffix. Otherwise, the plain table name is returned.- Parameters:
tableIdentifier- Iceberg table identifieruseUniqueLocation- whether to ensure uniqueness- Returns:
- a string representing the table name component for a location URI
-
hasScheme
Returns true if the location contains a URI scheme (e.g.s3:,hdfs:,file:), per RFC 3986 section 3.1. -
resolveLocation
Resolves a location against a table location. If the location has a URI scheme, it is returned as-is. Otherwise, the table location and the relative location are joined by the URI separator character/.The separator is appended unconditionally;
tableLocationis expected not to end with/andlocationis expected not to start with/. Otherwise the result will contain a duplicate//. -
relativizeLocation
Relativizes a location against a table location. If the location starts with the table location immediately followed by the URI separator character/, the prefix and separator are removed and the remaining relative portion is returned. Otherwise, the location is returned as-is.tableLocationis expected not to end with/. A trailing separator on the table location will cause locations that would otherwise match to be returned unchanged.
-