Skip to content

Commit 59339fb

Browse files
committed
Apply cargo fmt
1 parent d653b0c commit 59339fb

1 file changed

Lines changed: 11 additions & 21 deletions

File tree

src/lib.rs

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,12 @@ fn df_to_py(py: Python<'_>, df: &DataFrame) -> PyResult<Py<PyAny>> {
2525
let rb = df.inner();
2626
let mut buffer = Vec::new();
2727
{
28-
let mut writer = StreamWriter::try_new(&mut buffer, &rb.schema())
29-
.map_err(|e| {
30-
PyErr::new::<pyo3::exceptions::PyValueError, _>(format!(
31-
"Failed to create IPC writer: {}",
32-
e
33-
))
34-
})?;
28+
let mut writer = StreamWriter::try_new(&mut buffer, &rb.schema()).map_err(|e| {
29+
PyErr::new::<pyo3::exceptions::PyValueError, _>(format!(
30+
"Failed to create IPC writer: {}",
31+
e
32+
))
33+
})?;
3534
writer.write(rb).map_err(|e| {
3635
PyErr::new::<pyo3::exceptions::PyValueError, _>(format!(
3736
"Failed to write RecordBatch: {}",
@@ -79,10 +78,7 @@ fn py_to_df(py: Python<'_>, obj: &Bound<'_, PyAny>) -> PyResult<DataFrame> {
7978

8079
let cursor = Cursor::new(ipc_bytes);
8180
let reader = StreamReader::try_new(cursor, None).map_err(|e| {
82-
PyErr::new::<pyo3::exceptions::PyValueError, _>(format!(
83-
"Failed to read IPC stream: {}",
84-
e
85-
))
81+
PyErr::new::<pyo3::exceptions::PyValueError, _>(format!("Failed to read IPC stream: {}", e))
8682
})?;
8783

8884
let batches: Vec<_> = reader
@@ -99,14 +95,9 @@ fn py_to_df(py: Python<'_>, obj: &Bound<'_, PyAny>) -> PyResult<DataFrame> {
9995
return Ok(DataFrame::empty());
10096
}
10197

102-
let combined = arrow::compute::concat_batches(&batches[0].schema(), &batches).map_err(
103-
|e| {
104-
PyErr::new::<pyo3::exceptions::PyValueError, _>(format!(
105-
"Failed to concat batches: {}",
106-
e
107-
))
108-
},
109-
)?;
98+
let combined = arrow::compute::concat_batches(&batches[0].schema(), &batches).map_err(|e| {
99+
PyErr::new::<pyo3::exceptions::PyValueError, _>(format!("Failed to concat batches: {}", e))
100+
})?;
110101

111102
Ok(DataFrame::from_record_batch(combined))
112103
}
@@ -181,8 +172,7 @@ impl Reader for PyReaderBridge {
181172

182173
fn register(&self, name: &str, df: DataFrame, replace: bool) -> ggsql::Result<()> {
183174
Python::attach(|py| {
184-
let py_table =
185-
df_to_py(py, &df).map_err(|e| GgsqlError::ReaderError(e.to_string()))?;
175+
let py_table = df_to_py(py, &df).map_err(|e| GgsqlError::ReaderError(e.to_string()))?;
186176
self.obj
187177
.bind(py)
188178
.call_method1("register", (name, py_table, replace))

0 commit comments

Comments
 (0)