@@ -101,7 +101,7 @@ async fn set_test_namespace(catalog: &HmsCatalog, namespace: &NamespaceIdent) ->
101101 Ok ( ( ) )
102102}
103103
104- fn set_table_creation ( name : impl ToString ) -> Result < TableCreation > {
104+ fn set_table_creation ( location : Option < String > , name : impl ToString ) -> Result < TableCreation > {
105105 let schema = Schema :: builder ( )
106106 . with_schema_id ( 0 )
107107 . with_fields ( vec ! [
@@ -110,19 +110,19 @@ fn set_table_creation(name: impl ToString) -> Result<TableCreation> {
110110 ] )
111111 . build ( ) ?;
112112
113- let creation = TableCreation :: builder ( )
113+ let builder = TableCreation :: builder ( )
114114 . name ( name. to_string ( ) )
115115 . properties ( HashMap :: new ( ) )
116- . schema ( schema )
117- . build ( ) ;
116+ . location_opt ( location )
117+ . schema ( schema ) ;
118118
119- Ok ( creation )
119+ Ok ( builder . build ( ) )
120120}
121121
122122#[ tokio:: test]
123123async fn test_rename_table ( ) -> Result < ( ) > {
124124 let catalog = get_catalog ( ) . await ;
125- let creation: TableCreation = set_table_creation ( "my_table" ) ?;
125+ let creation: TableCreation = set_table_creation ( None , "my_table" ) ?;
126126 let namespace = Namespace :: new ( NamespaceIdent :: new ( "test_rename_table" . into ( ) ) ) ;
127127 set_test_namespace ( & catalog, namespace. name ( ) ) . await ?;
128128
@@ -142,7 +142,7 @@ async fn test_rename_table() -> Result<()> {
142142#[ tokio:: test]
143143async fn test_table_exists ( ) -> Result < ( ) > {
144144 let catalog = get_catalog ( ) . await ;
145- let creation = set_table_creation ( "my_table" ) ?;
145+ let creation = set_table_creation ( None , "my_table" ) ?;
146146 let namespace = Namespace :: new ( NamespaceIdent :: new ( "test_table_exists" . into ( ) ) ) ;
147147 set_test_namespace ( & catalog, namespace. name ( ) ) . await ?;
148148
@@ -158,7 +158,7 @@ async fn test_table_exists() -> Result<()> {
158158#[ tokio:: test]
159159async fn test_drop_table ( ) -> Result < ( ) > {
160160 let catalog = get_catalog ( ) . await ;
161- let creation = set_table_creation ( "my_table" ) ?;
161+ let creation = set_table_creation ( None , "my_table" ) ?;
162162 let namespace = Namespace :: new ( NamespaceIdent :: new ( "test_drop_table" . into ( ) ) ) ;
163163 set_test_namespace ( & catalog, namespace. name ( ) ) . await ?;
164164
@@ -176,7 +176,7 @@ async fn test_drop_table() -> Result<()> {
176176#[ tokio:: test]
177177async fn test_load_table ( ) -> Result < ( ) > {
178178 let catalog = get_catalog ( ) . await ;
179- let creation = set_table_creation ( "my_table" ) ?;
179+ let creation = set_table_creation ( None , "my_table" ) ?;
180180 let namespace = Namespace :: new ( NamespaceIdent :: new ( "test_load_table" . into ( ) ) ) ;
181181 set_test_namespace ( & catalog, namespace. name ( ) ) . await ?;
182182
@@ -199,9 +199,8 @@ async fn test_load_table() -> Result<()> {
199199#[ tokio:: test]
200200async fn test_create_table ( ) -> Result < ( ) > {
201201 let catalog = get_catalog ( ) . await ;
202- let mut creation = set_table_creation ( "my_table" ) ?;
203202 // inject custom location, ignore the namespace prefix
204- creation. location = Some ( "s3a://warehouse/hive" . to_string ( ) ) ;
203+ let creation = set_table_creation ( Some ( "s3a://warehouse/hive" . into ( ) ) , "my_table" ) ? ;
205204 let namespace = Namespace :: new ( NamespaceIdent :: new ( "test_create_table" . into ( ) ) ) ;
206205 set_test_namespace ( & catalog, namespace. name ( ) ) . await ?;
207206
@@ -230,7 +229,7 @@ async fn test_list_tables() -> Result<()> {
230229
231230 assert_eq ! ( result, vec![ ] ) ;
232231
233- let creation = set_table_creation ( "my_table" ) ?;
232+ let creation = set_table_creation ( None , "my_table" ) ?;
234233 catalog. create_table ( ns. name ( ) , creation) . await ?;
235234 let result = catalog. list_tables ( ns. name ( ) ) . await ?;
236235
0 commit comments