Skip to content

Commit e0ecfc6

Browse files
committed
Change the sentinel value's type for COUNT(*) to Int64
1 parent 2f55003 commit e0ecfc6

21 files changed

+68
-66
lines changed

Diff for: datafusion/core/tests/sql/explain_analyze.rs

+9-7
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18+
use rstest::rstest;
1819
use super::*;
1920

2021
use datafusion::config::ConfigOptions;
@@ -566,27 +567,28 @@ async fn csv_explain_verbose_plans() {
566567
assert_contains!(actual, "ProjectionExec: expr=[c1@0 as c1]");
567568
}
568569

570+
#[rstest]
569571
#[tokio::test]
570-
async fn explain_analyze_runs_optimizers() {
572+
async fn explain_analyze_runs_optimizers(#[values("*", "1")] expr: &str) {
571573
// repro for https://github.com/apache/arrow-datafusion/issues/917
572574
// where EXPLAIN ANALYZE was not correctly running optiimizer
573575
let ctx = SessionContext::new();
574576
register_alltypes_parquet(&ctx).await;
575577

576-
// This happens as an optimization pass where count(*) can be
578+
// This happens as an optimization pass where count(*)/count(1) can be
577579
// answered using statistics only.
578580
let expected = "PlaceholderRowExec";
579581

580-
let sql = "EXPLAIN SELECT count(*) from alltypes_plain";
581-
let actual = execute_to_batches(&ctx, sql).await;
582+
let sql = format!("EXPLAIN SELECT count({expr}) from alltypes_plain");
583+
let actual = execute_to_batches(&ctx, &sql).await;
582584
let actual = arrow::util::pretty::pretty_format_batches(&actual)
583585
.unwrap()
584586
.to_string();
585587
assert_contains!(actual, expected);
586588

587589
// EXPLAIN ANALYZE should work the same
588-
let sql = "EXPLAIN ANALYZE SELECT count(*) from alltypes_plain";
589-
let actual = execute_to_batches(&ctx, sql).await;
590+
let sql = format!("EXPLAIN ANALYZE SELECT count({expr}) from alltypes_plain");
591+
let actual = execute_to_batches(&ctx, &sql).await;
590592
let actual = arrow::util::pretty::pretty_format_batches(&actual)
591593
.unwrap()
592594
.to_string();
@@ -791,7 +793,7 @@ async fn explain_logical_plan_only() {
791793
let expected = vec![
792794
vec![
793795
"logical_plan",
794-
"Aggregate: groupBy=[[]], aggr=[[COUNT(UInt8(1)) AS COUNT(*)]]\
796+
"Aggregate: groupBy=[[]], aggr=[[COUNT(Int64(1)) AS COUNT(*)]]\
795797
\n SubqueryAlias: t\
796798
\n Projection: \
797799
\n Values: (Utf8(\"a\"), Int64(1), Int64(100)), (Utf8(\"a\"), Int64(2), Int64(150))"

Diff for: datafusion/expr/src/utils.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ use sqlparser::ast::{ExceptSelectItem, ExcludeSelectItem, WildcardAdditionalOpti
4242

4343
/// The value to which `COUNT(*)` is expanded to in
4444
/// `COUNT(<constant>)` expressions
45-
pub const COUNT_STAR_EXPANSION: ScalarValue = ScalarValue::UInt8(Some(1));
45+
pub const COUNT_STAR_EXPANSION: ScalarValue = ScalarValue::Int64(Some(1));
4646

4747
/// Recursively walk a list of expression trees, collecting the unique set of columns
4848
/// referenced in the expression

Diff for: datafusion/optimizer/src/analyzer/count_wildcard_rule.rs

+11-11
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ mod tests {
255255
.build()?;
256256
let expected = "Sort: COUNT(*) ASC NULLS LAST [COUNT(*):Int64;N]\
257257
\n Projection: COUNT(*) [COUNT(*):Int64;N]\
258-
\n Aggregate: groupBy=[[test.b]], aggr=[[COUNT(UInt8(1)) AS COUNT(*)]] [b:UInt32, COUNT(*):Int64;N]\
258+
\n Aggregate: groupBy=[[test.b]], aggr=[[COUNT(Int64(1)) AS COUNT(*)]] [b:UInt32, COUNT(*):Int64;N]\
259259
\n TableScan: test [a:UInt32, b:UInt32, c:UInt32]";
260260
assert_plan_eq(&plan, expected)
261261
}
@@ -280,7 +280,7 @@ mod tests {
280280
let expected = "Filter: t1.a IN (<subquery>) [a:UInt32, b:UInt32, c:UInt32]\
281281
\n Subquery: [COUNT(*):Int64;N]\
282282
\n Projection: COUNT(*) [COUNT(*):Int64;N]\
283-
\n Aggregate: groupBy=[[]], aggr=[[COUNT(UInt8(1)) AS COUNT(*)]] [COUNT(*):Int64;N]\
283+
\n Aggregate: groupBy=[[]], aggr=[[COUNT(Int64(1)) AS COUNT(*)]] [COUNT(*):Int64;N]\
284284
\n TableScan: t2 [a:UInt32, b:UInt32, c:UInt32]\
285285
\n TableScan: t1 [a:UInt32, b:UInt32, c:UInt32]";
286286
assert_plan_eq(&plan, expected)
@@ -303,7 +303,7 @@ mod tests {
303303
let expected = "Filter: EXISTS (<subquery>) [a:UInt32, b:UInt32, c:UInt32]\
304304
\n Subquery: [COUNT(*):Int64;N]\
305305
\n Projection: COUNT(*) [COUNT(*):Int64;N]\
306-
\n Aggregate: groupBy=[[]], aggr=[[COUNT(UInt8(1)) AS COUNT(*)]] [COUNT(*):Int64;N]\
306+
\n Aggregate: groupBy=[[]], aggr=[[COUNT(Int64(1)) AS COUNT(*)]] [COUNT(*):Int64;N]\
307307
\n TableScan: t2 [a:UInt32, b:UInt32, c:UInt32]\
308308
\n TableScan: t1 [a:UInt32, b:UInt32, c:UInt32]";
309309
assert_plan_eq(&plan, expected)
@@ -333,9 +333,9 @@ mod tests {
333333

334334
let expected = "Projection: t1.a, t1.b [a:UInt32, b:UInt32]\
335335
\n Filter: (<subquery>) > UInt8(0) [a:UInt32, b:UInt32, c:UInt32]\
336-
\n Subquery: [COUNT(UInt8(1)):Int64;N]\
337-
\n Projection: COUNT(UInt8(1)) [COUNT(UInt8(1)):Int64;N]\
338-
\n Aggregate: groupBy=[[]], aggr=[[COUNT(UInt8(1))]] [COUNT(UInt8(1)):Int64;N]\
336+
\n Subquery: [COUNT(Int64(1)):Int64;N]\
337+
\n Projection: COUNT(Int64(1)) [COUNT(Int64(1)):Int64;N]\
338+
\n Aggregate: groupBy=[[]], aggr=[[COUNT(Int64(1))]] [COUNT(Int64(1)):Int64;N]\
339339
\n Filter: outer_ref(t1.a) = t2.a [a:UInt32, b:UInt32, c:UInt32]\
340340
\n TableScan: t2 [a:UInt32, b:UInt32, c:UInt32]\
341341
\n TableScan: t1 [a:UInt32, b:UInt32, c:UInt32]";
@@ -361,8 +361,8 @@ mod tests {
361361
.project(vec![count(wildcard())])?
362362
.build()?;
363363

364-
let expected = "Projection: COUNT(UInt8(1)) AS COUNT(*) [COUNT(*):Int64;N]\
365-
\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]\
364+
let expected = "Projection: COUNT(Int64(1)) AS COUNT(*) [COUNT(*):Int64;N]\
365+
\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]\
366366
\n TableScan: test [a:UInt32, b:UInt32, c:UInt32]";
367367
assert_plan_eq(&plan, expected)
368368
}
@@ -376,7 +376,7 @@ mod tests {
376376
.build()?;
377377

378378
let expected = "Projection: COUNT(*) [COUNT(*):Int64;N]\
379-
\n Aggregate: groupBy=[[]], aggr=[[COUNT(UInt8(1)) AS COUNT(*)]] [COUNT(*):Int64;N]\
379+
\n Aggregate: groupBy=[[]], aggr=[[COUNT(Int64(1)) AS COUNT(*)]] [COUNT(*):Int64;N]\
380380
\n TableScan: test [a:UInt32, b:UInt32, c:UInt32]";
381381
assert_plan_eq(&plan, expected)
382382
}
@@ -389,8 +389,8 @@ mod tests {
389389
.project(vec![count(wildcard())])?
390390
.build()?;
391391

392-
let expected = "Projection: COUNT(UInt8(1)) AS COUNT(*) [COUNT(*):Int64;N]\
393-
\n Aggregate: groupBy=[[]], aggr=[[MAX(COUNT(UInt8(1))) AS MAX(COUNT(*))]] [MAX(COUNT(*)):Int64;N]\
392+
let expected = "Projection: COUNT(Int64(1)) AS COUNT(*) [COUNT(*):Int64;N]\
393+
\n Aggregate: groupBy=[[]], aggr=[[MAX(COUNT(Int64(1))) AS MAX(COUNT(*))]] [MAX(COUNT(*)):Int64;N]\
394394
\n TableScan: test [a:UInt32, b:UInt32, c:UInt32]";
395395
assert_plan_eq(&plan, expected)
396396
}

Diff for: datafusion/optimizer/tests/optimizer_integration.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ fn push_down_filter_groupby_expr_contains_alias() {
281281
let sql = "SELECT * FROM (SELECT (col_int32 + col_uint32) AS c, count(*) FROM test GROUP BY 1) where c > 3";
282282
let plan = test_sql(sql).unwrap();
283283
let expected = "Projection: test.col_int32 + test.col_uint32 AS c, COUNT(*)\
284-
\n Aggregate: groupBy=[[test.col_int32 + CAST(test.col_uint32 AS Int32)]], aggr=[[COUNT(UInt8(1)) AS COUNT(*)]]\
284+
\n Aggregate: groupBy=[[test.col_int32 + CAST(test.col_uint32 AS Int32)]], aggr=[[COUNT(Int64(1)) AS COUNT(*)]]\
285285
\n Filter: test.col_int32 + CAST(test.col_uint32 AS Int32) > Int32(3)\
286286
\n TableScan: test projection=[col_int32, col_uint32]";
287287
assert_eq!(expected, format!("{plan:?}"));

Diff for: datafusion/sql/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ optimizer that can be applied to plans produced by this crate.
6767

6868
```
6969
Sort: state_tax DESC NULLS FIRST
70-
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
71-
Aggregate: groupBy=[[c.id, c.first_name, c.last_name]], aggr=[[COUNT(UInt8(1)), SUM(o.price), SUM(o.price * s.sales_tax)]]
70+
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
71+
Aggregate: groupBy=[[c.id, c.first_name, c.last_name]], aggr=[[COUNT(Int64(1)), SUM(o.price), SUM(o.price * s.sales_tax)]]
7272
Filter: o.price > Int64(0) AND c.last_name LIKE Utf8("G%")
7373
Inner Join: c.id = o.customer_id
7474
Inner Join: c.state = s.id

Diff for: datafusion/sqllogictest/test_files/avro.slt

+1-1
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ query TT
252252
EXPLAIN SELECT count(*) from alltypes_plain
253253
----
254254
logical_plan
255-
Aggregate: groupBy=[[]], aggr=[[COUNT(UInt8(1)) AS COUNT(*)]]
255+
Aggregate: groupBy=[[]], aggr=[[COUNT(Int64(1)) AS COUNT(*)]]
256256
--TableScan: alltypes_plain projection=[]
257257
physical_plan
258258
AggregateExec: mode=Final, gby=[], aggr=[COUNT(*)]

Diff for: datafusion/sqllogictest/test_files/insert.slt

+3-3
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Dml: op=[Insert Into] table=[table_without_values]
6161
--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
6262
----Sort: aggregate_test_100.c1 ASC NULLS LAST
6363
------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
64-
--------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]]
64+
--------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]]
6565
----------TableScan: aggregate_test_100 projection=[c1, c4, c9]
6666
physical_plan
6767
FileSinkExec: sink=MemoryTable (partitions=1)
@@ -122,7 +122,7 @@ FROM aggregate_test_100
122122
logical_plan
123123
Dml: op=[Insert Into] table=[table_without_values]
124124
--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
125-
----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]]
125+
----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]]
126126
------TableScan: aggregate_test_100 projection=[c1, c4, c9]
127127
physical_plan
128128
FileSinkExec: sink=MemoryTable (partitions=1)
@@ -172,7 +172,7 @@ Dml: op=[Insert Into] table=[table_without_values]
172172
--Projection: a1 AS a1, a2 AS a2
173173
----Sort: aggregate_test_100.c1 ASC NULLS LAST
174174
------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
175-
--------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]]
175+
--------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]]
176176
----------TableScan: aggregate_test_100 projection=[c1, c4, c9]
177177
physical_plan
178178
FileSinkExec: sink=MemoryTable (partitions=8)

Diff for: datafusion/sqllogictest/test_files/insert_to_external.slt

+2-2
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ Dml: op=[Insert Into] table=[table_without_values]
350350
--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
351351
----Sort: aggregate_test_100.c1 ASC NULLS LAST
352352
------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
353-
--------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]]
353+
--------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]]
354354
----------TableScan: aggregate_test_100 projection=[c1, c4, c9]
355355
physical_plan
356356
FileSinkExec: sink=ParquetSink(file_groups=[])
@@ -412,7 +412,7 @@ FROM aggregate_test_100
412412
logical_plan
413413
Dml: op=[Insert Into] table=[table_without_values]
414414
--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
415-
----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]]
415+
----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]]
416416
------TableScan: aggregate_test_100 projection=[c1, c4, c9]
417417
physical_plan
418418
FileSinkExec: sink=ParquetSink(file_groups=[])

Diff for: datafusion/sqllogictest/test_files/joins.slt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1344,7 +1344,7 @@ group by t1_id
13441344
----
13451345
logical_plan
13461346
Projection: COUNT(*)
1347-
--Aggregate: groupBy=[[join_t1.t1_id]], aggr=[[COUNT(UInt8(1)) AS COUNT(*)]]
1347+
--Aggregate: groupBy=[[join_t1.t1_id]], aggr=[[COUNT(Int64(1)) AS COUNT(*)]]
13481348
----Projection: join_t1.t1_id
13491349
------Inner Join: join_t1.t1_id = join_t2.t2_id
13501350
--------TableScan: join_t1 projection=[t1_id]

Diff for: datafusion/sqllogictest/test_files/json.slt

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ query TT
4949
EXPLAIN SELECT count(*) from json_test
5050
----
5151
logical_plan
52-
Aggregate: groupBy=[[]], aggr=[[COUNT(UInt8(1)) AS COUNT(*)]]
52+
Aggregate: groupBy=[[]], aggr=[[COUNT(Int64(1)) AS COUNT(*)]]
5353
--TableScan: json_test projection=[]
5454
physical_plan
5555
AggregateExec: mode=Final, gby=[], aggr=[COUNT(*)]

Diff for: datafusion/sqllogictest/test_files/limit.slt

+4-4
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ query TT
307307
EXPLAIN SELECT COUNT(*) FROM (SELECT a FROM t1 LIMIT 3 OFFSET 11);
308308
----
309309
logical_plan
310-
Aggregate: groupBy=[[]], aggr=[[COUNT(UInt8(1)) AS COUNT(*)]]
310+
Aggregate: groupBy=[[]], aggr=[[COUNT(Int64(1)) AS COUNT(*)]]
311311
--Limit: skip=11, fetch=3
312312
----TableScan: t1 projection=[], fetch=14
313313
physical_plan
@@ -325,7 +325,7 @@ query TT
325325
EXPLAIN SELECT COUNT(*) FROM (SELECT a FROM t1 LIMIT 3 OFFSET 8);
326326
----
327327
logical_plan
328-
Aggregate: groupBy=[[]], aggr=[[COUNT(UInt8(1)) AS COUNT(*)]]
328+
Aggregate: groupBy=[[]], aggr=[[COUNT(Int64(1)) AS COUNT(*)]]
329329
--Limit: skip=8, fetch=3
330330
----TableScan: t1 projection=[], fetch=11
331331
physical_plan
@@ -343,7 +343,7 @@ query TT
343343
EXPLAIN SELECT COUNT(*) FROM (SELECT a FROM t1 OFFSET 8);
344344
----
345345
logical_plan
346-
Aggregate: groupBy=[[]], aggr=[[COUNT(UInt8(1)) AS COUNT(*)]]
346+
Aggregate: groupBy=[[]], aggr=[[COUNT(Int64(1)) AS COUNT(*)]]
347347
--Limit: skip=8, fetch=None
348348
----TableScan: t1 projection=[]
349349
physical_plan
@@ -360,7 +360,7 @@ query TT
360360
EXPLAIN SELECT COUNT(*) FROM (SELECT a FROM t1 WHERE a > 3 LIMIT 3 OFFSET 6);
361361
----
362362
logical_plan
363-
Aggregate: groupBy=[[]], aggr=[[COUNT(UInt8(1)) AS COUNT(*)]]
363+
Aggregate: groupBy=[[]], aggr=[[COUNT(Int64(1)) AS COUNT(*)]]
364364
--Projection:
365365
----Limit: skip=6, fetch=3
366366
------Filter: t1.a > Int32(3)

Diff for: datafusion/sqllogictest/test_files/select.slt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1373,7 +1373,7 @@ ORDER BY c1, c2)
13731373
GROUP BY c2;
13741374
----
13751375
logical_plan
1376-
Aggregate: groupBy=[[aggregate_test_100.c2]], aggr=[[COUNT(UInt8(1)) AS COUNT(*)]]
1376+
Aggregate: groupBy=[[aggregate_test_100.c2]], aggr=[[COUNT(Int64(1)) AS COUNT(*)]]
13771377
--Projection: aggregate_test_100.c2
13781378
----Sort: aggregate_test_100.c1 ASC NULLS LAST, aggregate_test_100.c2 ASC NULLS LAST
13791379
------Projection: aggregate_test_100.c2, aggregate_test_100.c1

0 commit comments

Comments
 (0)