1616// under the License.
1717
1818use 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
2125use datafusion:: logical_expr:: CreateExternalTable ;
2226use pyo3:: prelude:: * ;
@@ -45,7 +49,11 @@ impl From<CreateExternalTable> for PyCreateExternalTable {
4549
4650impl 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-
177174impl 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