Skip to content

Commit 2dda4ff

Browse files
feat: add upstream variant and method params
- `WindowFunction` and `AggregateFunction` have `null_treatment` options. - `ScalarValue` and `DataType` have new variants - `SchemaProvider::table` now returns a `Result`
1 parent 5e74b74 commit 2dda4ff

File tree

5 files changed

+31
-3
lines changed

5 files changed

+31
-3
lines changed

src/catalog.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ impl PyDatabase {
9797
}
9898

9999
fn table(&self, name: &str, py: Python) -> PyResult<PyTable> {
100-
if let Some(table) = wait_for_future(py, self.database.table(name)) {
100+
if let Some(table) = wait_for_future(py, self.database.table(name))? {
101101
Ok(PyTable::new(table))
102102
} else {
103103
Err(DataFusionError::Common(format!("Table not found: {name}")).into())

src/common/data_type.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,19 @@ impl DataTypeMap {
226226
DataType::RunEndEncoded(_, _) => Err(py_datafusion_err(
227227
DataFusionError::NotImplemented(format!("{:?}", arrow_type)),
228228
)),
229+
DataType::BinaryView => Err(py_datafusion_err(DataFusionError::NotImplemented(
230+
format!("{:?}", arrow_type),
231+
))),
232+
DataType::Utf8View => Err(py_datafusion_err(DataFusionError::NotImplemented(format!(
233+
"{:?}",
234+
arrow_type
235+
)))),
236+
DataType::ListView(_) => Err(py_datafusion_err(DataFusionError::NotImplemented(
237+
format!("{:?}", arrow_type),
238+
))),
239+
DataType::LargeListView(_) => Err(py_datafusion_err(DataFusionError::NotImplemented(
240+
format!("{:?}", arrow_type),
241+
))),
229242
}
230243
}
231244

@@ -309,6 +322,9 @@ impl DataTypeMap {
309322
ScalarValue::DurationMillisecond(_) => Ok(DataType::Duration(TimeUnit::Millisecond)),
310323
ScalarValue::DurationMicrosecond(_) => Ok(DataType::Duration(TimeUnit::Microsecond)),
311324
ScalarValue::DurationNanosecond(_) => Ok(DataType::Duration(TimeUnit::Nanosecond)),
325+
ScalarValue::Union(_, _, _) => Err(py_datafusion_err(DataFusionError::NotImplemented(
326+
"ScalarValue::LargeList".to_string(),
327+
))),
312328
}
313329
}
314330
}
@@ -598,6 +614,10 @@ impl DataTypeMap {
598614
DataType::Decimal256(_, _) => "Decimal256",
599615
DataType::Map(_, _) => "Map",
600616
DataType::RunEndEncoded(_, _) => "RunEndEncoded",
617+
DataType::BinaryView => "BinaryView",
618+
DataType::Utf8View => "Utf8View",
619+
DataType::ListView(_) => "ListView",
620+
DataType::LargeListView(_) => "LargeListView",
601621
})
602622
}
603623
}

src/expr.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,11 @@ impl PyExpr {
382382
"ScalarValue::LargeList".to_string(),
383383
),
384384
)),
385+
ScalarValue::Union(_, _, _) => Err(py_datafusion_err(
386+
datafusion_common::DataFusionError::NotImplemented(
387+
"ScalarValue::Union".to_string(),
388+
),
389+
)),
385390
},
386391
_ => Err(py_type_err(format!(
387392
"Non Expr::Literal encountered in types: {:?}",

src/functions.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ fn count_star() -> PyResult<PyExpr> {
162162
distinct: false,
163163
filter: None,
164164
order_by: None,
165+
null_treatment: None,
165166
}),
166167
})
167168
}
@@ -214,6 +215,7 @@ fn window(
214215
.map(|x| x.expr)
215216
.collect::<Vec<_>>(),
216217
window_frame,
218+
null_treatment: None,
217219
}),
218220
})
219221
}
@@ -256,6 +258,7 @@ macro_rules! aggregate_function {
256258
distinct,
257259
filter: None,
258260
order_by: None,
261+
null_treatment: None,
259262
});
260263
expr.into()
261264
}

src/utils.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ pub(crate) fn get_tokio_runtime(py: Python) -> PyRef<TokioRuntime> {
3737
}
3838

3939
/// Utility to collect rust futures with GIL released
40-
pub fn wait_for_future<F: Future>(py: Python, f: F) -> F::Output
40+
pub fn wait_for_future<F>(py: Python, f: F) -> F::Output
4141
where
42-
F: Send,
42+
F: Future + Send,
4343
F::Output: Send,
4444
{
4545
let runtime: &Runtime = &get_tokio_runtime(py).0;

0 commit comments

Comments
 (0)