@@ -11,10 +11,7 @@ use pyo3::pybacked::PyBackedStr;
11
11
12
12
use super :: PyDataFrame ;
13
13
use crate :: conversion:: Wrap ;
14
- use crate :: file:: {
15
- EitherRustPythonFile , get_either_file, get_file_like, get_mmap_bytes_reader,
16
- get_mmap_bytes_reader_and_path,
17
- } ;
14
+ use crate :: file:: { get_file_like, get_mmap_bytes_reader, get_mmap_bytes_reader_and_path} ;
18
15
use crate :: prelude:: PyCompatLevel ;
19
16
use crate :: utils:: EnterPolarsExt ;
20
17
@@ -127,58 +124,6 @@ impl PyDataFrame {
127
124
} )
128
125
}
129
126
130
- #[ staticmethod]
131
- #[ cfg( feature = "parquet" ) ]
132
- #[ pyo3( signature = ( py_f, columns, projection, n_rows, row_index, low_memory, parallel, use_statistics, rechunk) ) ]
133
- pub fn read_parquet (
134
- py : Python < ' _ > ,
135
- py_f : PyObject ,
136
- columns : Option < Vec < String > > ,
137
- projection : Option < Vec < usize > > ,
138
- n_rows : Option < usize > ,
139
- row_index : Option < ( String , IdxSize ) > ,
140
- low_memory : bool ,
141
- parallel : Wrap < ParallelStrategy > ,
142
- use_statistics : bool ,
143
- rechunk : bool ,
144
- ) -> PyResult < Self > {
145
- use EitherRustPythonFile :: * ;
146
-
147
- let row_index = row_index. map ( |( name, offset) | RowIndex {
148
- name : name. into ( ) ,
149
- offset,
150
- } ) ;
151
-
152
- _ = use_statistics;
153
-
154
- match get_either_file ( py_f, false ) ? {
155
- Py ( f) => {
156
- let buf = std:: io:: Cursor :: new ( f. to_memslice ( ) ) ;
157
- py. enter_polars_df ( move || {
158
- ParquetReader :: new ( buf)
159
- . with_projection ( projection)
160
- . with_columns ( columns)
161
- . read_parallel ( parallel. 0 )
162
- . with_slice ( n_rows. map ( |x| ( 0 , x) ) )
163
- . with_row_index ( row_index)
164
- . set_low_memory ( low_memory)
165
- . set_rechunk ( rechunk)
166
- . finish ( )
167
- } )
168
- } ,
169
- Rust ( f) => py. enter_polars_df ( move || {
170
- ParquetReader :: new ( f)
171
- . with_projection ( projection)
172
- . with_columns ( columns)
173
- . read_parallel ( parallel. 0 )
174
- . with_slice ( n_rows. map ( |x| ( 0 , x) ) )
175
- . with_row_index ( row_index)
176
- . set_rechunk ( rechunk)
177
- . finish ( )
178
- } ) ,
179
- }
180
- }
181
-
182
127
#[ staticmethod]
183
128
#[ cfg( feature = "json" ) ]
184
129
#[ pyo3( signature = ( py_f, infer_schema_length, schema, schema_overrides) ) ]
@@ -209,33 +154,6 @@ impl PyDataFrame {
209
154
} )
210
155
}
211
156
212
- #[ staticmethod]
213
- #[ cfg( feature = "json" ) ]
214
- #[ pyo3( signature = ( py_f, ignore_errors, schema, schema_overrides) ) ]
215
- pub fn read_ndjson (
216
- py : Python < ' _ > ,
217
- py_f : Bound < PyAny > ,
218
- ignore_errors : bool ,
219
- schema : Option < Wrap < Schema > > ,
220
- schema_overrides : Option < Wrap < Schema > > ,
221
- ) -> PyResult < Self > {
222
- let mmap_bytes_r = get_mmap_bytes_reader ( & py_f) ?;
223
-
224
- let mut builder = JsonReader :: new ( mmap_bytes_r)
225
- . with_json_format ( JsonFormat :: JsonLines )
226
- . with_ignore_errors ( ignore_errors) ;
227
-
228
- if let Some ( schema) = schema {
229
- builder = builder. with_schema ( Arc :: new ( schema. 0 ) ) ;
230
- }
231
-
232
- if let Some ( schema) = schema_overrides. as_ref ( ) {
233
- builder = builder. with_schema_overwrite ( & schema. 0 ) ;
234
- }
235
-
236
- py. enter_polars_df ( move || builder. finish ( ) )
237
- }
238
-
239
157
#[ staticmethod]
240
158
#[ cfg( feature = "ipc" ) ]
241
159
#[ pyo3( signature = ( py_f, columns, projection, n_rows, row_index, memory_map) ) ]
0 commit comments