@@ -923,6 +923,7 @@ def _resolve_table_location(self, location: Optional[str], database_name: str, t
923923 return location .rstrip ("/" )
924924
925925 def _get_default_warehouse_location (self , database_name : str , table_name : str ) -> str :
926+ """Return the default warehouse location using the convention of `warehousePath/databaseName/tableName`."""
926927 database_properties = self .load_namespace_properties (database_name )
927928 if database_location := database_properties .get (LOCATION ):
928929 database_location = database_location .rstrip ("/" )
@@ -934,6 +935,19 @@ def _get_default_warehouse_location(self, database_name: str, table_name: str) -
934935
935936 raise ValueError ("No default path is set, please specify a location when creating a table" )
936937
938+ def _get_hive_style_warehouse_location (self , database_name : str , table_name : str ) -> str :
939+ """Return the default warehouse location following the Hive convention of `warehousePath/databaseName.db/tableName`."""
940+ database_properties = self .load_namespace_properties (database_name )
941+ if database_location := database_properties .get (LOCATION ):
942+ database_location = database_location .rstrip ("/" )
943+ return f"{ database_location } /{ table_name } "
944+
945+ if warehouse_path := self .properties .get (WAREHOUSE_LOCATION ):
946+ warehouse_path = warehouse_path .rstrip ("/" )
947+ return f"{ warehouse_path } /{ database_name } .db/{ table_name } "
948+
949+ raise ValueError ("No default path is set, please specify a location when creating a table" )
950+
937951 @staticmethod
938952 def _write_metadata (metadata : TableMetadata , io : FileIO , metadata_path : str ) -> None :
939953 ToOutputFile .table_metadata (metadata , io .new_output (metadata_path ))
0 commit comments