gruuya commented on code in PR #9944:
URL: https://github.com/apache/arrow-datafusion/pull/9944#discussion_r1551563337


##########
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));

Review Comment:
   This does however result in `count(1)` being auto-named to `count(*)` now.
   ```bash
   ❯ explain select count(1) from hits;
   +---------------+---------------------------------------------------+
   | plan_type     | plan                                              |
   +---------------+---------------------------------------------------+
   | logical_plan  | Aggregate: groupBy=[[]], aggr=[[COUNT(Int64(1))]] |
   |               |   TableScan: hits projection=[]                   |
   | physical_plan | ProjectionExec: expr=[99997497 as COUNT(*)]       |
   |               |   PlaceholderRowExec                              |
   |               |                                                   |
   +---------------+---------------------------------------------------+
   2 row(s) fetched.
   Elapsed 0.263 seconds.
   
   ❯ select count(1) from hits;
   +----------+
   | COUNT(*) |
   +----------+
   | 99997497 |
   +----------+
   1 row(s) fetched.
   Elapsed 0.015 seconds.
   ```
   On the other hand that might be fine as it reduces ambiguity.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to