From 6b1045348a08a5aea77ee0d95f24517bd9527a70 Mon Sep 17 00:00:00 2001 From: carlosdelest Date: Mon, 15 Jul 2024 14:45:24 +0200 Subject: [PATCH] Add Exp CSV tests --- .../testFixtures/src/main/resources/math.csv-spec | 13 +++++++++++++ .../testFixtures/src/main/resources/meta.csv-spec | 6 +++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/x-pack/plugin/esql/qa/testFixtures/src/main/resources/math.csv-spec b/x-pack/plugin/esql/qa/testFixtures/src/main/resources/math.csv-spec index 8337af42df5ea..fd689d502e202 100644 --- a/x-pack/plugin/esql/qa/testFixtures/src/main/resources/math.csv-spec +++ b/x-pack/plugin/esql/qa/testFixtures/src/main/resources/math.csv-spec @@ -190,6 +190,19 @@ s:double 25976.0 ; +exp#[skip:-8.15.99,reason:new scalar function added in 8.16] +// tag::exp[] +ROW d = 5.5 +| EVAL s = EXP(d) +// end::exp[] +; + +// tag::exp-result[] +d: double | s:double +5.5 | 244.69193226422038 +// end::exp-result[] +; + powHeightSquared from employees | sort height asc | limit 20 | eval s = round(pow(height, 2) - 2, 2) | keep height, s | sort s desc | limit 4; diff --git a/x-pack/plugin/esql/qa/testFixtures/src/main/resources/meta.csv-spec b/x-pack/plugin/esql/qa/testFixtures/src/main/resources/meta.csv-spec index f44f1041a6800..3174e07707720 100644 --- a/x-pack/plugin/esql/qa/testFixtures/src/main/resources/meta.csv-spec +++ b/x-pack/plugin/esql/qa/testFixtures/src/main/resources/meta.csv-spec @@ -27,6 +27,7 @@ synopsis:keyword "date date_trunc(interval:date_period|time_duration, date:date)" double e() "boolean ends_with(str:keyword|text, suffix:keyword|text)" +"double exp(number:double|integer|long|unsigned_long)" "double|integer|long|unsigned_long floor(number:double|integer|long|unsigned_long)" "keyword from_base64(string:keyword|text)" "boolean|double|integer|ip|keyword|long|text|version greatest(first:boolean|double|integer|ip|keyword|long|text|version, ?rest...:boolean|double|integer|ip|keyword|long|text|version)" @@ -147,6 +148,7 @@ date_parse |[datePattern, dateString] |["keyword|text", "keyword|te date_trunc |[interval, date] |["date_period|time_duration", date] |[Interval; expressed using the timespan literal syntax., Date expression] e |null |null |null ends_with |[str, suffix] |["keyword|text", "keyword|text"] |[String expression. If `null`\, the function returns `null`., String expression. If `null`\, the function returns `null`.] +exp |number |"double|integer|long|unsigned_long" |Numeric expression. If `null`, the function returns `null`. floor |number |"double|integer|long|unsigned_long" |Numeric expression. If `null`, the function returns `null`. from_base64 |string |"keyword|text" |A base64 string. greatest |first |"boolean|double|integer|ip|keyword|long|text|version" |First of the columns to evaluate. @@ -268,6 +270,7 @@ date_parse |Returns a date by parsing the second argument using the format sp date_trunc |Rounds down a date to the closest interval. e |Returns {wikipedia}/E_(mathematical_constant)[Euler's number]. ends_with |Returns a boolean that indicates whether a keyword string ends with another string. +exp |Returns the value of e raised to the power of tbe given number. floor |Round a number down to the nearest integer. from_base64 |Decode a base64 string. greatest |Returns the maximum value from multiple columns. This is similar to <> except it is intended to run on multiple columns at once. @@ -390,6 +393,7 @@ date_parse |date date_trunc |date |[false, false] |false |false e |double |null |false |false ends_with |boolean |[false, false] |false |false +exp |double |false |false |false floor |"double|integer|long|unsigned_long" |false |false |false from_base64 |keyword |false |false |false greatest |"boolean|double|integer|ip|keyword|long|text|version" |false |true |false @@ -493,5 +497,5 @@ countFunctions#[skip:-8.15.99] meta functions | stats a = count(*), b = count(*), c = count(*) | mv_expand c; a:long | b:long | c:long -112 | 112 | 112 +113 | 113 | 113 ;