Skip to content

Commit e8dae59

Browse files
committed
CatalogSession -> Session
1 parent adfbbf9 commit e8dae59

File tree

26 files changed

+64
-64
lines changed

26 files changed

+64
-64
lines changed

datafusion-cli/src/functions.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use arrow::record_batch::RecordBatch;
2222
use arrow::util::pretty::pretty_format_batches;
2323
use async_trait::async_trait;
2424

25-
use datafusion::catalog::CatalogSession;
25+
use datafusion::catalog::Session;
2626
use datafusion::common::{plan_err, Column};
2727
use datafusion::datasource::function::TableFunctionImpl;
2828
use datafusion::datasource::TableProvider;
@@ -234,7 +234,7 @@ impl TableProvider for ParquetMetadataTable {
234234

235235
async fn scan(
236236
&self,
237-
_state: &dyn CatalogSession,
237+
_state: &dyn Session,
238238
projection: Option<&Vec<usize>>,
239239
_filters: &[Expr],
240240
_limit: Option<usize>,

datafusion-examples/examples/advanced_parquet_index.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use arrow::array::{ArrayRef, Int32Array, RecordBatch, StringArray};
1919
use arrow_schema::SchemaRef;
2020
use async_trait::async_trait;
2121
use bytes::Bytes;
22-
use datafusion::catalog::CatalogSession;
22+
use datafusion::catalog::Session;
2323
use datafusion::datasource::listing::PartitionedFile;
2424
use datafusion::datasource::physical_plan::parquet::{
2525
ParquetAccessPlan, ParquetExecBuilder,
@@ -271,7 +271,7 @@ impl IndexTableProvider {
271271
/// to a single predicate like `a = 1 AND b = 2` suitable for execution
272272
fn filters_to_predicate(
273273
&self,
274-
state: &dyn CatalogSession,
274+
state: &dyn Session,
275275
filters: &[Expr],
276276
) -> Result<Arc<dyn PhysicalExpr>> {
277277
let df_schema = DFSchema::try_from(self.schema())?;
@@ -463,7 +463,7 @@ impl TableProvider for IndexTableProvider {
463463

464464
async fn scan(
465465
&self,
466-
state: &dyn CatalogSession,
466+
state: &dyn Session,
467467
projection: Option<&Vec<usize>>,
468468
filters: &[Expr],
469469
limit: Option<usize>,

datafusion-examples/examples/custom_datasource.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ use datafusion_expr::LogicalPlanBuilder;
3737
use datafusion_physical_expr::EquivalenceProperties;
3838

3939
use async_trait::async_trait;
40-
use datafusion::catalog::CatalogSession;
40+
use datafusion::catalog::Session;
4141
use tokio::time::timeout;
4242

4343
/// This example demonstrates executing a simple query against a custom datasource
@@ -176,7 +176,7 @@ impl TableProvider for CustomDataSource {
176176

177177
async fn scan(
178178
&self,
179-
_state: &dyn CatalogSession,
179+
_state: &dyn Session,
180180
projection: Option<&Vec<usize>>,
181181
// filters and limit can be used here to inject some push-down operations if needed
182182
_filters: &[Expr],

datafusion-examples/examples/parquet_index.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use arrow::datatypes::Int32Type;
2323
use arrow::util::pretty::pretty_format_batches;
2424
use arrow_schema::SchemaRef;
2525
use async_trait::async_trait;
26-
use datafusion::catalog::CatalogSession;
26+
use datafusion::catalog::Session;
2727
use datafusion::datasource::listing::PartitionedFile;
2828
use datafusion::datasource::physical_plan::{
2929
parquet::StatisticsConverter,
@@ -222,7 +222,7 @@ impl TableProvider for IndexTableProvider {
222222

223223
async fn scan(
224224
&self,
225-
state: &dyn CatalogSession,
225+
state: &dyn Session,
226226
projection: Option<&Vec<usize>>,
227227
filters: &[Expr],
228228
limit: Option<usize>,

datafusion-examples/examples/simple_udtf.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use arrow::csv::ReaderBuilder;
2020
use async_trait::async_trait;
2121
use datafusion::arrow::datatypes::SchemaRef;
2222
use datafusion::arrow::record_batch::RecordBatch;
23-
use datafusion::catalog::CatalogSession;
23+
use datafusion::catalog::Session;
2424
use datafusion::datasource::function::TableFunctionImpl;
2525
use datafusion::datasource::TableProvider;
2626
use datafusion::error::Result;
@@ -95,7 +95,7 @@ impl TableProvider for LocalCsvTable {
9595

9696
async fn scan(
9797
&self,
98-
_state: &dyn CatalogSession,
98+
_state: &dyn Session,
9999
projection: Option<&Vec<usize>>,
100100
_filters: &[Expr],
101101
_limit: Option<usize>,

datafusion/catalog/src/session.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ use std::sync::Arc;
3636
/// (`.as_any().downcast_ref::<SessionState>().unwrap()`). This functionality
3737
/// is provided to facilitate transition period, avoid depending on it.
3838
#[async_trait]
39-
pub trait CatalogSession: Send + Sync {
39+
pub trait Session: Send + Sync {
4040
/// Return the session ID
4141
fn session_id(&self) -> &str;
4242

@@ -92,9 +92,9 @@ pub trait CatalogSession: Send + Sync {
9292
fn as_any(&self) -> &dyn Any;
9393
}
9494

95-
/// Create a new task context instance from CatalogSession
96-
impl From<&dyn CatalogSession> for TaskContext {
97-
fn from(state: &dyn CatalogSession) -> Self {
95+
/// Create a new task context instance from Session
96+
impl From<&dyn Session> for TaskContext {
97+
fn from(state: &dyn Session) -> Self {
9898
let task_id = None;
9999
TaskContext::new(
100100
task_id,

datafusion/catalog/src/table.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
use std::any::Any;
1919
use std::sync::Arc;
2020

21-
use crate::session::CatalogSession;
21+
use crate::session::Session;
2222
use arrow_schema::SchemaRef;
2323
use async_trait::async_trait;
2424
use datafusion_common::Result;
@@ -147,7 +147,7 @@ pub trait TableProvider: Sync + Send {
147147
/// to return as a final result.
148148
async fn scan(
149149
&self,
150-
state: &dyn CatalogSession,
150+
state: &dyn Session,
151151
projection: Option<&Vec<usize>>,
152152
filters: &[Expr],
153153
limit: Option<usize>,
@@ -187,7 +187,7 @@ pub trait TableProvider: Sync + Send {
187187
/// # use std::sync::Arc;
188188
/// # use arrow_schema::SchemaRef;
189189
/// # use async_trait::async_trait;
190-
/// # use datafusion_catalog::{TableProvider, CatalogSession};
190+
/// # use datafusion_catalog::{TableProvider, Session};
191191
/// # use datafusion_common::Result;
192192
/// # use datafusion_expr::{Expr, TableProviderFilterPushDown, TableType};
193193
/// # use datafusion_physical_plan::ExecutionPlan;
@@ -199,7 +199,7 @@ pub trait TableProvider: Sync + Send {
199199
/// # fn as_any(&self) -> &dyn Any { todo!() }
200200
/// # fn schema(&self) -> SchemaRef { todo!() }
201201
/// # fn table_type(&self) -> TableType { todo!() }
202-
/// # async fn scan(&self, s: &dyn CatalogSession, p: Option<&Vec<usize>>, f: &[Expr], l: Option<usize>) -> Result<Arc<dyn ExecutionPlan>> {
202+
/// # async fn scan(&self, s: &dyn Session, p: Option<&Vec<usize>>, f: &[Expr], l: Option<usize>) -> Result<Arc<dyn ExecutionPlan>> {
203203
/// todo!()
204204
/// # }
205205
/// // Override the supports_filters_pushdown to evaluate which expressions
@@ -269,7 +269,7 @@ pub trait TableProvider: Sync + Send {
269269
/// [`DataSinkExec`]: datafusion_physical_plan::insert::DataSinkExec
270270
async fn insert_into(
271271
&self,
272-
_state: &dyn CatalogSession,
272+
_state: &dyn Session,
273273
_input: Arc<dyn ExecutionPlan>,
274274
_overwrite: bool,
275275
) -> Result<Arc<dyn ExecutionPlan>> {
@@ -286,7 +286,7 @@ pub trait TableProviderFactory: Sync + Send {
286286
/// Create a TableProvider with the given url
287287
async fn create(
288288
&self,
289-
state: &dyn CatalogSession,
289+
state: &dyn Session,
290290
cmd: &CreateExternalTable,
291291
) -> Result<Arc<dyn TableProvider>>;
292292
}

datafusion/core/src/dataframe/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ use datafusion_expr::{
5858
use datafusion_functions_aggregate::expr_fn::{avg, count, median, stddev, sum};
5959

6060
use async_trait::async_trait;
61-
use datafusion_catalog::CatalogSession;
61+
use datafusion_catalog::Session;
6262

6363
/// Contains options that control how data is
6464
/// written out from a DataFrame
@@ -1658,7 +1658,7 @@ impl TableProvider for DataFrameTableProvider {
16581658

16591659
async fn scan(
16601660
&self,
1661-
state: &dyn CatalogSession,
1661+
state: &dyn Session,
16621662
projection: Option<&Vec<usize>>,
16631663
filters: &[Expr],
16641664
limit: Option<usize>,

datafusion/core/src/datasource/cte_worktable.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use std::sync::Arc;
2222

2323
use arrow::datatypes::SchemaRef;
2424
use async_trait::async_trait;
25-
use datafusion_catalog::CatalogSession;
25+
use datafusion_catalog::Session;
2626
use datafusion_physical_plan::work_table::WorkTableExec;
2727

2828
use crate::{
@@ -77,7 +77,7 @@ impl TableProvider for CteWorkTable {
7777

7878
async fn scan(
7979
&self,
80-
_state: &dyn CatalogSession,
80+
_state: &dyn Session,
8181
_projection: Option<&Vec<usize>>,
8282
_filters: &[Expr],
8383
_limit: Option<usize>,

datafusion/core/src/datasource/empty.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use std::sync::Arc;
2222

2323
use arrow::datatypes::*;
2424
use async_trait::async_trait;
25-
use datafusion_catalog::CatalogSession;
25+
use datafusion_catalog::Session;
2626
use datafusion_common::project_schema;
2727

2828
use crate::datasource::{TableProvider, TableType};
@@ -69,7 +69,7 @@ impl TableProvider for EmptyTable {
6969

7070
async fn scan(
7171
&self,
72-
_state: &dyn CatalogSession,
72+
_state: &dyn Session,
7373
projection: Option<&Vec<usize>>,
7474
_filters: &[Expr],
7575
_limit: Option<usize>,

datafusion/core/src/datasource/listing/table.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ use datafusion_physical_expr::{
5151
};
5252

5353
use async_trait::async_trait;
54-
use datafusion_catalog::CatalogSession;
54+
use datafusion_catalog::Session;
5555
use futures::{future, stream, StreamExt, TryStreamExt};
5656
use itertools::Itertools;
5757
use object_store::ObjectStore;
@@ -736,7 +736,7 @@ impl TableProvider for ListingTable {
736736

737737
async fn scan(
738738
&self,
739-
state: &dyn CatalogSession,
739+
state: &dyn Session,
740740
projection: Option<&Vec<usize>>,
741741
filters: &[Expr],
742742
limit: Option<usize>,
@@ -855,7 +855,7 @@ impl TableProvider for ListingTable {
855855

856856
async fn insert_into(
857857
&self,
858-
state: &dyn CatalogSession,
858+
state: &dyn Session,
859859
input: Arc<dyn ExecutionPlan>,
860860
overwrite: bool,
861861
) -> Result<Arc<dyn ExecutionPlan>> {

datafusion/core/src/datasource/listing_table_factory.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ use datafusion_common::{config_datafusion_err, Result};
3232
use datafusion_expr::CreateExternalTable;
3333

3434
use async_trait::async_trait;
35-
use datafusion_catalog::CatalogSession;
35+
use datafusion_catalog::Session;
3636

3737
/// A `TableProviderFactory` capable of creating new `ListingTable`s
3838
#[derive(Debug, Default)]
@@ -49,7 +49,7 @@ impl ListingTableFactory {
4949
impl TableProviderFactory for ListingTableFactory {
5050
async fn create(
5151
&self,
52-
state: &dyn CatalogSession,
52+
state: &dyn Session,
5353
cmd: &CreateExternalTable,
5454
) -> Result<Arc<dyn TableProvider>> {
5555
// TODO remove downcast_ref from here. Should file format factory be an extension to session state?

datafusion/core/src/datasource/memory.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ use datafusion_execution::TaskContext;
4242
use datafusion_physical_plan::metrics::MetricsSet;
4343

4444
use async_trait::async_trait;
45-
use datafusion_catalog::CatalogSession;
45+
use datafusion_catalog::Session;
4646
use futures::StreamExt;
4747
use log::debug;
4848
use parking_lot::Mutex;
@@ -207,7 +207,7 @@ impl TableProvider for MemTable {
207207

208208
async fn scan(
209209
&self,
210-
state: &dyn CatalogSession,
210+
state: &dyn Session,
211211
projection: Option<&Vec<usize>>,
212212
_filters: &[Expr],
213213
_limit: Option<usize>,
@@ -259,7 +259,7 @@ impl TableProvider for MemTable {
259259
/// * A plan that returns the number of rows written.
260260
async fn insert_into(
261261
&self,
262-
_state: &dyn CatalogSession,
262+
_state: &dyn Session,
263263
input: Arc<dyn ExecutionPlan>,
264264
overwrite: bool,
265265
) -> Result<Arc<dyn ExecutionPlan>> {

datafusion/core/src/datasource/provider.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
use std::sync::Arc;
2121

2222
use async_trait::async_trait;
23-
use datafusion_catalog::CatalogSession;
23+
use datafusion_catalog::Session;
2424
use datafusion_expr::CreateExternalTable;
2525
pub use datafusion_expr::{TableProviderFilterPushDown, TableType};
2626

@@ -50,7 +50,7 @@ impl DefaultTableFactory {
5050
impl TableProviderFactory for DefaultTableFactory {
5151
async fn create(
5252
&self,
53-
state: &dyn CatalogSession,
53+
state: &dyn Session,
5454
cmd: &CreateExternalTable,
5555
) -> Result<Arc<dyn TableProvider>> {
5656
let mut unbounded = cmd.unbounded;

datafusion/core/src/datasource/stream.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ use datafusion_physical_plan::streaming::{PartitionStream, StreamingTableExec};
4141
use datafusion_physical_plan::{DisplayAs, DisplayFormatType, ExecutionPlan};
4242

4343
use async_trait::async_trait;
44-
use datafusion_catalog::CatalogSession;
44+
use datafusion_catalog::Session;
4545
use futures::StreamExt;
4646

4747
/// A [`TableProviderFactory`] for [`StreamTable`]
@@ -52,7 +52,7 @@ pub struct StreamTableFactory {}
5252
impl TableProviderFactory for StreamTableFactory {
5353
async fn create(
5454
&self,
55-
state: &dyn CatalogSession,
55+
state: &dyn Session,
5656
cmd: &CreateExternalTable,
5757
) -> Result<Arc<dyn TableProvider>> {
5858
let schema: SchemaRef = Arc::new(cmd.schema.as_ref().into());
@@ -322,7 +322,7 @@ impl TableProvider for StreamTable {
322322

323323
async fn scan(
324324
&self,
325-
_state: &dyn CatalogSession,
325+
_state: &dyn Session,
326326
projection: Option<&Vec<usize>>,
327327
_filters: &[Expr],
328328
limit: Option<usize>,
@@ -347,7 +347,7 @@ impl TableProvider for StreamTable {
347347

348348
async fn insert_into(
349349
&self,
350-
_state: &dyn CatalogSession,
350+
_state: &dyn Session,
351351
input: Arc<dyn ExecutionPlan>,
352352
_overwrite: bool,
353353
) -> Result<Arc<dyn ExecutionPlan>> {

datafusion/core/src/datasource/streaming.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use async_trait::async_trait;
2626
use crate::datasource::TableProvider;
2727
use crate::physical_plan::streaming::{PartitionStream, StreamingTableExec};
2828
use crate::physical_plan::ExecutionPlan;
29-
use datafusion_catalog::CatalogSession;
29+
use datafusion_catalog::Session;
3030
use datafusion_common::{plan_err, Result};
3131
use datafusion_expr::{Expr, TableType};
3232
use log::debug;
@@ -84,7 +84,7 @@ impl TableProvider for StreamingTable {
8484

8585
async fn scan(
8686
&self,
87-
_state: &dyn CatalogSession,
87+
_state: &dyn Session,
8888
projection: Option<&Vec<usize>>,
8989
_filters: &[Expr],
9090
limit: Option<usize>,

datafusion/core/src/datasource/view.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use std::{any::Any, sync::Arc};
2121

2222
use arrow::datatypes::SchemaRef;
2323
use async_trait::async_trait;
24-
use datafusion_catalog::CatalogSession;
24+
use datafusion_catalog::Session;
2525
use datafusion_common::Column;
2626
use datafusion_expr::{LogicalPlanBuilder, TableProviderFilterPushDown};
2727

@@ -103,7 +103,7 @@ impl TableProvider for ViewTable {
103103

104104
async fn scan(
105105
&self,
106-
state: &dyn CatalogSession,
106+
state: &dyn Session,
107107
projection: Option<&Vec<usize>>,
108108
filters: &[Expr],
109109
limit: Option<usize>,

0 commit comments

Comments
 (0)