Skip to content

Commit 088334b

Browse files
committed
format
1 parent afd28a6 commit 088334b

17 files changed

+325
-188
lines changed

src/expr.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,22 @@ pub mod case;
6464
pub mod cast;
6565
pub mod column;
6666
pub mod conditional_expr;
67+
pub mod constraints;
68+
pub mod copy_to;
69+
pub mod create_catalog;
70+
pub mod create_catalog_schema;
71+
pub mod create_external_table;
72+
pub mod create_function;
73+
pub mod create_index;
6774
pub mod create_memory_table;
6875
pub mod create_view;
76+
pub mod describe_table;
6977
pub mod distinct;
78+
pub mod dml;
79+
pub mod drop_catalog_schema;
80+
pub mod drop_function;
7081
pub mod drop_table;
82+
pub mod drop_view;
7183
pub mod empty_relation;
7284
pub mod exists;
7385
pub mod explain;
@@ -83,34 +95,22 @@ pub mod literal;
8395
pub mod logical_node;
8496
pub mod placeholder;
8597
pub mod projection;
98+
pub mod recursive_query;
8699
pub mod repartition;
87100
pub mod scalar_subquery;
88101
pub mod scalar_variable;
89102
pub mod signature;
90103
pub mod sort;
91104
pub mod sort_expr;
105+
pub mod statement;
92106
pub mod subquery;
93107
pub mod subquery_alias;
94108
pub mod table_scan;
95109
pub mod union;
96110
pub mod unnest;
97111
pub mod unnest_expr;
98-
pub mod window;
99-
pub mod statement;
100112
pub mod values;
101-
pub mod dml;
102-
pub mod create_external_table;
103-
pub mod copy_to;
104-
pub mod create_catalog_schema;
105-
pub mod drop_view;
106-
pub mod create_catalog;
107-
pub mod drop_catalog_schema;
108-
pub mod drop_function;
109-
pub mod create_function;
110-
pub mod create_index;
111-
pub mod describe_table;
112-
pub mod recursive_query;
113-
pub mod constraints;
113+
pub mod window;
114114

115115
use sort_expr::{to_sort_expressions, PySortExpr};
116116

src/expr/constraints.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,3 @@ impl Display for PyConstraints {
2626
write!(f, "Constraints: {:?}", self.constraints)
2727
}
2828
}
29-

src/expr/copy_to.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18-
use std::{collections::HashMap, fmt::{self, Display, Formatter}, sync::Arc};
18+
use std::{
19+
collections::HashMap,
20+
fmt::{self, Display, Formatter},
21+
sync::Arc,
22+
};
1923

2024
use datafusion::{common::file_options::file_type::FileType, logical_expr::dml::CopyTo};
2125
use pyo3::prelude::*;
@@ -49,7 +53,6 @@ impl Display for PyCopyTo {
4953
}
5054

