Commit Graph

111 Commits

Author SHA1 Message Date
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
Abdon Pijpelink a9dac30e1e One more set of meta attributes 2023-07-10 10:23:38 +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
Abdon Pijpelink 02d62d29f4 Remove meta tags 2023-07-07 13:54:39 +02:00
Abdon Pijpelink f4581bb4bd Change ESQL into ES|QL 2023-07-07 13:42: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
Abdon Pijpelink ce64080c13 Merge pull request ESQL-1322 from abdonpijpelink/rename-clarify-order
[DOCS] Clarify the field order for RENAME
2023-06-27 17:14:23 +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
Abdon Pijpelink 73147db4d4 Remove unnecessary space 2023-06-26 16:33:41 +02:00
Abdon Pijpelink f5c590bc6f [DOCS] Clarify the order for RENAME 2023-06-26 16:31:53 +02:00
Luigi Dell'Aquila 79596cc05c Add docs for ENRICH command (ESQL-1313)
Co-authored-by: Abdon Pijpelink <abdon.pijpelink@elastic.co>
2023-06-23 12:13:06 +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 82d67dc289 Docs for aggregation functions (ESQL-1268)
This adds docs for all of ESQL's aggregation functions. Hopefully from
here on out we can add the docs as we add new functions.

I've created a few tagged regions in the aggs docs themselves so we can
include them into the ESQL docs.

---------

Co-authored-by: Abdon Pijpelink <abdon.pijpelink@elastic.co>
2023-06-14 09:23:34 -05: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
Abdon Pijpelink 3c72829216 Merge pull request ESQL-1236 from abdonpijpelink/processing_commands_files
[DOCS] Move processing commands to a file per command
2023-06-12 14:21:02 +02:00
Abdon Pijpelink 43a8346ed0 Review feedback 2023-06-12 13:08:14 +02:00
Nik Everett 74c97dd75b Add more docs for multivalue fields (ESQL-1252)
Describes how we fetch multivalued fields by default, return them as
json arrays, how the internal sort order is not guaranteed, how most
functions will turn them into null, and how some fields remove
duplicates on save.

---------

Co-authored-by: Abdon Pijpelink <abdon.pijpelink@elastic.co>
2023-06-09 08:42:02 -04:00
Abdon Pijpelink 2c3766cd3d Review feedback 2023-06-07 08:35:01 +02: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
Abdon Pijpelink 3b34382bdc [DOCS] Move processing commands to a file per command 2023-06-05 18:38:55 +02: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
Bogdan Pintea 82a4715eca Add docs for the IN operator (ESQL-1216)
Document the IN operator.

---------

Co-authored-by: Abdon Pijpelink <abdon.pijpelink@elastic.co>
2023-06-03 04:53:01 +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 64cc549958 Docs: move source commands into a file per command (ESQL-1191)
I think it's a bit easier to deal with the files this way. They also
make a page per command so it lines up with the files which is nice.

Also I moved some of the examples into the docs. They were mostly there
already, but I linked them.

---------

Co-authored-by: Abdon Pijpelink <abdon.pijpelink@elastic.co>
2023-05-30 21:58:33 +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 fa75c58a21 Implement `mv_expand` (ESQL-1132)
This implements the `mv_expand` command that converts multivalued fields
into single valued fields by emitting one row per value and copying all
other fields.

---------

Co-authored-by: Abdon Pijpelink <abdon.pijpelink@elastic.co>
2023-05-25 01:14:32 +10:00
Nik Everett 65d5e3c1c1 Link docs for mv_median 2023-05-23 18:40:37 -04: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 af465dbaac List COUNT_DISTINCT function under STATS...BY 2023-05-11 17:29:10 +02:00
Abdon Pijpelink e13281acc0 Show how to create multi-values with ROW 2023-05-11 17:25:46 +02:00
Abdon Pijpelink a3ce029b60 Add metadata to each page 2023-05-11 17:14:11 +02: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
Abdon Pijpelink b8e824d341 Add CIDR_MATCH function 2023-05-01 16:29:39 +02:00
Abdon Pijpelink 7edabb1d0b Add LIKE and RLIKE. Move operators to syntax page 2023-05-01 15:47:26 +02:00
Abdon Pijpelink e7dce054d4 Fix function list 2023-04-28 15:16:24 +02:00
Abdon Pijpelink 278faf1cce List 'alias' as a supported field type 2023-04-28 15:02:34 +02:00
Abdon Pijpelink 7b0b2c98da Add IS_FINITE, IS_INFINITE, IS_NAN, and POW functions 2023-04-28 14:50:54 +02:00
Abdon Pijpelink 09a1324a14 Add CASE function 2023-04-24 16:37:47 +02:00
Abdon Pijpelink f742b6eb3a Fix lowercased commands 2023-04-24 15:32:14 +02:00
Abdon Pijpelink ad72b725b8 Add ip and version to supported field types 2023-04-24 15:31:12 +02:00
Abdon Pijpelink 8c81f3a921 Fix description and keywords meta fields 2023-04-17 11:18:51 +02:00
Abdon Pijpelink 1364f50cbf Edits 2023-04-17 11:18:51 +02:00
Abdon Pijpelink 518a97006a Edits 2023-04-17 11:18:50 +02:00
Abdon Pijpelink 81fd338297 Initial commit 2023-04-17 11:18:50 +02:00
Nik Everett 02e8293f54 Add shell for ESQL docs (ESQL-913)
This adds a super basic shell for the esql docs. You can build them with
the standard docs build commend:
```
../docs/build_docs --doc docs/reference/index.asciidoc \
  --resource x-pack/docs/ --chunk 1 --open
```
2023-03-23 13:53:43 -04:00