Skip to content

Commit 0b9af88

Browse files
committed
fix tests
1 parent 21d601a commit 0b9af88

3 files changed

Lines changed: 44 additions & 18 deletions

File tree

‎datafusion/core/tests/dataframe/mod.rs‎

Lines changed: 37 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,9 @@ use datafusion_physical_plan::aggregates::{
9191
AggregateExec, AggregateMode, PhysicalGroupBy,
9292
};
9393
use datafusion_physical_plan::empty::EmptyExec;
94-
use datafusion_physical_plan::{ExecutionPlan, ExecutionPlanProperties, displayable};
94+
use datafusion_physical_plan::{
95+
ExecutionPlan, ExecutionPlanProperties, collect, displayable,
96+
};
9597

9698
use datafusion::error::Result as DataFusionResult;
9799
use datafusion::execution::options::JsonReadOptions;
@@ -7246,19 +7248,42 @@ async fn test_grouping_with_alias() -> Result<()> {
72467248

72477249
#[tokio::test]
72487250
async fn test_unresolved_lambda_variable() -> Result<()> {
7249-
table_with_mixed_lists().await?.with_column(
7250-
"c",
7251-
array_transform(
7252-
make_array(vec![col("list")]),
7253-
lambda(
7254-
["x"],
7255-
array_filter(
7256-
lambda_var("x"),
7257-
lambda(["y"], lambda_var("y").gt_eq(lit(1))),
7251+
let plan = table_with_mixed_lists()
7252+
.await?
7253+
.with_column(
7254+
"c",
7255+
array_transform(
7256+
make_array(vec![col("list")]),
7257+
lambda(
7258+
["x"],
7259+
array_filter(
7260+
lambda_var("x"),
7261+
lambda(["y"], lambda_var("y").gt_eq(lit(2))),
7262+
),
72587263
),
72597264
),
7260-
),
7261-
)?;
7265+
)?
7266+
.select_columns(&["list", "c"])?
7267+
.into_unoptimized_plan()
7268+
.resolve_lambda_variables()?
7269+
.data;
7270+
7271+
let session = SessionContext::new();
7272+
let exec = session.state().create_physical_plan(&plan).await?;
7273+
let context = session.task_ctx();
7274+
let results = collect(exec, context).await?;
7275+
7276+
let expected = [
7277+
"+-----------+----------+",
7278+
"| list | c |",
7279+
"+-----------+----------+",
7280+
"| [1, 2, 3] | [[2, 3]] |",
7281+
"| | [] |",
7282+
"| [] | [[]] |",
7283+
"| | [] |",
7284+
"+-----------+----------+",
7285+
];
7286+
assert_batches_eq!(expected, &results);
72627287

72637288
Ok(())
72647289
}

‎datafusion/sqllogictest/test_files/spark/array/array_repeat.slt‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,3 +112,10 @@ FROM VALUES
112112
[[123], [123]]
113113
[[], []]
114114
[[NULL], [NULL]]
115+
116+
117+
# null count
118+
query ?
119+
select array_repeat('a', NULL);
120+
----
121+
NULL

‎datafusion/sqllogictest/test_files/spark/string/repeat.slt‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,3 @@
2525
## PySpark 3.5.5 Result: {'repeat(123, 2)': '123123', 'typeof(repeat(123, 2))': 'string', 'typeof(123)': 'string', 'typeof(2)': 'int'}
2626
#query
2727
#SELECT repeat('123'::string, 2::int);
28-
29-
# null count
30-
query T
31-
select repeat('a', NULL);
32-
----
33-
NULL

0 commit comments

Comments
 (0)