marvinlanhenke commented on code in PR #285:
URL: https://github.com/apache/iceberg-rust/pull/285#discussion_r1531800011
##########
crates/catalog/hms/src/utils.rs:
##########
@@ -183,6 +227,65 @@ pub(crate) fn validate_namespace(namespace:
&NamespaceIdent) -> Result<String> {
Ok(name)
}
+/// Get default table location from `Namespace` properties
+pub(crate) fn get_default_table_location(
+ namespace: &Namespace,
+ table_name: impl AsRef<str> + Display,
Review Comment:
fixed
##########
crates/catalog/hms/src/utils.rs:
##########
@@ -183,6 +227,65 @@ pub(crate) fn validate_namespace(namespace:
&NamespaceIdent) -> Result<String> {
Ok(name)
}
+/// Get default table location from `Namespace` properties
+pub(crate) fn get_default_table_location(
+ namespace: &Namespace,
+ table_name: impl AsRef<str> + Display,
+) -> Result<String> {
+ let properties = namespace.properties();
+ properties
+ .get(LOCATION)
+ .or_else(|| properties.get(WAREHOUSE_LOCATION))
+ .map(|location| format!("{}/{}", location, table_name))
+ .ok_or_else(|| {
+ Error::new(
+ ErrorKind::DataInvalid,
+ "No default path is set, please specify a location when
creating a table",
+ )
+ })
+}
+
+/// Create metadata location from `location` and `version`
+pub(crate) fn create_metadata_location(
+ location: impl AsRef<str> + Display,
Review Comment:
fixed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]