Skip to content

Commit 1f9209a

Browse files
committed
Remove date/time null statements. Other fixups
1 parent 37734ec commit 1f9209a

File tree

3 files changed

+23
-28
lines changed

3 files changed

+23
-28
lines changed

docs/reference/sql/functions/aggs.asciidoc

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,14 @@ COUNT(expression) <1>
4949

5050
*Input*:
5151

52-
<1> a field name, wildcard (`*`) or any numeric value
52+
<1> a field name, wildcard (`*`) or any numeric value. For `COUNT(*)` or
53+
`COUNT(<literal>)`, all values are considered, including `null` or missing
54+
ones). For `COUNT(<field_name>)`, `null` values are not considered.
5355

54-
*Output*: numeric value. If this field contains only `null` values, the function
55-
returns `null`. Otherwise, the function ignores `null` values in this field.
56+
*Output*: numeric value
5657

5758
*Description*: Returns the total number (count) of input values.
5859

59-
In case of `COUNT(*)` or `COUNT(<literal>)`, _all_ values are considered (including `null` or missing ones).
60-
61-
In case of `COUNT(<field_name>)` `null` values are not considered.
62-
6360

6461
["source","sql",subs="attributes,macros"]
6562
--------------------------------------------------

docs/reference/sql/functions/date-time.asciidoc

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ subtraction from the date/datetime. If `null`, the function returns `null`.
266266
*Output*: datetime
267267

268268
*Description*: Add the given number of date/time units to a date/datetime. If the number of units is negative then it's subtracted from
269-
the date/datetime. If any of the three arguments is `null` a `null` is returned.
269+
the date/datetime.
270270

271271
[WARNING]
272272
If the second argument is a long there is possibility of truncation since an integer value will be extracted and
@@ -343,7 +343,7 @@ following two date/datetime expressions. If `null`, the function returns `null`.
343343

344344
*Description*: Subtract the second argument from the third argument and return their difference in multiples of the unit
345345
specified in the first argument. If the second argument (start) is greater than the third argument (end),
346-
then negative values are returned. If any of the three arguments is `null`, a `null` is returned.
346+
then negative values are returned.
347347