5155
impl LogicalNode for PyCopyTo {
52-
5356
fn inputs(&self) -> Vec<PyLogicalPlan> {
5457
vec![PyLogicalPlan::from((*self.copy.input).clone())]
5558
}
@@ -67,7 +70,8 @@ impl PyCopyTo {
6770
output_url: String,
6871
partition_by: Vec<String>,
6972
file_type: PyFileType,
70-
options: HashMap<String, String>) -> Self {
73+
options: HashMap<String, String>,
74+
) -> Self {
7175
return PyCopyTo {
7276
copy: CopyTo {
7377
input: input.plan(),
@@ -76,7 +80,7 @@ impl PyCopyTo {
7680
file_type: file_type.file_type,
7781
options,
7882
},
79-
}
83+
};
8084
}
8185

8286
fn input(&self) -> PyLogicalPlan {
@@ -92,7 +96,9 @@ impl PyCopyTo {
9296
}
9397

9498
fn file_type(&self) -> PyFileType {
95-
PyFileType { file_type: self.copy.file_type.clone() }
99+
PyFileType {
100+
file_type: self.copy.file_type.clone(),
101+
}
96102
}
97103

98104
fn options(&self) -> HashMap<String, String> {

src/expr/create_catalog.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18-
use std::{fmt::{self, Display, Formatter}, sync::Arc};
18+
use std::{
19+
fmt::{self, Display, Formatter},
20+
sync::Arc,
21+
};
1922

2023
use datafusion::logical_expr::CreateCatalog;
2124
use pyo3::prelude::*;
@@ -50,15 +53,18 @@ impl Display for PyCreateCatalog {
5053

5154
#[pymethods]
5255
impl PyCreateCatalog {
53-
5456
#[new]
55-
pub fn new(catalog_name: String, if_not_exists: bool, schema: PyDFSchema) -> PyResult<PyCreateCatalog> {
57+
pub fn new(
58+
catalog_name: String,
59+
if_not_exists: bool,
60+
schema: PyDFSchema,
61+
) -> PyResult<PyCreateCatalog> {
5662
Ok(PyCreateCatalog {
5763
create: CreateCatalog {
5864
catalog_name,
5965
if_not_exists,
6066
schema: Arc::new(schema.into()),
61-
}
67+
},
6268
})
6369
}
6470

src/expr/create_catalog_schema.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18-
use std::{fmt::{self, Display, Formatter}, sync::Arc};
18+
use std::{
19+
fmt::{self, Display, Formatter},
20+
sync::Arc,
21+
};
1922

2023
use datafusion::logical_expr::CreateCatalogSchema;
2124
use pyo3::prelude::*;
@@ -30,7 +33,6 @@ pub struct PyCreateCatalogSchema {
3033
create: CreateCatalogSchema,
3134
}
3235

33-
3436
impl From<PyCreateCatalogSchema> for CreateCatalogSchema {
3537
fn from(create: PyCreateCatalogSchema) -> Self {
3638
create.create
@@ -49,18 +51,20 @@ impl Display for PyCreateCatalogSchema {
4951
}
5052
}
5153

52-
5354
#[pymethods]
5455
impl PyCreateCatalogSchema {
55-
5656
#[new]
57-
pub fn new(schema_name: String, if_not_exists: bool, schema: PyDFSchema) -> PyResult<PyCreateCatalogSchema> {
57+
pub fn new(
58+
schema_name: String,
59+
if_not_exists: bool,
60+
schema: PyDFSchema,
61+
) -> PyResult<PyCreateCatalogSchema> {
5862
Ok(PyCreateCatalogSchema {
5963
create: CreateCatalogSchema {
6064
schema_name,
6165
if_not_exists,
6266
schema: Arc::new(schema.into()),
63-
}
67+
},
6468
})
6569
}
6670

src/expr/create_external_table.rs

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@
1616
// under the License.
1717

1818
use crate::{expr::PyExpr, sql::logical::PyLogicalPlan};
19-
use std::{collections::HashMap, fmt::{self, Display, Formatter}, sync::Arc};
19+
use std::{
20+
collections::HashMap,
21+
fmt::{self, Display, Formatter},
22+
sync::Arc,
23+
};
2024

2125
use datafusion::logical_expr::CreateExternalTable;
2226
use pyo3::prelude::*;
@@ -45,7 +49,11 @@ impl From<CreateExternalTable> for PyCreateExternalTable {
4549

4650
impl Display for PyCreateExternalTable {
4751
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
48-
write!(f, "CreateExternalTable: {:?}{}", self.create.name, self.create.constraints)
52+
write!(
53+
f,
54+
"CreateExternalTable: {:?}{}",
55+
self.create.name, self.create.constraints
56+
)
4957
}
5058
}
5159

@@ -92,76 +100,66 @@ impl PyCreateExternalTable {
92100
PyCreateExternalTable { create: create }
93101
}
94102

95-
96103
pub fn schema(&self) -> PyDFSchema {
97104
(*self.create.schema).clone().into()
98105
}
99106

100-
101107
pub fn name(&self) -> PyResult<String> {
102108
Ok(self.create.name.to_string())
103109
}
104110

105-
106111
pub fn location(&self) -> String {
107112
self.create.location.clone()
108113
}
109114

110-
111115
pub fn file_type(&self) -> String {
112116
self.create.file_type.clone()
113117
}
114118

115-
116119
pub fn table_partition_cols(&self) -> Vec<String> {
117120
self.create.table_partition_cols.clone()
118121
}
119122

120-
121123
pub fn if_not_exists(&self) -> bool {
122124
self.create.if_not_exists
123125
}
124126

125-
126127
pub fn temporary(&self) -> bool {
127128
self.create.temporary
128129
}
129130

130-
131131
pub fn definition(&self) -> Option<String> {
132132
self.create.definition.clone()
133133
}
134134

135-
136135
pub fn order_exprs(&self) -> Vec<Vec<PySortExpr>> {
137-
self.create.order_exprs.iter().map(|vec| vec.iter().map(|s| s.clone().into()).collect()).collect()
136+
self.create
137+
.order_exprs
138+
.iter()
139+
.map(|vec| vec.iter().map(|s| s.clone().into()).collect())
140+
.collect()
138141
}
139142

140-
141143
pub fn unbounded(&self) -> bool {
142144
self.create.unbounded
143145
}
144146

145-
146147
pub fn options(&self) -> HashMap<String, String> {
147148
self.create.options.clone()
148149
}
149150

150-
151151
pub fn constraints(&self) -> PyConstraints {
152152
PyConstraints {
153153
constraints: self.create.constraints.clone(),
154154
}
155155
}
156156

157-
158157
pub fn column_defaults(&self) -> HashMap<String, PyExpr> {
159158
self.create
160159
.column_defaults
161160
.iter()
162161
.map(|(k, v)| (k.clone(), v.clone().into()))
163162
.collect()
164-
165163
}
166164

167165
fn __repr__(&self) -> PyResult<String> {
@@ -173,7 +171,6 @@ impl PyCreateExternalTable {
173171
}
174172
}
175173

176-
177174
impl LogicalNode for PyCreateExternalTable {
178175
fn inputs(&self) -> Vec<PyLogicalPlan> {
179176
vec![]
@@ -183,4 +180,3 @@ impl LogicalNode for PyCreateExternalTable {
183180
Ok(self.clone().into_py(py))
184181
}
185182
}
186-

0 commit comments

Comments
 (0)