holicc commented on issue #4850:
URL: 
https://github.com/apache/arrow-datafusion/issues/4850#issuecomment-1722668165

   @alamb  I'm having trouble inferring the schema because I can't get a 
SessionState from the ContextProvider. Can you help me?
   
   ```rust
   let listing_options = 
CsvReadOptions::default().to_listing_options(&self.config);
   let url = ListingTableUrl::parse(file_path)?;
   let cfg = ListingTableConfig::new(url)
               .with_listing_options(listing_options)
               .with_schema(Arc::new(arrow_schema::Schema::empty()));
   
   // FIXME How to get a SessionState?
   cfg.infer_schema(state);
   
   let table = ListingTable::try_new(cfg)?;
   let source = Arc::new(DefaultTableSource::new(Arc::new(table)));
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to