File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- use std:: sync:: Arc ;
2- use std:: time:: Duration ;
31use datafusion:: { prelude:: SessionContext , sql:: TableReference } ;
42use datafusion_table_providers:: {
53 sql:: db_connection_pool:: { sqlitepool:: SqliteConnectionPoolFactory , Mode } ,
64 sqlite:: SqliteTableFactory ,
75} ;
6+ use std:: sync:: Arc ;
7+ use std:: time:: Duration ;
88
99/// This example demonstrates how to create a SqliteTableFactory and use it to create TableProviders
1010/// that can be registered with DataFusion.
1111#[ tokio:: main]
1212async fn main ( ) {
1313 let sqlite_pool = Arc :: new (
14- SqliteConnectionPoolFactory :: new ( "examples/sqlite_example.db" , Mode :: File , Duration :: default ( ) )
15- . build ( )
16- . await
17- . expect ( "unable to create Sqlite connection pool" ) ,
14+ SqliteConnectionPoolFactory :: new (
15+ "examples/sqlite_example.db" ,
16+ Mode :: File ,
17+ Duration :: default ( ) ,
18+ )
19+ . build ( )
20+ . await
21+ . expect ( "unable to create Sqlite connection pool" ) ,
1822 ) ;
1923
2024 let sqlite_table_factory = SqliteTableFactory :: new ( sqlite_pool) ;
Original file line number Diff line number Diff line change @@ -240,10 +240,7 @@ pub fn enforce_schema(
240240/// For a target schema field, extract the column with the same name if present in the
241241/// record batch and cast it to the desired data type if needed. If the column is missing
242242/// but the target schema field is nullable, generates a null-array column.
243- fn find_matching_column (
244- batch : & RecordBatch ,
245- field : & Field ,
246- ) -> arrow:: error:: Result < ArrayRef > {
243+ fn find_matching_column ( batch : & RecordBatch , field : & Field ) -> arrow:: error:: Result < ArrayRef > {
247244 if let Some ( column) = batch. column_by_name ( field. name ( ) ) {
248245 if column. data_type ( ) == field. data_type ( ) {
249246 Ok ( column. to_owned ( ) )
You can’t perform that action at this time.
0 commit comments