Apache DataFusion SQL Query Engine
Fix column name for COUNT(*) set by AggregateStatistics (#7757)
Kirill Zaborskyc0409a7b0b45
diff --git a/datafusion/core/src/physical_optimizer/aggregate_statistics.rs b/datafusion/core/src/physical_optimizer/aggregate_statistics.rsindex 396e66972f..52fd60aa94 100644--- a/datafusion/core/src/physical_optimizer/aggregate_statistics.rs+++ b/datafusion/core/src/physical_optimizer/aggregate_statistics.rs@@ -38,7 +38,7 @@ use crate::error::Result;pub struct AggregateStatistics {}/// The name of the column corresponding to [`COUNT_STAR_EXPANSION`]-const COUNT_STAR_NAME: &str = "COUNT(UInt8(1))";+const COUNT_STAR_NAME: &str = "COUNT(*)";impl AggregateStatistics {#[allow(missing_docs)]diff --git a/datafusion/core/tests/custom_sources.rs b/datafusion/core/tests/custom_sources.rsindex 3886ad3c42..377c2ab2ab 100644--- a/datafusion/core/tests/custom_sources.rs+++ b/datafusion/core/tests/custom_sources.rs@@ -268,7 +268,7 @@ async fn optimizers_catch_all_statistics() {let expected = RecordBatch::try_new(Arc::new(Schema::new(vec![- Field::new("COUNT(UInt8(1))", DataType::Int64, false),+ Field::new("COUNT(*)", DataType::Int64, false),Field::new("MIN(test.c1)", DataType::Int32, false),Field::new("MAX(test.c1)", DataType::Int32, false),])),diff --git a/datafusion/core/tests/sql/explain_analyze.rs b/datafusion/core/tests/sql/explain_analyze.rsindex 2b708df4f3..46f94c3487 100644--- a/datafusion/core/tests/sql/explain_analyze.rs+++ b/datafusion/core/tests/sql/explain_analyze.rs@@ -804,7 +804,7 @@ async fn explain_physical_plan_only() {let expected = vec![vec!["physical_plan",- "ProjectionExec: expr=[2 as COUNT(UInt8(1))]\+ "ProjectionExec: expr=[2 as COUNT(*)]\\n EmptyExec: produce_one_row=true\\n",]];diff --git a/datafusion/sqllogictest/test_files/explain.slt b/datafusion/sqllogictest/test_files/explain.sltindex 27ab8671e9..23055cd978 100644--- a/datafusion/sqllogictest/test_files/explain.slt+++ b/datafusion/sqllogictest/test_files/explain.slt@@ -93,7 +93,7 @@ query TTEXPLAIN select count(*) from (values ('a', 1, 100), ('a', 2, 150)) as t (c1,c2,c3)----physical_plan-ProjectionExec: expr=[2 as COUNT(UInt8(1))]+ProjectionExec: expr=[2 as COUNT(*)]--EmptyExec: produce_one_row=truestatement ok