@@ -115,39 +115,41 @@ impl LogicalPlanBuilder {
115115
116116 /// Scan a CSV data source
117117 pub fn scan_csv (
118- path : & str ,
118+ path : impl Into < String > ,
119119 options : CsvReadOptions ,
120120 projection : Option < Vec < usize > > ,
121121 ) -> Result < Self > {
122- Self :: scan_csv_with_name ( path, options, projection, path)
122+ let path = path. into ( ) ;
123+ Self :: scan_csv_with_name ( path. clone ( ) , options, projection, path)
123124 }
124125
125126 /// Scan a CSV data source and register it with a given table name
126127 pub fn scan_csv_with_name (
127- path : & str ,
128+ path : impl Into < String > ,
128129 options : CsvReadOptions ,
129130 projection : Option < Vec < usize > > ,
130- table_name : & str ,
131+ table_name : impl Into < String > ,
131132 ) -> Result < Self > {
132133 let provider = Arc :: new ( CsvFile :: try_new ( path, options) ?) ;
133134 Self :: scan ( table_name, provider, projection)
134135 }
135136
136137 /// Scan a Parquet data source
137138 pub fn scan_parquet (
138- path : & str ,
139+ path : impl Into < String > ,
139140 projection : Option < Vec < usize > > ,
140141 max_concurrency : usize ,
141142 ) -> Result < Self > {
142- Self :: scan_parquet_with_name ( path, projection, max_concurrency, path)
143+ let path = path. into ( ) ;
144+ Self :: scan_parquet_with_name ( path. clone ( ) , projection, max_concurrency, path)
143145 }
144146
145147 /// Scan a Parquet data source and register it with a given table name
146148 pub fn scan_parquet_with_name (
147- path : & str ,
149+ path : impl Into < String > ,
148150 projection : Option < Vec < usize > > ,
149151 max_concurrency : usize ,
150- table_name : & str ,
152+ table_name : impl Into < String > ,
151153 ) -> Result < Self > {
152154 let provider = Arc :: new ( ParquetTable :: try_new ( path, max_concurrency) ?) ;
153155 Self :: scan ( table_name, provider, projection)
@@ -166,10 +168,12 @@ impl LogicalPlanBuilder {
166168
167169 /// Convert a table provider into a builder with a TableScan
168170 pub fn scan (
169- table_name : & str ,
171+ table_name : impl Into < String > ,
170172 provider : Arc < dyn TableProvider > ,
171173 projection : Option < Vec < usize > > ,
172174 ) -> Result < Self > {
175+ let table_name = table_name. into ( ) ;
176+
173177 if table_name. is_empty ( ) {
174178 return Err ( DataFusionError :: Plan (
175179 "table_name cannot be empty" . to_string ( ) ,
@@ -184,17 +188,17 @@ impl LogicalPlanBuilder {
184188 DFSchema :: new (
185189 p. iter ( )
186190 . map ( |i| {
187- DFField :: from_qualified ( table_name, schema. field ( * i) . clone ( ) )
191+ DFField :: from_qualified ( & table_name, schema. field ( * i) . clone ( ) )
188192 } )
189193 . collect ( ) ,
190194 )
191195 } )
192196 . unwrap_or_else ( || {
193- DFSchema :: try_from_qualified_schema ( table_name, & schema)
197+ DFSchema :: try_from_qualified_schema ( & table_name, & schema)
194198 } ) ?;
195199
196200 let table_scan = LogicalPlan :: TableScan {
197- table_name : table_name . to_string ( ) ,
201+ table_name,
198202 source : provider,
199203 projected_schema : Arc :: new ( projected_schema) ,
200204 projection,
0 commit comments