Skip to content

Commit 43cc911

Browse files
ntjohnson1kosiew
authored andcommitted
Add source root - cherry pick apache#1252
1 parent f1a9722 commit 43cc911

File tree

12 files changed

+34
-26
lines changed

12 files changed

+34
-26
lines changed

src/catalog.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,19 @@ use std::any::Any;
3636
use std::collections::HashSet;
3737
use std::sync::Arc;
3838

39-
#[pyclass(name = "RawCatalog", module = "datafusion.catalog", subclass)]
39+
#[pyclass(frozen, name = "RawCatalog", module = "datafusion.catalog", subclass)]
4040
#[derive(Clone)]
4141
pub struct PyCatalog {
4242
pub catalog: Arc<dyn CatalogProvider>,
4343
}
4444

45-
#[pyclass(name = "RawSchema", module = "datafusion.catalog", subclass)]
45+
#[pyclass(frozen, name = "RawSchema", module = "datafusion.catalog", subclass)]
4646
#[derive(Clone)]
4747
pub struct PySchema {
4848
pub schema: Arc<dyn SchemaProvider>,
4949
}
5050

51-
#[pyclass(name = "RawTable", module = "datafusion.catalog", subclass)]
51+
#[pyclass(frozen, name = "RawTable", module = "datafusion.catalog", subclass)]
5252
#[derive(Clone)]
5353
pub struct PyTable {
5454
pub table: Arc<dyn TableProvider>,

src/config.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
// Licensed to the Apache Software Foundation (ASF) under one
1+
// Licensed to the Apache use parking_lot::RwLock;
2+
3+
#[pyclass(name = "Config", module = "datafusion", subclass, frozen)]
4+
#[derive(Clone)]Foundation (ASF) under one
25
// or more contributor license agreements. See the NOTICE file
36
// distributed with this work for additional information
47
// regarding copyright ownership. The ASF licenses this file

src/context.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ use pyo3::IntoPyObjectExt;
7777
use tokio::task::JoinHandle;
7878

7979
/// Configuration options for a SessionContext
80-
#[pyclass(name = "SessionConfig", module = "datafusion", subclass)]
80+
#[pyclass(frozen, name = "SessionConfig", module = "datafusion", subclass)]
8181
#[derive(Clone, Default)]
8282
pub struct PySessionConfig {
8383
pub config: SessionConfig,
@@ -170,7 +170,7 @@ impl PySessionConfig {
170170
}
171171

172172
/// Runtime options for a SessionContext
173-
#[pyclass(name = "RuntimeEnvBuilder", module = "datafusion", subclass)]
173+
#[pyclass(frozen, name = "RuntimeEnvBuilder", module = "datafusion", subclass)]
174174
#[derive(Clone)]
175175
pub struct PyRuntimeEnvBuilder {
176176
pub builder: RuntimeEnvBuilder,
@@ -257,7 +257,7 @@ impl PyRuntimeEnvBuilder {
257257
}
258258

259259
/// `PySQLOptions` allows you to specify options to the sql execution.
260-
#[pyclass(name = "SQLOptions", module = "datafusion", subclass)]
260+
#[pyclass(frozen, name = "SQLOptions", module = "datafusion", subclass)]
261261
#[derive(Clone)]
262262
pub struct PySQLOptions {
263263
pub options: SQLOptions,

src/dataframe.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ type SharedCachedBatches = Arc<Mutex<CachedBatches>>;
6868
// https://github.com/apache/datafusion-python/pull/1016#discussion_r1983239116
6969
// - we have not decided on the table_provider approach yet
7070
// this is an interim implementation
71-
#[pyclass(name = "TableProvider", module = "datafusion")]
71+
#[pyclass(frozen, name = "TableProvider", module = "datafusion")]
7272
pub struct PyTableProvider {
7373
provider: Arc<dyn TableProvider + Send>,
7474
}
@@ -195,7 +195,7 @@ fn build_formatter_config_from_python(formatter: &Bound<'_, PyAny>) -> PyResult<
195195
}
196196

197197
/// Python mapping of `ParquetOptions` (includes just the writer-related options).
198-
#[pyclass(name = "ParquetWriterOptions", module = "datafusion", subclass)]
198+
#[pyclass(frozen, name = "ParquetWriterOptions", module = "datafusion", subclass)]
199199
#[derive(Clone, Default)]
200200
pub struct PyParquetWriterOptions {
201201
options: ParquetOptions,
@@ -256,7 +256,7 @@ impl PyParquetWriterOptions {
256256
}
257257

258258
/// Python mapping of `ParquetColumnOptions`.
259-
#[pyclass(name = "ParquetColumnOptions", module = "datafusion", subclass)]
259+
#[pyclass(frozen, name = "ParquetColumnOptions", module = "datafusion", subclass)]
260260
#[derive(Clone, Default)]
261261
pub struct PyParquetColumnOptions {
262262
options: ParquetColumnOptions,

src/expr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ pub mod window;
115115
use sort_expr::{to_sort_expressions, PySortExpr};
116116

117117
/// A PyExpr that can be used on a DataFrame
118-
#[pyclass(name = "RawExpr", module = "datafusion.expr", subclass)]
118+
#[pyclass(frozen, name = "RawExpr", module = "datafusion.expr", subclass)]
119119
#[derive(Debug, Clone)]
120120
pub struct PyExpr {
121121
pub expr: Expr,
@@ -637,7 +637,7 @@ impl PyExpr {
637637
}
638638
}
639639

640-
#[pyclass(name = "ExprFuncBuilder", module = "datafusion.expr", subclass)]
640+
#[pyclass(frozen, name = "ExprFuncBuilder", module = "datafusion.expr", subclass)]
641641
#[derive(Debug, Clone)]
642642
pub struct PyExprFuncBuilder {
643643
pub builder: ExprFuncBuilder,

src/physical_plan.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use pyo3::{exceptions::PyRuntimeError, prelude::*, types::PyBytes};
2424

2525
use crate::{context::PySessionContext, errors::PyDataFusionResult};
2626

27-
#[pyclass(name = "ExecutionPlan", module = "datafusion", subclass)]
27+
#[pyclass(frozen, name = "ExecutionPlan", module = "datafusion", subclass)]
2828
#[derive(Debug, Clone)]
2929
pub struct PyExecutionPlan {
3030
pub plan: Arc<dyn ExecutionPlan>,

src/store.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,12 @@ pub enum StorageContexts {
3636
HTTP(PyHttpContext),
3737
}
3838

39-
#[pyclass(name = "LocalFileSystem", module = "datafusion.store", subclass)]
39+
#[pyclass(
40+
frozen,
41+
name = "LocalFileSystem",
42+
module = "datafusion.store",
43+
subclass
44+
)]
4045
#[derive(Debug, Clone)]
4146
pub struct PyLocalFileSystemContext {
4247
pub inner: Arc<LocalFileSystem>,
@@ -62,7 +67,7 @@ impl PyLocalFileSystemContext {
6267
}
6368
}
6469

65-
#[pyclass(name = "MicrosoftAzure", module = "datafusion.store", subclass)]
70+
#[pyclass(frozen, name = "MicrosoftAzure", module = "datafusion.store", subclass)]
6671
#[derive(Debug, Clone)]
6772
pub struct PyMicrosoftAzureContext {
6873
pub inner: Arc<MicrosoftAzure>,
@@ -134,7 +139,7 @@ impl PyMicrosoftAzureContext {
134139
}
135140
}
136141

137-
#[pyclass(name = "GoogleCloud", module = "datafusion.store", subclass)]
142+
#[pyclass(frozen, name = "GoogleCloud", module = "datafusion.store", subclass)]
138143
#[derive(Debug, Clone)]
139144
pub struct PyGoogleCloudContext {
140145
pub inner: Arc<GoogleCloudStorage>,
@@ -164,7 +169,7 @@ impl PyGoogleCloudContext {
164169
}
165170
}
166171

167-
#[pyclass(name = "AmazonS3", module = "datafusion.store", subclass)]
172+
#[pyclass(frozen, name = "AmazonS3", module = "datafusion.store", subclass)]
168173
#[derive(Debug, Clone)]
169174
pub struct PyAmazonS3Context {
170175
pub inner: Arc<AmazonS3>,
@@ -223,7 +228,7 @@ impl PyAmazonS3Context {
223228
}
224229
}
225230

226-
#[pyclass(name = "Http", module = "datafusion.store", subclass)]
231+
#[pyclass(frozen, name = "Http", module = "datafusion.store", subclass)]
227232
#[derive(Debug, Clone)]
228233
pub struct PyHttpContext {
229234
pub url: String,

src/substrait.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use datafusion_substrait::serializer;
2727
use datafusion_substrait::substrait::proto::Plan;
2828
use prost::Message;
2929

30-
#[pyclass(name = "Plan", module = "datafusion.substrait", subclass)]
30+
#[pyclass(frozen, name = "Plan", module = "datafusion.substrait", subclass)]
3131
#[derive(Debug, Clone)]
3232
pub struct PyPlan {
3333
pub plan: Plan,
@@ -59,7 +59,7 @@ impl From<Plan> for PyPlan {
5959
/// A PySubstraitSerializer is a representation of a Serializer that is capable of both serializing
6060
/// a `LogicalPlan` instance to Substrait Protobuf bytes and also deserialize Substrait Protobuf bytes
6161
/// to a valid `LogicalPlan` instance.
62-
#[pyclass(name = "Serde", module = "datafusion.substrait", subclass)]
62+
#[pyclass(frozen, name = "Serde", module = "datafusion.substrait", subclass)]
6363
#[derive(Debug, Clone)]
6464
pub struct PySubstraitSerializer;
6565

@@ -112,7 +112,7 @@ impl PySubstraitSerializer {
112112
}
113113
}
114114

115-
#[pyclass(name = "Producer", module = "datafusion.substrait", subclass)]
115+
#[pyclass(frozen, name = "Producer", module = "datafusion.substrait", subclass)]
116116
#[derive(Debug, Clone)]
117117
pub struct PySubstraitProducer;
118118

@@ -129,7 +129,7 @@ impl PySubstraitProducer {
129129
}
130130
}
131131

132-
#[pyclass(name = "Consumer", module = "datafusion.substrait", subclass)]
132+
#[pyclass(frozen, name = "Consumer", module = "datafusion.substrait", subclass)]
133133
#[derive(Debug, Clone)]
134134
pub struct PySubstraitConsumer;
135135

src/udaf.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ pub fn to_rust_accumulator(accum: PyObject) -> AccumulatorFactoryFunction {
155155
}
156156

157157
/// Represents an AggregateUDF
158-
#[pyclass(name = "AggregateUDF", module = "datafusion", subclass)]
158+
#[pyclass(frozen, name = "AggregateUDF", module = "datafusion", subclass)]
159159
#[derive(Debug, Clone)]
160160
pub struct PyAggregateUDF {
161161
pub(crate) function: AggregateUDF,

src/udf.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ fn to_scalar_function_impl(func: PyObject) -> ScalarFunctionImplementation {
8181
}
8282

8383
/// Represents a PyScalarUDF
84-
#[pyclass(name = "ScalarUDF", module = "datafusion", subclass)]
84+
#[pyclass(frozen, name = "ScalarUDF", module = "datafusion", subclass)]
8585
#[derive(Debug, Clone)]
8686
pub struct PyScalarUDF {
8787
pub(crate) function: ScalarUDF,

0 commit comments

Comments
 (0)