348348
[cols="^,^"]
349349
|===
@@ -428,7 +428,6 @@ DATE_PARSE(
428428
*Description*: Returns a date by parsing the 1st argument using the format specified in the 2nd argument. The parsing
429429
format pattern used is the one from
430430
https://docs.oracle.com/en/java/javase/14/docs/api/java.base/java/time/format/DateTimeFormatter.html[`java.time.format.DateTimeFormatter`].
431-
If any of the two arguments is `null` or an empty string, then `null` is returned.
432431

433432
[NOTE]
434433
If the parsing pattern does not contain all valid date units (e.g. 'HH:mm:ss', 'dd-MM HH:mm:ss', etc.) an error is returned
@@ -472,7 +471,6 @@ DATETIME_FORMAT(
472471
*Description*: Returns the date/datetime/time as a string using the format specified in the 2nd argument. The formatting
473472
pattern used is the one from
474473
https://docs.oracle.com/en/java/javase/14/docs/api/java.base/java/time/format/DateTimeFormatter.html[`java.time.format.DateTimeFormatter`].
475-
If any of the two arguments is `null` or the pattern is an empty string `null` is returned.
476474

477475
[NOTE]
478476
If the 1st argument is of type `time`, then pattern specified by the 2nd argument cannot contain date related units
@@ -514,7 +512,6 @@ DATETIME_PARSE(
514512
*Description*: Returns a datetime by parsing the 1st argument using the format specified in the 2nd argument. The parsing
515513
format pattern used is the one from
516514
https://docs.oracle.com/en/java/javase/14/docs/api/java.base/java/time/format/DateTimeFormatter.html[`java.time.format.DateTimeFormatter`].
517-
If any of the two arguments is `null` or an empty string `null` is returned.
518515

519516

520517
[NOTE]
@@ -564,7 +561,6 @@ TIME_PARSE(
564561
*Description*: Returns a time by parsing the 1st argument using the format specified in the 2nd argument. The parsing
565562
format pattern used is the one from
566563
https://docs.oracle.com/en/java/javase/14/docs/api/java.base/java/time/format/DateTimeFormatter.html[`java.time.format.DateTimeFormatter`].
567-
If any of the two arguments is `null` or an empty string `null` is returned.
568564

569565
[NOTE]
570566
If the parsing pattern contains only date units (e.g. 'dd/MM/yyyy') an error is returned
@@ -612,9 +608,9 @@ DATE_PART(
612608

613609
*Output*: integer
614610

615-
*Description*: Extract the specified unit from a date/datetime. If any of the two arguments is `null` a `null` is returned.
616-
It's similar to <<sql-functions-datetime-extract>> but with different names and aliases for the units and
617-
provides more options (e.g.: `TZOFFSET`).
611+
*Description*: Extract the specified unit from a date/datetime. It's similar to
612+
<<sql-functions-datetime-extract>> but with different names and aliases for the
613+
units and provides more options (e.g.: `TZOFFSET`).
618614

619615
[cols="^,^"]
620616
|===
@@ -701,9 +697,11 @@ should be truncated to. If `null`, the function returns `null`.
701697

702698
*Output*: datetime/interval
703699

704-
*Description*: Truncate the date/datetime/interval to the specified unit by setting all fields that are less significant than the specified
705-
one to zero (or one, for day, day of week and month). If any of the two arguments is `null` a `null` is returned.
706-
If the first argument is `week` and the second argument is of `interval` type, an error is thrown since the `interval` data type doesn't support a `week` time unit.
700+
*Description*: Truncate the date/datetime/interval to the specified unit by
701+
setting all fields that are less significant than the specified one to zero (or
702+
one, for day, day of week and month). If the first argument is `week` and the
703+
second argument is of `interval` type, an error is thrown since the `interval`
704+
data type doesn't support a `week` time unit.
707705

708706
[cols="^,^"]
709707
|===
@@ -789,10 +787,10 @@ FORMAT(
789787
*Output*: string
790788

791789
*Description*: Returns the date/datetime/time as a string using the
792-
https://docs.microsoft.com/en-us/sql/t-sql/functions/format-transact-sql#arguments[format] specified in the 2nd argument. The formatting
793-
pattern used is the one from
794-
https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings[Microsoft SQL Server Format Specification].
795-
If any of the two arguments is `null` or the pattern is an empty string `null` is returned.
790+
https://docs.microsoft.com/en-us/sql/t-sql/functions/format-transact-sql#arguments[format]
791+
specified in the 2nd argument. The formatting pattern used is the one from
792+
https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings[Microsoft
793+
SQL Server Format Specification].
796794

797795
[NOTE]
798796
If the 1st argument is of type `time`, then pattern specified by the 2nd argument cannot contain date related units
@@ -839,10 +837,10 @@ TO_CHAR(
839837

840838
*Output*: string
841839

842-
*Description*: Returns the date/datetime/time as a string using the format specified in the 2nd argument. The formatting
843-
pattern conforms to
844-
https://www.postgresql.org/docs/13/functions-formatting.html[PostgreSQL Template Patterns for Date/Time Formatting].
845-
If any of the two arguments is `null` or the pattern is an empty string `null` is returned.
840+
*Description*: Returns the date/datetime/time as a string using the format
841+
specified in the 2nd argument. The formatting pattern conforms to
842+
https://www.postgresql.org/docs/13/functions-formatting.html[PostgreSQL Template
843+
Patterns for Date/Time Formatting].
846844

847845
[NOTE]
848846
If the 1st argument is of type `time`, then the pattern specified by the 2nd argument cannot contain date related units

docs/reference/sql/functions/grouping.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ bucket_key = Math.floor(value / interval) * interval
4343
----
4444

4545
[NOTE]
46-
The histogram in SQL does *NOT* return empty buckets for missing intervals as the traditional <<search-aggregations-bucket-histogram-aggregation, histogram>> and <<search-aggregations-bucket-datehistogram-aggregation, date histogram>>. Such behavior does not fit conceptually in SQL which treats all missing values as `NULL`; as such the histogram places all missing values in the `NULL` group.
46+
The histogram in SQL does *NOT* return empty buckets for missing intervals as the traditional <<search-aggregations-bucket-histogram-aggregation, histogram>> and <<search-aggregations-bucket-datehistogram-aggregation, date histogram>>. Such behavior does not fit conceptually in SQL which treats all missing values as `null`; as such the histogram places all missing values in the `null` group.
4747

4848
`Histogram` can be applied on either numeric fields:
4949

0 commit comments

Comments
 (0)