浏览代码

Add docs clarifications on DATE_DIFF args (#108301)

This adds some clarifications on the time unit strings the function
takes as arguments, noting the differences between these and the time
span literals, as well as the abbreviations' source.
Bogdan Pintea 1 年之前
父节点
当前提交
de725aef80

+ 6 - 0
docs/reference/esql/functions/description/date_diff.asciidoc

@@ -25,3 +25,9 @@ s|abbreviations
 | microsecond | microseconds, mcs
 | nanosecond  | nanoseconds, ns
 |===
+
+Note that while there is an overlap between the function's supported units and
+{esql}'s supported time span literals, these sets are distinct and not
+interchangeable. Similarly, the supported abbreviations are conveniently shared
+with implementations of this function in other established products and not
+necessarily common with the date-time nomenclature used by {es}.

+ 7 - 1
x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/date/DateDiff.java

@@ -145,7 +145,13 @@ public class DateDiff extends EsqlScalarFunction implements OptionalArgument {
         | millisecond | milliseconds, ms
         | microsecond | microseconds, mcs
         | nanosecond  | nanoseconds, ns
-        |===""", examples = @Example(file = "date", tag = "docsDateDiff"))
+        |===
+
+        Note that while there is an overlap between the function's supported units and
+        {esql}'s supported time span literals, these sets are distinct and not
+        interchangeable. Similarly, the supported abbreviations are conveniently shared
+        with implementations of this function in other established products and not
+        necessarily common with the date-time nomenclature used by {es}.""", examples = @Example(file = "date", tag = "docsDateDiff"))
     public DateDiff(
         Source source,
         @Param(name = "unit", type = { "keyword", "text" }, description = "Time difference unit") Expression unit,