This is an automated email from the ASF dual-hosted git repository.
HyukjinKwon pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark-connect-rust.git
The following commit(s) were added to refs/heads/master by this push:
new 7279b055 [SPARK-61603][CONNECT] Take any iterable of columns or names
in drop_columns, with_columns, grouping_sets, udtf and the other remaining list
arguments of the Rust API
7279b055 is described below
commit 7279b05562bcb1ef01b273fd11a7a8392b1ef411
Author: Hyukjin Kwon <[email protected]>
AuthorDate: Fri Nov 13 10:33:26 2026 +0900
[SPARK-61603][CONNECT] Take any iterable of columns or names in
drop_columns, with_columns, grouping_sets, udtf and the other remaining list
arguments of the Rust API
### What changes were proposed in this pull request?
Part 2 of the column-list sweep of the Rust API (part 1: SPARK-61600). The
remaining list-taking methods take any iterable, as `select` and `group_by` do,
with #590's patterns: `C: Into<Column>` for columns and `S: Into<String>` for
names.
- Columns: `DataFrame::drop_columns` (both lists), `with_columns`
(name/Column pairs), `grouping_sets`, `grouping_sets_with_columns`,
`TableValuedFunction::udtf`, `functions::count_distinct_columns`, the wasm UDF
`to_expression`, and `DataStreamWriter::partition_by` and `cluster_by` (which
took `Vec<&str>`).
- Names: `DataFrame::drop`, `with_columns_renamed` (pairs), `describe`,
`to_df`, `to_schema`, `melt` (`id_vars`), the numeric aggregates of
`GroupedData`, `StatFunctions::freq_items` and `approx_quantile`, and
`Column::drop_fields`.
- A `columns_of` helper is added next to `expressions_of`.
- The sweep paragraph of `docs/compatibility.md` is extended. The drop-in
does not change behavior: eight `to_df` call sites collect into a `Vec`.
The `Option<Vec<&str>>` subset arguments (`fillna*`, `dropna`,
`drop_duplicates*`, `replace_*`, `fill`, `melt`'s `value_vars`) are unchanged,
because a bare `None` would become ambiguous for their callers.
### Why are the changes needed?
For a consistent API: before, `df.drop(["temp_col"])` did not compile
("expected Vec<&str>, found [&str; 1]"), and only a `Vec` was taken. After,
arrays, Vecs and iterators all compile and build the same plan.
### Does this PR introduce _any_ user-facing change?
Yes, in the Rust API: these methods take any iterable. Callers that pass a
`Vec` or an array need no change. A caller that passes an empty `vec![]` or
`[]` needs its item type (`Vec::<Column>::new()`), as the compatibility docs
note.
### How was this patch tested?
- Unit tests compare the plan protos of the array, Vec and iterator forms,
and fail to compile against the old signatures.
`list_methods_take_any_iterable_as_their_vec_does` covers the DataFrame
methods, plus tests for `drop_fields`, `udtf`, the stream writer and the wasm
`to_expression`.
- e2e: `list_methods_take_any_iterable_on_the_server`.
- On the branch, against Spark 4.3.0:
- The full spark-connect integration suite: 1012 passed.
- The doc snippet checker: 56 snippets.
- CI's offline Python set: 3273 passed.
- `test_dropin_e2e.py`: 275 passed.
- On the tree merged with the latest master: the lib tests (656 and 220),
the `--no-run` builds with and without `wasm-udf`, the pyspark-rs and examples
builds, `cargo fmt`, and the new e2e test.
### Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Opus 5.5
This pull request and its description were written by Isaac.
Closes #598 from HyukjinKwon/SPARK-61603-column-list-part2.
Authored-by: Hyukjin Kwon <[email protected]>
Signed-off-by: Hyukjin Kwon <[email protected]>
---
crates/pyspark-rs/src/pyarrow_import.rs | 2 +-
crates/pyspark-rs/src/session.rs | 65 ++++++---
crates/spark-connect/src/column.rs | 15 +-
crates/spark-connect/src/dataframe.rs | 203 ++++++++++++++++++++++++----
crates/spark-connect/src/functions.rs | 11 +-
crates/spark-connect/src/group.rs | 31 +++--
crates/spark-connect/src/streaming.rs | 31 ++++-
crates/spark-connect/src/tvf.rs | 45 +++++-
crates/spark-connect/src/wasm_udf.rs | 28 +++-
crates/spark-connect/tests/e2e_dataframe.rs | 87 ++++++++++--
docs/compatibility.md | 29 ++--
11 files changed, 453 insertions(+), 94 deletions(-)
diff --git a/crates/pyspark-rs/src/pyarrow_import.rs
b/crates/pyspark-rs/src/pyarrow_import.rs
index afaf2b7c..06fac127 100644
--- a/crates/pyspark-rs/src/pyarrow_import.rs
+++ b/crates/pyspark-rs/src/pyarrow_import.rs
@@ -92,7 +92,7 @@ pub(crate) fn create_dataframe(
// As in PySpark, column names are applied with toDF only when there are
any.
let dataframe = match names {
Some(names) if !names.is_empty() => {
- dataframe.to_df(names.iter().map(String::as_str).collect())
+
dataframe.to_df(names.iter().map(String::as_str).collect::<Vec<_>>())
}
_ => dataframe,
};
diff --git a/crates/pyspark-rs/src/session.rs b/crates/pyspark-rs/src/session.rs
index eb13281c..b4b6b995 100644
--- a/crates/pyspark-rs/src/session.rs
+++ b/crates/pyspark-rs/src/session.rs
@@ -1063,7 +1063,9 @@ impl PySparkSession {
// them, so this only changes the plan, which the server resolves into
a Project that
// is not local; it keeps isLocal() as in pyspark and is not redundant.
Ok(PyDataFrame::new(match cols.take() {
- Some(cols) if !cols.is_empty() =>
df.to_df(cols.iter().map(String::as_str).collect()),
+ Some(cols) if !cols.is_empty() => {
+ df.to_df(cols.iter().map(String::as_str).collect::<Vec<_>>())
+ }
_ => df,
}))
}
@@ -1138,9 +1140,14 @@ impl PySparkSession {
.map_err(Box::new)
})?;
// As the other pandas paths, the explicit names are applied with toDF.
- Ok(Some(PyDataFrame::new(df.to_df(
- fields.iter().map(|field| field.name.as_str()).collect(),
- ))))
+ Ok(Some(PyDataFrame::new(
+ df.to_df(
+ fields
+ .iter()
+ .map(|field| field.name.as_str())
+ .collect::<Vec<_>>(),
+ ),
+ )))
}
/// A DataFrame of a pandas DataFrame without a schema, or of names, as
PySpark Connect
@@ -1228,7 +1235,7 @@ impl PySparkSession {
Ok(Some(PyDataFrame::new(if columns.is_empty() {
df
} else {
- df.to_df(columns.iter().map(String::as_str).collect())
+ df.to_df(columns.iter().map(String::as_str).collect::<Vec<_>>())
})))
}
@@ -1713,7 +1720,7 @@ impl PySparkSession {
};
Ok(PyDataFrame::new(match names {
Some(names) if !names.is_empty() => {
- df.to_df(names.iter().map(String::as_str).collect())
+ df.to_df(names.iter().map(String::as_str).collect::<Vec<_>>())
}
_ => df,
}))
@@ -2142,9 +2149,12 @@ impl PySparkSession {
return Ok(match &spec {
Spec::Struct(fields) if !fields.is_empty() && table.len()?
> 0 => {
PyDataFrame::new(
- frame
- .dataframe
- .to_df(fields.iter().map(|field|
field.name.as_str()).collect()),
+ frame.dataframe.to_df(
+ fields
+ .iter()
+ .map(|field| field.name.as_str())
+ .collect::<Vec<_>>(),
+ ),
)
}
_ => frame,
@@ -2175,7 +2185,10 @@ impl PySparkSession {
Spec::Struct(fields) if !fields.is_empty() &&
table.len()? > 0 => {
PyDataFrame::new(
frame.dataframe.to_df(
- fields.iter().map(|field|
field.name.as_str()).collect(),
+ fields
+ .iter()
+ .map(|field| field.name.as_str())
+ .collect::<Vec<_>>(),
),
)
}
@@ -2208,7 +2221,12 @@ impl PySparkSession {
// Match pandas row input: explicit nonempty field names travel
// through toDF as well as the local relation's logical schema.
return Ok(PyDataFrame::new(
- frame.to_df(fields.iter().map(|field|
field.name.as_str()).collect()),
+ frame.to_df(
+ fields
+ .iter()
+ .map(|field| field.name.as_str())
+ .collect::<Vec<_>>(),
+ ),
));
}
let ipc = py
@@ -2223,9 +2241,12 @@ impl PySparkSession {
return Ok(match &spec {
Spec::Struct(fields) if !fields.is_empty() && ipc.len()? >
0 => {
PyDataFrame::new(
- frame
- .dataframe
- .to_df(fields.iter().map(|field|
field.name.as_str()).collect()),
+ frame.dataframe.to_df(
+ fields
+ .iter()
+ .map(|field| field.name.as_str())
+ .collect::<Vec<_>>(),
+ ),
)
}
_ => frame,
@@ -2252,7 +2273,12 @@ impl PySparkSession {
// Match pandas row input: explicit nonempty field names travel
// through toDF as well as the local relation's logical schema.
return Ok(PyDataFrame::new(
- frame.to_df(fields.iter().map(|field|
field.name.as_str()).collect()),
+ frame.to_df(
+ fields
+ .iter()
+ .map(|field| field.name.as_str())
+ .collect::<Vec<_>>(),
+ ),
));
}
let table = py
@@ -2265,9 +2291,12 @@ impl PySparkSession {
return Ok(match &spec {
Spec::Struct(fields) if !fields.is_empty() && table.len()?
> 0 => {
PyDataFrame::new(
- frame
- .dataframe
- .to_df(fields.iter().map(|field|
field.name.as_str()).collect()),
+ frame.dataframe.to_df(
+ fields
+ .iter()
+ .map(|field| field.name.as_str())
+ .collect::<Vec<_>>(),
+ ),
)
}
_ => frame,
diff --git a/crates/spark-connect/src/column.rs
b/crates/spark-connect/src/column.rs
index d16c167e..b98390df 100644
--- a/crates/spark-connect/src/column.rs
+++ b/crates/spark-connect/src/column.rs
@@ -263,7 +263,7 @@ impl Column {
/// Mirrors `pyspark.sql.column.Column.dropFields`: drop one or more fields
/// from a struct-typed column (chained `UpdateFields`, one per field).
- pub fn drop_fields(self, field_names: Vec<&str>) -> Column {
+ pub fn drop_fields<S: Into<String>>(self, field_names: impl
IntoIterator<Item = S>) -> Column {
let mut expr = self.expr;
for name in field_names {
expr =
ExpressionNode::UpdateFields(Box::new(UpdateFieldsExpr::new(expr, name, None)))
@@ -688,6 +688,11 @@ pub(crate) fn expressions_of<C: Into<Column>>(
.collect()
}
+/// The Columns of `columns`, for the APIs that keep a list of them.
+pub(crate) fn columns_of<C: Into<Column>>(columns: impl IntoIterator<Item =
C>) -> Vec<Column> {
+ columns.into_iter().map(Into::into).collect()
+}
+
/// Mirrors `pyspark.sql.functions.lit` for an integer value.
///
/// PySpark infers `IntegerType` for a Python int that fits in i32 and
`LongType`
@@ -1004,6 +1009,14 @@ mod tests {
assert!(expressions_of(Vec::<Column>::new()).is_empty());
}
+ #[test]
+ fn drop_fields_takes_any_names_as_a_vec_does() {
+ let of_vec = col("s").drop_fields(vec!["a", "b"]);
+ assert_eq!(col("s").drop_fields(["a", "b"]), of_vec);
+ assert_eq!(col("s").drop_fields(["a", "b"].iter().copied()), of_vec);
+ assert_eq!(col("s").drop_fields(["a", "b"].map(String::from)), of_vec);
+ }
+
#[test]
fn test_lit_functions() {
// Test lit with small number (fits in i32)
diff --git a/crates/spark-connect/src/dataframe.rs
b/crates/spark-connect/src/dataframe.rs
index eb5fc8b9..ea796d1c 100644
--- a/crates/spark-connect/src/dataframe.rs
+++ b/crates/spark-connect/src/dataframe.rs
@@ -10,7 +10,7 @@ use spark_connect_core::error::{Result, SparkError,
SparkErrorKind};
use spark_connect_core::runtime::{block_on, get_runtime};
use spark_connect_proto as proto;
-use crate::column::{expressions_of, Column};
+use crate::column::{columns_of, expressions_of, Column};
use crate::expression::{Expression, ExpressionNode, SortOrder};
use crate::plan::{
AggregateGroupType, AsOfJoinDirection, AsOfJoinType, JoinType,
LogicalPlan, RelationOwner,
@@ -499,9 +499,15 @@ impl DataFrame {
DataFrame::new(self.session.clone(), plan)
}
- /// Add or replace multiple columns.
- pub fn with_columns(&self, columns: Vec<(String, Column)>) -> DataFrame {
- let (names, cols) = columns.into_iter().unzip();
+ /// Add or replace multiple columns, of their names and Columns.
+ pub fn with_columns<N: Into<String>, C: Into<Column>>(
+ &self,
+ columns: impl IntoIterator<Item = (N, C)>,
+ ) -> DataFrame {
+ let (names, cols): (Vec<String>, Vec<Column>) = columns
+ .into_iter()
+ .map(|(name, column)| (name.into(), column.into()))
+ .unzip();
let plan = LogicalPlan::WithColumns {
input: Arc::clone(&self.plan),
column_names: names,
@@ -522,26 +528,36 @@ impl DataFrame {
/// Rename multiple columns, of old and new names in their order, in which
the server
/// applies them, as PySpark's `withColumnsRenamed` of a dict sends them:
so
/// `[("id", "a"), ("a", "b")]` renames `id` to `b`.
- pub fn with_columns_renamed(&self, renames: Vec<(String, String)>) ->
DataFrame {
+ pub fn with_columns_renamed<O: Into<String>, N: Into<String>>(
+ &self,
+ renames: impl IntoIterator<Item = (O, N)>,
+ ) -> DataFrame {
let plan = LogicalPlan::WithColumnsRenamed {
input: Arc::clone(&self.plan),
- renames,
+ renames: renames
+ .into_iter()
+ .map(|(old, new)| (old.into(), new.into()))
+ .collect(),
};
DataFrame::new(self.session.clone(), plan)
}
- /// Drop columns.
- pub fn drop(&self, columns: Vec<&str>) -> DataFrame {
- self.drop_columns(Vec::new(), columns)
+ /// Drop columns, of their names.
+ pub fn drop<S: Into<String>>(&self, columns: impl IntoIterator<Item = S>)
-> DataFrame {
+ self.drop_columns(Vec::<Column>::new(), columns)
}
/// Drop `columns` and the columns of `column_names`, mirroring
`pyspark.sql.DataFrame.drop`
/// of Columns and column names: a Column is sent as its expression, and a
name as it is.
- pub fn drop_columns(&self, columns: Vec<Column>, column_names: Vec<&str>)
-> DataFrame {
+ pub fn drop_columns<C: Into<Column>, S: Into<String>>(
+ &self,
+ columns: impl IntoIterator<Item = C>,
+ column_names: impl IntoIterator<Item = S>,
+ ) -> DataFrame {
let plan = LogicalPlan::Drop {
input: Arc::clone(&self.plan),
- columns: column_names.iter().map(|s| s.to_string()).collect(),
- expressions: columns.iter().map(|c|
c.expression().clone()).collect(),
+ columns: column_names.into_iter().map(Into::into).collect(),
+ expressions: expressions_of(columns),
};
DataFrame::new(self.session.clone(), plan)
}
@@ -841,8 +857,8 @@ impl DataFrame {
}
/// Convert to DataFrame with new column names.
- pub fn to_df(&self, column_names: Vec<&str>) -> DataFrame {
- let names = column_names.iter().map(|s| s.to_string()).collect();
+ pub fn to_df<S: Into<String>>(&self, column_names: impl IntoIterator<Item
= S>) -> DataFrame {
+ let names: Vec<String> =
column_names.into_iter().map(Into::into).collect();
let plan = LogicalPlan::ToDF {
input: Arc::clone(&self.plan),
column_names: names,
@@ -1878,19 +1894,23 @@ impl DataFrame {
}
/// Alias for to_df().
- pub fn to_schema(&self, column_names: Vec<&str>) -> DataFrame {
+ pub fn to_schema<S: Into<String>>(
+ &self,
+ column_names: impl IntoIterator<Item = S>,
+ ) -> DataFrame {
self.to_df(column_names)
}
/// Melt (unpivot) this DataFrame.
- pub fn melt(
+ pub fn melt<S: Into<String>>(
&self,
- id_vars: Vec<&str>,
+ id_vars: impl IntoIterator<Item = S>,
value_vars: Option<Vec<&str>>,
var_name: &str,
value_name: &str,
) -> DataFrame {
use crate::column::col;
+ let id_vars: Vec<String> =
id_vars.into_iter().map(Into::into).collect();
let ids: Vec<Column> = id_vars.iter().map(|name| col(name)).collect();
let vals: Option<Vec<Column>> =
value_vars.map(|v| v.iter().map(|name| col(name)).collect());
@@ -2204,8 +2224,8 @@ impl DataFrame {
}
/// Describe this DataFrame (show statistics).
- pub fn describe(&self, columns: Vec<&str>) -> DataFrame {
- let col_names = columns.iter().map(|s| s.to_string()).collect();
+ pub fn describe<S: Into<String>>(&self, columns: impl IntoIterator<Item =
S>) -> DataFrame {
+ let col_names = columns.into_iter().map(Into::into).collect();
let plan = LogicalPlan::Describe {
input: Arc::clone(&self.plan),
columns: col_names,
@@ -2279,7 +2299,11 @@ impl DataFrame {
/// Group by with grouping sets. Each inner `Vec<Column>` is one grouping
set;
/// the sets are preserved on the wire (`GROUP_TYPE_GROUPING_SETS` + the
/// `grouping_sets` field) rather than flattened into a single group-by.
- pub fn grouping_sets(&self, group_cols: Vec<Vec<Column>>) ->
crate::group::GroupedData {
+ pub fn grouping_sets<C: Into<Column>>(
+ &self,
+ group_cols: impl IntoIterator<Item = impl IntoIterator<Item = C>>,
+ ) -> crate::group::GroupedData {
+ let group_cols: Vec<Vec<Column>> =
group_cols.into_iter().map(columns_of).collect();
crate::group::GroupedData::new_grouping_sets(self.clone(), group_cols)
}
@@ -2287,12 +2311,17 @@ impl DataFrame {
/// which are the columns of the result besides the aggregations,
mirroring PySpark's
/// `DataFrame.groupingSets(groupingSets, *cols)`: a column of the
grouping columns that
/// a set does not hold is null in the rows of that set.
- pub fn grouping_sets_with_columns(
+ pub fn grouping_sets_with_columns<C: Into<Column>, D: Into<Column>>(
&self,
- grouping_sets: Vec<Vec<Column>>,
- group_cols: Vec<Column>,
+ grouping_sets: impl IntoIterator<Item = impl IntoIterator<Item = C>>,
+ group_cols: impl IntoIterator<Item = D>,
) -> crate::group::GroupedData {
- crate::group::GroupedData::new_grouping_sets_of(self.clone(),
grouping_sets, group_cols)
+ let grouping_sets: Vec<Vec<Column>> =
grouping_sets.into_iter().map(columns_of).collect();
+ crate::group::GroupedData::new_grouping_sets_of(
+ self.clone(),
+ grouping_sets,
+ columns_of(group_cols),
+ )
}
/// Sort within partitions (local sort), by `columns` as
[`DataFrame::sort`] sorts by them.
@@ -5458,7 +5487,7 @@ mod plan_construction_tests {
assert!(local.is_local());
assert!(cached.is_local());
// As in PySpark, where the server resolves toDF into a Project.
- assert!(!local.to_df(vec![]).is_local());
+ assert!(!local.to_df(Vec::<&str>::new()).is_local());
assert!(!cached.to_df(vec!["x"]).is_local());
assert!(!spark.range(1).unwrap().is_local());
}
@@ -6644,6 +6673,128 @@ mod plan_construction_tests {
);
}
+ /// The methods of lists of columns and of names take any iterable of
them, as `select`
+ /// does, and build the plans that their `Vec` builds: an array, a `Vec`
and an iterator alike.
+ #[test]
+ fn list_methods_take_any_iterable_as_their_vec_does() {
+ use crate::column::{col, lit};
+ use crate::functions::{count, count_distinct_columns};
+
+ let df = session().range(5).unwrap();
+ let aggregates = || [count(lit(1)).alias("rows")];
+ let same_as = |vec_form: &DataFrame, others: [&DataFrame; 2]| {
+ for other in others {
+ assert_eq!(other.plan.to_proto(), vec_form.plan.to_proto());
+ }
+ };
+
+ same_as(
+ &df.drop(vec!["id"]),
+ [&df.drop(["id"]), &df.drop(["id"].iter().copied())],
+ );
+ same_as(
+ &df.drop(vec![String::from("id")]),
+ [
+ &df.drop(["id"].map(String::from)),
+ &df.drop(["id"].into_iter().map(String::from)),
+ ],
+ );
+ same_as(
+ &df.drop_columns(vec![col("id")], vec!["x"]),
+ [
+ &df.drop_columns([col("id")], ["x"]),
+ &df.drop_columns(vec![col("id")].into_iter(),
["x"].into_iter()),
+ ],
+ );
+ same_as(
+ &df.with_columns(vec![("p".to_string(), lit(1))]),
+ [
+ &df.with_columns([("p", lit(1))]),
+ &df.with_columns(vec![("p", lit(1))].into_iter()),
+ ],
+ );
+ same_as(
+ &df.with_columns_renamed(vec![("id".to_string(),
"x".to_string())]),
+ [
+ &df.with_columns_renamed([("id", "x")]),
+ &df.with_columns_renamed(vec![("id", "x")].into_iter()),
+ ],
+ );
+ same_as(
+ &df.describe(vec!["id"]),
+ [&df.describe(["id"]), &df.describe(["id"].iter().copied())],
+ );
+ same_as(
+ &df.to_df(vec!["x"]),
+ [&df.to_df(["x"]), &df.to_df(["x"].iter().copied())],
+ );
+ same_as(
+ &df.to_schema(vec!["x"]),
+ [&df.to_schema(["x"]), &df.to_schema(["x"].iter().copied())],
+ );
+ same_as(
+ &df.melt(vec!["id"], None, "variable", "value"),
+ [
+ &df.melt(["id"], None, "variable", "value"),
+ &df.melt(["id"].iter().copied(), None, "variable", "value"),
+ ],
+ );
+ same_as(
+ &df.stat().freq_items(vec!["id"], 0.5),
+ [
+ &df.stat().freq_items(["id"], 0.5),
+ &df.stat().freq_items(["id"].iter().copied(), 0.5),
+ ],
+ );
+ same_as(
+ &df.stat().approx_quantile(vec!["id"], vec![0.5], 0.1),
+ [
+ &df.stat().approx_quantile(["id"], vec![0.5], 0.1),
+ &df.stat()
+ .approx_quantile(["id"].iter().copied(), vec![0.5], 0.1),
+ ],
+ );
+ // The grouping sets, and the grouping columns of
`grouping_sets_with_columns`, of arrays,
+ // Vecs and iterators.
+ same_as(
+ &df.grouping_sets(vec![vec![col("id")], vec![col("id") % lit(2)]])
+ .agg(aggregates()),
+ [
+ &df.grouping_sets([[col("id")], [col("id") % lit(2)]])
+ .agg(aggregates()),
+ &df.grouping_sets(
+ vec![col("id"), col("id") % lit(2)]
+ .into_iter()
+ .map(|column| [column]),
+ )
+ .agg(aggregates()),
+ ],
+ );
+ same_as(
+ &df.grouping_sets_with_columns(
+ vec![vec![col("id")]],
+ vec![col("id"), col("id") % lit(2)],
+ )
+ .agg(aggregates()),
+ [
+ &df.grouping_sets_with_columns([[col("id")]], [col("id"),
col("id") % lit(2)])
+ .agg(aggregates()),
+ &df.grouping_sets_with_columns(
+ (0..1).map(|_| vec![col("id")]),
+ vec![col("id"), col("id") % lit(2)].into_iter(),
+ )
+ .agg(aggregates()),
+ ],
+ );
+ same_as(
+ &df.agg([count_distinct_columns(col("id"), vec![col("id")])]),
+ [
+ &df.agg([count_distinct_columns(col("id"), [col("id")])]),
+ &df.agg([count_distinct_columns(col("id"), ["id"])]),
+ ],
+ );
+ }
+
/// Streaming reader terminal builders (serialize their plans) + the
writer builder
/// chain across every Trigger variant (setters only; no server-side
start()).
#[test]
@@ -6784,7 +6935,7 @@ mod plan_construction_tests {
let udtf_df = spark.tvf().udtf(
"myudtf",
- vec![],
+ Vec::<Column>::new(),
Some(DataType::Integer),
300,
vec![1, 2],
diff --git a/crates/spark-connect/src/functions.rs
b/crates/spark-connect/src/functions.rs
index 18323a26..794d3173 100644
--- a/crates/spark-connect/src/functions.rs
+++ b/crates/spark-connect/src/functions.rs
@@ -8,7 +8,7 @@
//! PySpark's camelCase spelling on purpose, so `non_snake_case` is allowed
here.
#![allow(non_snake_case)]
-use crate::column::Column;
+use crate::column::{expressions_of, Column};
use crate::dataframe::DataFrame;
use crate::expression::{
CallFunctionWrapper, Expression, ExpressionNode, LiteralExpression,
UnresolvedFunction,
@@ -858,9 +858,12 @@ pub fn count_distinct(col1: Column) -> Column {
/// Mirrors `pyspark.sql.functions.count_distinct(col, *cols)`: the number of
distinct
/// combinations of the columns.
-pub fn count_distinct_columns(col1: Column, cols: impl IntoIterator<Item =
Column>) -> Column {
+pub fn count_distinct_columns<C: Into<Column>>(
+ col1: Column,
+ cols: impl IntoIterator<Item = C>,
+) -> Column {
let mut args = vec![col1.expression().clone()];
- args.extend(cols.into_iter().map(|c| c.expression().clone()));
+ args.extend(expressions_of(cols));
func_distinct("count", args)
}
@@ -4915,7 +4918,7 @@ mod tests {
assert_eq!(counted.expression().render(), "count(distinct a, b, c)");
assert_eq!(distinct(counted), ("count".to_string(), 3, true));
assert_eq!(
- distinct(count_distinct_columns(col("a"), [])),
+ distinct(count_distinct_columns(col("a"), Vec::<Column>::new())),
distinct(count_distinct(col("a")))
);
let delimiter = || Column::new(lit_str(","));
diff --git a/crates/spark-connect/src/group.rs
b/crates/spark-connect/src/group.rs
index 4ea7f20e..1c278d3b 100644
--- a/crates/spark-connect/src/group.rs
+++ b/crates/spark-connect/src/group.rs
@@ -458,7 +458,12 @@ impl GroupedData {
/// group, mirroring `GroupedData._numeric_agg` of `min`, `max`, `avg`,
`mean` and `sum`:
/// every numeric column of the DataFrame without columns, and
`NOT_NUMERIC_COLUMNS` for a
/// column that is not a numeric one of its schema.
- pub fn numeric_agg(&self, function: &str, columns: Vec<&str>) ->
Result<DataFrame> {
+ pub fn numeric_agg<S: Into<String>>(
+ &self,
+ function: &str,
+ columns: impl IntoIterator<Item = S>,
+ ) -> Result<DataFrame> {
+ let columns: Vec<String> =
columns.into_iter().map(Into::into).collect();
let schema = self.dataframe.schema()?;
let names: Vec<String> = if columns.is_empty() {
match &schema {
@@ -498,27 +503,27 @@ impl GroupedData {
}
/// Sum values in each group, as `GroupedData.sum`: every numeric column
without `columns`.
- pub fn sum(&self, columns: Vec<&str>) -> Result<DataFrame> {
+ pub fn sum<S: Into<String>>(&self, columns: impl IntoIterator<Item = S>)
-> Result<DataFrame> {
self.numeric_agg("sum", columns)
}
/// Average values in each group, as `GroupedData.avg`: every numeric
column without `columns`.
- pub fn avg(&self, columns: Vec<&str>) -> Result<DataFrame> {
+ pub fn avg<S: Into<String>>(&self, columns: impl IntoIterator<Item = S>)
-> Result<DataFrame> {
self.numeric_agg("avg", columns)
}
/// Minimum values in each group, as `GroupedData.min`: every numeric
column without `columns`.
- pub fn min(&self, columns: Vec<&str>) -> Result<DataFrame> {
+ pub fn min<S: Into<String>>(&self, columns: impl IntoIterator<Item = S>)
-> Result<DataFrame> {
self.numeric_agg("min", columns)
}
/// Maximum values in each group, as `GroupedData.max`: every numeric
column without `columns`.
- pub fn max(&self, columns: Vec<&str>) -> Result<DataFrame> {
+ pub fn max<S: Into<String>>(&self, columns: impl IntoIterator<Item = S>)
-> Result<DataFrame> {
self.numeric_agg("max", columns)
}
/// Mean (alias for avg).
- pub fn mean(&self, columns: Vec<&str>) -> Result<DataFrame> {
+ pub fn mean<S: Into<String>>(&self, columns: impl IntoIterator<Item = S>)
-> Result<DataFrame> {
self.avg(columns)
}
}
@@ -644,25 +649,29 @@ impl StatFunctions {
}
/// Find frequent items.
- pub fn freq_items(&self, columns: Vec<&str>, support: f64) -> DataFrame {
+ pub fn freq_items<S: Into<String>>(
+ &self,
+ columns: impl IntoIterator<Item = S>,
+ support: f64,
+ ) -> DataFrame {
let plan = LogicalPlan::StatFreqItems {
input: Arc::clone(&self.dataframe.plan),
- columns: columns.iter().map(|s| s.to_string()).collect(),
+ columns: columns.into_iter().map(Into::into).collect(),
support,
};
DataFrame::new(self.dataframe.session.clone(), plan)
}
/// Compute approximate quantiles.
- pub fn approx_quantile(
+ pub fn approx_quantile<S: Into<String>>(
&self,
- columns: Vec<&str>,
+ columns: impl IntoIterator<Item = S>,
probabilities: Vec<f64>,
relative_error: f64,
) -> DataFrame {
let plan = LogicalPlan::StatApproxQuantile {
input: Arc::clone(&self.dataframe.plan),
- columns: columns.iter().map(|s| s.to_string()).collect(),
+ columns: columns.into_iter().map(Into::into).collect(),
probabilities,
relative_error,
};
diff --git a/crates/spark-connect/src/streaming.rs
b/crates/spark-connect/src/streaming.rs
index 0010d5bf..39ba9a5a 100644
--- a/crates/spark-connect/src/streaming.rs
+++ b/crates/spark-connect/src/streaming.rs
@@ -352,14 +352,14 @@ impl DataStreamWriter {
}
/// Set partitioning columns.
- pub fn partition_by(mut self, columns: Vec<&str>) -> Self {
- self.partitioning_columns = columns.iter().map(|s|
s.to_string()).collect();
+ pub fn partition_by<S: Into<String>>(mut self, columns: impl
IntoIterator<Item = S>) -> Self {
+ self.partitioning_columns =
columns.into_iter().map(Into::into).collect();
self
}
/// Set clustering columns.
- pub fn cluster_by(mut self, columns: Vec<&str>) -> Self {
- self.clustering_columns = columns.iter().map(|s|
s.to_string()).collect();
+ pub fn cluster_by<S: Into<String>>(mut self, columns: impl
IntoIterator<Item = S>) -> Self {
+ self.clustering_columns =
columns.into_iter().map(Into::into).collect();
self
}
@@ -3253,6 +3253,29 @@ mod tests {
assert_eq!(writer.clustering_columns, vec!["user_id", "session_id"]);
}
+ /// The partitioning and clustering columns of a writer are names of any
iterable, as a Vec.
+ #[test]
+ fn stream_writer_takes_names_as_any_iterable() {
+ let spark = session();
+ let df = spark.read_stream().format("kafka").load(None);
+ let of_vec = df
+ .write_stream()
+ .partition_by(vec!["date", "region"])
+ .cluster_by(vec!["user_id"]);
+ let of_array = df
+ .write_stream()
+ .partition_by(["date", "region"])
+ .cluster_by(["user_id"]);
+ let of_iter = df
+ .write_stream()
+ .partition_by(["date", "region"].map(String::from))
+ .cluster_by(["user_id"].iter().copied());
+ for writer in [&of_array, &of_iter] {
+ assert_eq!(writer.partitioning_columns,
of_vec.partitioning_columns);
+ assert_eq!(writer.clustering_columns, of_vec.clustering_columns);
+ }
+ }
+
#[test]
fn stream_writer_query_name() {
let spark = session();
diff --git a/crates/spark-connect/src/tvf.rs b/crates/spark-connect/src/tvf.rs
index 65a4e488..41e95881 100644
--- a/crates/spark-connect/src/tvf.rs
+++ b/crates/spark-connect/src/tvf.rs
@@ -3,7 +3,7 @@
//! Provides table-valued functions that return DataFrames, such as explode,
inline,
//! range, and other TVF operations.
-use crate::column::Column;
+use crate::column::{expressions_of, Column};
use crate::dataframe::DataFrame;
use crate::expression::Expression;
use crate::plan::LogicalPlan;
@@ -30,17 +30,17 @@ impl TableValuedFunction {
/// cloudpickles the handler and sets `eval_type` (300 SQL_TABLE_UDF,
/// 301 SQL_ARROW_TABLE_UDF, 302 SQL_ARROW_UDTF); `command` is the pickled
payload.
#[allow(clippy::too_many_arguments)]
- pub fn udtf(
+ pub fn udtf<C: Into<Column>>(
&self,
name: &str,
- arguments: Vec<Column>,
+ arguments: impl IntoIterator<Item = C>,
return_type: Option<DataType>,
eval_type: i32,
command: Vec<u8>,
python_ver: String,
deterministic: bool,
) -> DataFrame {
- let args: Vec<Expression> = arguments.iter().map(|c|
c.expression().clone()).collect();
+ let args: Vec<Expression> = expressions_of(arguments);
let plan = LogicalPlan::CommonInlineUdtf {
function_name: name.to_string(),
deterministic,
@@ -252,6 +252,43 @@ mod tests {
.expect("failed to build session")
}
+ /// `udtf` takes its arguments as any Columns, as a Vec of them, and sends
the same plan.
+ #[test]
+ fn udtf_takes_any_columns_as_a_vec_does() {
+ use crate::column::col;
+
+ let spark = session();
+ let of_vec = spark.tvf().udtf(
+ "myudtf",
+ vec![col("a")],
+ None,
+ 300,
+ vec![],
+ "3.11".to_string(),
+ true,
+ );
+ let of_array = spark.tvf().udtf(
+ "myudtf",
+ [col("a")],
+ None,
+ 300,
+ vec![],
+ "3.11".to_string(),
+ true,
+ );
+ let of_iter = spark.tvf().udtf(
+ "myudtf",
+ vec![col("a")].into_iter(),
+ None,
+ 300,
+ vec![],
+ "3.11".to_string(),
+ true,
+ );
+ assert_eq!(of_array.plan.to_proto(), of_vec.plan.to_proto());
+ assert_eq!(of_iter.plan.to_proto(), of_vec.plan.to_proto());
+ }
+
#[test]
fn tvf_range_plan() {
let spark = session();
diff --git a/crates/spark-connect/src/wasm_udf.rs
b/crates/spark-connect/src/wasm_udf.rs
index beb970c6..08814a72 100644
--- a/crates/spark-connect/src/wasm_udf.rs
+++ b/crates/spark-connect/src/wasm_udf.rs
@@ -68,7 +68,7 @@ use std::process::{Command, Stdio};
use base64::Engine as _;
-use crate::column::Column;
+use crate::column::{expressions_of, Column};
use crate::expression::ExpressionNode;
use crate::types::DataType;
use crate::udf::{eval_type, CommonInlineUserDefinedFunctionExpression,
PythonUDFPayload};
@@ -444,14 +444,14 @@ impl UserDefinedFunction {
/// Build the [`CommonInlineUserDefinedFunctionExpression`] for the given
/// argument columns.
- pub fn to_expression(
+ pub fn to_expression<C: Into<Column>>(
&self,
- args: Vec<Column>,
+ args: impl IntoIterator<Item = C>,
) -> Result<CommonInlineUserDefinedFunctionExpression> {
Ok(CommonInlineUserDefinedFunctionExpression::new(
self.name.clone(),
self.deterministic,
- args.iter().map(|c| c.expression().clone()).collect(),
+ expressions_of(args),
self.to_payload()?,
))
}
@@ -459,7 +459,6 @@ impl UserDefinedFunction {
/// Apply the UDF to `args`, producing a [`Column`] — mirroring calling a
/// PySpark `UserDefinedFunction` on columns (`my_udf(col("x"))`).
pub fn call<C: Into<Column>>(&self, args: impl IntoIterator<Item = C>) ->
Result<Column> {
- let args: Vec<Column> = args.into_iter().map(Into::into).collect();
let expr = self.to_expression(args)?;
Ok(Column::new(
ExpressionNode::CommonInlineUserDefinedFunction(Box::new(expr)).into(),
@@ -718,6 +717,25 @@ mod tests {
assert_eq!(cmd[0], 0x80); // cloudpickle PROTO opcode
}
+ /// `to_expression` takes its argument Columns as any iterable of them, as
`call` does. It
+ /// packs the UDF, so it runs with the packer, as the test above:
`--features wasm-udf -- --ignored`.
+ #[test]
+ #[ignore]
+ fn to_expression_takes_any_columns_as_a_vec_does() {
+ use crate::column::col;
+
+ let f = sample();
+ let of_vec = f
+ .to_expression(vec![col("x")])
+ .expect("packer should succeed");
+ let of_array = f.to_expression([col("x")]).expect("packer should
succeed");
+ let of_iter = f
+ .to_expression(vec![col("x")].into_iter())
+ .expect("packer should succeed");
+ assert_eq!(of_array.arguments, of_vec.arguments);
+ assert_eq!(of_iter.arguments, of_vec.arguments);
+ }
+
#[test]
fn parse_python_version_output_trims_whitespace() {
// Test that we correctly parse Python version strings from stdout
diff --git a/crates/spark-connect/tests/e2e_dataframe.rs
b/crates/spark-connect/tests/e2e_dataframe.rs
index dbdb10d3..168cc9eb 100644
--- a/crates/spark-connect/tests/e2e_dataframe.rs
+++ b/crates/spark-connect/tests/e2e_dataframe.rs
@@ -120,31 +120,35 @@ fn group_numeric_aggregates_follow_pyspark() {
};
// Every numeric column, in schema order, with PySpark's names (`sum(i)`,
...).
- let (cols, got) =
named_rows(&df.group_by(vec![col("k")]).sum(vec![]).unwrap());
+ let (cols, got) =
named_rows(&df.group_by(vec![col("k")]).sum(Vec::<&str>::new()).unwrap());
assert_eq!(cols, names(&["k", "sum(i)", "sum(l)", "sum(d)"]));
assert_eq!(
got,
rows(&[&["a", "3", "30", "4"], &["b", "3", "30", "NULL"]])
);
- let (cols, got) =
named_rows(&df.group_by(vec![col("k")]).avg(vec![]).unwrap());
+ let (cols, got) =
named_rows(&df.group_by(vec![col("k")]).avg(Vec::<&str>::new()).unwrap());
assert_eq!(cols, names(&["k", "avg(i)", "avg(l)", "avg(d)"]));
assert_eq!(
got,
rows(&[&["a", "1.5", "15", "2"], &["b", "3", "30", "NULL"]])
);
- let (cols, got) =
named_rows(&df.group_by(vec![col("k")]).mean(vec![]).unwrap());
+ let (cols, got) = named_rows(
+ &df.group_by(vec![col("k")])
+ .mean(Vec::<&str>::new())
+ .unwrap(),
+ );
assert_eq!(cols, names(&["k", "avg(i)", "avg(l)", "avg(d)"]));
assert_eq!(
got,
rows(&[&["a", "1.5", "15", "2"], &["b", "3", "30", "NULL"]])
);
- let (cols, got) =
named_rows(&df.group_by(vec![col("k")]).min(vec![]).unwrap());
+ let (cols, got) =
named_rows(&df.group_by(vec![col("k")]).min(Vec::<&str>::new()).unwrap());
assert_eq!(cols, names(&["k", "min(i)", "min(l)", "min(d)"]));
assert_eq!(
got,
rows(&[&["a", "1", "10", "1.5"], &["b", "3", "30", "NULL"]])
);
- let (cols, got) =
named_rows(&df.group_by(vec![col("k")]).max(vec![]).unwrap());
+ let (cols, got) =
named_rows(&df.group_by(vec![col("k")]).max(Vec::<&str>::new()).unwrap());
assert_eq!(cols, names(&["k", "max(i)", "max(l)", "max(d)"]));
assert_eq!(
got,
@@ -157,7 +161,7 @@ fn group_numeric_aggregates_follow_pyspark() {
assert_eq!(got, rows(&[&["a", "4", "3"], &["b", "NULL", "3"]]));
// Rollup, cube and grouping sets (`GROUPING SETS ((k), ())` is
`ROLLUP(k)`).
- let (cols, got) =
named_rows(&df.rollup(vec![col("k")]).sum(vec![]).unwrap());
+ let (cols, got) =
named_rows(&df.rollup(vec![col("k")]).sum(Vec::<&str>::new()).unwrap());
assert_eq!(cols, names(&["k", "sum(i)", "sum(l)", "sum(d)"]));
assert_eq!(
got,
@@ -169,16 +173,16 @@ fn group_numeric_aggregates_follow_pyspark() {
);
// With one grouping column, a cube is a rollup.
assert_eq!(
- named_rows(&df.cube(vec![col("k")]).sum(vec![]).unwrap()),
- named_rows(&df.rollup(vec![col("k")]).sum(vec![]).unwrap())
+ named_rows(&df.cube(vec![col("k")]).sum(Vec::<&str>::new()).unwrap()),
+ named_rows(&df.rollup(vec![col("k")]).sum(Vec::<&str>::new()).unwrap())
);
let grouping_sets = df
.grouping_sets(vec![vec![col("k")], vec![]])
- .sum(vec![])
+ .sum(Vec::<&str>::new())
.unwrap();
assert_eq!(
named_rows(&grouping_sets).1,
- named_rows(&df.rollup(vec![col("k")]).sum(vec![]).unwrap()).1
+
named_rows(&df.rollup(vec![col("k")]).sum(Vec::<&str>::new()).unwrap()).1
);
// Pivot: the numeric columns of each pivot value, or the given one.
@@ -190,7 +194,11 @@ fn group_numeric_aggregates_follow_pyspark() {
)
.unwrap()
};
- let (cols, got) =
named_rows(&pivot(df.group_by(vec![col("k")])).sum(vec![]).unwrap());
+ let (cols, got) = named_rows(
+ &pivot(df.group_by(vec![col("k")]))
+ .sum(Vec::<&str>::new())
+ .unwrap(),
+ );
assert_eq!(
cols,
names(&["k", "p_sum(i)", "p_sum(l)", "p_sum(d)", "q_sum(i)",
"q_sum(l)", "q_sum(d)"])
@@ -246,6 +254,63 @@ fn group_numeric_aggregates_follow_pyspark() {
);
}
+/// The numeric aggregates and the list methods take the names of their
columns, and the
+/// columns of their lists, as any iterable of them, as a Vec does: the server
runs each form to
+/// the same rows.
+#[test]
+fn list_methods_take_any_iterable_on_the_server() {
+ if !should_run() {
+ return;
+ }
+ let s = session();
+ let df = s
+ .sql("SELECT * FROM VALUES ('a', 1, 10L, 'x'), ('a', 2, 20L, 'y'),
('b', 3, 30L, 'x') AS t(k, i, l, s)")
+ .unwrap();
+
+ let grouped = df.group_by(vec![col("k")]);
+ let sums = named_rows(&grouped.sum(vec!["i", "l"]).unwrap());
+ assert_eq!(
+ sums.1,
+ vec![
+ vec!["a".to_string(), "3".to_string(), "30".to_string()],
+ vec!["b".to_string(), "3".to_string(), "30".to_string()],
+ ]
+ );
+ assert_eq!(named_rows(&grouped.sum(["i", "l"]).unwrap()), sums);
+ assert_eq!(
+ named_rows(&grouped.sum(["i", "l"].iter().copied()).unwrap()),
+ sums
+ );
+ assert_eq!(
+ named_rows(&grouped.sum(["i", "l"].map(String::from)).unwrap()),
+ sums
+ );
+
+ let dropped = named_rows(&df.drop(vec!["s"]));
+ assert_eq!(dropped.0, vec!["k", "i", "l"]);
+ assert_eq!(named_rows(&df.drop(["s"])), dropped);
+ assert_eq!(named_rows(&df.drop(["s"].map(String::from))), dropped);
+ let of_columns = named_rows(&df.drop_columns(vec![col("s")], vec!["i"]));
+ assert_eq!(of_columns.0, vec!["k", "l"]);
+ assert_eq!(named_rows(&df.drop_columns([col("s")], ["i"])), of_columns);
+ assert_eq!(
+ named_rows(&df.drop_columns(vec![col("s")].into_iter(),
["i"].into_iter())),
+ of_columns
+ );
+
+ let with_columns = named_rows(&df.with_columns(vec![("p".to_string(),
lit(1))]));
+ assert_eq!(with_columns.0, vec!["k", "i", "l", "s", "p"]);
+ assert_eq!(named_rows(&df.with_columns([("p", lit(1))])), with_columns);
+
+ let renamed = named_rows(&df.to_df(vec!["a", "b", "c", "d"]));
+ assert_eq!(renamed.0, vec!["a", "b", "c", "d"]);
+ assert_eq!(named_rows(&df.to_df(["a", "b", "c", "d"])), renamed);
+ assert_eq!(
+ named_rows(&df.to_df(["a", "b", "c", "d"].iter().copied())),
+ renamed
+ );
+}
+
/// A pivot on a date, timestamp or decimal column takes typed values. The
counts match those
/// of PySpark 4.3.0 pivoting the same column on the same values as strings,
which the server
/// casts to the column's type.
diff --git a/docs/compatibility.md b/docs/compatibility.md
index 56d02633..fd7aa268 100644
--- a/docs/compatibility.md
+++ b/docs/compatibility.md
@@ -21,15 +21,26 @@ the new variant. Rust interval map keys are stringified as
raw microseconds;
Python `timedelta` map keys are not yet supported.
`DataFrame::sort`, `order_by`, `sort_within_partitions`, `agg`, `observe`,
`observe_with`,
-`hint_expressions`, `repartition_by_range`, `repartition_by_range_opt` and
-`repartition_by_expressions`, `GroupedData::agg`, and the `partition_by` and
`order_by` of
-`Window` and `WindowSpec` take `impl IntoIterator<Item = impl Into<Column>>`,
as `select` and
-`group_by` do: Columns, column names or expressions, such as
`df.sort([col("x").desc()])` and
-`.agg([sum(col("id")).alias("total")])`, without `.expression().clone()`. The
`Vec<Expression>`
-that they took still compiles, by the new `From<Expression> for Column`, and
so does the
-`Vec<SortOrder>` of the `order_by` of a window, by `From<SortOrder> for
Column`; there a Column
-that is not a sort order is sorted ascending, nulls first, as PySpark's
`WindowSpec.orderBy`
-sorts it. An empty `vec![]` has no item type to infer: pass
`Vec::<Column>::new()` instead.
+`hint_expressions`, `repartition_by_range`, `repartition_by_range_opt`,
+`repartition_by_expressions`, `drop_columns`, `with_columns`, `grouping_sets`
and
+`grouping_sets_with_columns`, `GroupedData::agg`, the `partition_by` and
`order_by` of `Window`
+and `WindowSpec`, and `TableValuedFunction::udtf` take
+`impl IntoIterator<Item = impl Into<Column>>`, as `select` and `group_by` do:
Columns, column
+names or expressions, such as `df.sort([col("x").desc()])` and
+`.agg([sum(col("id")).alias("total")])`, without `.expression().clone()`. The
names of `drop`,
+`describe`, `to_df`, `to_schema`, `melt`, the numeric aggregates of
`GroupedData` (`sum`, `avg`,
+`min`, `max`, `mean`, `numeric_agg`), the `freq_items` and `approx_quantile`
of `StatFunctions`,
+`Column::drop_fields` and the `partition_by` and `cluster_by` of
`DataStreamWriter` take any
+iterable of names. The `(name, Column)` pairs of `with_columns` and the `(old,
new)` pairs of
+`with_columns_renamed` take any iterable of pairs, and
`functions::count_distinct_columns` and
+`UserDefinedFunction::to_expression` (wasm) takes any Columns. A `Vec` or an
array of them
+compiles as before. The `Vec<Expression>` that the sort and aggregate methods
took still compiles,
+by the new `From<Expression> for Column`, and so does the `Vec<SortOrder>` of
the `order_by` of a
+window, by `From<SortOrder> for Column`; there a Column that is not a sort
order is sorted
+ascending, nulls first, as PySpark's `WindowSpec.orderBy` sorts it. An empty
`vec![]` or `[]` has
+no item type to infer: pass `Vec::<Column>::new()` or `Vec::<&str>::new()`
instead. The optional
+`subset` arguments of the null functions, and the optional `value_vars` of
`melt`, stay
+`Option<Vec<&str>>`, so that `None` still infers its type.
`BinaryClassificationEvaluator::set_score_col` and `score_col`, and the Python
`scoreCol=` argument and `setScoreCol` of v4.2.0 are removed, without an alias:
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]