fix: several clippy error/warnings after upgrading toolchain (#2156)

* fix pyscripts mod

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* fix clippy::needless-pass-by-ref-mut

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* add pyo3 feature gate in Makefile

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

---------

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
This commit is contained in:
Ruihang Xia
2023-08-11 20:20:21 +08:00
committed by GitHub
parent 6877d082f6
commit 4fd1057764
6 changed files with 14 additions and 15 deletions

View File

@@ -351,7 +351,7 @@ bind_aggr_expr!(median, Median,[v0], v0, expr0=>0);
#[pyfunction]
fn approx_percentile_cont(py: Python<'_>, values: &PyVector, percent: f64) -> PyResult<PyObject> {
let percent = expressions::Literal::new(datafusion_common::ScalarValue::Float64(Some(percent)));
return eval_df_aggr_expr(
eval_df_aggr_expr(
py,
expressions::ApproxPercentileCont::new(
vec![
@@ -363,7 +363,7 @@ fn approx_percentile_cont(py: Python<'_>, values: &PyVector, percent: f64) -> Py
)
.map_err(|e| PyValueError::new_err(format!("{e:?}")))?,
&[values.to_arrow_array()],
);
)
}
bind_aggr_expr!(array_agg, ArrayAgg,[v0], v0, expr0=>0);

View File

@@ -69,7 +69,7 @@ pub(crate) fn pyo3_exec_parsed(
) -> Result<RecordBatch> {
let _t = timer!(metric::METRIC_PYO3_EXEC_TOTAL_ELAPSED);
// i.e params or use `vector(..)` to construct a PyVector
let arg_names = &copr.deco_args.arg_names.clone().unwrap_or(vec![]);
let arg_names = &copr.deco_args.arg_names.clone().unwrap_or_default();
let args: Vec<PyVector> = if let Some(rb) = rb {
let args = select_from_rb(rb, arg_names)?;
check_args_anno_real_type(arg_names, &args, copr, rb)?;
@@ -270,7 +270,7 @@ fn py_list_to_vec(list: &PyList) -> PyResult<VectorRef> {
})?;
v.push(scalar);
}
let array = ScalarValue::iter_to_array(v.into_iter()).map_err(|err| {
let array = ScalarValue::iter_to_array(v).map_err(|err| {
PyRuntimeError::new_err(format!("Can't convert scalar value list to array: {}", err))
})?;
let ret = Helper::try_into_vector(array).map_err(|err| {