Skip to content

Apache DataFusion SQL Query Engine

Differentiate 0-row and 1-row EmptyRelation in EXPLAIN (#17145)

Piotr Findeisen43718d5fff20
diff --git a/datafusion-cli/tests/snapshots/cli_quick_test@can_see_indent_format.snap b/datafusion-cli/tests/snapshots/cli_quick_test@can_see_indent_format.snap
index b2fb647099..8275041aca 100644
--- a/datafusion-cli/tests/snapshots/cli_quick_test@can_see_indent_format.snap
+++ b/datafusion-cli/tests/snapshots/cli_quick_test@can_see_indent_format.snap
@@ -5,7 +5,6 @@ info:
args:
- "--command"
- EXPLAIN FORMAT indent SELECT 123
-snapshot_kind: text
---
success: true
exit_code: 0
@@ -15,7 +14,7 @@ exit_code: 0
| plan_type | plan |
+---------------+------------------------------------------+
| logical_plan | Projection: Int64(123) |
-| | EmptyRelation |
+| | EmptyRelation: rows=1 |
| physical_plan | ProjectionExec: expr=[123 as Int64(123)] |
| | PlaceholderRowExec |
| | |
diff --git a/datafusion/core/tests/dataframe/mod.rs b/datafusion/core/tests/dataframe/mod.rs
index a38d6ef1ac..38dc0dc735 100644
--- a/datafusion/core/tests/dataframe/mod.rs
+++ b/datafusion/core/tests/dataframe/mod.rs
@@ -1213,7 +1213,7 @@ async fn join_on_filter_datatype() -> Result<()> {
JoinType::Inner,
Some(Expr::Literal(ScalarValue::Null, None)),
)?;
- assert_snapshot!(join.into_optimized_plan().unwrap(), @"EmptyRelation");
+ assert_snapshot!(join.into_optimized_plan().unwrap(), @"EmptyRelation: rows=0");
// JOIN ON expression must be boolean type
let join = left.join_on(right, JoinType::Inner, Some(lit("TRUE")))?;
@@ -2751,7 +2751,7 @@ async fn test_count_wildcard_on_where_exist() -> Result<()> {
| logical_plan | LeftSemi Join: |
| | TableScan: t1 projection=[a, b] |
| | SubqueryAlias: __correlated_sq_1 |
- | | EmptyRelation |
+ | | EmptyRelation: rows=1 |
| physical_plan | NestedLoopJoinExec: join_type=RightSemi |
| | PlaceholderRowExec |
| | DataSourceExec: partitions=1, partition_sizes=[1] |
@@ -2787,7 +2787,7 @@ async fn test_count_wildcard_on_where_exist() -> Result<()> {
| logical_plan | LeftSemi Join: |
| | TableScan: t1 projection=[a, b] |
| | SubqueryAlias: __correlated_sq_1 |
- | | EmptyRelation |
+ | | EmptyRelation: rows=1 |
| physical_plan | NestedLoopJoinExec: join_type=RightSemi |
| | PlaceholderRowExec |
| | DataSourceExec: partitions=1, partition_sizes=[1] |
@@ -4934,11 +4934,11 @@ async fn test_dataframe_placeholder_missing_param_values() -> Result<()> {
assert_snapshot!(
actual,
- @r###"
+ @r"
Filter: a = $0 [a:Int32]
Projection: Int32(1) AS a [a:Int32]
- EmptyRelation []
- "###
+ EmptyRelation: rows=1 []
+ "
);
// Executing LogicalPlans with placeholders that don't have bound values
@@ -4967,11 +4967,11 @@ async fn test_dataframe_placeholder_missing_param_values() -> Result<()> {
assert_snapshot!(
actual,
- @r###"
+ @r"
Filter: a = Int32(3) [a:Int32]
Projection: Int32(1) AS a [a:Int32]
- EmptyRelation []
- "###
+ EmptyRelation: rows=1 []
+ "
);
// N.B., the test is basically `SELECT 1 as a WHERE a = 3;` which returns no results.
@@ -4998,10 +4998,10 @@ async fn test_dataframe_placeholder_column_parameter() -> Result<()> {
assert_snapshot!(
actual,
- @r###"
+ @r"
Projection: $1 [$1:Null;N]
- EmptyRelation []
- "###
+ EmptyRelation: rows=1 []
+ "
);
// Executing LogicalPlans with placeholders that don't have bound values
@@ -5028,10 +5028,10 @@ async fn test_dataframe_placeholder_column_parameter() -> Result<()> {
assert_snapshot!(
actual,
- @r###"
+ @r"
Projection: Int32(3) AS $1 [$1:Null;N]
- EmptyRelation []
- "###
+ EmptyRelation: rows=1 []
+ "
);
assert_snapshot!(
@@ -5067,11 +5067,11 @@ async fn test_dataframe_placeholder_like_expression() -> Result<()> {
assert_snapshot!(
actual,
- @r###"
+ @r#"
Filter: a LIKE $1 [a:Utf8]
Projection: Utf8("foo") AS a [a:Utf8]
- EmptyRelation []
- "###
+ EmptyRelation: rows=1 []
+ "#
);
// Executing LogicalPlans with placeholders that don't have bound values
@@ -5100,11 +5100,11 @@ async fn test_dataframe_placeholder_like_expression() -> Result<()> {
assert_snapshot!(
actual,
- @r###"
+ @r#"
Filter: a LIKE Utf8("f%") [a:Utf8]
Projection: Utf8("foo") AS a [a:Utf8]
- EmptyRelation []
- "###
+ EmptyRelation: rows=1 []
+ "#
);
assert_snapshot!(
diff --git a/datafusion/core/tests/execution/logical_plan.rs b/datafusion/core/tests/execution/logical_plan.rs
index da8f980722..ef2e263f2c 100644
--- a/datafusion/core/tests/execution/logical_plan.rs
+++ b/datafusion/core/tests/execution/logical_plan.rs
@@ -128,7 +128,7 @@ fn inline_scan_projection_test() -> Result<()> {
@r"
SubqueryAlias: ?table?
Projection: a
- EmptyRelation
+ EmptyRelation: rows=0
"
);
diff --git a/datafusion/core/tests/optimizer/mod.rs b/datafusion/core/tests/optimizer/mod.rs
index 5934c9ab92..9899a0158f 100644
--- a/datafusion/core/tests/optimizer/mod.rs
+++ b/datafusion/core/tests/optimizer/mod.rs
@@ -62,7 +62,7 @@ fn select_arrow_cast() {
plan,
@r#"
Projection: Float64(1234) AS f64, LargeUtf8("foo") AS large
- EmptyRelation
+ EmptyRelation: rows=1
"#
);
}
diff --git a/datafusion/expr/src/logical_plan/plan.rs b/datafusion/expr/src/logical_plan/plan.rs
index ffc1548335..8df6c22db6 100644
--- a/datafusion/expr/src/logical_plan/plan.rs
+++ b/datafusion/expr/src/logical_plan/plan.rs
@@ -1720,7 +1720,10 @@ impl LogicalPlan {
impl Display for Wrapper<'_> {
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
match self.0 {
- LogicalPlan::EmptyRelation(_) => write!(f, "EmptyRelation"),
+ LogicalPlan::EmptyRelation(EmptyRelation { produce_one_row, schema: _ }) => {
+ let rows = if *produce_one_row { 1 } else { 0 };
+ write!(f, "EmptyRelation: rows={rows}")
+ },
LogicalPlan::RecursiveQuery(RecursiveQuery {
is_distinct, ..
}) => {
diff --git a/datafusion/optimizer/src/analyzer/type_coercion.rs b/datafusion/optimizer/src/analyzer/type_coercion.rs
index 3ab8b9d26a..5c656885f0 100644
--- a/datafusion/optimizer/src/analyzer/type_coercion.rs
+++ b/datafusion/optimizer/src/analyzer/type_coercion.rs
@@ -1188,7 +1188,7 @@ mod test {
plan,
@r"
Projection: a < CAST(UInt32(2) AS Float64)
- EmptyRelation
+ EmptyRelation: rows=0
"
)
}
@@ -1231,8 +1231,8 @@ mod test {
Projection: a
Union
Projection: CAST(datafusion.test.foo.a AS Int64) AS a
- EmptyRelation
- EmptyRelation
+ EmptyRelation: rows=0
+ EmptyRelation: rows=0
"
)
}
@@ -1254,7 +1254,7 @@ mod test {
plan.clone(),
@r"
Projection: a
- EmptyRelation
+ EmptyRelation: rows=0
"
)?;
@@ -1264,7 +1264,7 @@ mod test {
plan.clone(),
@r"
Projection: CAST(a AS LargeUtf8)
- EmptyRelation
+ EmptyRelation: rows=0
"
)?;
@@ -1281,7 +1281,7 @@ mod test {
bool_plan.clone(),
@r#"
Projection: a < CAST(Utf8("foo") AS Utf8View)
- EmptyRelation
+ EmptyRelation: rows=0
"#
)?;
@@ -1290,7 +1290,7 @@ mod test {
plan.clone(),
@r"
Projection: a
- EmptyRelation
+ EmptyRelation: rows=0
"
)?;
@@ -1300,7 +1300,7 @@ mod test {
plan.clone(),
@r"
Projection: CAST(a AS LargeUtf8)
- EmptyRelation
+ EmptyRelation: rows=0
"
)?;
@@ -1320,7 +1320,7 @@ mod test {
@r"
Sort: a ASC NULLS FIRST
Projection: a
- EmptyRelation
+ EmptyRelation: rows=0
"
)?;
@@ -1332,7 +1332,7 @@ mod test {
Projection: CAST(a AS LargeUtf8)
Sort: a ASC NULLS FIRST
Projection: a
- EmptyRelation
+ EmptyRelation: rows=0
"
)?;
@@ -1350,7 +1350,7 @@ mod test {
Projection: a
Sort: a ASC NULLS FIRST
Projection: a
- EmptyRelation
+ EmptyRelation: rows=0
"
)?;
// Plan B: coerce requested: Utf8View => LargeUtf8 only on outermost
@@ -1361,7 +1361,7 @@ mod test {
Projection: CAST(a AS LargeUtf8)
Sort: a ASC NULLS FIRST
Projection: a
- EmptyRelation
+ EmptyRelation: rows=0
"
)?;
@@ -1385,7 +1385,7 @@ mod test {
plan.clone(),
@r"
Projection: a
- EmptyRelation
+ EmptyRelation: rows=0
"
)?;
@@ -1395,7 +1395,7 @@ mod test {
plan.clone(),
@r"
Projection: CAST(a AS LargeBinary)
- EmptyRelation
+ EmptyRelation: rows=0
"
)?;
@@ -1413,7 +1413,7 @@ mod test {
bool_plan.clone(),
@r#"
Projection: a < CAST(Binary("8,1,8,1") AS BinaryView)
- EmptyRelation
+ EmptyRelation: rows=0
"#
)?;
@@ -1423,7 +1423,7 @@ mod test {
bool_plan.clone(),
@r#"
Projection: a < CAST(Binary("8,1,8,1") AS BinaryView)
- EmptyRelation
+ EmptyRelation: rows=0
"#
)?;
@@ -1443,7 +1443,7 @@ mod test {
@r"
Sort: a ASC NULLS FIRST
Projection: a
- EmptyRelation
+ EmptyRelation: rows=0
"
)?;
// Plan C: coerce requested: BinaryView => LargeBinary
@@ -1454,7 +1454,7 @@ mod test {
Projection: CAST(a AS LargeBinary)
Sort: a ASC NULLS FIRST
Projection: a
- EmptyRelation
+ EmptyRelation: rows=0
"
)?;
@@ -1473,7 +1473,7 @@ mod test {
Projection: a
Sort: a ASC NULLS FIRST
Projection: a
- EmptyRelation
+ EmptyRelation: rows=0
"
)?;
@@ -1485,7 +1485,7 @@ mod test {
Projection: CAST(a AS LargeBinary)
Sort: a ASC NULLS FIRST
Projection: a
- EmptyRelation
+ EmptyRelation: rows=0
"
)?;
@@ -1506,7 +1506,7 @@ mod test {
plan,
@r"
Projection: a < CAST(UInt32(2) AS Float64) OR a < CAST(UInt32(2) AS Float64)
- EmptyRelation
+ EmptyRelation: rows=0
"
)
}
@@ -1552,7 +1552,7 @@ mod test {
plan,
@r"
Projection: TestScalarUDF(CAST(Int32(123) AS Float32))
- EmptyRelation
+ EmptyRelation: rows=0
"
)
}
@@ -1589,7 +1589,7 @@ mod test {
plan,
@r"
Projection: TestScalarUDF(CAST(Int64(10) AS Float32))
- EmptyRelation
+ EmptyRelation: rows=0
"
)
}
@@ -1619,7 +1619,7 @@ mod test {
plan,
@r"
Projection: MY_AVG(CAST(Int64(10) AS Float64))
- EmptyRelation
+ EmptyRelation: rows=0
"
)
}
@@ -1673,7 +1673,7 @@ mod test {
plan,
@r"
Projection: avg(Float64(12))
- EmptyRelation
+ EmptyRelation: rows=0
"
)?;
@@ -1692,7 +1692,7 @@ mod test {
plan,
@r"
Projection: avg(CAST(a AS Float64))
- EmptyRelation
+ EmptyRelation: rows=0
"
)
}
@@ -1728,7 +1728,7 @@ mod test {
plan,
@r#"
Projection: CAST(Utf8("1998-03-18") AS Date32) + IntervalDayTime("IntervalDayTime { days: 123, milliseconds: 456 }")
- EmptyRelation
+ EmptyRelation: rows=0
"#
)
}
@@ -1743,7 +1743,7 @@ mod test {
plan,
@r"
Projection: a IN ([CAST(Int32(1) AS Int64), CAST(Int8(4) AS Int64), Int64(8)])
- EmptyRelation
+ EmptyRelation: rows=0
")?;
// a in (1,4,8), a is decimal
@@ -1760,7 +1760,7 @@ mod test {
plan,
@r"
Projection: CAST(a AS Decimal128(24, 4)) IN ([CAST(Int32(1) AS Decimal128(24, 4)), CAST(Int8(4) AS Decimal128(24, 4)), CAST(Int64(8) AS Decimal128(24, 4))])
- EmptyRelation
+ EmptyRelation: rows=0
")
}
@@ -1779,7 +1779,7 @@ mod test {
plan,
@r#"
Filter: CAST(a AS Date32) BETWEEN CAST(Utf8("2002-05-08") AS Date32) AND CAST(Utf8("2002-05-08") AS Date32) + IntervalYearMonth("1")
- EmptyRelation
+ EmptyRelation: rows=0
"#
)
}
@@ -1800,7 +1800,7 @@ mod test {
plan,
@r#"
Filter: CAST(a AS Date32) BETWEEN CAST(Utf8("2002-05-08") AS Date32) + IntervalYearMonth("1") AND CAST(Utf8("2002-12-08") AS Date32)
- EmptyRelation
+ EmptyRelation: rows=0
"#
)
}
@@ -1815,7 +1815,7 @@ mod test {
plan,
@r"
Filter: CAST(NULL AS Int64) BETWEEN CAST(NULL AS Int64) AND Int64(2)
- EmptyRelation
+ EmptyRelation: rows=0
"
)
}
@@ -1832,7 +1832,7 @@ mod test {
plan,
@r"
Projection: a IS TRUE
- EmptyRelation
+ EmptyRelation: rows=0
"
)?;
@@ -1852,7 +1852,7 @@ mod test {
plan,
@r"
Projection: a IS NOT TRUE
- EmptyRelation
+ EmptyRelation: rows=0
"
)?;
@@ -1865,7 +1865,7 @@ mod test {
plan,
@r"
Projection: a IS FALSE
- EmptyRelation
+ EmptyRelation: rows=0
"
)?;
@@ -1878,7 +1878,7 @@ mod test {
plan,
@r"
Projection: a IS NOT FALSE
- EmptyRelation
+ EmptyRelation: rows=0
"
)
}
@@ -1896,7 +1896,7 @@ mod test {
plan,
@r#"
Projection: a LIKE Utf8("abc")
- EmptyRelation
+ EmptyRelation: rows=0
"#
)?;
@@ -1910,7 +1910,7 @@ mod test {
plan,
@r"
Projection: a LIKE CAST(NULL AS Utf8)
- EmptyRelation
+ EmptyRelation: rows=0
"
)?;
@@ -1935,7 +1935,7 @@ mod test {
plan,
@r#"
Projection: a ILIKE Utf8("abc")
- EmptyRelation
+ EmptyRelation: rows=0
"#
)?;
@@ -1949,7 +1949,7 @@ mod test {
plan,
@r"
Projection: a ILIKE CAST(NULL AS Utf8)
- EmptyRelation
+ EmptyRelation: rows=0
"
)?;
@@ -1978,7 +1978,7 @@ mod test {
plan,
@r"
Projection: a IS UNKNOWN
- EmptyRelation
+ EmptyRelation: rows=0
"
)?;
@@ -1998,7 +1998,7 @@ mod test {
plan,
@r"
Projection: a IS NOT UNKNOWN
- EmptyRelation
+ EmptyRelation: rows=0
"
)
}
@@ -2019,7 +2019,7 @@ mod test {
plan,
@r#"
Projection: TestScalarUDF(a, Utf8("b"), CAST(Boolean(true) AS Utf8), CAST(Boolean(false) AS Utf8), CAST(Int32(13) AS Utf8))
- EmptyRelation
+ EmptyRelation: rows=0
"#
)
}
@@ -2076,7 +2076,7 @@ mod test {
plan,
@r#"
Projection: CAST(Utf8("1998-03-18") AS Timestamp(Nanosecond, None)) = CAST(CAST(Utf8("1998-03-18") AS Date32) AS Timestamp(Nanosecond, None))
- EmptyRelation
+ EmptyRelation: rows=0
"#
)
}
@@ -2424,7 +2424,7 @@ mod test {
plan,
@r#"
Projection: a = CAST(CAST(a AS Map(Field { name: "key_value", data_type: Struct([Field { name: "key", data_type: Utf8, nullable: false, dict_id: 0, dict_is_ordered: false, metadata: {} }, Field { name: "value", data_type: Float64, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} }]), nullable: false, dict_id: 0, dict_is_ordered: false, metadata: {} }, false)) AS Map(Field { name: "entries", data_type: Struct([Field { name: "key", data_type: Utf8, nullable: false, dict_id: 0, dict_is_ordered: false, metadata: {} }, Field { name: "value", data_type: Float64, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} }]), nullable: false, dict_id: 0, dict_is_ordered: false, metadata: {} }, false))
- EmptyRelation
+ EmptyRelation: rows=0
"#
)
}
@@ -2447,7 +2447,7 @@ mod test {
plan,
@r#"
Projection: IntervalYearMonth("12") + CAST(Utf8("2000-01-01T00:00:00") AS Timestamp(Nanosecond, None))
- EmptyRelation
+ EmptyRelation: rows=0
"#
)
}
@@ -2472,7 +2472,7 @@ mod test {
plan,
@r#"
Projection: CAST(Utf8("1998-03-18") AS Timestamp(Nanosecond, None)) - CAST(Utf8("1998-03-18") AS Timestamp(Nanosecond, None))
- EmptyRelation
+ EmptyRelation: rows=0
"#
)
}
@@ -2500,8 +2500,8 @@ mod test {
Filter: a IN (<subquery>)
Subquery:
Projection: CAST(a AS Int64)
- EmptyRelation
- EmptyRelation
+ EmptyRelation: rows=0
+ EmptyRelation: rows=0
"
)
}
@@ -2528,8 +2528,8 @@ mod test {
@r"
Filter: CAST(a AS Int64) IN (<subquery>)
Subquery:
- EmptyRelation
- EmptyRelation
+ EmptyRelation: rows=0
+ EmptyRelation: rows=0
"
)
}
@@ -2557,8 +2557,8 @@ mod test {
Filter: CAST(a AS Decimal128(13, 8)) IN (<subquery>)
Subquery:
Projection: CAST(a AS Decimal128(13, 8))
- EmptyRelation
- EmptyRelation
+ EmptyRelation: rows=0
+ EmptyRelation: rows=0
"
)
}
diff --git a/datafusion/optimizer/src/eliminate_filter.rs b/datafusion/optimizer/src/eliminate_filter.rs
index e28771be54..1b763d6f89 100644
--- a/datafusion/optimizer/src/eliminate_filter.rs
+++ b/datafusion/optimizer/src/eliminate_filter.rs
@@ -117,7 +117,7 @@ mod tests {
.build()?;
// No aggregate / scan / limit
- assert_optimized_plan_equal!(plan, @"EmptyRelation")
+ assert_optimized_plan_equal!(plan, @"EmptyRelation: rows=0")
}
#[test]
@@ -131,7 +131,7 @@ mod tests {
.build()?;
// No aggregate / scan / limit
- assert_optimized_plan_equal!(plan, @"EmptyRelation")
+ assert_optimized_plan_equal!(plan, @"EmptyRelation: rows=0")
}
#[test]
@@ -151,7 +151,7 @@ mod tests {
// Left side is removed
assert_optimized_plan_equal!(plan, @r"
Union
- EmptyRelation
+ EmptyRelation: rows=0
Aggregate: groupBy=[[test.a]], aggr=[[sum(test.b)]]
TableScan: test
")
@@ -217,7 +217,7 @@ mod tests {
// Filter is removed
assert_optimized_plan_equal!(plan, @r"
Projection: test.a
- EmptyRelation
+ EmptyRelation: rows=0
")
}
}
diff --git a/datafusion/optimizer/src/eliminate_join.rs b/datafusion/optimizer/src/eliminate_join.rs
index dfc3a220d0..412bbea2ae 100644
--- a/datafusion/optimizer/src/eliminate_join.rs
+++ b/datafusion/optimizer/src/eliminate_join.rs
@@ -108,6 +108,6 @@ mod tests {
)?
.build()?;
- assert_optimized_plan_equal!(plan, @"EmptyRelation")
+ assert_optimized_plan_equal!(plan, @"EmptyRelation: rows=0")
}
}
diff --git a/datafusion/optimizer/src/eliminate_limit.rs b/datafusion/optimizer/src/eliminate_limit.rs
index 2007e0c820..8e25d3246f 100644
--- a/datafusion/optimizer/src/eliminate_limit.rs
+++ b/datafusion/optimizer/src/eliminate_limit.rs
@@ -148,7 +148,7 @@ mod tests {
// No aggregate / scan / limit
assert_optimized_plan_equal!(
plan,
- @ r"EmptyRelation"
+ @ "EmptyRelation: rows=0"
)
}
@@ -169,7 +169,7 @@ mod tests {
plan,
@ r"
Union
- EmptyRelation
+ EmptyRelation: rows=0
Aggregate: groupBy=[[test.a]], aggr=[[sum(test.b)]]
TableScan: test
"
@@ -188,7 +188,7 @@ mod tests {
// No aggregate / scan / limit
assert_optimized_plan_eq_with_pushdown!(
plan,
- @ "EmptyRelation"
+ @ "EmptyRelation: rows=0"
)
}
diff --git a/datafusion/optimizer/src/optimize_projections/mod.rs b/datafusion/optimizer/src/optimize_projections/mod.rs
index 08909f5f86..97402c990b 100644
--- a/datafusion/optimizer/src/optimize_projections/mod.rs
+++ b/datafusion/optimizer/src/optimize_projections/mod.rs
@@ -1139,7 +1139,7 @@ mod tests {
plan,
@r"
Aggregate: groupBy=[[]], aggr=[[count(Int32(1))]]
- EmptyRelation
+ EmptyRelation: rows=1
"
)
}
diff --git a/datafusion/optimizer/src/propagate_empty_relation.rs b/datafusion/optimizer/src/propagate_empty_relation.rs
index 4fb9e117e2..4db3215dfb 100644
--- a/datafusion/optimizer/src/propagate_empty_relation.rs
+++ b/datafusion/optimizer/src/propagate_empty_relation.rs
@@ -294,7 +294,7 @@ mod tests {
.project(vec![binary_expr(lit(1), Operator::Plus, lit(1))])?
.build()?;
- assert_optimized_plan_equal!(plan, @"EmptyRelation")
+ assert_optimized_plan_equal!(plan, @"EmptyRelation: rows=0")
}
#[test]
@@ -316,7 +316,7 @@ mod tests {
.filter(col("a").lt_eq(lit(1i64)))?
.build()?;
- let expected = "EmptyRelation";
+ let expected = "EmptyRelation: rows=0";
assert_together_optimized_plan(plan, expected, true)
}
@@ -379,7 +379,7 @@ mod tests {
.union(four)?
.build()?;
- let expected = "EmptyRelation";
+ let expected = "EmptyRelation: rows=0";
assert_together_optimized_plan(plan, expected, true)
}
@@ -434,7 +434,7 @@ mod tests {
.filter(col("a").lt_eq(lit(1i64)))?
.build()?;
- let expected = "EmptyRelation";
+ let expected = "EmptyRelation: rows=0";
assert_together_optimized_plan(plan, expected, true)
}
@@ -474,7 +474,7 @@ mod tests {
)?
.build()?;
- let expected = "EmptyRelation";
+ let expected = "EmptyRelation: rows=0";
assert_together_optimized_plan(plan, expected, eq)
}
diff --git a/datafusion/optimizer/src/push_down_filter.rs b/datafusion/optimizer/src/push_down_filter.rs
index 35ec7d074d..2de81671f4 100644
--- a/datafusion/optimizer/src/push_down_filter.rs
+++ b/datafusion/optimizer/src/push_down_filter.rs
@@ -3423,7 +3423,7 @@ mod tests {
Projection: b.a
SubqueryAlias: b
Projection: Int64(0) AS a
- EmptyRelation
+ EmptyRelation: rows=1
",
);
// Ensure that the predicate without any columns (0 = 1) is
@@ -3437,7 +3437,7 @@ mod tests {
SubqueryAlias: b
Projection: Int64(0) AS a
Filter: Int64(0) = Int64(1)
- EmptyRelation
+ EmptyRelation: rows=1
"
)
}
diff --git a/datafusion/optimizer/tests/optimizer_integration.rs b/datafusion/optimizer/tests/optimizer_integration.rs
index d6d7b58f0b..deda8fadbe 100644
--- a/datafusion/optimizer/tests/optimizer_integration.rs
+++ b/datafusion/optimizer/tests/optimizer_integration.rs
@@ -284,9 +284,7 @@ fn propagate_empty_relation() {
assert_snapshot!(
format!("{plan}"),
- @r#"
- EmptyRelation
- "#
+ @"EmptyRelation: rows=0"
);
}
diff --git a/datafusion/sql/tests/cases/params.rs b/datafusion/sql/tests/cases/params.rs
index 15e7d923a9..048c15f93d 100644
--- a/datafusion/sql/tests/cases/params.rs
+++ b/datafusion/sql/tests/cases/params.rs
@@ -266,7 +266,7 @@ fn test_prepare_statement_to_plan_params_as_constants() {
@r#"
Prepare: "my_plan" [Int32]
Projection: $1
- EmptyRelation
+ EmptyRelation: rows=1
"#
);
assert_snapshot!(dt, @r#"[Int32]"#);
@@ -279,7 +279,7 @@ fn test_prepare_statement_to_plan_params_as_constants() {
plan_with_params,
@r"
Projection: Int32(10) AS $1
- EmptyRelation
+ EmptyRelation: rows=1
"
);
@@ -291,7 +291,7 @@ fn test_prepare_statement_to_plan_params_as_constants() {
@r#"
Prepare: "my_plan" [Int32]
Projection: Int64(1) + $1
- EmptyRelation
+ EmptyRelation: rows=1
"#
);
assert_snapshot!(dt, @r#"[Int32]"#);
@@ -304,7 +304,7 @@ fn test_prepare_statement_to_plan_params_as_constants() {
plan_with_params,
@r"
Projection: Int64(1) + Int32(10) AS Int64(1) + $1
- EmptyRelation
+ EmptyRelation: rows=1
"
);
@@ -316,7 +316,7 @@ fn test_prepare_statement_to_plan_params_as_constants() {
@r#"
Prepare: "my_plan" [Int32, Float64]
Projection: Int64(1) + $1 + $2
- EmptyRelation
+ EmptyRelation: rows=1
"#
);
assert_snapshot!(dt, @r#"[Int32, Float64]"#);
@@ -332,7 +332,7 @@ fn test_prepare_statement_to_plan_params_as_constants() {
plan_with_params,
@r"
Projection: Int64(1) + Int32(10) + Float64(10) AS Int64(1) + $1 + $2
- EmptyRelation
+ EmptyRelation: rows=1
"
);
}
diff --git a/datafusion/sql/tests/sql_integration.rs b/datafusion/sql/tests/sql_integration.rs
index 751254ff20..60a3960202 100644
--- a/datafusion/sql/tests/sql_integration.rs
+++ b/datafusion/sql/tests/sql_integration.rs
@@ -58,10 +58,10 @@ fn parse_decimals_1() {
let plan = logical_plan_with_options(sql, options).unwrap();
assert_snapshot!(
plan,
- @r#"
- Projection: Int64(1)
- EmptyRelation
- "#
+ @r"
+ Projection: Int64(1)
+ EmptyRelation: rows=1
+ "
);
}
@@ -72,10 +72,10 @@ fn parse_decimals_2() {
let plan = logical_plan_with_options(sql, options).unwrap();
assert_snapshot!(
plan,
- @r#"
- Projection: Int64(1)
- EmptyRelation
- "#
+ @r"
+ Projection: Int64(1)
+ EmptyRelation: rows=1
+ "
);
}
@@ -86,10 +86,10 @@ fn parse_decimals_3() {
let plan = logical_plan_with_options(sql, options).unwrap();
assert_snapshot!(
plan,
- @r#"
- Projection: Decimal128(Some(1),1,1)
- EmptyRelation
- "#
+ @r"
+ Projection: Decimal128(Some(1),1,1)
+ EmptyRelation: rows=1
+ "
);
}
@@ -100,10 +100,10 @@ fn parse_decimals_4() {
let plan = logical_plan_with_options(sql, options).unwrap();
assert_snapshot!(
plan,
- @r#"
- Projection: Decimal128(Some(1),2,2)
- EmptyRelation
- "#
+ @r"
+ Projection: Decimal128(Some(1),2,2)
+ EmptyRelation: rows=1
+ "
);
}
@@ -114,10 +114,10 @@ fn parse_decimals_5() {
let plan = logical_plan_with_options(sql, options).unwrap();
assert_snapshot!(
plan,
- @r#"
- Projection: Decimal128(Some(10),2,1)
- EmptyRelation
- "#
+ @r"
+ Projection: Decimal128(Some(10),2,1)
+ EmptyRelation: rows=1
+ "
);
}
@@ -128,10 +128,10 @@ fn parse_decimals_6() {
let plan = logical_plan_with_options(sql, options).unwrap();
assert_snapshot!(
plan,
- @r#"
- Projection: Decimal128(Some(1001),4,2)
- EmptyRelation
- "#
+ @r"
+ Projection: Decimal128(Some(1001),4,2)
+ EmptyRelation: rows=1
+ "
);
}
@@ -142,10 +142,10 @@ fn parse_decimals_7() {
let plan = logical_plan_with_options(sql, options).unwrap();
assert_snapshot!(
plan,
- @r#"
- Projection: Decimal128(Some(1000000000000000000000),22,2)
- EmptyRelation
- "#
+ @r"
+ Projection: Decimal128(Some(1000000000000000000000),22,2)
+ EmptyRelation: rows=1
+ "
);
}
@@ -156,10 +156,10 @@ fn parse_decimals_8() {
let plan = logical_plan_with_options(sql, options).unwrap();
assert_snapshot!(
plan,
- @r#"
- Projection: UInt64(18446744073709551615)
- EmptyRelation
- "#
+ @r"
+ Projection: UInt64(18446744073709551615)
+ EmptyRelation: rows=1
+ "
);
}
@@ -170,10 +170,10 @@ fn parse_decimals_9() {
let plan = logical_plan_with_options(sql, options).unwrap();
assert_snapshot!(
plan,
- @r#"
- Projection: Decimal128(Some(18446744073709551616),20,0)
- EmptyRelation
- "#
+ @r"
+ Projection: Decimal128(Some(18446744073709551616),20,0)
+ EmptyRelation: rows=1
+ "
);
}
@@ -185,9 +185,9 @@ fn parse_ident_normalization_1() {
assert_snapshot!(
plan,
@r#"
- Projection: character_length(Utf8("str"))
- EmptyRelation
- "#
+ Projection: character_length(Utf8("str"))
+ EmptyRelation: rows=1
+ "#
);
}
@@ -199,9 +199,9 @@ fn parse_ident_normalization_2() {
assert_snapshot!(
plan,
@r#"
- Projection: concat(Utf8("Hello"), Utf8("World"))
- EmptyRelation
- "#
+ Projection: concat(Utf8("Hello"), Utf8("World"))
+ EmptyRelation: rows=1
+ "#
);
}
@@ -281,10 +281,10 @@ fn select_no_relation() {
let plan = logical_plan("SELECT 1").unwrap();
assert_snapshot!(
plan,
- @r#"
- Projection: Int64(1)
- EmptyRelation
- "#
+ @r"
+ Projection: Int64(1)
+ EmptyRelation: rows=1
+ "
);
}
@@ -293,10 +293,10 @@ fn test_real_f32() {
let plan = logical_plan("SELECT CAST(1.1 AS REAL)").unwrap();
assert_snapshot!(
plan,
- @r#"
- Projection: CAST(Float64(1.1) AS Float32)
- EmptyRelation
- "#
+ @r"
+ Projection: CAST(Float64(1.1) AS Float32)
+ EmptyRelation: rows=1
+ "
);
}
@@ -305,10 +305,10 @@ fn test_int_decimal_default() {
let plan = logical_plan("SELECT CAST(10 AS DECIMAL)").unwrap();
assert_snapshot!(
plan,
- @r#"
- Projection: CAST(Int64(10) AS Decimal128(38, 10))
- EmptyRelation
- "#
+ @r"
+ Projection: CAST(Int64(10) AS Decimal128(38, 10))
+ EmptyRelation: rows=1
+ "
);
}
@@ -317,10 +317,10 @@ fn test_int_decimal_no_scale() {
let plan = logical_plan("SELECT CAST(10 AS DECIMAL(5))").unwrap();
assert_snapshot!(
plan,
- @r#"
- Projection: CAST(Int64(10) AS Decimal128(5, 0))
- EmptyRelation
- "#
+ @r"
+ Projection: CAST(Int64(10) AS Decimal128(5, 0))
+ EmptyRelation: rows=1
+ "
);
}
@@ -329,10 +329,10 @@ fn test_tinyint() {
let plan = logical_plan("SELECT CAST(6 AS TINYINT)").unwrap();
assert_snapshot!(
plan,
- @r#"
- Projection: CAST(Int64(6) AS Int8)
- EmptyRelation
- "#
+ @r"
+ Projection: CAST(Int64(6) AS Int8)
+ EmptyRelation: rows=1
+ "
);
}
@@ -341,11 +341,11 @@ fn cast_from_subquery() {
let plan = logical_plan("SELECT CAST (a AS FLOAT) FROM (SELECT 1 AS a)").unwrap();
assert_snapshot!(
plan,
- @r#"
- Projection: CAST(a AS Float32)
- Projection: Int64(1) AS a
- EmptyRelation
- "#
+ @r"
+ Projection: CAST(a AS Float32)
+ Projection: Int64(1) AS a
+ EmptyRelation: rows=1
+ "
);
}
@@ -381,10 +381,10 @@ fn cast_to_invalid_decimal_type_precision_gt_38() {
let plan = logical_plan(sql).unwrap();
assert_snapshot!(
plan,
- @r#"
- Projection: CAST(Int64(10) AS Decimal256(39, 0))
- EmptyRelation
- "#
+ @r"
+ Projection: CAST(Int64(10) AS Decimal256(39, 0))
+ EmptyRelation: rows=1
+ "
);
}
@@ -419,9 +419,9 @@ fn plan_create_table_with_pk() {
assert_snapshot!(
plan,
@r#"
- CreateMemoryTable: Bare { table: "person" } constraints=[PrimaryKey([0])]
- EmptyRelation
- "#
+ CreateMemoryTable: Bare { table: "person" } constraints=[PrimaryKey([0])]
+ EmptyRelation: rows=0
+ "#
);
let sql = "create table person (id int primary key, name string)";
@@ -429,9 +429,9 @@ fn plan_create_table_with_pk() {
assert_snapshot!(
plan,
@r#"
- CreateMemoryTable: Bare { table: "person" } constraints=[PrimaryKey([0])]
- EmptyRelation
- "#
+ CreateMemoryTable: Bare { table: "person" } constraints=[PrimaryKey([0])]
+ EmptyRelation: rows=0
+ "#
);
let sql =
@@ -440,9 +440,9 @@ fn plan_create_table_with_pk() {
assert_snapshot!(
plan,
@r#"
- CreateMemoryTable: Bare { table: "person" } constraints=[PrimaryKey([0]), Unique([1])]
- EmptyRelation
- "#
+ CreateMemoryTable: Bare { table: "person" } constraints=[PrimaryKey([0]), Unique([1])]
+ EmptyRelation: rows=0
+ "#
);
let sql = "create table person (id int, name varchar, primary key(name, id));";
@@ -450,9 +450,9 @@ fn plan_create_table_with_pk() {
assert_snapshot!(
plan,
@r#"
- CreateMemoryTable: Bare { table: "person" } constraints=[PrimaryKey([1, 0])]
- EmptyRelation
- "#
+ CreateMemoryTable: Bare { table: "person" } constraints=[PrimaryKey([1, 0])]
+ EmptyRelation: rows=0
+ "#
);
}
@@ -463,9 +463,9 @@ fn plan_create_table_with_multi_pk() {
assert_snapshot!(
plan,
@r#"
- CreateMemoryTable: Bare { table: "person" } constraints=[PrimaryKey([0]), PrimaryKey([1])]
- EmptyRelation
- "#
+ CreateMemoryTable: Bare { table: "person" } constraints=[PrimaryKey([0]), PrimaryKey([1])]
+ EmptyRelation: rows=0
+ "#
);
}
@@ -476,9 +476,9 @@ fn plan_create_table_with_unique() {
assert_snapshot!(
plan,
@r#"
- CreateMemoryTable: Bare { table: "person" } constraints=[Unique([0])]
- EmptyRelation
- "#
+ CreateMemoryTable: Bare { table: "person" } constraints=[Unique([0])]
+ EmptyRelation: rows=0
+ "#
);
}
@@ -489,9 +489,9 @@ fn plan_create_table_no_pk() {
assert_snapshot!(
plan,
@r#"
- CreateMemoryTable: Bare { table: "person" }
- EmptyRelation
- "#
+ CreateMemoryTable: Bare { table: "person" }
+ EmptyRelation: rows=0
+ "#
);
}
@@ -502,9 +502,9 @@ fn plan_create_table_check_constraint() {
assert_snapshot!(
plan,
@r#"
- CreateMemoryTable: Bare { table: "person" } constraints=[Unique([0])]
- EmptyRelation
- "#
+ CreateMemoryTable: Bare { table: "person" } constraints=[Unique([0])]
+ EmptyRelation: rows=0
+ "#
);
}
@@ -803,10 +803,10 @@ fn select_scalar_func_with_literal_no_relation() {
let plan = logical_plan("SELECT sqrt(9)").unwrap();
assert_snapshot!(
plan,
- @r#"
- Projection: sqrt(Int64(9))
- EmptyRelation
- "#
+ @r"
+ Projection: sqrt(Int64(9))
+ EmptyRelation: rows=1
+ "
);
}
@@ -3138,9 +3138,9 @@ fn select_typed_date_string() {
assert_snapshot!(
plan,
@r#"
-Projection: CAST(Utf8("2020-12-10") AS Date32) AS date
- EmptyRelation
-"#
+ Projection: CAST(Utf8("2020-12-10") AS Date32) AS date
+ EmptyRelation: rows=1
+ "#
);
}
@@ -3151,9 +3151,9 @@ fn select_typed_time_string() {
assert_snapshot!(
plan,
@r#"
-Projection: CAST(Utf8("08:09:10.123") AS Time64(Nanosecond)) AS time
- EmptyRelation
-"#
+ Projection: CAST(Utf8("08:09:10.123") AS Time64(Nanosecond)) AS time
+ EmptyRelation: rows=1
+ "#
);
}
@@ -3445,9 +3445,9 @@ fn negative_interval_plus_interval_in_projection() {
assert_snapshot!(
plan,
@r#"
-Projection: IntervalMonthDayNano("IntervalMonthDayNano { months: 0, days: -2, nanoseconds: 0 }") + IntervalMonthDayNano("IntervalMonthDayNano { months: 0, days: 5, nanoseconds: 0 }")
- EmptyRelation
-"#
+ Projection: IntervalMonthDayNano("IntervalMonthDayNano { months: 0, days: -2, nanoseconds: 0 }") + IntervalMonthDayNano("IntervalMonthDayNano { months: 0, days: 5, nanoseconds: 0 }")
+ EmptyRelation: rows=1
+ "#
);
}
@@ -3458,9 +3458,9 @@ fn complex_interval_expression_in_projection() {
assert_snapshot!(
plan,
@r#"
-Projection: IntervalMonthDayNano("IntervalMonthDayNano { months: 0, days: -2, nanoseconds: 0 }") + IntervalMonthDayNano("IntervalMonthDayNano { months: 0, days: 5, nanoseconds: 0 }") + IntervalMonthDayNano("IntervalMonthDayNano { months: 0, days: -3, nanoseconds: 0 }") + IntervalMonthDayNano("IntervalMonthDayNano { months: 0, days: 5, nanoseconds: 0 }")
- EmptyRelation
-"#
+ Projection: IntervalMonthDayNano("IntervalMonthDayNano { months: 0, days: -2, nanoseconds: 0 }") + IntervalMonthDayNano("IntervalMonthDayNano { months: 0, days: 5, nanoseconds: 0 }") + IntervalMonthDayNano("IntervalMonthDayNano { months: 0, days: -3, nanoseconds: 0 }") + IntervalMonthDayNano("IntervalMonthDayNano { months: 0, days: 5, nanoseconds: 0 }")
+ EmptyRelation: rows=1
+ "#
);
}
@@ -3471,9 +3471,9 @@ fn negative_sum_intervals_in_projection() {
assert_snapshot!(
plan,
@r#"
-Projection: (- IntervalMonthDayNano("IntervalMonthDayNano { months: 0, days: 2, nanoseconds: 0 }") + IntervalMonthDayNano("IntervalMonthDayNano { months: 0, days: 5, nanoseconds: 0 }") + (- IntervalMonthDayNano("IntervalMonthDayNano { months: 0, days: 4, nanoseconds: 0 }") + IntervalMonthDayNano("IntervalMonthDayNano { months: 0, days: 7, nanoseconds: 0 }")))
- EmptyRelation
-"#
+ Projection: (- IntervalMonthDayNano("IntervalMonthDayNano { months: 0, days: 2, nanoseconds: 0 }") + IntervalMonthDayNano("IntervalMonthDayNano { months: 0, days: 5, nanoseconds: 0 }") + (- IntervalMonthDayNano("IntervalMonthDayNano { months: 0, days: 4, nanoseconds: 0 }") + IntervalMonthDayNano("IntervalMonthDayNano { months: 0, days: 7, nanoseconds: 0 }")))
+ EmptyRelation: rows=1
+ "#
);
}
@@ -4417,7 +4417,7 @@ fn test_parse_escaped_string_literal_value() {
plan,
@r#"
Projection: character_length(Utf8("\r\n")) AS len
- EmptyRelation
+ EmptyRelation: rows=1
"#
);
let sql = "SELECT character_length(E'\r\n') AS len";
@@ -4425,17 +4425,17 @@ fn test_parse_escaped_string_literal_value() {
assert_snapshot!(
plan,
@r#"
-Projection: character_length(Utf8("
-")) AS len
- EmptyRelation
-"#
+ Projection: character_length(Utf8("
+ ")) AS len
+ EmptyRelation: rows=1
+ "#
);
let sql =
r"SELECT character_length(E'\445') AS len, E'\x4B' AS hex, E'\u0001' AS unicode";
let plan = logical_plan(sql).unwrap();
assert_snapshot!(
plan,
- @"Projection: character_length(Utf8(\"%\")) AS len, Utf8(\"K\") AS hex, Utf8(\"\u{1}\") AS unicode\n EmptyRelation"
+ @"Projection: character_length(Utf8(\"%\")) AS len, Utf8(\"K\") AS hex, Utf8(\"\u{1}\") AS unicode\n EmptyRelation: rows=1"
);
let sql = r"SELECT character_length(E'\000') AS len";
@@ -4564,20 +4564,20 @@ fn test_custom_type_plan() -> Result<()> {
assert_snapshot!(
plan,
- @r###"
- Projection: CAST(Utf8("2001-01-01 18:00:00") AS Timestamp(Nanosecond, None))
- EmptyRelation
- "###
+ @r#"
+ Projection: CAST(Utf8("2001-01-01 18:00:00") AS Timestamp(Nanosecond, None))
+ EmptyRelation: rows=1
+ "#
);
let plan = plan_sql("SELECT CAST(TIMESTAMP '2001-01-01 18:00:00' AS DATETIME)");
assert_snapshot!(
plan,
- @r###"
- Projection: CAST(CAST(Utf8("2001-01-01 18:00:00") AS Timestamp(Nanosecond, None)) AS Timestamp(Nanosecond, None))
- EmptyRelation
- "###
+ @r#"
+ Projection: CAST(CAST(Utf8("2001-01-01 18:00:00") AS Timestamp(Nanosecond, None)) AS Timestamp(Nanosecond, None))
+ EmptyRelation: rows=1
+ "#
);
let plan = plan_sql(
@@ -4586,10 +4586,10 @@ fn test_custom_type_plan() -> Result<()> {
assert_snapshot!(
plan,
- @r###"
- Projection: make_array(CAST(Utf8("2001-01-01 18:00:00") AS Timestamp(Nanosecond, None)), CAST(Utf8("2001-01-02 18:00:00") AS Timestamp(Nanosecond, None)))
- EmptyRelation
- "###
+ @r#"
+ Projection: make_array(CAST(Utf8("2001-01-01 18:00:00") AS Timestamp(Nanosecond, None)), CAST(Utf8("2001-01-02 18:00:00") AS Timestamp(Nanosecond, None)))
+ EmptyRelation: rows=1
+ "#
);
Ok(())
diff --git a/datafusion/sqllogictest/test_files/aggregate.slt b/datafusion/sqllogictest/test_files/aggregate.slt
index 1af0bbf6e8..5c6b104157 100644
--- a/datafusion/sqllogictest/test_files/aggregate.slt
+++ b/datafusion/sqllogictest/test_files/aggregate.slt
@@ -410,15 +410,15 @@ logical_plan
04)------SubqueryAlias: a
05)--------Union
06)----------Projection: Int64(1) AS id, Int64(2) AS foo
-07)------------EmptyRelation
+07)------------EmptyRelation: rows=1
08)----------Projection: Int64(1) AS id, Int64(NULL) AS foo
-09)------------EmptyRelation
+09)------------EmptyRelation: rows=1
10)----------Projection: Int64(1) AS id, Int64(NULL) AS foo
-11)------------EmptyRelation
+11)------------EmptyRelation: rows=1
12)----------Projection: Int64(1) AS id, Int64(3) AS foo
-13)------------EmptyRelation
+13)------------EmptyRelation: rows=1
14)----------Projection: Int64(1) AS id, Int64(2) AS foo
-15)------------EmptyRelation
+15)------------EmptyRelation: rows=1
physical_plan
01)ProjectionExec: expr=[array_length(array_agg(DISTINCT a.foo)@1) as array_length(array_agg(DISTINCT a.foo)), sum(DISTINCT Int64(1))@2 as sum(DISTINCT Int64(1))]
02)--AggregateExec: mode=FinalPartitioned, gby=[id@0 as id], aggr=[array_agg(DISTINCT a.foo), sum(DISTINCT Int64(1))], ordering_mode=Sorted
@@ -6820,15 +6820,15 @@ logical_plan
04)------SubqueryAlias: a
05)--------Union
06)----------Projection: Int64(1) AS id, Int64(2) AS foo
-07)------------EmptyRelation
+07)------------EmptyRelation: rows=1
08)----------Projection: Int64(1) AS id, Int64(4) AS foo
-09)------------EmptyRelation
+09)------------EmptyRelation: rows=1
10)----------Projection: Int64(1) AS id, Int64(5) AS foo
-11)------------EmptyRelation
+11)------------EmptyRelation: rows=1
12)----------Projection: Int64(1) AS id, Int64(3) AS foo
-13)------------EmptyRelation
+13)------------EmptyRelation: rows=1
14)----------Projection: Int64(1) AS id, Int64(2) AS foo
-15)------------EmptyRelation
+15)------------EmptyRelation: rows=1
physical_plan
01)ProjectionExec: expr=[last_value(a.foo) ORDER BY [a.foo ASC NULLS LAST]@1 as last_value(a.foo) ORDER BY [a.foo ASC NULLS LAST], sum(DISTINCT Int64(1))@2 as sum(DISTINCT Int64(1))]
02)--AggregateExec: mode=FinalPartitioned, gby=[id@0 as id], aggr=[last_value(a.foo) ORDER BY [a.foo ASC NULLS LAST], sum(DISTINCT Int64(1))], ordering_mode=Sorted
diff --git a/datafusion/sqllogictest/test_files/array.slt b/datafusion/sqllogictest/test_files/array.slt
index 8cbc427250..4e35dc3781 100644
--- a/datafusion/sqllogictest/test_files/array.slt
+++ b/datafusion/sqllogictest/test_files/array.slt
@@ -7367,7 +7367,7 @@ explain select [1,2,3] @> [1,3];
----
logical_plan
01)Projection: Boolean(true) AS array_has_all(make_array(Int64(1),Int64(2),Int64(3)),make_array(Int64(1),Int64(3)))
-02)--EmptyRelation
+02)--EmptyRelation: rows=1
physical_plan
01)ProjectionExec: expr=[true as array_has_all(make_array(Int64(1),Int64(2),Int64(3)),make_array(Int64(1),Int64(3)))]
02)--PlaceholderRowExec
@@ -7390,7 +7390,7 @@ explain select [1,3] <@ [1,2,3];
----
logical_plan
01)Projection: Boolean(true) AS array_has_all(make_array(Int64(1),Int64(2),Int64(3)),make_array(Int64(1),Int64(3)))
-02)--EmptyRelation
+02)--EmptyRelation: rows=1
physical_plan
01)ProjectionExec: expr=[true as array_has_all(make_array(Int64(1),Int64(2),Int64(3)),make_array(Int64(1),Int64(3)))]
02)--PlaceholderRowExec
diff --git a/datafusion/sqllogictest/test_files/count_star_rule.slt b/datafusion/sqllogictest/test_files/count_star_rule.slt
index d38d3490fe..8267422672 100644
--- a/datafusion/sqllogictest/test_files/count_star_rule.slt
+++ b/datafusion/sqllogictest/test_files/count_star_rule.slt
@@ -34,7 +34,7 @@ logical_plan
01)Projection: count(Int64(1)) AS count()
02)--Aggregate: groupBy=[[]], aggr=[[count(Int64(1))]]
03)----SubqueryAlias: t
-04)------EmptyRelation
+04)------EmptyRelation: rows=1
physical_plan
01)ProjectionExec: expr=[1 as count()]
02)--PlaceholderRowExec
diff --git a/datafusion/sqllogictest/test_files/cte.slt b/datafusion/sqllogictest/test_files/cte.slt
index 5f8fd1a0b5..adbf308a96 100644
--- a/datafusion/sqllogictest/test_files/cte.slt
+++ b/datafusion/sqllogictest/test_files/cte.slt
@@ -33,7 +33,7 @@ EXPLAIN WITH "NUMBERS" AS (SELECT 1 as a, 2 as b, 3 as c) SELECT "NUMBERS".* FRO
logical_plan
01)SubqueryAlias: NUMBERS
02)--Projection: Int64(1) AS a, Int64(2) AS b, Int64(3) AS c
-03)----EmptyRelation
+03)----EmptyRelation: rows=1
physical_plan
01)ProjectionExec: expr=[1 as a, 2 as b, 3 as c]
02)--PlaceholderRowExec
@@ -107,7 +107,7 @@ logical_plan
01)SubqueryAlias: nodes
02)--RecursiveQuery: is_distinct=false
03)----Projection: Int64(1) AS id
-04)------EmptyRelation
+04)------EmptyRelation: rows=1
05)----Projection: nodes.id + Int64(1) AS id
06)------Filter: nodes.id < Int64(10)
07)--------TableScan: nodes
@@ -720,14 +720,14 @@ logical_plan
01)SubqueryAlias: recursive_cte
02)--RecursiveQuery: is_distinct=false
03)----Projection: Int64(1) AS val
-04)------EmptyRelation
+04)------EmptyRelation: rows=1
05)----Projection: Int64(2) AS val
06)------Cross Join:
07)--------Filter: recursive_cte.val < Int64(2)
08)----------TableScan: recursive_cte
09)--------SubqueryAlias: sub_cte
10)----------Projection: Int64(2) AS val
-11)------------EmptyRelation
+11)------------EmptyRelation: rows=1
physical_plan
01)RecursiveQueryExec: name=recursive_cte, is_distinct=false
02)--ProjectionExec: expr=[1 as val]
@@ -869,7 +869,7 @@ explain with numbers(a,b,c) as (select 1 as x, 2 as y, 3 as z) select * from num
logical_plan
01)SubqueryAlias: numbers
02)--Projection: Int64(1) AS a, Int64(2) AS b, Int64(3) AS c
-03)----EmptyRelation
+03)----EmptyRelation: rows=1
physical_plan
01)ProjectionExec: expr=[1 as a, 2 as b, 3 as c]
02)--PlaceholderRowExec
@@ -880,7 +880,7 @@ explain with numbers(a,b,c) as (select 1,2,3) select * from numbers;
logical_plan
01)SubqueryAlias: numbers
02)--Projection: Int64(1) AS a, Int64(2) AS b, Int64(3) AS c
-03)----EmptyRelation
+03)----EmptyRelation: rows=1
physical_plan
01)ProjectionExec: expr=[1 as a, 2 as b, 3 as c]
02)--PlaceholderRowExec
@@ -891,7 +891,7 @@ explain with numbers as (select 1 as a, 2 as b, 3 as c) select * from numbers;
logical_plan
01)SubqueryAlias: numbers
02)--Projection: Int64(1) AS a, Int64(2) AS b, Int64(3) AS c
-03)----EmptyRelation
+03)----EmptyRelation: rows=1
physical_plan
01)ProjectionExec: expr=[1 as a, 2 as b, 3 as c]
02)--PlaceholderRowExec
@@ -931,7 +931,7 @@ logical_plan
02)--TableScan: j1 projection=[a]
03)--SubqueryAlias: j2
04)----Projection: Int64(1)
-05)------EmptyRelation
+05)------EmptyRelation: rows=1
physical_plan
01)CrossJoinExec
02)--DataSourceExec: partitions=1, partition_sizes=[0]
@@ -955,7 +955,7 @@ logical_plan
01)SubqueryAlias: numbers
02)--RecursiveQuery: is_distinct=false
03)----Projection: Int64(1) AS n
-04)------EmptyRelation
+04)------EmptyRelation: rows=1
05)----Projection: numbers.n + Int64(1)
06)------Filter: numbers.n < Int64(10)
07)--------TableScan: numbers
@@ -981,7 +981,7 @@ logical_plan
01)SubqueryAlias: numbers
02)--RecursiveQuery: is_distinct=false
03)----Projection: Int64(1) AS n
-04)------EmptyRelation
+04)------EmptyRelation: rows=1
05)----Projection: numbers.n + Int64(1)
06)------Filter: numbers.n < Int64(10)
07)--------TableScan: numbers
@@ -1039,7 +1039,7 @@ logical_plan
02)--Limit: skip=0, fetch=5
03)----RecursiveQuery: is_distinct=false
04)------Projection: Int64(0) AS k, Int64(0) AS v
-05)--------EmptyRelation
+05)--------EmptyRelation: rows=1
06)------Sort: r.v ASC NULLS LAST, fetch=1
07)--------Projection: r.k, r.v
08)----------TableScan: r
diff --git a/datafusion/sqllogictest/test_files/explain.slt b/datafusion/sqllogictest/test_files/explain.slt
index c32a5e6b33..cccffe08ad 100644
--- a/datafusion/sqllogictest/test_files/explain.slt
+++ b/datafusion/sqllogictest/test_files/explain.slt
@@ -388,7 +388,7 @@ explain select make_array(make_array(1, 2, 3), make_array(4, 5, 6));
----
logical_plan
01)Projection: List([[1, 2, 3], [4, 5, 6]]) AS make_array(make_array(Int64(1),Int64(2),Int64(3)),make_array(Int64(4),Int64(5),Int64(6)))
-02)--EmptyRelation
+02)--EmptyRelation: rows=1
physical_plan
01)ProjectionExec: expr=[[[1, 2, 3], [4, 5, 6]] as make_array(make_array(Int64(1),Int64(2),Int64(3)),make_array(Int64(4),Int64(5),Int64(6)))]
02)--PlaceholderRowExec
@@ -398,7 +398,7 @@ explain select [[1, 2, 3], [4, 5, 6]];
----
logical_plan
01)Projection: List([[1, 2, 3], [4, 5, 6]]) AS make_array(make_array(Int64(1),Int64(2),Int64(3)),make_array(Int64(4),Int64(5),Int64(6)))
-02)--EmptyRelation
+02)--EmptyRelation: rows=1
physical_plan
01)ProjectionExec: expr=[[[1, 2, 3], [4, 5, 6]] as make_array(make_array(Int64(1),Int64(2),Int64(3)),make_array(Int64(4),Int64(5),Int64(6)))]
02)--PlaceholderRowExec
@@ -410,7 +410,7 @@ explain select struct(1, 2.3, 'abc');
----
logical_plan
01)Projection: Struct({c0:1,c1:2.3,c2:abc}) AS struct(Int64(1),Float64(2.3),Utf8("abc"))
-02)--EmptyRelation
+02)--EmptyRelation: rows=1
physical_plan
01)ProjectionExec: expr=[{c0:1,c1:2.3,c2:abc} as struct(Int64(1),Float64(2.3),Utf8("abc"))]
02)--PlaceholderRowExec
@@ -429,7 +429,7 @@ logical_plan
01)LeftSemi Join:
02)--TableScan: t1 projection=[a]
03)--SubqueryAlias: __correlated_sq_1
-04)----EmptyRelation
+04)----EmptyRelation: rows=1
physical_plan
01)NestedLoopJoinExec: join_type=LeftSemi
02)--DataSourceExec: partitions=1, partition_sizes=[0]
diff --git a/datafusion/sqllogictest/test_files/issue_17138.slt b/datafusion/sqllogictest/test_files/issue_17138.slt
index d7dcf8d4db..de9cb4bcf7 100644
--- a/datafusion/sqllogictest/test_files/issue_17138.slt
+++ b/datafusion/sqllogictest/test_files/issue_17138.slt
@@ -14,7 +14,7 @@ EXPLAIN SELECT NULL * AVG(DISTINCT 4) + SUM(col1) AS col0 FROM tab1
----
logical_plan
01)Projection: Float64(NULL) AS col0
-02)--EmptyRelation
+02)--EmptyRelation: rows=1
physical_plan
01)ProjectionExec: expr=[NULL as col0]
02)--PlaceholderRowExec
@@ -30,7 +30,7 @@ EXPLAIN SELECT + CAST ( NULL AS INTEGER ) * + + AVG ( DISTINCT 4 ) + - SUM ( ALL
----
logical_plan
01)Projection: Float64(NULL) AS col0
-02)--EmptyRelation
+02)--EmptyRelation: rows=1
physical_plan
01)ProjectionExec: expr=[NULL as col0]
02)--PlaceholderRowExec
diff --git a/datafusion/sqllogictest/test_files/join.slt.part b/datafusion/sqllogictest/test_files/join.slt.part
index 203dc328e7..c34f168817 100644
--- a/datafusion/sqllogictest/test_files/join.slt.part
+++ b/datafusion/sqllogictest/test_files/join.slt.part
@@ -681,7 +681,7 @@ select col2, col4 from t1 full outer join t2 on col1 = col3
query TT
explain select * from t1 join t2 on false;
----
-logical_plan EmptyRelation
+logical_plan EmptyRelation: rows=0
physical_plan EmptyExec
# Make batch size smaller than table row number. to introduce parallelism to the plan.
diff --git a/datafusion/sqllogictest/test_files/joins.slt b/datafusion/sqllogictest/test_files/joins.slt
index e7beec17e9..e74c96e9d4 100644
--- a/datafusion/sqllogictest/test_files/joins.slt
+++ b/datafusion/sqllogictest/test_files/joins.slt
@@ -3629,12 +3629,12 @@ logical_plan
02)--SubqueryAlias: a
03)----Union
04)------Projection: Int64(1) AS c, Int64(2) AS d
-05)--------EmptyRelation
+05)--------EmptyRelation: rows=1
06)------Projection: Int64(1) AS c, Int64(3) AS d
-07)--------EmptyRelation
+07)--------EmptyRelation: rows=1
08)--SubqueryAlias: rhs
09)----Projection: Int64(1) AS e, Int64(3) AS f
-10)------EmptyRelation
+10)------EmptyRelation: rows=1
physical_plan
01)ProjectionExec: expr=[c@2 as c, d@3 as d, e@0 as e, f@1 as f]
02)--CoalesceBatchesExec: target_batch_size=2
@@ -3672,12 +3672,12 @@ logical_plan
02)--SubqueryAlias: a
03)----Union
04)------Projection: Int64(1) AS c, Int64(2) AS d
-05)--------EmptyRelation
+05)--------EmptyRelation: rows=1
06)------Projection: Int64(1) AS c, Int64(3) AS d
-07)--------EmptyRelation
+07)--------EmptyRelation: rows=1
08)--SubqueryAlias: rhs
09)----Projection: Int64(1) AS e, Int64(3) AS f
-10)------EmptyRelation
+10)------EmptyRelation: rows=1
physical_plan
01)ProjectionExec: expr=[c@2 as c, d@3 as d, e@0 as e, f@1 as f]
02)--CoalesceBatchesExec: target_batch_size=2
@@ -3712,7 +3712,7 @@ EXPLAIN SELECT * FROM (
SELECT 1 as a WHERE 1=0
) AS a INNER JOIN (SELECT 1 as a) AS b ON a.a=b.a;
----
-logical_plan EmptyRelation
+logical_plan EmptyRelation: rows=0
# Inner join with empty right table
query TT
@@ -3720,7 +3720,7 @@ EXPLAIN SELECT * FROM (
SELECT 1 AS a
) AS a INNER JOIN (SELECT 1 AS a WHERE 1=0) AS b ON a.a=b.a;
----
-logical_plan EmptyRelation
+logical_plan EmptyRelation: rows=0
# Left join with empty left table
query TT
@@ -3728,7 +3728,7 @@ EXPLAIN SELECT * FROM (
SELECT 1 as a WHERE 1=0
) AS a LEFT JOIN (SELECT 1 as a) AS b ON a.a=b.a;
----
-logical_plan EmptyRelation
+logical_plan EmptyRelation: rows=0
# Left join with empty left and empty right table
query TT
@@ -3736,7 +3736,7 @@ EXPLAIN SELECT * FROM (
SELECT 1 as a WHERE 1=0
) AS a LEFT JOIN (SELECT 1 as a WHERE 1=0) AS b ON a.a=b.a;
----
-logical_plan EmptyRelation
+logical_plan EmptyRelation: rows=0
# Right join with empty right table
query TT
@@ -3744,7 +3744,7 @@ EXPLAIN SELECT * FROM (
SELECT 1 AS a
) AS a RIGHT JOIN (SELECT 1 AS a WHERE 1=0) AS b ON a.a=b.a;
----
-logical_plan EmptyRelation
+logical_plan EmptyRelation: rows=0
# Right join with empty right and empty left table
query TT
@@ -3752,7 +3752,7 @@ EXPLAIN SELECT * FROM (
SELECT 1 as a WHERE 1=0
) AS a RIGHT JOIN (SELECT 1 as a WHERE 1=0) AS b ON a.a=b.a;
----
-logical_plan EmptyRelation
+logical_plan EmptyRelation: rows=0
# Left SEMI join with empty left table
query TT
@@ -3760,7 +3760,7 @@ EXPLAIN SELECT * FROM (
SELECT 1 AS a
) AS a LEFT SEMI JOIN (SELECT 1 AS a WHERE 1=0) AS b ON a.a=b.a;
----
-logical_plan EmptyRelation
+logical_plan EmptyRelation: rows=0
# Left SEMI join with empty right table
query TT
@@ -3768,7 +3768,7 @@ EXPLAIN SELECT * FROM (
SELECT 1 AS a WHERE 1=0
) AS a LEFT SEMI JOIN (SELECT 1 AS a) AS b ON a.a=b.a;
----
-logical_plan EmptyRelation
+logical_plan EmptyRelation: rows=0
# Right SEMI join with empty left table
query TT
@@ -3776,7 +3776,7 @@ EXPLAIN SELECT * FROM (
SELECT 1 AS a WHERE 1=0
) AS a RIGHT SEMI JOIN (SELECT 1 AS a) AS b ON a.a=b.a;
----
-logical_plan EmptyRelation
+logical_plan EmptyRelation: rows=0
# Right SEMI join with empty right table
query TT
@@ -3784,7 +3784,7 @@ EXPLAIN SELECT * FROM (
SELECT 1 AS a
) AS a RIGHT SEMI JOIN (SELECT 1 AS a WHERE 1=0) AS b ON a.a=b.a;
----
-logical_plan EmptyRelation
+logical_plan EmptyRelation: rows=0
# Left ANTI join with empty left table
query TT
@@ -3792,7 +3792,7 @@ EXPLAIN SELECT * FROM (
SELECT 1 AS a WHERE 1=0
) AS a LEFT ANTI JOIN (SELECT 1 AS a) AS b ON a.a=b.a;
----
-logical_plan EmptyRelation
+logical_plan EmptyRelation: rows=0
# Right ANTI join with empty right table
query TT
@@ -3800,7 +3800,7 @@ EXPLAIN SELECT * FROM (
SELECT 1 AS a
) AS a RIGHT ANTI JOIN (SELECT 1 AS a WHERE 1=0) AS b ON a.a=b.a;
----
-logical_plan EmptyRelation
+logical_plan EmptyRelation: rows=0
# FULL OUTER join with empty left and empty right table
query TT
@@ -3808,7 +3808,7 @@ EXPLAIN SELECT * FROM (
SELECT 1 as a WHERE 1=0
) AS a FULL JOIN (SELECT 1 AS a WHERE 1=0) AS b ON a.a=b.a;
----
-logical_plan EmptyRelation
+logical_plan EmptyRelation: rows=0
# Left ANTI join with empty right table
query TT
@@ -3819,7 +3819,7 @@ EXPLAIN SELECT * FROM (
logical_plan
01)SubqueryAlias: a
02)--Projection: Int64(1) AS a
-03)----EmptyRelation
+03)----EmptyRelation: rows=1
# Right ANTI join with empty left table
query TT
@@ -3830,7 +3830,7 @@ EXPLAIN SELECT * FROM (
logical_plan
01)SubqueryAlias: b
02)--Projection: Int64(1) AS a
-03)----EmptyRelation
+03)----EmptyRelation: rows=1
statement ok
@@ -4033,7 +4033,7 @@ logical_plan
08)----------Projection: __unnest_placeholder(generate_series(Int64(1),outer_ref(t1.t1_int)),depth=1) AS UNNEST(generate_series(Int64(1),outer_ref(t1.t1_int)))
09)------------Unnest: lists[__unnest_placeholder(generate_series(Int64(1),outer_ref(t1.t1_int)))|depth=1] structs[]
10)--------------Projection: generate_series(Int64(1), CAST(outer_ref(t1.t1_int) AS Int64)) AS __unnest_placeholder(generate_series(Int64(1),outer_ref(t1.t1_int)))
-11)----------------EmptyRelation
+11)----------------EmptyRelation: rows=1
physical_plan_error This feature is not implemented: Physical plan does not support logical expression OuterReferenceColumn(UInt32, Column { relation: Some(Bare { table: "t1" }), name: "t1_int" })
@@ -4058,7 +4058,7 @@ logical_plan
08)----------Projection: __unnest_placeholder(generate_series(Int64(1),outer_ref(t2.t1_int)),depth=1) AS UNNEST(generate_series(Int64(1),outer_ref(t2.t1_int)))
09)------------Unnest: lists[__unnest_placeholder(generate_series(Int64(1),outer_ref(t2.t1_int)))|depth=1] structs[]
10)--------------Projection: generate_series(Int64(1), CAST(outer_ref(t2.t1_int) AS Int64)) AS __unnest_placeholder(generate_series(Int64(1),outer_ref(t2.t1_int)))
-11)----------------EmptyRelation
+11)----------------EmptyRelation: rows=1
physical_plan_error This feature is not implemented: Physical plan does not support logical expression OuterReferenceColumn(UInt32, Column { relation: Some(Bare { table: "t2" }), name: "t1_int" })
@@ -4738,7 +4738,7 @@ logical_plan
02)--TableScan: j1 projection=[j1_string, j1_id]
03)--SubqueryAlias: j2
04)----Projection: Int64(1)
-05)------EmptyRelation
+05)------EmptyRelation: rows=1
physical_plan
01)CrossJoinExec
02)--DataSourceExec: partitions=1, partition_sizes=[0]
diff --git a/datafusion/sqllogictest/test_files/order.slt b/datafusion/sqllogictest/test_files/order.slt
index 1ceea1a7ea..14bc5fba3a 100644
--- a/datafusion/sqllogictest/test_files/order.slt
+++ b/datafusion/sqllogictest/test_files/order.slt
@@ -1390,9 +1390,9 @@ logical_plan
02)--Projection: CASE WHEN name = Utf8("name1") THEN Float64(0) WHEN name = Utf8("name2") THEN Float64(0.5) END AS a
03)----Union
04)------Projection: Utf8("name1") AS name
-05)--------EmptyRelation
+05)--------EmptyRelation: rows=1
06)------Projection: Utf8("name2") AS name
-07)--------EmptyRelation
+07)--------EmptyRelation: rows=1
physical_plan
01)SortPreservingMergeExec: [a@0 DESC]
02)--ProjectionExec: expr=[CASE WHEN name@0 = name1 THEN 0 WHEN name@0 = name2 THEN 0.5 END as a]
diff --git a/datafusion/sqllogictest/test_files/predicates.slt b/datafusion/sqllogictest/test_files/predicates.slt
index f141a66fb5..77ee3e4f05 100644
--- a/datafusion/sqllogictest/test_files/predicates.slt
+++ b/datafusion/sqllogictest/test_files/predicates.slt
@@ -795,7 +795,7 @@ physical_plan
query TT
EXPLAIN FORMAT INDENT SELECT * FROM t WHERE x > NULL;
----
-logical_plan EmptyRelation
+logical_plan EmptyRelation: rows=0
physical_plan EmptyExec
query TT
@@ -831,7 +831,7 @@ create table t(x int) as values (1), (2), (3);
query TT
explain select x from t where x IN (1,2,3) AND x IN (4,5);
----
-logical_plan EmptyRelation
+logical_plan EmptyRelation: rows=0
physical_plan EmptyExec
query TT
@@ -854,7 +854,7 @@ physical_plan
query TT
explain select x from t where x NOT IN (1,2,3,4,5) AND x IN (1,2,3);
----
-logical_plan EmptyRelation
+logical_plan EmptyRelation: rows=0
physical_plan EmptyExec
query error DataFusion error: This feature is not implemented: Physical plan does not support logical expression InSubquery\(InSubquery \{ expr: Literal\(Int64\(NULL\), None\), subquery: <subquery>, negated: false \}\)
diff --git a/datafusion/sqllogictest/test_files/simplify_predicates.slt b/datafusion/sqllogictest/test_files/simplify_predicates.slt
index 0dd551d96d..31ce1efd21 100644
--- a/datafusion/sqllogictest/test_files/simplify_predicates.slt
+++ b/datafusion/sqllogictest/test_files/simplify_predicates.slt
@@ -82,7 +82,7 @@ logical_plan
query TT
EXPLAIN SELECT * FROM test_data WHERE int_col = 7 AND int_col = 6;
----
-logical_plan EmptyRelation
+logical_plan EmptyRelation: rows=0
# TODO: x = 7 AND x < 2 should simplify to false
query TT
@@ -207,7 +207,7 @@ logical_plan
query TT
EXPLAIN SELECT * FROM test_data WHERE int_col = 5 AND int_col = 6;
----
-logical_plan EmptyRelation
+logical_plan EmptyRelation: rows=0
# (x > 5 OR y < 10) AND (x > 6 OR y < 8)
# This is more complex but could still benefit from some simplification
diff --git a/datafusion/sqllogictest/test_files/subquery.slt b/datafusion/sqllogictest/test_files/subquery.slt
index e33271cf6d..43f85d1e20 100644
--- a/datafusion/sqllogictest/test_files/subquery.slt
+++ b/datafusion/sqllogictest/test_files/subquery.slt
@@ -499,7 +499,7 @@ logical_plan
03)----TableScan: t1 projection=[t1_id, t1_int]
04)----SubqueryAlias: __scalar_sq_1
05)------Projection: Int64(1) AS a
-06)--------EmptyRelation
+06)--------EmptyRelation: rows=1
query II rowsort
SELECT t1_id, (SELECT a FROM (select 1 as a) WHERE a = t1.t1_int) as t2_int from t1
@@ -619,7 +619,7 @@ logical_plan
01)LeftSemi Join:
02)--TableScan: t1 projection=[t1_id, t1_name]
03)--SubqueryAlias: __correlated_sq_1
-04)----EmptyRelation
+04)----EmptyRelation: rows=1
#exists_subquery_with_limit
#de-correlated, limit is removed
@@ -644,7 +644,7 @@ SELECT t1_id, t1_name FROM t1 WHERE EXISTS (SELECT * FROM t2 WHERE t2_id = t1_id
query TT
explain SELECT t1_id, t1_name FROM t1 WHERE EXISTS (SELECT * FROM t2 WHERE t2_id = t1_id limit 0)
----
-logical_plan EmptyRelation
+logical_plan EmptyRelation: rows=0
query IT rowsort
SELECT t1_id, t1_name FROM t1 WHERE EXISTS (SELECT * FROM t2 WHERE t2_id = t1_id limit 0)
@@ -701,7 +701,7 @@ logical_plan
01)Projection: t1.t1_id, __scalar_sq_1.t2_id AS t2_id
02)--Left Join:
03)----TableScan: t1 projection=[t1_id]
-04)----EmptyRelation
+04)----EmptyRelation: rows=0
query II rowsort
SELECT t1_id, (SELECT t2_id FROM t2 limit 0) FROM t1
@@ -1453,7 +1453,7 @@ logical_plan
01)LeftSemi Join:
02)--TableScan: t1 projection=[a]
03)--SubqueryAlias: __correlated_sq_1
-04)----EmptyRelation
+04)----EmptyRelation: rows=1
statement count 0
drop table t1;
diff --git a/datafusion/sqllogictest/test_files/type_coercion.slt b/datafusion/sqllogictest/test_files/type_coercion.slt
index 2c6079bc70..3175a0646b 100644
--- a/datafusion/sqllogictest/test_files/type_coercion.slt
+++ b/datafusion/sqllogictest/test_files/type_coercion.slt
@@ -128,9 +128,9 @@ EXPLAIN SELECT 1, 2 UNION ALL SELECT 3, 4
logical_plan
01)Union
02)--Projection: Int64(1) AS Int64(1), Int64(2) AS Int64(2)
-03)----EmptyRelation
+03)----EmptyRelation: rows=1
04)--Projection: Int64(3) AS Int64(1), Int64(4) AS Int64(2)
-05)----EmptyRelation
+05)----EmptyRelation: rows=1
# union_with_incompatible_data_type()
query error Incompatible inputs for Union: Previous inputs were of type Interval\(MonthDayNano\), but got incompatible type Int64 on column 'Int64\(1\)'
@@ -143,9 +143,9 @@ EXPLAIN SELECT 1 a UNION ALL SELECT 1.1 a
logical_plan
01)Union
02)--Projection: CAST(Int64(1) AS Float64) AS a
-03)----EmptyRelation
+03)----EmptyRelation: rows=1
04)--Projection: Float64(1.1) AS a
-05)----EmptyRelation
+05)----EmptyRelation: rows=1
# union_with_null()
query TT
@@ -154,9 +154,9 @@ EXPLAIN SELECT NULL a UNION ALL SELECT 1.1 a
logical_plan
01)Union
02)--Projection: CAST(NULL AS Float64) AS a
-03)----EmptyRelation
+03)----EmptyRelation: rows=1
04)--Projection: Float64(1.1) AS a
-05)----EmptyRelation
+05)----EmptyRelation: rows=1
# union_with_float_and_string()
query TT
@@ -165,9 +165,9 @@ EXPLAIN SELECT 'a' a UNION ALL SELECT 1.1 a
logical_plan
01)Union
02)--Projection: Utf8("a") AS a
-03)----EmptyRelation
+03)----EmptyRelation: rows=1
04)--Projection: CAST(Float64(1.1) AS Utf8) AS a
-05)----EmptyRelation
+05)----EmptyRelation: rows=1
# union_with_multiply_cols()
query TT
@@ -176,9 +176,9 @@ EXPLAIN SELECT 'a' a, 1 b UNION ALL SELECT 1.1 a, 1.1 b
logical_plan
01)Union
02)--Projection: Utf8("a") AS a, CAST(Int64(1) AS Float64) AS b
-03)----EmptyRelation
+03)----EmptyRelation: rows=1
04)--Projection: CAST(Float64(1.1) AS Utf8) AS a, Float64(1.1) AS b
-05)----EmptyRelation
+05)----EmptyRelation: rows=1
# sorted_union_with_different_types_and_group_by()
query TT
@@ -193,12 +193,12 @@ logical_plan
04)------Aggregate: groupBy=[[x.a]], aggr=[[]]
05)--------SubqueryAlias: x
06)----------Projection: Int64(1) AS a
-07)------------EmptyRelation
+07)------------EmptyRelation: rows=1
08)----Projection: x.a
09)------Aggregate: groupBy=[[x.a]], aggr=[[]]
10)--------SubqueryAlias: x
11)----------Projection: Float64(1.1) AS a
-12)------------EmptyRelation
+12)------------EmptyRelation: rows=1
# union_with_binary_expr_and_cast()
query TT
@@ -212,12 +212,12 @@ logical_plan
03)----Aggregate: groupBy=[[CAST(Float64(0) + CAST(x.a AS Float64) AS Int32)]], aggr=[[]]
04)------SubqueryAlias: x
05)--------Projection: Int64(1) AS a
-06)----------EmptyRelation
+06)----------EmptyRelation: rows=1
07)--Projection: Float64(2.1) + x.a AS Float64(0) + x.a
08)----Aggregate: groupBy=[[Float64(2.1) + CAST(x.a AS Float64)]], aggr=[[]]
09)------SubqueryAlias: x
10)--------Projection: Int64(1) AS a
-11)----------EmptyRelation
+11)----------EmptyRelation: rows=1
# union_with_aliases()
query TT
@@ -231,12 +231,12 @@ logical_plan
03)----Aggregate: groupBy=[[x.a]], aggr=[[]]
04)------SubqueryAlias: x
05)--------Projection: Int64(1) AS a
-06)----------EmptyRelation
+06)----------EmptyRelation: rows=1
07)--Projection: x.a AS a1
08)----Aggregate: groupBy=[[x.a]], aggr=[[]]
09)------SubqueryAlias: x
10)--------Projection: Float64(1.1) AS a
-11)----------EmptyRelation
+11)----------EmptyRelation: rows=1
# union_with_incompatible_data_types()
query error Incompatible inputs for Union: Previous inputs were of type Utf8, but got incompatible type Boolean on column 'a'
diff --git a/datafusion/sqllogictest/test_files/union.slt b/datafusion/sqllogictest/test_files/union.slt
index 6097444bc5..996ba0d70a 100644
--- a/datafusion/sqllogictest/test_files/union.slt
+++ b/datafusion/sqllogictest/test_files/union.slt
@@ -495,13 +495,13 @@ logical_plan
11)--------------------TableScan: aggregate_test_100 projection=[c1, c13], partial_filters=[aggregate_test_100.c13 != Utf8View("C2GT5KVyOPZpgKVl110TyZO0NcJ434")]
12)----Projection: Int64(1) AS cnt
13)------Limit: skip=0, fetch=3
-14)--------EmptyRelation
+14)--------EmptyRelation: rows=1
15)----Projection: lead(b.c1,Int64(1)) ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING AS cnt
16)------Limit: skip=0, fetch=3
17)--------WindowAggr: windowExpr=[[lead(b.c1, Int64(1)) ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING]]
18)----------SubqueryAlias: b
19)------------Projection: Int64(1) AS c1
-20)--------------EmptyRelation
+20)--------------EmptyRelation: rows=1
physical_plan
01)CoalescePartitionsExec: fetch=3
02)--UnionExec
@@ -620,11 +620,11 @@ logical_plan
01)Union
02)--Projection: Int64(1) AS a
03)----Aggregate: groupBy=[[Int64(1)]], aggr=[[]]
-04)------EmptyRelation
+04)------EmptyRelation: rows=1
05)--Projection: Int64(2) AS a
-06)----EmptyRelation
+06)----EmptyRelation: rows=1
07)--Projection: Int64(3) AS a
-08)----EmptyRelation
+08)----EmptyRelation: rows=1
physical_plan
01)UnionExec
02)--ProjectionExec: expr=[Int64(1)@0 as a]
@@ -647,12 +647,12 @@ logical_plan
03)----Aggregate: groupBy=[[a.n]], aggr=[[count(Int64(1))]]
04)------SubqueryAlias: a
05)--------Projection: Int64(5) AS n
-06)----------EmptyRelation
+06)----------EmptyRelation: rows=1
07)--Projection: b.x AS count, b.y AS n
08)----SubqueryAlias: b
09)------Projection: Int64(1) AS x, max(Int64(10)) AS y
10)--------Aggregate: groupBy=[[]], aggr=[[max(Int64(10))]]
-11)----------EmptyRelation
+11)----------EmptyRelation: rows=1
physical_plan
01)UnionExec
02)--ProjectionExec: expr=[count(Int64(1))@1 as count, n@0 as n]
diff --git a/datafusion/sqllogictest/test_files/unnest.slt b/datafusion/sqllogictest/test_files/unnest.slt
index 92e6f9995a..d955d4c19e 100644
--- a/datafusion/sqllogictest/test_files/unnest.slt
+++ b/datafusion/sqllogictest/test_files/unnest.slt
@@ -875,14 +875,14 @@ query TT
explain select * from unnest_table u, unnest(u.column1);
----
logical_plan
-01)Cross Join:
+01)Cross Join:
02)--SubqueryAlias: u
03)----TableScan: unnest_table projection=[column1, column2, column3, column4, column5]
04)--Subquery:
05)----Projection: __unnest_placeholder(outer_ref(u.column1),depth=1) AS UNNEST(outer_ref(u.column1))
06)------Unnest: lists[__unnest_placeholder(outer_ref(u.column1))|depth=1] structs[]
07)--------Projection: outer_ref(u.column1) AS __unnest_placeholder(outer_ref(u.column1))
-08)----------EmptyRelation
+08)----------EmptyRelation: rows=1
physical_plan_error This feature is not implemented: Physical plan does not support logical expression OuterReferenceColumn(List(Field { name: "item", data_type: Int64, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} }), Column { relation: Some(Bare { table: "u" }), name: "column1" })
# Test implicit LATERAL planning for UNNEST (INNER JOIN)
@@ -898,7 +898,7 @@ logical_plan
06)------Projection: __unnest_placeholder(outer_ref(u.column1),depth=1) AS column1
07)--------Unnest: lists[__unnest_placeholder(outer_ref(u.column1))|depth=1] structs[]
08)----------Projection: outer_ref(u.column1) AS __unnest_placeholder(outer_ref(u.column1))
-09)------------EmptyRelation
+09)------------EmptyRelation: rows=1
physical_plan_error This feature is not implemented: Physical plan does not support logical expression OuterReferenceColumn(List(Field { name: "item", data_type: Int64, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} }), Column { relation: Some(Bare { table: "u" }), name: "column1" })
# uncorrelated EXISTS with unnest
diff --git a/datafusion/sqllogictest/test_files/window.slt b/datafusion/sqllogictest/test_files/window.slt
index 44677fd5b9..60ce22062f 100644
--- a/datafusion/sqllogictest/test_files/window.slt
+++ b/datafusion/sqllogictest/test_files/window.slt
@@ -263,13 +263,13 @@ logical_plan
07)------------SubqueryAlias: _sample_data
08)--------------Union
09)----------------Projection: Int64(1) AS a, Utf8("aa") AS b
-10)------------------EmptyRelation
+10)------------------EmptyRelation: rows=1
11)----------------Projection: Int64(3) AS a, Utf8("aa") AS b
-12)------------------EmptyRelation
+12)------------------EmptyRelation: rows=1
13)----------------Projection: Int64(5) AS a, Utf8("bb") AS b
-14)------------------EmptyRelation
+14)------------------EmptyRelation: rows=1
15)----------------Projection: Int64(7) AS a, Utf8("bb") AS b
-16)------------------EmptyRelation
+16)------------------EmptyRelation: rows=1
physical_plan
01)SortPreservingMergeExec: [b@0 ASC NULLS LAST]
02)--SortExec: expr=[b@0 ASC NULLS LAST], preserve_partitioning=[true]
@@ -348,13 +348,13 @@ logical_plan
09)----------------SubqueryAlias: _sample_data
10)------------------Union
11)--------------------Projection: Int64(1) AS a, Utf8("aa") AS b
-12)----------------------EmptyRelation
+12)----------------------EmptyRelation: rows=1
13)--------------------Projection: Int64(3) AS a, Utf8("aa") AS b
-14)----------------------EmptyRelation
+14)----------------------EmptyRelation: rows=1
15)--------------------Projection: Int64(5) AS a, Utf8("bb") AS b
-16)----------------------EmptyRelation
+16)----------------------EmptyRelation: rows=1
17)--------------------Projection: Int64(7) AS a, Utf8("bb") AS b
-18)----------------------EmptyRelation
+18)----------------------EmptyRelation: rows=1
physical_plan
01)SortPreservingMergeExec: [b@0 ASC NULLS LAST]
02)--ProjectionExec: expr=[b@0 as b, max(d.a)@1 as max_a, max(d.seq)@2 as max(d.seq)]
diff --git a/docs/source/library-user-guide/working-with-exprs.md b/docs/source/library-user-guide/working-with-exprs.md
index ce3d42cd13..634e3fea55 100644
--- a/docs/source/library-user-guide/working-with-exprs.md
+++ b/docs/source/library-user-guide/working-with-exprs.md
@@ -322,7 +322,7 @@ async fn main() -> Result<()> {
let plan = ctx.sql(sql).await?.into_optimized_plan()?.clone();
let expected = r#"Projection: Int64(6) AS added_one
- EmptyRelation"#;
+ EmptyRelation: rows=1"#;
assert_eq!(plan.to_string(), expected);