Commit Graph

29 Commits

Author SHA1 Message Date
Craig Taverner 9e566c9068 Update docs/reference/esql/functions/pow.asciidoc
Co-authored-by: Bogdan Pintea <pintea@mailbox.org>
2023-07-24 15:50:13 +02:00
Craig Taverner 75ea3ab3cd Numerical overflow should result in `null` and a warning
To implement this we:

* Cast both arguments to double
* Perform integer and long validation on the double results before casting back to integer or long
* Perform a special case validation for exponent==1
* Any validation failures result in ArithmeticException, which is caught and added to warnings
2023-07-20 19:03:29 +02:00
Craig Taverner 925bdf49a8 Improve documentation for pow function and refined type rules 2023-07-20 11:32:09 +02:00
Luigi Dell'Aquila 95d9fd75ed Add date_extract function (ESQL-1346) 2023-07-19 14:08:06 +02:00
Abdon Pijpelink d204de411b Merge pull request ESQL-1393 from abdonpijpelink/es-pipe-ql
[DOCS] Change ESQL into ES|QL and other docs improvements
2023-07-11 10:07:18 +02:00
Martijn van Groningen b259248568 Reused example from spec file 2023-07-10 10:17:12 +02:00
Martijn van Groningen c406b64058 use ROW in docs and added test with ROWS 2023-07-07 20:57:39 +02:00
Martijn van Groningen 3c3963cc28 Add trim function
This change adds a string `trim` function.
2023-07-07 17:37:38 +02:00
Abdon Pijpelink 68b74bea34 Move IS_NULL, POW, ROUND, STARTS_WITH, SUBSTRING code snippets to CSV files 2023-07-07 15:45:06 +02:00
Mark Tozzi 985b1949cb Log base 10 for ESQL (ESQL-1358)
Introduces a unary scalar function for base 10 log, which is a thin
wrapper over the Java.Math implementation

---------

Co-authored-by: Abdon Pijpelink <abdon.pijpelink@elastic.co>
2023-07-06 15:37:35 -04:00
Nik Everett f3b20067a3 Add `PI` and `TAU` functions (ESQL-1357)
Adds functions for the constants `PI` and it's big brother `TAU`.
2023-07-05 16:06:06 -05:00
Bogdan Pintea 48cb069670 Add unsigned_long type support (ESQL-1289)
This adds support for the `unsigned_long` type.
The type can be now used with the defined math function, both scalar and
MV'ed, arithmetic and binary comparison ones.
The `to_unsigned_long()` conversion function is also added.
2023-07-04 15:45:10 +02:00
Nik Everett 1a1941913d Implement `MV_DEDUPE` (ESQL-1287)
This implements the `MV_DEDUPE` function that removes duplicates from
multivalues fields. It wasn't strictly in our list of things we need in
the first release, but I'm grabbing this now because I realized I needed
very similar infrastructure when I was trying to build grouping by
multivalued fields. In fact, I realized that I could use our
stringtemplate code generation to generate most of the complex parts.
This generates the actual body of `MV_DEDUPE`'s implementation and the
body of the `Block` accepting `BlockHash` implementations. It'll be
useful in the final step for grouping by multivalued fields.

I also got pretty curious about whether the `O(n^2)` or `O(n*log(n))`
algorithm for deduplication is faster. I'd been assuming that for all
reasonable sized inputs the `O(n^2)` bubble sort looking selection
algorithm was faster. So I measured it. And it's mostly true - even for
`BytesRef` if you have a dozen entries the selection algorithm is
faster. Lower overhead and stuff. Anyway, to measure it I had to
implement the copy-and-sort `O(n*log(n))` algorithm. So while I was
there I plugged it in and selected it in cases where the number of
inputs is large and the selection alogorithm is likely to be slower.
2023-06-27 08:13:19 -05:00
Luigi Dell'Aquila c2c0b0fa0d Implement now() function (ESQL-1172)
returns current datetime
2023-06-27 12:01:09 +02:00
Nik Everett 35fddc2281 Create e() function (ESQL-1304)
Euler's number.
2023-06-22 10:02:23 -04:00
Luigi Dell'Aquila 100ca0acca Rename PROJECT command to KEEP (ESQL-1282) 2023-06-19 13:06:44 +02:00
Nik Everett 1f383f3cd2 Docs: compress results into query (ESQL-1259)
This compresses the results and the query on the page to take up less
space and make them more obviously connected.
2023-06-12 09:37:45 -05:00
Bogdan Pintea 1e268fa0f0 Introduce `version` type support (ESQL-1218)
This adds support for the type `version`.
The conversion function `to_version()` has also beed added;
`to_string()` now supports the type as well.
2023-06-06 10:39:51 +10:00
Bogdan Pintea 33776045f6 Add docs for the conversion functions (ESQL-1217)
Add docs for the `to_xxx()` conversion functions.

---------

Co-authored-by: Abdon Pijpelink <abdon.pijpelink@elastic.co>
2023-06-06 01:32:14 +10:00
Nik Everett be7e182a6c Rename mv_join to mv_concat (ESQL-1213)
That's not the name SPL uses for this, but it's a much more intuitive
name.

Closes ESQL-1210
2023-06-01 05:48:04 +10:00
Nik Everett 024217ba27 Docs for `auto_bucket` (ESQL-1208)
This adds some docs for the `auto_bucket` command.

---------

Co-authored-by: Abdon Pijpelink <abdon.pijpelink@elastic.co>
2023-06-01 03:49:39 +10:00
Nik Everett 64e41ef100 Add `mv_join` function (ESQL-1166)
Adds an `mv_join` function that joins together multivalue string fields.
You can combine this with out fancy new `to_string` to join together any
multivalued fields into a string.
2023-05-25 02:32:23 +10:00
Nik Everett efe8bdef3a Add `mv_median` function (ESQL-1164)
This adds a `mv_median` function that converts a multivalued field into
a single valued field by picking the median. If there are an even number
of values we return the average of the middle two numbers. If the input
type is `int` or `long` then the average rounds *down*.
2023-05-23 17:01:08 -04:00
Nik Everett 75a6ac1ed1 Docs: convert the results into a table (ESQL-1143)
This moves the results in the esql examples from preformatted text to an
actual html table. We can further format it from there.
2023-05-17 16:00:15 -04:00
Nik Everett b7b9f71a49 Implement `mv_count` (ESQL-1126)
Implements the `mv_count` function which returns a count of the values
in a column.
2023-05-12 15:57:49 -04:00
Abdon Pijpelink 35356b86a2 Move each function to its own file 2023-05-11 17:02:27 +02:00
Nik Everett 555781a8a0 Docs for remaining mv functions (ESQL-1114)
This adds docs for all of the remaining `mv_*` functions that have been
implemented at this point.
2023-05-11 07:03:58 -04:00
Nik Everett ce1d634d77 Docs for `mv_min` (ESQL-1092)
This adds docs for the `mv_min` function. It uses an as yet unsupported
syntax, `ROW a=[2,1]`, but I think we'll support it before long.
2023-05-10 17:26:59 -04:00
Nik Everett 87e6fcc948 Docs for `split` (ESQL-1084)
This adds docs for the new `split` function.
2023-05-04 06:26:48 -04:00