This is an automated email from the ASF dual-hosted git repository.

alamb pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-datafusion.git


The following commit(s) were added to refs/heads/main by this push:
     new c0409a7b0b Fix column name for COUNT(*) set by AggregateStatistics 
(#7757)
c0409a7b0b is described below

commit c0409a7b0b45e98f43013dff71550b9fe864fa26
Author: Kirill Zaborsky <[email protected]>
AuthorDate: Fri Oct 6 23:14:23 2023 +0300

    Fix column name for COUNT(*) set by AggregateStatistics (#7757)
    
    This fixes the issue of column name COUNT(UInt8) appearing instead
    Resolves #104
---
 datafusion/core/src/physical_optimizer/aggregate_statistics.rs | 2 +-
 datafusion/core/tests/custom_sources.rs                        | 2 +-
 datafusion/core/tests/sql/explain_analyze.rs                   | 2 +-
 datafusion/sqllogictest/test_files/explain.slt                 | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/datafusion/core/src/physical_optimizer/aggregate_statistics.rs 
b/datafusion/core/src/physical_optimizer/aggregate_statistics.rs
index 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.rs
index 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.rs
index 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.slt
index 27ab8671e9..23055cd978 100644
--- a/datafusion/sqllogictest/test_files/explain.slt
+++ b/datafusion/sqllogictest/test_files/explain.slt
@@ -93,7 +93,7 @@ query TT
 EXPLAIN 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=true
 
 statement ok

Reply via email to