File tree Expand file tree Collapse file tree 2 files changed +6
-10
lines changed
Expand file tree Collapse file tree 2 files changed +6
-10
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,6 @@ use indicatif::ProgressBar;
2020use itertools:: Itertools ;
2121use log:: warn;
2222use prelude:: SessionContext ;
23- use tempfile:: { TempDir , tempdir} ;
2423use tokio:: runtime:: Runtime ;
2524use tracing:: { debug, info_span} ;
2625use tracing_futures:: Instrument ;
@@ -89,15 +88,13 @@ struct DataFusionCtx {
8988
9089struct DuckDBCtx {
9190 duckdb_path : PathBuf ,
92- tmp_dir : TempDir ,
9391}
9492
9593impl DuckDBCtx {
9694 pub fn duckdb_file ( & self , format : Format ) -> PathBuf {
97- self . tmp_dir
98- . path ( )
99- . to_path_buf ( )
100- . join ( format ! ( "hits-{format}.db" ) )
95+ let dir = Path :: new ( "bench-vortex/data/duckdb" ) ;
96+ std:: fs:: create_dir_all ( dir) . vortex_expect ( "failed to create duckdb data dir" ) ;
97+ dir. join ( format ! ( "{format}.db" ) )
10198 }
10299}
103100
@@ -119,7 +116,6 @@ impl EngineCtx {
119116 fn new_with_duckdb ( duckdb_path : & Path ) -> Self {
120117 EngineCtx :: DuckDB ( DuckDBCtx {
121118 duckdb_path : duckdb_path. to_path_buf ( ) ,
122- tmp_dir : tempdir ( ) . vortex_expect ( "cannot open temp directory" ) ,
123119 } )
124120 }
125121
Original file line number Diff line number Diff line change @@ -153,7 +153,7 @@ fn create_table_registration(
153153 for table_name in & tables {
154154 let table_path = format ! ( "{base_dir}{table_name}.{extension}" ) ;
155155 commands. push_str ( & format ! (
156- "CREATE {} {table_name} AS SELECT * FROM read_{extension}('{table_path}');\n " ,
156+ "CREATE {} IF NOT EXISTS {table_name} AS SELECT * FROM read_{extension}('{table_path}');\n " ,
157157 duckdb_object. to_str( ) ,
158158 ) ) ;
159159 }
@@ -167,7 +167,7 @@ fn create_table_registration(
167167 } ;
168168
169169 format ! (
170- "CREATE {} hits AS SELECT * FROM read_{extension}('{file_glob}');" ,
170+ "CREATE {} IF NOT EXISTS hits AS SELECT * FROM read_{extension}('{file_glob}');" ,
171171 duckdb_object. to_str( )
172172 )
173173 }
@@ -178,7 +178,7 @@ fn create_table_registration(
178178 for table_name in tables {
179179 let table_path = format ! ( "{base_dir}{table_name}.{extension}" ) ;
180180 commands. push_str ( & format ! (
181- "CREATE {} {table_name} AS SELECT * FROM read_{extension}('{table_path}');\n " ,
181+ "CREATE {} IF NOT EXISTS {table_name} AS SELECT * FROM read_{extension}('{table_path}');\n " ,
182182 duckdb_object. to_str( ) ,
183183 ) ) ;
184184 }
You can’t perform that action at this time.
0 commit comments