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 1553a3631b Change the sentinel value's type for COUNT(*) to Int64 
(#9944)
1553a3631b is described below

commit 1553a3631b58251c1f119b63d54cd2b7de2817a1
Author: Marko Grujic <[email protected]>
AuthorDate: Fri Apr 5 13:13:45 2024 +0200

    Change the sentinel value's type for COUNT(*) to Int64 (#9944)
---
 datafusion/core/tests/sql/explain_analyze.rs       | 16 +++++++------
 datafusion/expr/src/utils.rs                       |  2 +-
 .../optimizer/src/analyzer/count_wildcard_rule.rs  | 22 ++++++++---------
 .../optimizer/tests/optimizer_integration.rs       |  2 +-
 datafusion/sql/README.md                           |  4 ++--
 datafusion/sqllogictest/test_files/avro.slt        |  2 +-
 datafusion/sqllogictest/test_files/insert.slt      |  6 ++---
 .../sqllogictest/test_files/insert_to_external.slt |  4 ++--
 datafusion/sqllogictest/test_files/joins.slt       |  2 +-
 datafusion/sqllogictest/test_files/json.slt        |  2 +-
 datafusion/sqllogictest/test_files/limit.slt       |  8 +++----
 datafusion/sqllogictest/test_files/select.slt      |  2 +-
 datafusion/sqllogictest/test_files/subquery.slt    | 28 +++++++++++-----------
 .../sqllogictest/test_files/tpch/q1.slt.part       |  2 +-
 .../sqllogictest/test_files/tpch/q13.slt.part      |  2 +-
 .../sqllogictest/test_files/tpch/q21.slt.part      |  2 +-
 .../sqllogictest/test_files/tpch/q22.slt.part      |  2 +-
 .../sqllogictest/test_files/tpch/q4.slt.part       |  2 +-
 datafusion/sqllogictest/test_files/union.slt       |  4 ++--
 datafusion/sqllogictest/test_files/window.slt      | 16 ++++++-------
 .../tests/cases/roundtrip_logical_plan.rs          |  4 ++--
 21 files changed, 68 insertions(+), 66 deletions(-)

diff --git a/datafusion/core/tests/sql/explain_analyze.rs 
b/datafusion/core/tests/sql/explain_analyze.rs
index 30b11fe2a0..d80d728d65 100644
--- a/datafusion/core/tests/sql/explain_analyze.rs
+++ b/datafusion/core/tests/sql/explain_analyze.rs
@@ -16,6 +16,7 @@
 // under the License.
 
 use super::*;
+use rstest::rstest;
 
 use datafusion::config::ConfigOptions;
 use datafusion::physical_plan::display::DisplayableExecutionPlan;
@@ -566,27 +567,28 @@ async fn csv_explain_verbose_plans() {
     assert_contains!(actual, "ProjectionExec: expr=[c1@0 as c1]");
 }
 
+#[rstest]
 #[tokio::test]
-async fn explain_analyze_runs_optimizers() {
+async fn explain_analyze_runs_optimizers(#[values("*", "1")] count_expr: &str) 
{
     // repro for https://github.com/apache/arrow-datafusion/issues/917
     // where EXPLAIN ANALYZE was not correctly running optiimizer
     let ctx = SessionContext::new();
     register_alltypes_parquet(&ctx).await;
 
-    // This happens as an optimization pass where count(*) can be
+    // This happens as an optimization pass where count(*)/count(1) can be
     // answered using statistics only.
     let expected = "PlaceholderRowExec";
 
-    let sql = "EXPLAIN SELECT count(*) from alltypes_plain";
-    let actual = execute_to_batches(&ctx, sql).await;
+    let sql = format!("EXPLAIN SELECT count({count_expr}) from 
alltypes_plain");
+    let actual = execute_to_batches(&ctx, &sql).await;
     let actual = arrow::util::pretty::pretty_format_batches(&actual)
         .unwrap()
         .to_string();
     assert_contains!(actual, expected);
 
     // EXPLAIN ANALYZE should work the same
-    let sql = "EXPLAIN  ANALYZE SELECT count(*) from alltypes_plain";
-    let actual = execute_to_batches(&ctx, sql).await;
+    let sql = format!("EXPLAIN ANALYZE SELECT count({count_expr}) from 
alltypes_plain");
+    let actual = execute_to_batches(&ctx, &sql).await;
     let actual = arrow::util::pretty::pretty_format_batches(&actual)
         .unwrap()
         .to_string();
@@ -791,7 +793,7 @@ async fn explain_logical_plan_only() {
     let expected = vec![
         vec![
             "logical_plan",
-            "Aggregate: groupBy=[[]], aggr=[[COUNT(UInt8(1)) AS COUNT(*)]]\
+            "Aggregate: groupBy=[[]], aggr=[[COUNT(Int64(1)) AS COUNT(*)]]\
             \n  SubqueryAlias: t\
             \n    Projection: \
             \n      Values: (Utf8(\"a\"), Int64(1), Int64(100)), (Utf8(\"a\"), 
Int64(2), Int64(150))"
diff --git a/datafusion/expr/src/utils.rs b/datafusion/expr/src/utils.rs
index 2b126da154..72d01da204 100644
--- a/datafusion/expr/src/utils.rs
+++ b/datafusion/expr/src/utils.rs
@@ -42,7 +42,7 @@ use sqlparser::ast::{ExceptSelectItem, ExcludeSelectItem, 
WildcardAdditionalOpti
 
 ///  The value to which `COUNT(*)` is expanded to in
 ///  `COUNT(<constant>)` expressions
-pub const COUNT_STAR_EXPANSION: ScalarValue = ScalarValue::UInt8(Some(1));
+pub const COUNT_STAR_EXPANSION: ScalarValue = ScalarValue::Int64(Some(1));
 
 /// Recursively walk a list of expression trees, collecting the unique set of 
columns
 /// referenced in the expression
diff --git a/datafusion/optimizer/src/analyzer/count_wildcard_rule.rs 
b/datafusion/optimizer/src/analyzer/count_wildcard_rule.rs
index c07445fa7f..273766edac 100644
--- a/datafusion/optimizer/src/analyzer/count_wildcard_rule.rs
+++ b/datafusion/optimizer/src/analyzer/count_wildcard_rule.rs
@@ -255,7 +255,7 @@ mod tests {
             .build()?;
         let expected = "Sort: COUNT(*) ASC NULLS LAST [COUNT(*):Int64;N]\
         \n  Projection: COUNT(*) [COUNT(*):Int64;N]\
-        \n    Aggregate: groupBy=[[test.b]], aggr=[[COUNT(UInt8(1)) AS 
COUNT(*)]] [b:UInt32, COUNT(*):Int64;N]\
+        \n    Aggregate: groupBy=[[test.b]], aggr=[[COUNT(Int64(1)) AS 
COUNT(*)]] [b:UInt32, COUNT(*):Int64;N]\
         \n      TableScan: test [a:UInt32, b:UInt32, c:UInt32]";
         assert_plan_eq(&plan, expected)
     }
@@ -280,7 +280,7 @@ mod tests {
         let expected = "Filter: t1.a IN (<subquery>) [a:UInt32, b:UInt32, 
c:UInt32]\
         \n  Subquery: [COUNT(*):Int64;N]\
         \n    Projection: COUNT(*) [COUNT(*):Int64;N]\
-        \n      Aggregate: groupBy=[[]], aggr=[[COUNT(UInt8(1)) AS COUNT(*)]] 
[COUNT(*):Int64;N]\
+        \n      Aggregate: groupBy=[[]], aggr=[[COUNT(Int64(1)) AS COUNT(*)]] 
[COUNT(*):Int64;N]\
         \n        TableScan: t2 [a:UInt32, b:UInt32, c:UInt32]\
         \n  TableScan: t1 [a:UInt32, b:UInt32, c:UInt32]";
         assert_plan_eq(&plan, expected)
@@ -303,7 +303,7 @@ mod tests {
         let expected = "Filter: EXISTS (<subquery>) [a:UInt32, b:UInt32, 
c:UInt32]\
         \n  Subquery: [COUNT(*):Int64;N]\
         \n    Projection: COUNT(*) [COUNT(*):Int64;N]\
-        \n      Aggregate: groupBy=[[]], aggr=[[COUNT(UInt8(1)) AS COUNT(*)]] 
[COUNT(*):Int64;N]\
+        \n      Aggregate: groupBy=[[]], aggr=[[COUNT(Int64(1)) AS COUNT(*)]] 
[COUNT(*):Int64;N]\
         \n        TableScan: t2 [a:UInt32, b:UInt32, c:UInt32]\
         \n  TableScan: t1 [a:UInt32, b:UInt32, c:UInt32]";
         assert_plan_eq(&plan, expected)
@@ -333,9 +333,9 @@ mod tests {
 
         let expected = "Projection: t1.a, t1.b [a:UInt32, b:UInt32]\
               \n  Filter: (<subquery>) > UInt8(0) [a:UInt32, b:UInt32, 
c:UInt32]\
-              \n    Subquery: [COUNT(UInt8(1)):Int64;N]\
-              \n      Projection: COUNT(UInt8(1)) [COUNT(UInt8(1)):Int64;N]\
-              \n        Aggregate: groupBy=[[]], aggr=[[COUNT(UInt8(1))]] 
[COUNT(UInt8(1)):Int64;N]\
+              \n    Subquery: [COUNT(Int64(1)):Int64;N]\
+              \n      Projection: COUNT(Int64(1)) [COUNT(Int64(1)):Int64;N]\
+              \n        Aggregate: groupBy=[[]], aggr=[[COUNT(Int64(1))]] 
[COUNT(Int64(1)):Int64;N]\
               \n          Filter: outer_ref(t1.a) = t2.a [a:UInt32, b:UInt32, 
c:UInt32]\
               \n            TableScan: t2 [a:UInt32, b:UInt32, c:UInt32]\
               \n    TableScan: t1 [a:UInt32, b:UInt32, c:UInt32]";
@@ -361,8 +361,8 @@ mod tests {
             .project(vec![count(wildcard())])?
             .build()?;
 
-        let expected = "Projection: COUNT(UInt8(1)) AS COUNT(*) 
[COUNT(*):Int64;N]\
-        \n  WindowAggr: windowExpr=[[COUNT(UInt8(1)) ORDER BY [test.a DESC 
NULLS FIRST] RANGE BETWEEN 6 PRECEDING AND 2 FOLLOWING AS COUNT(*) ORDER BY 
[test.a DESC NULLS FIRST] RANGE BETWEEN 6 PRECEDING AND 2 FOLLOWING]] 
[a:UInt32, b:UInt32, c:UInt32, COUNT(*) ORDER BY [test.a DESC NULLS FIRST] 
RANGE BETWEEN 6 PRECEDING AND 2 FOLLOWING:Int64;N]\
+        let expected = "Projection: COUNT(Int64(1)) AS COUNT(*) 
[COUNT(*):Int64;N]\
+        \n  WindowAggr: windowExpr=[[COUNT(Int64(1)) ORDER BY [test.a DESC 
NULLS FIRST] RANGE BETWEEN 6 PRECEDING AND 2 FOLLOWING AS COUNT(*) ORDER BY 
[test.a DESC NULLS FIRST] RANGE BETWEEN 6 PRECEDING AND 2 FOLLOWING]] 
[a:UInt32, b:UInt32, c:UInt32, COUNT(*) ORDER BY [test.a DESC NULLS FIRST] 
RANGE BETWEEN 6 PRECEDING AND 2 FOLLOWING:Int64;N]\
         \n    TableScan: test [a:UInt32, b:UInt32, c:UInt32]";
         assert_plan_eq(&plan, expected)
     }
@@ -376,7 +376,7 @@ mod tests {
             .build()?;
 
         let expected = "Projection: COUNT(*) [COUNT(*):Int64;N]\
-        \n  Aggregate: groupBy=[[]], aggr=[[COUNT(UInt8(1)) AS COUNT(*)]] 
[COUNT(*):Int64;N]\
+        \n  Aggregate: groupBy=[[]], aggr=[[COUNT(Int64(1)) AS COUNT(*)]] 
[COUNT(*):Int64;N]\
         \n    TableScan: test [a:UInt32, b:UInt32, c:UInt32]";
         assert_plan_eq(&plan, expected)
     }
@@ -389,8 +389,8 @@ mod tests {
             .project(vec![count(wildcard())])?
             .build()?;
 
-        let expected = "Projection: COUNT(UInt8(1)) AS COUNT(*) 
[COUNT(*):Int64;N]\
-        \n  Aggregate: groupBy=[[]], aggr=[[MAX(COUNT(UInt8(1))) AS 
MAX(COUNT(*))]] [MAX(COUNT(*)):Int64;N]\
+        let expected = "Projection: COUNT(Int64(1)) AS COUNT(*) 
[COUNT(*):Int64;N]\
+        \n  Aggregate: groupBy=[[]], aggr=[[MAX(COUNT(Int64(1))) AS 
MAX(COUNT(*))]] [MAX(COUNT(*)):Int64;N]\
         \n    TableScan: test [a:UInt32, b:UInt32, c:UInt32]";
         assert_plan_eq(&plan, expected)
     }
diff --git a/datafusion/optimizer/tests/optimizer_integration.rs 
b/datafusion/optimizer/tests/optimizer_integration.rs
index acafc0bafa..61d2535930 100644
--- a/datafusion/optimizer/tests/optimizer_integration.rs
+++ b/datafusion/optimizer/tests/optimizer_integration.rs
@@ -281,7 +281,7 @@ fn push_down_filter_groupby_expr_contains_alias() {
     let sql = "SELECT * FROM (SELECT (col_int32 + col_uint32) AS c, count(*) 
FROM test GROUP BY 1) where c > 3";
     let plan = test_sql(sql).unwrap();
     let expected = "Projection: test.col_int32 + test.col_uint32 AS c, 
COUNT(*)\
-    \n  Aggregate: groupBy=[[test.col_int32 + CAST(test.col_uint32 AS 
Int32)]], aggr=[[COUNT(UInt8(1)) AS COUNT(*)]]\
+    \n  Aggregate: groupBy=[[test.col_int32 + CAST(test.col_uint32 AS 
Int32)]], aggr=[[COUNT(Int64(1)) AS COUNT(*)]]\
     \n    Filter: test.col_int32 + CAST(test.col_uint32 AS Int32) > Int32(3)\
     \n      TableScan: test projection=[col_int32, col_uint32]";
     assert_eq!(expected, format!("{plan:?}"));
diff --git a/datafusion/sql/README.md b/datafusion/sql/README.md
index 256fa774b4..02ed1ae1f5 100644
--- a/datafusion/sql/README.md
+++ b/datafusion/sql/README.md
@@ -67,8 +67,8 @@ optimizer that can be applied to plans produced by this crate.
 
 ```
 Sort: state_tax DESC NULLS FIRST
-  Projection: c.id, c.first_name, c.last_name, COUNT(UInt8(1)) AS num_orders, 
SUM(o.price) AS total_price, SUM(o.price * s.sales_tax) AS state_tax
-    Aggregate: groupBy=[[c.id, c.first_name, c.last_name]], 
aggr=[[COUNT(UInt8(1)), SUM(o.price), SUM(o.price * s.sales_tax)]]
+  Projection: c.id, c.first_name, c.last_name, COUNT(Int64(1)) AS num_orders, 
SUM(o.price) AS total_price, SUM(o.price * s.sales_tax) AS state_tax
+    Aggregate: groupBy=[[c.id, c.first_name, c.last_name]], 
aggr=[[COUNT(Int64(1)), SUM(o.price), SUM(o.price * s.sales_tax)]]
       Filter: o.price > Int64(0) AND c.last_name LIKE Utf8("G%")
         Inner Join: c.id = o.customer_id
           Inner Join: c.state = s.id
diff --git a/datafusion/sqllogictest/test_files/avro.slt 
b/datafusion/sqllogictest/test_files/avro.slt
index 3f21274c00..92ef2a3628 100644
--- a/datafusion/sqllogictest/test_files/avro.slt
+++ b/datafusion/sqllogictest/test_files/avro.slt
@@ -252,7 +252,7 @@ query TT
 EXPLAIN SELECT count(*) from alltypes_plain
 ----
 logical_plan
-Aggregate: groupBy=[[]], aggr=[[COUNT(UInt8(1)) AS COUNT(*)]]
+Aggregate: groupBy=[[]], aggr=[[COUNT(Int64(1)) AS COUNT(*)]]
 --TableScan: alltypes_plain projection=[]
 physical_plan
 AggregateExec: mode=Final, gby=[], aggr=[COUNT(*)]
diff --git a/datafusion/sqllogictest/test_files/insert.slt 
b/datafusion/sqllogictest/test_files/insert.slt
index fc27232697..b3fbb33e68 100644
--- a/datafusion/sqllogictest/test_files/insert.slt
+++ b/datafusion/sqllogictest/test_files/insert.slt
@@ -61,7 +61,7 @@ Dml: op=[Insert Into] table=[table_without_values]
 --Projection: SUM(aggregate_test_100.c4) PARTITION BY [aggregate_test_100.c1] 
ORDER BY [aggregate_test_100.c9 ASC NULLS LAST] ROWS BETWEEN 1 PRECEDING AND 1 
FOLLOWING AS field1, COUNT(*) PARTITION BY [aggregate_test_100.c1] ORDER BY 
[aggregate_test_100.c9 ASC NULLS LAST] ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING 
AS field2
 ----Sort: aggregate_test_100.c1 ASC NULLS LAST
 ------Projection: SUM(aggregate_test_100.c4) PARTITION BY 
[aggregate_test_100.c1] ORDER BY [aggregate_test_100.c9 ASC NULLS LAST] ROWS 
BETWEEN 1 PRECEDING AND 1 FOLLOWING, COUNT(*) PARTITION BY 
[aggregate_test_100.c1] ORDER BY [aggregate_test_100.c9 ASC NULLS LAST] ROWS 
BETWEEN 1 PRECEDING AND 1 FOLLOWING, aggregate_test_100.c1
---------WindowAggr: windowExpr=[[SUM(CAST(aggregate_test_100.c4 AS Int64)) 
PARTITION BY [aggregate_test_100.c1] ORDER BY [aggregate_test_100.c9 ASC NULLS 
LAST] ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING, COUNT(UInt8(1)) PARTITION BY 
[aggregate_test_100.c1] ORDER BY [aggregate_test_100.c9 ASC NULLS LAST] ROWS 
BETWEEN 1 PRECEDING AND 1 FOLLOWING AS COUNT(*) PARTITION BY 
[aggregate_test_100.c1] ORDER BY [aggregate_test_100.c9 ASC NULLS LAST] ROWS 
BETWEEN 1 PRECEDING AND 1 FOLLOWING]]
+--------WindowAggr: windowExpr=[[SUM(CAST(aggregate_test_100.c4 AS Int64)) 
PARTITION BY [aggregate_test_100.c1] ORDER BY [aggregate_test_100.c9 ASC NULLS 
LAST] ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING, COUNT(Int64(1)) PARTITION BY 
[aggregate_test_100.c1] ORDER BY [aggregate_test_100.c9 ASC NULLS LAST] ROWS 
BETWEEN 1 PRECEDING AND 1 FOLLOWING AS COUNT(*) PARTITION BY 
[aggregate_test_100.c1] ORDER BY [aggregate_test_100.c9 ASC NULLS LAST] ROWS 
BETWEEN 1 PRECEDING AND 1 FOLLOWING]]
 ----------TableScan: aggregate_test_100 projection=[c1, c4, c9]
 physical_plan
 FileSinkExec: sink=MemoryTable (partitions=1)
@@ -122,7 +122,7 @@ FROM aggregate_test_100
 logical_plan
 Dml: op=[Insert Into] table=[table_without_values]
 --Projection: SUM(aggregate_test_100.c4) PARTITION BY [aggregate_test_100.c1] 
ORDER BY [aggregate_test_100.c9 ASC NULLS LAST] ROWS BETWEEN 1 PRECEDING AND 1 
FOLLOWING AS field1, COUNT(*) PARTITION BY [aggregate_test_100.c1] ORDER BY 
[aggregate_test_100.c9 ASC NULLS LAST] ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING 
AS field2
-----WindowAggr: windowExpr=[[SUM(CAST(aggregate_test_100.c4 AS Int64)) 
PARTITION BY [aggregate_test_100.c1] ORDER BY [aggregate_test_100.c9 ASC NULLS 
LAST] ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING, COUNT(UInt8(1)) PARTITION BY 
[aggregate_test_100.c1] ORDER BY [aggregate_test_100.c9 ASC NULLS LAST] ROWS 
BETWEEN 1 PRECEDING AND 1 FOLLOWING AS COUNT(*) PARTITION BY 
[aggregate_test_100.c1] ORDER BY [aggregate_test_100.c9 ASC NULLS LAST] ROWS 
BETWEEN 1 PRECEDING AND 1 FOLLOWING]]
+----WindowAggr: windowExpr=[[SUM(CAST(aggregate_test_100.c4 AS Int64)) 
PARTITION BY [aggregate_test_100.c1] ORDER BY [aggregate_test_100.c9 ASC NULLS 
LAST] ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING, COUNT(Int64(1)) PARTITION BY 
[aggregate_test_100.c1] ORDER BY [aggregate_test_100.c9 ASC NULLS LAST] ROWS 
BETWEEN 1 PRECEDING AND 1 FOLLOWING AS COUNT(*) PARTITION BY 
[aggregate_test_100.c1] ORDER BY [aggregate_test_100.c9 ASC NULLS LAST] ROWS 
BETWEEN 1 PRECEDING AND 1 FOLLOWING]]
 ------TableScan: aggregate_test_100 projection=[c1, c4, c9]
 physical_plan
 FileSinkExec: sink=MemoryTable (partitions=1)
@@ -172,7 +172,7 @@ Dml: op=[Insert Into] table=[table_without_values]
 --Projection: a1 AS a1, a2 AS a2
 ----Sort: aggregate_test_100.c1 ASC NULLS LAST
 ------Projection: SUM(aggregate_test_100.c4) PARTITION BY 
[aggregate_test_100.c1] ORDER BY [aggregate_test_100.c9 ASC NULLS LAST] ROWS 
BETWEEN 1 PRECEDING AND 1 FOLLOWING AS a1, COUNT(*) PARTITION BY 
[aggregate_test_100.c1] ORDER BY [aggregate_test_100.c9 ASC NULLS LAST] ROWS 
BETWEEN 1 PRECEDING AND 1 FOLLOWING AS a2, aggregate_test_100.c1
---------WindowAggr: windowExpr=[[SUM(CAST(aggregate_test_100.c4 AS Int64)) 
PARTITION BY [aggregate_test_100.c1] ORDER BY [aggregate_test_100.c9 ASC NULLS 
LAST] ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING, COUNT(UInt8(1)) PARTITION BY 
[aggregate_test_100.c1] ORDER BY [aggregate_test_100.c9 ASC NULLS LAST] ROWS 
BETWEEN 1 PRECEDING AND 1 FOLLOWING AS COUNT(*) PARTITION BY 
[aggregate_test_100.c1] ORDER BY [aggregate_test_100.c9 ASC NULLS LAST] ROWS 
BETWEEN 1 PRECEDING AND 1 FOLLOWING]]
+--------WindowAggr: windowExpr=[[SUM(CAST(aggregate_test_100.c4 AS Int64)) 
PARTITION BY [aggregate_test_100.c1] ORDER BY [aggregate_test_100.c9 ASC NULLS 
LAST] ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING, COUNT(Int64(1)) PARTITION BY 
[aggregate_test_100.c1] ORDER BY [aggregate_test_100.c9 ASC NULLS LAST] ROWS 
BETWEEN 1 PRECEDING AND 1 FOLLOWING AS COUNT(*) PARTITION BY 
[aggregate_test_100.c1] ORDER BY [aggregate_test_100.c9 ASC NULLS LAST] ROWS 
BETWEEN 1 PRECEDING AND 1 FOLLOWING]]
 ----------TableScan: aggregate_test_100 projection=[c1, c4, c9]
 physical_plan
 FileSinkExec: sink=MemoryTable (partitions=8)
diff --git a/datafusion/sqllogictest/test_files/insert_to_external.slt 
b/datafusion/sqllogictest/test_files/insert_to_external.slt
index 4b9af3bdea..5f100953af 100644
--- a/datafusion/sqllogictest/test_files/insert_to_external.slt
+++ b/datafusion/sqllogictest/test_files/insert_to_external.slt
@@ -350,7 +350,7 @@ Dml: op=[Insert Into] table=[table_without_values]
 --Projection: SUM(aggregate_test_100.c4) PARTITION BY [aggregate_test_100.c1] 
ORDER BY [aggregate_test_100.c9 ASC NULLS LAST] ROWS BETWEEN 1 PRECEDING AND 1 
FOLLOWING AS field1, COUNT(*) PARTITION BY [aggregate_test_100.c1] ORDER BY 
[aggregate_test_100.c9 ASC NULLS LAST] ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING 
AS field2
 ----Sort: aggregate_test_100.c1 ASC NULLS LAST
 ------Projection: SUM(aggregate_test_100.c4) PARTITION BY 
[aggregate_test_100.c1] ORDER BY [aggregate_test_100.c9 ASC NULLS LAST] ROWS 
BETWEEN 1 PRECEDING AND 1 FOLLOWING, COUNT(*) PARTITION BY 
[aggregate_test_100.c1] ORDER BY [aggregate_test_100.c9 ASC NULLS LAST] ROWS 
BETWEEN 1 PRECEDING AND 1 FOLLOWING, aggregate_test_100.c1
---------WindowAggr: windowExpr=[[SUM(CAST(aggregate_test_100.c4 AS Int64)) 
PARTITION BY [aggregate_test_100.c1] ORDER BY [aggregate_test_100.c9 ASC NULLS 
LAST] ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING, COUNT(UInt8(1)) PARTITION BY 
[aggregate_test_100.c1] ORDER BY [aggregate_test_100.c9 ASC NULLS LAST] ROWS 
BETWEEN 1 PRECEDING AND 1 FOLLOWING AS COUNT(*) PARTITION BY 
[aggregate_test_100.c1] ORDER BY [aggregate_test_100.c9 ASC NULLS LAST] ROWS 
BETWEEN 1 PRECEDING AND 1 FOLLOWING]]
+--------WindowAggr: windowExpr=[[SUM(CAST(aggregate_test_100.c4 AS Int64)) 
PARTITION BY [aggregate_test_100.c1] ORDER BY [aggregate_test_100.c9 ASC NULLS 
LAST] ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING, COUNT(Int64(1)) PARTITION BY 
[aggregate_test_100.c1] ORDER BY [aggregate_test_100.c9 ASC NULLS LAST] ROWS 
BETWEEN 1 PRECEDING AND 1 FOLLOWING AS COUNT(*) PARTITION BY 
[aggregate_test_100.c1] ORDER BY [aggregate_test_100.c9 ASC NULLS LAST] ROWS 
BETWEEN 1 PRECEDING AND 1 FOLLOWING]]
 ----------TableScan: aggregate_test_100 projection=[c1, c4, c9]
 physical_plan
 FileSinkExec: sink=ParquetSink(file_groups=[])
@@ -412,7 +412,7 @@ FROM aggregate_test_100
 logical_plan
 Dml: op=[Insert Into] table=[table_without_values]
 --Projection: SUM(aggregate_test_100.c4) PARTITION BY [aggregate_test_100.c1] 
ORDER BY [aggregate_test_100.c9 ASC NULLS LAST] ROWS BETWEEN 1 PRECEDING AND 1 
FOLLOWING AS field1, COUNT(*) PARTITION BY [aggregate_test_100.c1] ORDER BY 
[aggregate_test_100.c9 ASC NULLS LAST] ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING 
AS field2
-----WindowAggr: windowExpr=[[SUM(CAST(aggregate_test_100.c4 AS Int64)) 
PARTITION BY [aggregate_test_100.c1] ORDER BY [aggregate_test_100.c9 ASC NULLS 
LAST] ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING, COUNT(UInt8(1)) PARTITION BY 
[aggregate_test_100.c1] ORDER BY [aggregate_test_100.c9 ASC NULLS LAST] ROWS 
BETWEEN 1 PRECEDING AND 1 FOLLOWING AS COUNT(*) PARTITION BY 
[aggregate_test_100.c1] ORDER BY [aggregate_test_100.c9 ASC NULLS LAST] ROWS 
BETWEEN 1 PRECEDING AND 1 FOLLOWING]]
+----WindowAggr: windowExpr=[[SUM(CAST(aggregate_test_100.c4 AS Int64)) 
PARTITION BY [aggregate_test_100.c1] ORDER BY [aggregate_test_100.c9 ASC NULLS 
LAST] ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING, COUNT(Int64(1)) PARTITION BY 
[aggregate_test_100.c1] ORDER BY [aggregate_test_100.c9 ASC NULLS LAST] ROWS 
BETWEEN 1 PRECEDING AND 1 FOLLOWING AS COUNT(*) PARTITION BY 
[aggregate_test_100.c1] ORDER BY [aggregate_test_100.c9 ASC NULLS LAST] ROWS 
BETWEEN 1 PRECEDING AND 1 FOLLOWING]]
 ------TableScan: aggregate_test_100 projection=[c1, c4, c9]
 physical_plan
 FileSinkExec: sink=ParquetSink(file_groups=[])
diff --git a/datafusion/sqllogictest/test_files/joins.slt 
b/datafusion/sqllogictest/test_files/joins.slt
index 344b65a7c2..b47c0a457f 100644
--- a/datafusion/sqllogictest/test_files/joins.slt
+++ b/datafusion/sqllogictest/test_files/joins.slt
@@ -1344,7 +1344,7 @@ group by t1_id
 ----
 logical_plan
 Projection: COUNT(*)
---Aggregate: groupBy=[[join_t1.t1_id]], aggr=[[COUNT(UInt8(1)) AS COUNT(*)]]
+--Aggregate: groupBy=[[join_t1.t1_id]], aggr=[[COUNT(Int64(1)) AS COUNT(*)]]
 ----Projection: join_t1.t1_id
 ------Inner Join: join_t1.t1_id = join_t2.t2_id
 --------TableScan: join_t1 projection=[t1_id]
diff --git a/datafusion/sqllogictest/test_files/json.slt 
b/datafusion/sqllogictest/test_files/json.slt
index 24c97816fe..7508b44f02 100644
--- a/datafusion/sqllogictest/test_files/json.slt
+++ b/datafusion/sqllogictest/test_files/json.slt
@@ -49,7 +49,7 @@ query TT
 EXPLAIN SELECT count(*) from json_test
 ----
 logical_plan
-Aggregate: groupBy=[[]], aggr=[[COUNT(UInt8(1)) AS COUNT(*)]]
+Aggregate: groupBy=[[]], aggr=[[COUNT(Int64(1)) AS COUNT(*)]]
 --TableScan: json_test projection=[]
 physical_plan
 AggregateExec: mode=Final, gby=[], aggr=[COUNT(*)]
diff --git a/datafusion/sqllogictest/test_files/limit.slt 
b/datafusion/sqllogictest/test_files/limit.slt
index 0d98c41d00..f70e4cb30e 100644
--- a/datafusion/sqllogictest/test_files/limit.slt
+++ b/datafusion/sqllogictest/test_files/limit.slt
@@ -307,7 +307,7 @@ query TT
 EXPLAIN SELECT COUNT(*) FROM (SELECT a FROM t1 LIMIT 3 OFFSET 11);
 ----
 logical_plan
-Aggregate: groupBy=[[]], aggr=[[COUNT(UInt8(1)) AS COUNT(*)]]
+Aggregate: groupBy=[[]], aggr=[[COUNT(Int64(1)) AS COUNT(*)]]
 --Limit: skip=11, fetch=3
 ----TableScan: t1 projection=[], fetch=14
 physical_plan
@@ -325,7 +325,7 @@ query TT
 EXPLAIN SELECT COUNT(*) FROM (SELECT a FROM t1 LIMIT 3 OFFSET 8);
 ----
 logical_plan
-Aggregate: groupBy=[[]], aggr=[[COUNT(UInt8(1)) AS COUNT(*)]]
+Aggregate: groupBy=[[]], aggr=[[COUNT(Int64(1)) AS COUNT(*)]]
 --Limit: skip=8, fetch=3
 ----TableScan: t1 projection=[], fetch=11
 physical_plan
@@ -343,7 +343,7 @@ query TT
 EXPLAIN SELECT COUNT(*) FROM (SELECT a FROM t1 OFFSET 8);
 ----
 logical_plan
-Aggregate: groupBy=[[]], aggr=[[COUNT(UInt8(1)) AS COUNT(*)]]
+Aggregate: groupBy=[[]], aggr=[[COUNT(Int64(1)) AS COUNT(*)]]
 --Limit: skip=8, fetch=None
 ----TableScan: t1 projection=[]
 physical_plan
@@ -360,7 +360,7 @@ query TT
 EXPLAIN SELECT COUNT(*) FROM (SELECT a FROM t1 WHERE a > 3 LIMIT 3 OFFSET 6);
 ----
 logical_plan
-Aggregate: groupBy=[[]], aggr=[[COUNT(UInt8(1)) AS COUNT(*)]]
+Aggregate: groupBy=[[]], aggr=[[COUNT(Int64(1)) AS COUNT(*)]]
 --Projection: 
 ----Limit: skip=6, fetch=3
 ------Filter: t1.a > Int32(3)
diff --git a/datafusion/sqllogictest/test_files/select.slt 
b/datafusion/sqllogictest/test_files/select.slt
index ad4b0df1a5..8975acb3f5 100644
--- a/datafusion/sqllogictest/test_files/select.slt
+++ b/datafusion/sqllogictest/test_files/select.slt
@@ -1373,7 +1373,7 @@ ORDER BY c1, c2)
 GROUP BY c2;
 ----
 logical_plan
-Aggregate: groupBy=[[aggregate_test_100.c2]], aggr=[[COUNT(UInt8(1)) AS 
COUNT(*)]]
+Aggregate: groupBy=[[aggregate_test_100.c2]], aggr=[[COUNT(Int64(1)) AS 
COUNT(*)]]
 --Projection: aggregate_test_100.c2
 ----Sort: aggregate_test_100.c1 ASC NULLS LAST, aggregate_test_100.c2 ASC 
NULLS LAST
 ------Projection: aggregate_test_100.c2, aggregate_test_100.c1
diff --git a/datafusion/sqllogictest/test_files/subquery.slt 
b/datafusion/sqllogictest/test_files/subquery.slt
index 4fb94cfab5..cc6428e514 100644
--- a/datafusion/sqllogictest/test_files/subquery.slt
+++ b/datafusion/sqllogictest/test_files/subquery.slt
@@ -521,7 +521,7 @@ Projection: t1.t1_id, t1.t1_name
 ----Subquery:
 ------Projection: COUNT(*)
 --------Filter: SUM(outer_ref(t1.t1_int) + t2.t2_id) > Int64(0)
-----------Aggregate: groupBy=[[]], aggr=[[COUNT(UInt8(1)) AS COUNT(*), 
SUM(CAST(outer_ref(t1.t1_int) + t2.t2_id AS Int64))]]
+----------Aggregate: groupBy=[[]], aggr=[[COUNT(Int64(1)) AS COUNT(*), 
SUM(CAST(outer_ref(t1.t1_int) + t2.t2_id AS Int64))]]
 ------------Filter: outer_ref(t1.t1_name) = t2.t2_name
 --------------TableScan: t2
 ----TableScan: t1 projection=[t1_id, t1_name, t1_int]
@@ -711,7 +711,7 @@ explain select (select count(*) from t1) as b
 logical_plan
 Projection: __scalar_sq_1.COUNT(*) AS b
 --SubqueryAlias: __scalar_sq_1
-----Aggregate: groupBy=[[]], aggr=[[COUNT(UInt8(1)) AS COUNT(*)]]
+----Aggregate: groupBy=[[]], aggr=[[COUNT(Int64(1)) AS COUNT(*)]]
 ------TableScan: t1 projection=[]
 
 #simple_uncorrelated_scalar_subquery2
@@ -722,7 +722,7 @@ logical_plan
 Projection: __scalar_sq_1.COUNT(*) AS b, __scalar_sq_2.COUNT(Int64(1)) AS 
COUNT(Int64(1))
 --Left Join:
 ----SubqueryAlias: __scalar_sq_1
-------Aggregate: groupBy=[[]], aggr=[[COUNT(UInt8(1)) AS COUNT(*)]]
+------Aggregate: groupBy=[[]], aggr=[[COUNT(Int64(1)) AS COUNT(*)]]
 --------TableScan: t1 projection=[]
 ----SubqueryAlias: __scalar_sq_2
 ------Aggregate: groupBy=[[]], aggr=[[COUNT(Int64(1))]]
@@ -743,7 +743,7 @@ Projection: t1.t1_id, CASE WHEN __scalar_sq_1.__always_true 
IS NULL THEN Int64(0
 ----TableScan: t1 projection=[t1_id, t1_int]
 ----SubqueryAlias: __scalar_sq_1
 ------Projection: COUNT(*), t2.t2_int, __always_true
---------Aggregate: groupBy=[[t2.t2_int, Boolean(true) AS __always_true]], 
aggr=[[COUNT(UInt8(1)) AS COUNT(*)]]
+--------Aggregate: groupBy=[[t2.t2_int, Boolean(true) AS __always_true]], 
aggr=[[COUNT(Int64(1)) AS COUNT(*)]]
 ----------TableScan: t2 projection=[t2_int]
 
 query II rowsort
@@ -765,7 +765,7 @@ Projection: t1.t1_id, CASE WHEN __scalar_sq_1.__always_true 
IS NULL THEN Int64(0
 ----TableScan: t1 projection=[t1_id, t1_int]
 ----SubqueryAlias: __scalar_sq_1
 ------Projection: COUNT(*), t2.t2_int, __always_true
---------Aggregate: groupBy=[[t2.t2_int, Boolean(true) AS __always_true]], 
aggr=[[COUNT(UInt8(1)) AS COUNT(*)]]
+--------Aggregate: groupBy=[[t2.t2_int, Boolean(true) AS __always_true]], 
aggr=[[COUNT(Int64(1)) AS COUNT(*)]]
 ----------TableScan: t2 projection=[t2_int]
 
 query II rowsort
@@ -786,7 +786,7 @@ Projection: t1.t1_id, CASE WHEN __scalar_sq_1.__always_true 
IS NULL THEN Int64(0
 ----TableScan: t1 projection=[t1_id, t1_int]
 ----SubqueryAlias: __scalar_sq_1
 ------Projection: COUNT(*) AS _cnt, t2.t2_int, __always_true
---------Aggregate: groupBy=[[t2.t2_int, Boolean(true) AS __always_true]], 
aggr=[[COUNT(UInt8(1)) AS COUNT(*)]]
+--------Aggregate: groupBy=[[t2.t2_int, Boolean(true) AS __always_true]], 
aggr=[[COUNT(Int64(1)) AS COUNT(*)]]
 ----------TableScan: t2 projection=[t2_int]
 
 query II rowsort
@@ -807,7 +807,7 @@ Projection: t1.t1_id, CASE WHEN __scalar_sq_1.__always_true 
IS NULL THEN Int64(2
 ----TableScan: t1 projection=[t1_id, t1_int]
 ----SubqueryAlias: __scalar_sq_1
 ------Projection: COUNT(*) + Int64(2) AS _cnt, t2.t2_int, __always_true
---------Aggregate: groupBy=[[t2.t2_int, Boolean(true) AS __always_true]], 
aggr=[[COUNT(UInt8(1)) AS COUNT(*)]]
+--------Aggregate: groupBy=[[t2.t2_int, Boolean(true) AS __always_true]], 
aggr=[[COUNT(Int64(1)) AS COUNT(*)]]
 ----------TableScan: t2 projection=[t2_int]
 
 query II rowsort
@@ -830,7 +830,7 @@ Projection: t1.t1_int
 --------TableScan: t1 projection=[t1_id, t1_int]
 --------SubqueryAlias: __scalar_sq_1
 ----------Projection: COUNT(*), t2.t2_id, __always_true
-------------Aggregate: groupBy=[[t2.t2_id, Boolean(true) AS __always_true]], 
aggr=[[COUNT(UInt8(1)) AS COUNT(*)]]
+------------Aggregate: groupBy=[[t2.t2_id, Boolean(true) AS __always_true]], 
aggr=[[COUNT(Int64(1)) AS COUNT(*)]]
 --------------TableScan: t2 projection=[t2_id]
 
 query I rowsort
@@ -853,7 +853,7 @@ Projection: t1.t1_id, __scalar_sq_1.cnt_plus_2 AS cnt_plus_2
 ------Projection: COUNT(*) + Int64(2) AS cnt_plus_2, t2.t2_int
 --------Filter: COUNT(*) > Int64(1)
 ----------Projection: t2.t2_int, COUNT(*)
-------------Aggregate: groupBy=[[t2.t2_int, Boolean(true) AS __always_true]], 
aggr=[[COUNT(UInt8(1)) AS COUNT(*)]]
+------------Aggregate: groupBy=[[t2.t2_int, Boolean(true) AS __always_true]], 
aggr=[[COUNT(Int64(1)) AS COUNT(*)]]
 --------------TableScan: t2 projection=[t2_int]
 
 query II rowsort
@@ -875,7 +875,7 @@ Projection: t1.t1_id, CASE WHEN __scalar_sq_1.__always_true 
IS NULL THEN Int64(2
 ----TableScan: t1 projection=[t1_id, t1_int]
 ----SubqueryAlias: __scalar_sq_1
 ------Projection: COUNT(*) + Int64(2) AS cnt_plus_2, t2.t2_int, COUNT(*), 
__always_true
---------Aggregate: groupBy=[[t2.t2_int, Boolean(true) AS __always_true]], 
aggr=[[COUNT(UInt8(1)) AS COUNT(*)]]
+--------Aggregate: groupBy=[[t2.t2_int, Boolean(true) AS __always_true]], 
aggr=[[COUNT(Int64(1)) AS COUNT(*)]]
 ----------TableScan: t2 projection=[t2_int]
 
 query II rowsort
@@ -899,7 +899,7 @@ Projection: t1.t1_int
 ----------TableScan: t1 projection=[t1_int]
 --------SubqueryAlias: __scalar_sq_1
 ----------Projection: COUNT(*), t2.t2_int, __always_true
-------------Aggregate: groupBy=[[t2.t2_int, Boolean(true) AS __always_true]], 
aggr=[[COUNT(UInt8(1)) AS COUNT(*)]]
+------------Aggregate: groupBy=[[t2.t2_int, Boolean(true) AS __always_true]], 
aggr=[[COUNT(Int64(1)) AS COUNT(*)]]
 --------------TableScan: t2 projection=[t2_int]
 
 query I rowsort
@@ -920,7 +920,7 @@ Projection: t1.t1_int
 --------TableScan: t1 projection=[t1_int]
 --------SubqueryAlias: __scalar_sq_1
 ----------Projection: COUNT(*) AS cnt, t2.t2_int, __always_true
-------------Aggregate: groupBy=[[t2.t2_int, Boolean(true) AS __always_true]], 
aggr=[[COUNT(UInt8(1)) AS COUNT(*)]]
+------------Aggregate: groupBy=[[t2.t2_int, Boolean(true) AS __always_true]], 
aggr=[[COUNT(Int64(1)) AS COUNT(*)]]
 --------------TableScan: t2 projection=[t2_int]
 
 
@@ -950,7 +950,7 @@ Projection: t1.t1_int
 --------TableScan: t1 projection=[t1_int]
 --------SubqueryAlias: __scalar_sq_1
 ----------Projection: COUNT(*) + Int64(1) + Int64(1) AS cnt_plus_two, 
t2.t2_int, COUNT(*), __always_true
-------------Aggregate: groupBy=[[t2.t2_int, Boolean(true) AS __always_true]], 
aggr=[[COUNT(UInt8(1)) AS COUNT(*)]]
+------------Aggregate: groupBy=[[t2.t2_int, Boolean(true) AS __always_true]], 
aggr=[[COUNT(Int64(1)) AS COUNT(*)]]
 --------------TableScan: t2 projection=[t2_int]
 
 query I rowsort
@@ -979,7 +979,7 @@ Projection: t1.t1_int
 --------TableScan: t1 projection=[t1_int]
 --------SubqueryAlias: __scalar_sq_1
 ----------Projection: CASE WHEN COUNT(*) = Int64(1) THEN Int64(NULL) ELSE 
COUNT(*) END AS cnt, t2.t2_int, __always_true
-------------Aggregate: groupBy=[[t2.t2_int, Boolean(true) AS __always_true]], 
aggr=[[COUNT(UInt8(1)) AS COUNT(*)]]
+------------Aggregate: groupBy=[[t2.t2_int, Boolean(true) AS __always_true]], 
aggr=[[COUNT(Int64(1)) AS COUNT(*)]]
 --------------TableScan: t2 projection=[t2_int]
 
 
diff --git a/datafusion/sqllogictest/test_files/tpch/q1.slt.part 
b/datafusion/sqllogictest/test_files/tpch/q1.slt.part
index 3086ab487a..52ad63e99f 100644
--- a/datafusion/sqllogictest/test_files/tpch/q1.slt.part
+++ b/datafusion/sqllogictest/test_files/tpch/q1.slt.part
@@ -42,7 +42,7 @@ explain select
 logical_plan
 Sort: lineitem.l_returnflag ASC NULLS LAST, lineitem.l_linestatus ASC NULLS 
LAST
 --Projection: lineitem.l_returnflag, lineitem.l_linestatus, 
SUM(lineitem.l_quantity) AS sum_qty, SUM(lineitem.l_extendedprice) AS 
sum_base_price, SUM(lineitem.l_extendedprice * Int64(1) - lineitem.l_discount) 
AS sum_disc_price, SUM(lineitem.l_extendedprice * Int64(1) - 
lineitem.l_discount * Int64(1) + lineitem.l_tax) AS sum_charge, 
AVG(lineitem.l_quantity) AS avg_qty, AVG(lineitem.l_extendedprice) AS 
avg_price, AVG(lineitem.l_discount) AS avg_disc, COUNT(*) AS count_order
-----Aggregate: groupBy=[[lineitem.l_returnflag, lineitem.l_linestatus]], 
aggr=[[SUM(lineitem.l_quantity), SUM(lineitem.l_extendedprice), 
SUM(lineitem.l_extendedprice * (Decimal128(Some(1),20,0) - 
lineitem.l_discount)Decimal128(Some(1),20,0) - 
lineitem.l_discountlineitem.l_discountDecimal128(Some(1),20,0)lineitem.l_extendedprice
 AS lineitem.l_extendedprice * Decimal128(Some(1),20,0) - lineitem.l_discount) 
AS SUM(lineitem.l_extendedprice * Int64(1) - lineitem.l_discount), 
SUM(lineitem.l_ex [...]
+----Aggregate: groupBy=[[lineitem.l_returnflag, lineitem.l_linestatus]], 
aggr=[[SUM(lineitem.l_quantity), SUM(lineitem.l_extendedprice), 
SUM(lineitem.l_extendedprice * (Decimal128(Some(1),20,0) - 
lineitem.l_discount)Decimal128(Some(1),20,0) - 
lineitem.l_discountlineitem.l_discountDecimal128(Some(1),20,0)lineitem.l_extendedprice
 AS lineitem.l_extendedprice * Decimal128(Some(1),20,0) - lineitem.l_discount) 
AS SUM(lineitem.l_extendedprice * Int64(1) - lineitem.l_discount), 
SUM(lineitem.l_ex [...]
 ------Projection: lineitem.l_extendedprice * (Decimal128(Some(1),20,0) - 
lineitem.l_discount) AS lineitem.l_extendedprice * (Decimal128(Some(1),20,0) - 
lineitem.l_discount)Decimal128(Some(1),20,0) - 
lineitem.l_discountlineitem.l_discountDecimal128(Some(1),20,0)lineitem.l_extendedprice,
 lineitem.l_quantity, lineitem.l_extendedprice, lineitem.l_discount, 
lineitem.l_tax, lineitem.l_returnflag, lineitem.l_linestatus
 --------Filter: lineitem.l_shipdate <= Date32("10471")
 ----------TableScan: lineitem projection=[l_quantity, l_extendedprice, 
l_discount, l_tax, l_returnflag, l_linestatus, l_shipdate], 
partial_filters=[lineitem.l_shipdate <= Date32("10471")]
diff --git a/datafusion/sqllogictest/test_files/tpch/q13.slt.part 
b/datafusion/sqllogictest/test_files/tpch/q13.slt.part
index e79dbf480a..592a507904 100644
--- a/datafusion/sqllogictest/test_files/tpch/q13.slt.part
+++ b/datafusion/sqllogictest/test_files/tpch/q13.slt.part
@@ -43,7 +43,7 @@ logical_plan
 Limit: skip=0, fetch=10
 --Sort: custdist DESC NULLS FIRST, c_orders.c_count DESC NULLS FIRST, fetch=10
 ----Projection: c_orders.c_count, COUNT(*) AS custdist
-------Aggregate: groupBy=[[c_orders.c_count]], aggr=[[COUNT(UInt8(1)) AS 
COUNT(*)]]
+------Aggregate: groupBy=[[c_orders.c_count]], aggr=[[COUNT(Int64(1)) AS 
COUNT(*)]]
 --------SubqueryAlias: c_orders
 ----------Projection: COUNT(orders.o_orderkey) AS c_count
 ------------Aggregate: groupBy=[[customer.c_custkey]], 
aggr=[[COUNT(orders.o_orderkey)]]
diff --git a/datafusion/sqllogictest/test_files/tpch/q21.slt.part 
b/datafusion/sqllogictest/test_files/tpch/q21.slt.part
index ea8ee34d7d..a2246381e6 100644
--- a/datafusion/sqllogictest/test_files/tpch/q21.slt.part
+++ b/datafusion/sqllogictest/test_files/tpch/q21.slt.part
@@ -60,7 +60,7 @@ order by
 logical_plan
 Sort: numwait DESC NULLS FIRST, supplier.s_name ASC NULLS LAST
 --Projection: supplier.s_name, COUNT(*) AS numwait
-----Aggregate: groupBy=[[supplier.s_name]], aggr=[[COUNT(UInt8(1)) AS 
COUNT(*)]]
+----Aggregate: groupBy=[[supplier.s_name]], aggr=[[COUNT(Int64(1)) AS 
COUNT(*)]]
 ------Projection: supplier.s_name
 --------LeftAnti Join: l1.l_orderkey = __correlated_sq_2.l_orderkey Filter: 
__correlated_sq_2.l_suppkey != l1.l_suppkey
 ----------LeftSemi Join: l1.l_orderkey = __correlated_sq_1.l_orderkey Filter: 
__correlated_sq_1.l_suppkey != l1.l_suppkey
diff --git a/datafusion/sqllogictest/test_files/tpch/q22.slt.part 
b/datafusion/sqllogictest/test_files/tpch/q22.slt.part
index c4556fee3f..fea82b9022 100644
--- a/datafusion/sqllogictest/test_files/tpch/q22.slt.part
+++ b/datafusion/sqllogictest/test_files/tpch/q22.slt.part
@@ -58,7 +58,7 @@ order by
 logical_plan
 Sort: custsale.cntrycode ASC NULLS LAST
 --Projection: custsale.cntrycode, COUNT(*) AS numcust, SUM(custsale.c_acctbal) 
AS totacctbal
-----Aggregate: groupBy=[[custsale.cntrycode]], aggr=[[COUNT(UInt8(1)) AS 
COUNT(*), SUM(custsale.c_acctbal)]]
+----Aggregate: groupBy=[[custsale.cntrycode]], aggr=[[COUNT(Int64(1)) AS 
COUNT(*), SUM(custsale.c_acctbal)]]
 ------SubqueryAlias: custsale
 --------Projection: substr(customer.c_phone, Int64(1), Int64(2)) AS cntrycode, 
customer.c_acctbal
 ----------Inner Join:  Filter: CAST(customer.c_acctbal AS Decimal128(19, 6)) > 
__scalar_sq_2.AVG(customer.c_acctbal)
diff --git a/datafusion/sqllogictest/test_files/tpch/q4.slt.part 
b/datafusion/sqllogictest/test_files/tpch/q4.slt.part
index 00e08010ea..1c35887c06 100644
--- a/datafusion/sqllogictest/test_files/tpch/q4.slt.part
+++ b/datafusion/sqllogictest/test_files/tpch/q4.slt.part
@@ -42,7 +42,7 @@ order by
 logical_plan
 Sort: orders.o_orderpriority ASC NULLS LAST
 --Projection: orders.o_orderpriority, COUNT(*) AS order_count
-----Aggregate: groupBy=[[orders.o_orderpriority]], aggr=[[COUNT(UInt8(1)) AS 
COUNT(*)]]
+----Aggregate: groupBy=[[orders.o_orderpriority]], aggr=[[COUNT(Int64(1)) AS 
COUNT(*)]]
 ------Projection: orders.o_orderpriority
 --------LeftSemi Join: orders.o_orderkey = __correlated_sq_1.l_orderkey
 ----------Projection: orders.o_orderkey, orders.o_orderpriority
diff --git a/datafusion/sqllogictest/test_files/union.slt 
b/datafusion/sqllogictest/test_files/union.slt
index feb97bf150..b87580a7bd 100644
--- a/datafusion/sqllogictest/test_files/union.slt
+++ b/datafusion/sqllogictest/test_files/union.slt
@@ -421,7 +421,7 @@ SELECT count(*) FROM (
 ----
 logical_plan
 Projection: COUNT(*)
---Aggregate: groupBy=[[t1.name]], aggr=[[COUNT(UInt8(1)) AS COUNT(*)]]
+--Aggregate: groupBy=[[t1.name]], aggr=[[COUNT(Int64(1)) AS COUNT(*)]]
 ----Union
 ------Aggregate: groupBy=[[t1.name]], aggr=[[]]
 --------TableScan: t1 projection=[name]
@@ -566,7 +566,7 @@ select x, y from (select 1 as x , max(10) as y) b
 logical_plan
 Union
 --Projection: COUNT(*) AS count, a.n
-----Aggregate: groupBy=[[a.n]], aggr=[[COUNT(UInt8(1)) AS COUNT(*)]]
+----Aggregate: groupBy=[[a.n]], aggr=[[COUNT(Int64(1)) AS COUNT(*)]]
 ------SubqueryAlias: a
 --------Projection: Int64(5) AS n
 ----------EmptyRelation
diff --git a/datafusion/sqllogictest/test_files/window.slt 
b/datafusion/sqllogictest/test_files/window.slt
index a309a97137..50132e783a 100644
--- a/datafusion/sqllogictest/test_files/window.slt
+++ b/datafusion/sqllogictest/test_files/window.slt
@@ -505,7 +505,7 @@ LIMIT 5
 #//     let actual = execute_to_batches(&ctx, sql).await;
 #//     let expected = vec![
 #//         "+----------------------------+-----------------+",
-#//         "| SUM(aggregate_test_100.c4) | COUNT(UInt8(1)) |",
+#//         "| SUM(aggregate_test_100.c4) | COUNT(Int64(1)) |",
 #//         "+----------------------------+-----------------+",
 #//         "| -33822      | 3|",
 #//         "| 20808       | 3|",
@@ -803,7 +803,7 @@ LIMIT 5
 # //     let actual = execute_to_batches(&ctx, sql).await;
 # //     let expected = vec![
 # //         
"+----+------------+----------------------------+-----------------+",
-# //         "| c2 | c9         | SUM(aggregate_test_100.c5) | COUNT(UInt8(1)) 
|",
+# //         "| c2 | c9         | SUM(aggregate_test_100.c5) | COUNT(Int64(1)) 
|",
 # //         
"+----+------------+----------------------------+-----------------+",
 # //         "| 1  | 879082834  | -438598674  | 22              |",
 # //         "| 1  | 3542840110 | -438598674  | 22              |",
@@ -1273,7 +1273,7 @@ EXPLAIN SELECT
 ----
 logical_plan
 Projection: SUM(aggregate_test_100.c4) PARTITION BY [aggregate_test_100.c1, 
aggregate_test_100.c2] ORDER BY [aggregate_test_100.c2 ASC NULLS LAST] ROWS 
BETWEEN 1 PRECEDING AND 1 FOLLOWING, COUNT(*) PARTITION BY 
[aggregate_test_100.c1] ORDER BY [aggregate_test_100.c2 ASC NULLS LAST] ROWS 
BETWEEN 1 PRECEDING AND 1 FOLLOWING
---WindowAggr: windowExpr=[[COUNT(UInt8(1)) PARTITION BY 
[aggregate_test_100.c1] ORDER BY [aggregate_test_100.c2 ASC NULLS LAST] ROWS 
BETWEEN 1 PRECEDING AND 1 FOLLOWING AS COUNT(*) PARTITION BY 
[aggregate_test_100.c1] ORDER BY [aggregate_test_100.c2 ASC NULLS LAST] ROWS 
BETWEEN 1 PRECEDING AND 1 FOLLOWING]]
+--WindowAggr: windowExpr=[[COUNT(Int64(1)) PARTITION BY 
[aggregate_test_100.c1] ORDER BY [aggregate_test_100.c2 ASC NULLS LAST] ROWS 
BETWEEN 1 PRECEDING AND 1 FOLLOWING AS COUNT(*) PARTITION BY 
[aggregate_test_100.c1] ORDER BY [aggregate_test_100.c2 ASC NULLS LAST] ROWS 
BETWEEN 1 PRECEDING AND 1 FOLLOWING]]
 ----Projection: aggregate_test_100.c1, aggregate_test_100.c2, 
SUM(aggregate_test_100.c4) PARTITION BY [aggregate_test_100.c1, 
aggregate_test_100.c2] ORDER BY [aggregate_test_100.c2 ASC NULLS LAST] ROWS 
BETWEEN 1 PRECEDING AND 1 FOLLOWING
 ------WindowAggr: windowExpr=[[SUM(CAST(aggregate_test_100.c4 AS Int64)) 
PARTITION BY [aggregate_test_100.c1, aggregate_test_100.c2] ORDER BY 
[aggregate_test_100.c2 ASC NULLS LAST] ROWS BETWEEN 1 PRECEDING AND 1 
FOLLOWING]]
 --------TableScan: aggregate_test_100 projection=[c1, c2, c4]
@@ -1733,7 +1733,7 @@ EXPLAIN SELECT count(*) as global_count FROM
 ----
 logical_plan
 Projection: COUNT(*) AS global_count
---Aggregate: groupBy=[[]], aggr=[[COUNT(UInt8(1)) AS COUNT(*)]]
+--Aggregate: groupBy=[[]], aggr=[[COUNT(Int64(1)) AS COUNT(*)]]
 ----SubqueryAlias: a
 ------Projection: 
 --------Sort: aggregate_test_100.c1 ASC NULLS LAST
@@ -2544,10 +2544,10 @@ Projection: sum1, sum2, sum3, min1, min2, min3, max1, 
max2, max3, cnt1, cnt2, su
 --Limit: skip=0, fetch=5
 ----Sort: annotated_data_finite.inc_col DESC NULLS FIRST, fetch=5
 ------Projection: SUM(annotated_data_finite.inc_col) ORDER BY 
[annotated_data_finite.ts ASC NULLS LAST] RANGE BETWEEN 10 PRECEDING AND 1 
FOLLOWING AS sum1, SUM(annotated_data_finite.desc_col) ORDER BY 
[annotated_data_finite.ts ASC NULLS LAST] RANGE BETWEEN 5 PRECEDING AND 1 
FOLLOWING AS sum2, SUM(annotated_data_finite.inc_col) ORDER BY 
[annotated_data_finite.ts ASC NULLS LAST] ROWS BETWEEN 1 PRECEDING AND 10 
FOLLOWING AS sum3, MIN(annotated_data_finite.inc_col) ORDER BY 
[annotated_data_f [...]
---------WindowAggr: windowExpr=[[SUM(CAST(annotated_data_finite.desc_col AS 
Int64)annotated_data_finite.desc_col AS annotated_data_finite.desc_col) ROWS 
BETWEEN 8 PRECEDING AND 1 FOLLOWING, COUNT(UInt8(1)) ROWS BETWEEN 8 PRECEDING 
AND 1 FOLLOWING AS COUNT(*) ROWS BETWEEN 8 PRECEDING AND 1 FOLLOWING]]
+--------WindowAggr: windowExpr=[[SUM(CAST(annotated_data_finite.desc_col AS 
Int64)annotated_data_finite.desc_col AS annotated_data_finite.desc_col) ROWS 
BETWEEN 8 PRECEDING AND 1 FOLLOWING, COUNT(Int64(1)) ROWS BETWEEN 8 PRECEDING 
AND 1 FOLLOWING AS COUNT(*) ROWS BETWEEN 8 PRECEDING AND 1 FOLLOWING]]
 ----------Projection: CAST(annotated_data_finite.desc_col AS 
Int64)annotated_data_finite.desc_col, annotated_data_finite.inc_col, 
SUM(annotated_data_finite.inc_col) ORDER BY [annotated_data_finite.ts DESC 
NULLS FIRST] RANGE BETWEEN 1 PRECEDING AND 4 FOLLOWING, 
SUM(annotated_data_finite.desc_col) ORDER BY [annotated_data_finite.ts DESC 
NULLS FIRST] RANGE BETWEEN 1 PRECEDING AND 8 FOLLOWING, 
SUM(annotated_data_finite.desc_col) ORDER BY [annotated_data_finite.ts DESC 
NULLS FIRST] ROWS BETWE [...]
-------------WindowAggr: windowExpr=[[SUM(CAST(annotated_data_finite.inc_col AS 
Int64)annotated_data_finite.inc_col AS annotated_data_finite.inc_col) ORDER BY 
[annotated_data_finite.ts ASC NULLS LAST] RANGE BETWEEN 10 PRECEDING AND 1 
FOLLOWING, SUM(CAST(annotated_data_finite.desc_col AS 
Int64)annotated_data_finite.desc_col AS annotated_data_finite.desc_col) ORDER 
BY [annotated_data_finite.ts ASC NULLS LAST] RANGE BETWEEN 5 PRECEDING AND 1 
FOLLOWING, SUM(CAST(annotated_data_finite.inc_col  [...]
---------------WindowAggr: windowExpr=[[SUM(CAST(annotated_data_finite.inc_col 
AS Int64)annotated_data_finite.inc_col AS annotated_data_finite.inc_col) ORDER 
BY [annotated_data_finite.ts DESC NULLS FIRST] RANGE BETWEEN 1 PRECEDING AND 4 
FOLLOWING, SUM(CAST(annotated_data_finite.desc_col AS 
Int64)annotated_data_finite.desc_col AS annotated_data_finite.desc_col) ORDER 
BY [annotated_data_finite.ts DESC NULLS FIRST] RANGE BETWEEN 1 PRECEDING AND 8 
FOLLOWING, SUM(CAST(annotated_data_finite.des [...]
+------------WindowAggr: windowExpr=[[SUM(CAST(annotated_data_finite.inc_col AS 
Int64)annotated_data_finite.inc_col AS annotated_data_finite.inc_col) ORDER BY 
[annotated_data_finite.ts ASC NULLS LAST] RANGE BETWEEN 10 PRECEDING AND 1 
FOLLOWING, SUM(CAST(annotated_data_finite.desc_col AS 
Int64)annotated_data_finite.desc_col AS annotated_data_finite.desc_col) ORDER 
BY [annotated_data_finite.ts ASC NULLS LAST] RANGE BETWEEN 5 PRECEDING AND 1 
FOLLOWING, SUM(CAST(annotated_data_finite.inc_col  [...]
+--------------WindowAggr: windowExpr=[[SUM(CAST(annotated_data_finite.inc_col 
AS Int64)annotated_data_finite.inc_col AS annotated_data_finite.inc_col) ORDER 
BY [annotated_data_finite.ts DESC NULLS FIRST] RANGE BETWEEN 1 PRECEDING AND 4 
FOLLOWING, SUM(CAST(annotated_data_finite.desc_col AS 
Int64)annotated_data_finite.desc_col AS annotated_data_finite.desc_col) ORDER 
BY [annotated_data_finite.ts DESC NULLS FIRST] RANGE BETWEEN 1 PRECEDING AND 8 
FOLLOWING, SUM(CAST(annotated_data_finite.des [...]
 ----------------Projection: CAST(annotated_data_finite.desc_col AS Int64) AS 
CAST(annotated_data_finite.desc_col AS Int64)annotated_data_finite.desc_col, 
CAST(annotated_data_finite.inc_col AS Int64) AS 
CAST(annotated_data_finite.inc_col AS Int64)annotated_data_finite.inc_col, 
annotated_data_finite.ts, annotated_data_finite.inc_col, 
annotated_data_finite.desc_col
 ------------------TableScan: annotated_data_finite projection=[ts, inc_col, 
desc_col]
 physical_plan
@@ -4105,7 +4105,7 @@ EXPLAIN select count(*) over (partition by a order by a) 
from (select * from a w
 ----
 logical_plan
 Projection: COUNT(*) PARTITION BY [a.a] ORDER BY [a.a ASC NULLS LAST] RANGE 
BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
---WindowAggr: windowExpr=[[COUNT(UInt8(1)) PARTITION BY [a.a] ORDER BY [a.a 
ASC NULLS LAST] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW AS COUNT(*) 
PARTITION BY [a.a] ORDER BY [a.a ASC NULLS LAST] RANGE BETWEEN UNBOUNDED 
PRECEDING AND CURRENT ROW]]
+--WindowAggr: windowExpr=[[COUNT(Int64(1)) PARTITION BY [a.a] ORDER BY [a.a 
ASC NULLS LAST] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW AS COUNT(*) 
PARTITION BY [a.a] ORDER BY [a.a ASC NULLS LAST] RANGE BETWEEN UNBOUNDED 
PRECEDING AND CURRENT ROW]]
 ----Filter: a.a = Int64(1)
 ------TableScan: a projection=[a]
 physical_plan
diff --git a/datafusion/substrait/tests/cases/roundtrip_logical_plan.rs 
b/datafusion/substrait/tests/cases/roundtrip_logical_plan.rs
index bc9cc66b76..28c0de1c99 100644
--- a/datafusion/substrait/tests/cases/roundtrip_logical_plan.rs
+++ b/datafusion/substrait/tests/cases/roundtrip_logical_plan.rs
@@ -568,7 +568,7 @@ async fn roundtrip_union_all() -> Result<()> {
 async fn simple_intersect() -> Result<()> {
     assert_expected_plan(
         "SELECT COUNT(*) FROM (SELECT data.a FROM data INTERSECT SELECT 
data2.a FROM data2);",
-        "Aggregate: groupBy=[[]], aggr=[[COUNT(UInt8(1))]]\
+        "Aggregate: groupBy=[[]], aggr=[[COUNT(Int64(1))]]\
          \n  Projection: \
          \n    LeftSemi Join: data.a = data2.a\
          \n      Aggregate: groupBy=[[data.a]], aggr=[[]]\
@@ -582,7 +582,7 @@ async fn simple_intersect() -> Result<()> {
 async fn simple_intersect_table_reuse() -> Result<()> {
     assert_expected_plan(
         "SELECT COUNT(*) FROM (SELECT data.a FROM data INTERSECT SELECT data.a 
FROM data);",
-        "Aggregate: groupBy=[[]], aggr=[[COUNT(UInt8(1))]]\
+        "Aggregate: groupBy=[[]], aggr=[[COUNT(Int64(1))]]\
          \n  Projection: \
          \n    LeftSemi Join: data.a = data.a\
          \n      Aggregate: groupBy=[[data.a]], aggr=[[]]\


Reply via email to