Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -198,16 +198,16 @@ foo:integer
2
;

# https://github.com/elastic/elasticsearch/pull/139797
statsAggs-Ignore
statsAggs
required_capability: optional_fields
required_capability: fix_agg_on_null_by_replacing_with_eval

SET unmapped_fields="nullify"\;
ROW x = 1
| STATS s = SUM(foo)
;

s:long
s:double
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why it become double? Looks like x in row could be cast to int or long

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that foo doesn't exist; x is unused.
About why double, I suspect it's a purely technical thing related with this condition:

@Override
public DataType dataType() {
DataType dt = field().dataType();
return dt.isWholeNumber() == false || dt == UNSIGNED_LONG ? DOUBLE : LONG;
}

dt.isWholeNumber() == false -> double. Alex may confirm what is the field type here. If it's NULL, and as NULL isn't a whole number, double it is!

Copy link
Copy Markdown
Contributor Author

@alex-spies alex-spies Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent question @idegtiarenko .

Ivan's answer is correct, although that boils down to "because we said so" when we implemented SUM.

I'll sleep better after double checking this, but currently this is consistent with ROW x = null | STATS SUM(x).

For sleeping better, I opened #140577.

null
;

Expand All @@ -223,17 +223,17 @@ foo:null
null
;

# https://github.com/elastic/elasticsearch/pull/139797
statsAggs-Ignore
statsAggsGrouped
required_capability: optional_fields
required_capability: fix_agg_on_null_by_replacing_with_eval

SET unmapped_fields="nullify"\;
ROW x = 1
| STATS s = SUM(foo) BY bar
;

s:long | bar:null
null | null
s:double | bar:null
null | null
;

statsExpressions
Expand Down