Skip to content

Commit c57de4b

Browse files
authored
refactor(python): Remove unused functions from the rust side (#23757)
1 parent a7081b6 commit c57de4b

File tree

3 files changed

+1
-89
lines changed

3 files changed

+1
-89
lines changed

crates/polars-python/src/dataframe/io.rs

Lines changed: 1 addition & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,7 @@ use pyo3::pybacked::PyBackedStr;
1111

1212
use super::PyDataFrame;
1313
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};
1815
use crate::prelude::PyCompatLevel;
1916
use crate::utils::EnterPolarsExt;
2017

@@ -127,58 +124,6 @@ impl PyDataFrame {
127124
})
128125
}
129126

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-
182127
#[staticmethod]
183128
#[cfg(feature = "json")]
184129
#[pyo3(signature = (py_f, infer_schema_length, schema, schema_overrides))]
@@ -209,33 +154,6 @@ impl PyDataFrame {
209154
})
210155
}
211156

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-
239157
#[staticmethod]
240158
#[cfg(feature = "ipc")]
241159
#[pyo3(signature = (py_f, columns, projection, n_rows, row_index, memory_map))]

crates/polars-python/src/functions/lazy.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -169,11 +169,6 @@ pub fn collect_all_with_callback(
169169
})
170170
}
171171

172-
#[pyfunction]
173-
pub fn cols(names: Vec<String>) -> PyExpr {
174-
dsl::cols(names).as_expr().into()
175-
}
176-
177172
#[pyfunction]
178173
pub fn concat_lf(
179174
seq: &Bound<'_, PyAny>,

py-polars/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,6 @@ fn polars(py: Python, m: &Bound<PyModule>) -> PyResult<()> {
186186
.unwrap();
187187
m.add_wrapped(wrap_pyfunction!(functions::collect_all_with_callback))
188188
.unwrap();
189-
m.add_wrapped(wrap_pyfunction!(functions::cols)).unwrap();
190189
m.add_wrapped(wrap_pyfunction!(functions::concat_lf))
191190
.unwrap();
192191
m.add_wrapped(wrap_pyfunction!(functions::concat_arr))

0 commit comments

Comments
 (0)