Commit graph

134 commits

Author SHA1 Message Date
Nik Everett
aac17616a3
ESQL: Improve tests and docs for some functions (#107331)
This improves the tests and docs for a few functions, specifically `E`,
`FLOOR`, `PI`, `POW`, and `ROUND`. The examples and tested signatures
will get copied into the docs and kibana signatures.


Co-authored-by: Liam Thompson <32779855+leemthompo@users.noreply.github.com>
2024-04-11 12:41:56 -04:00
Fang Xing
0075c1fb1e
[ES|QL] String literal implicit casting (#106932)
* string literal casting for scalar functions and arithmetic operations.
2024-04-10 21:20:12 -04:00
Craig Taverner
d915b964ba
Rename ST_CENTROID to ST_CENTROID_AGG (#107226)
* Rename ST_CENTROID to ST_CENTROID_AGG

In order to allow development of a scalar ST_CENTROID function.

* Fix table alignment
2024-04-10 17:56:45 +02:00
Liam Thompson
943885d0cd
[DOCS][ESQL] Render locate function docs (#107305) 2024-04-10 15:12:20 +02:00
Bogdan Pintea
8bcbc97128
Rename generated docs for (renamed) BUCKET func (#107299)
This checks in the generated-by-test doc files for newly renamed BUCKET
function.
2024-04-10 06:50:12 -04:00
Bogdan Pintea
d6f9d1e69e
ESQL: Rename AUTO_BUCKET to just BUCKET (#107197)
This renames the function AUTO_BUCKET to just BUCKET.
It also removes the experimental tagging of the function in the docs, making it generally available.
2024-04-10 12:21:08 +02:00
Nik Everett
96227a1970
ESQL: Generate kibana inline docs (#106782)
This takes a stab at generating the markdown files that Kibana uses for
its inline help. It doesn't include all of the examples because the
`@Example` annotation is not filled in - we're tracking that in
https://github.com/elastic/elasticsearch/issues/104247#issuecomment-2018944371

There are some links in the output and they are in markdown syntax. We
should figure out how to make them work for kibana.
2024-04-09 14:19:48 -04:00
Nik Everett
aba7566409
ESQL: Better tests to AUTO_BUCKET (#107228)
This improves the tests for AUTO_BUCKET marginally, specifically so that
it tests all valid combinations of arguments and generates a correct
types table. This'll combine nicely with #106782 to generate the
signatures that kibana needs for it's editor.
2024-04-09 12:22:15 -04:00
Luigi Dell'Aquila
2588c72a52
ES|QL: Add unit tests and docs for DATE_TRUNC() (#107145) 2024-04-09 10:41:34 +02:00
Craig Taverner
a7b38394d9
ESQL: Support ST_DISJOINT (#107007)
* WIP Started developing ST_DISJOINT

Initially based on ST_INTERSECTS

* Fix functions list and add spatial point integration tests

* Update docs/changelog/107007.yaml

* More tests for shapes and cartesian-multigeoms

* Some more tests to highlight issues with DISJOINT on cartesian point indices

* Disable Lucene push-down for DISJOINT on cartesian point indices

* Added docs for ST_DISJOINT

* Support DISJOINT in the lucene-pushdown code for cartesian point indexes

* Re-enable push-to-source for DISJOINT on cartesian_point indices

* Fix docs example

* Try fix internal docs links which are not being rendered

* Fixed disjoint on empty geometry

* Added tests on empty linestring, and changed lucene push-down to exception

In lucene code only LineString can be empty, but in Elasticsearch even that is not allowed, resulting in parsing errors. So we cannot get to this code in the lucene push-down and now throw an error instead. The tests now assert on the warnings.

Note that for any predicate DISJOINT and INTERSECTS alike, the predicate fails, because the parsing error results in null, the function returns null, the predicate interprets this as false, and no documents match. This null-in-null-out rule means that DISJOINT and INTERSECTS give the same answer on invalid geometries.
2024-04-08 12:26:26 +02:00
Tommaso Teofili
54eeb622d5
Add ES|QL Locate function (#106899)
* Add ES|QL Locate function
2024-04-05 15:29:54 +02:00
Ioana Tagirta
7b254218fb
Add ES|QL signum function (#106866)
* Add ES|QL signum function

* Update docs/changelog/106866.yaml

* Skip csv tests for versions older than 8.14

* Reference layout docs file and fix instructions for adding functions

* Break csv specs by param type

* More tests
2024-04-04 09:48:35 +02:00
Nik Everett
b97e2d61fb
ESQL: Fixup docs for LOG and LOG10 (#106963)
This merges all of the hand written docs for `LOG` and `LOG10` into the
annotations which updates the `META FUNCTIONS` - now it'll always be the
same as the docs. This also deletes the hand maintained docs and let's
the documentation generation process rebuild it.
2024-04-03 09:46:32 -04:00
Nik Everett
c74490c137
ESQL: Enable VALUES agg for datetime (#107016)
When I wrote the `VALUES` agg I didn't plug it in for `datetime` fields.
Ooops. We just have to plug it in.
2024-04-03 07:42:40 -04:00
Craig Taverner
2380492fac
ESQL: Support ST_CONTAINS and ST_WITHIN (#106503)
* WIP Started adding ST_CONTAINS

* Add generated evaluators

* Reduced warnings and use correct evaluators

* Refactored tests to remove duplicate code, and fixed Contains/multi-components

* Gradle build disallows using getDeclaredField

* Fixed cases where rectangles cross the dateline

* Fixed meta function tests

* Added ST_WITHIN to support inverting ST_CONTAINS

If the ST_CONTAINS is called with the constant on the left, we either have to create a lot more Evaluators to cover that case, or we have to invert it to ST_WITHIN. This inversion was a much easier option.

* Simplify inversion logic

* Add comment on choice of surrogate approach

* Add unit tests and missing fold() function

* Simple code cleanup

* Add integration tests for literals

* Add more integration tests based on actual data

* Generated documentation files

* Add documentation

* Fixed failing function count test

* Add tests that push-to-source works for ST_CONTAINS and ST_WITHIN

* Test more combinations of WITH/CONTAINS and literal on right and left

This also verifies that the re-writing of CONTAINS to WITHIN or vice versa occurs when the literal is on the left.

* test that physical planning also handles doc-values from STATS

* Added more tests for WITHIN/CONTAINS together with CENTROID

This should test the doc-values for points.

* Add cartesian_point tests

* Add cartesian_shape tests

* Disable Lucene-push-down for CARTESIAN data

This is a limitation in Lucene, which we could address as a performance optimization in a future PR, but since it probably requires Lucene changes, it cannot be done in this work.

* Fix doc links

* Added test data and tests for cartesian multi-polygons

Testing INTERSECTS, CONTAINS and WITHIN with multi-polydon fields

* Use required features for spatial points, shapes and centroid

* 8.13.0 is not yet historical version

This needs to be reverted as soon as 8.13.0 is released

* Added st_intersects and st_contains_within 'features'

* Code review updates

* Re-enable lucene push-down

* Added more required_features

* Fix point contains non-point

* Fix point contains point

* Re-enable lucene push-down in tests too

Forgot to change the physical planner unit tests after re-enabling lucene push-down

* Generate automatic docs

* Use generated examples docs

* Generated examples use '-result' prefix (singular)

* Mark spatial functions as preview/experimental
2024-04-02 10:31:00 +02:00
Nik Everett
00b0c54a74
ESQL: Generate docs for the trig functions (#106891)
This updates the in-code docs on the trig functions to line up with the
docs, removes the docs, and uses the now mostly identical generated
docs. This means we only need to document these functions in one place -
right next to the code.
2024-03-29 12:24:31 -04:00
Ioana Tagirta
b85d4b1dbb
Fix typo in functions/README.md (#106870) 2024-03-28 14:02:47 +01:00
Luigi Dell'Aquila
3e406e2d57
ES|QL: Improve support for TEXT fields in functions (#106810)
Re-submitting https://github.com/elastic/elasticsearch/pull/106688 after
a revert due to a conflict after merge
2024-03-27 08:47:09 -04:00
Luigi Dell'Aquila
720188e95f Revert "ES|QL: Improve support for TEXT fields in functions (#106688)"
This reverts commit 62e3e5fd1b.
2024-03-27 12:14:02 +01:00
Luigi Dell'Aquila
62e3e5fd1b
ES|QL: Improve support for TEXT fields in functions (#106688) 2024-03-27 12:08:10 +01:00
Nik Everett
d6d1edd529 ESQL: Fix typo in docs readme
s/and/are/
2024-03-25 09:22:20 -04:00
Nik Everett
35fcc9a29d
ESQL: Add README.md to docs (#106698)
This explains how to run the tests that build the docs. I tried to add
it in #106577 but the sync code deleted it. So I fixed that too.
2024-03-22 16:30:59 -04:00
Nik Everett
7c46c735e4
ESQL: Generate docs for ceil (#106616)
This replaces the hand maintained docs for `CEIL` and with the docs
generated by the tests. There shouldn't be any diff in the generated
docs.
2024-03-21 13:01:15 -04:00
Nik Everett
fa00e6176f
ESQL: Values aggregation function (#106065)
This creates the `VALUES` aggregation function which buffers all field
values it receives and emits them as a multivalued field. It can use a
significant amount of memory and will circuit break if it uses too much
memory, but it's really useful for putting together self-join-like
behavior. It sort of functions as a stop-gap measure until we have more
self-join style things.

In the future we'll have spill-to-disk for aggregations and, likely,
some kind of self-join command for aggregations at least so this will be
able to grow beyond memory. But for now, memory it is.

Example:

```
  FROM employees
| EVAL first_letter = SUBSTRING(first_name, 0, 1)
| STATS first_name=VALUES(first_name) BY first_letter
| SORT first_letter
;

                                        first_name:keyword | first_letter:keyword
            [Anneke, Alejandro, Anoosh, Amabile, Arumugam] | A
[Bezalel, Berni, Bojan, Basil, Brendon, Berhard, Breannda] | B
                  [Chirstian, Cristinel, Claudi, Charlene] | C
                      [Duangkaew, Divier, Domenick, Danel] | D
```

I made this work for everything but `geo_point` and `cartesian_point`
because I'm not 100% sure how to integrate with those. We can grab those
in a follow up.

Closes #103600
2024-03-21 12:52:04 -04:00
Nik Everett
34899069b6
ESQL: Generate a few more docs (#106577)
And improve the error message on csv test failures.
2024-03-21 10:51:35 -04:00
Nik Everett
a1305373f2
ESQL: Use generated docs for abs and acos (#106510)
ESQL: Use generated docs for abs and acos
2024-03-20 16:32:12 -04:00
Fang Xing
5d05d81854
[ES|QL] Remove variadic functions' optional args from the output of show functions (#106454)
* remove optional args from the output of show functions optionalArgs, argNames and argTypes for variadic functions
* consistent names for arguments
2024-03-20 10:15:49 -04:00
Nik Everett
1541da5e65
ESQL: Generate more docs (#106367)
This modifies the ESQL test infrastructure to generate more of the
documentation for functions. It generates the *Description* section, the
*Examples* section, and the *Parameters* section as separate files so we
can use them as needed. It also generates a `layout` file that's just
a guess as to how to render the whole thing. In some cases it'll work
and we can use that instead of hand maintaining a "top level"
description file for the function.

Most newly generated files are unused. We have to chose to pick them up
by replacing the sections we were manually maintaining with an include
of the generated section. Or by replacing the entire hand maintained
file with the generated top level file.

Relates to #104247
2024-03-19 15:40:13 -04:00
Craig Taverner
e14dd54ae9
Support ST_INTERSECTS between two geometry columns (#104907)
* Support ST_INTERSECTS between geometry column and other geometry or string

* Pushdown to lucene for ST_INTERSECTS on GEO_POINT

* Get geo_shape working in ST_INTERSECTS bypassing SingleValueQuery

* Initial work to support cartesian shape queries in ESQL

* Fixed CSV tests for combined ST_INTERSECTS and ST_CENTROID

* Fixed bug in point-in-shape query for CARTESIAN_POINT

* Added unit tests for SpatialIntersects and fixed a few bugs found

* Added comments to public ShapeQueryBuilder class

* Move calls to random() later to avoid security exception

* Refined type checking support in ST_INTERSECTS

Improved the combinations supported as preparation for removing the uly try/catch way of detecting the difference between WKT and WKB in some code.

* Fixed bugs in incorrect use of doc-values in parameter type matching

Also made a few reminfments, including removing one try/catch approach to differentiating between WKT and WKB.

* Removed second place where we used try/catch to differentiate WKT from WKB

This was a workaround for a mistake in the planning, where we incorrectly mapped incoming types to the wrong FieldEvaluators. We fixed that mistake in an earlier commit.

* Fixed flaky tests were GEO was treated as CARTSIAN

We assumed if the incoming types were constants, they had no CRS, even when they did, which was wrong. For shapes crossing the dateline this lead to different (incorrect) behaviour.

* Fixed a flaky test by removing some point==point optimizations

* Moved spatial intersects to 'spatial' package

When we developed the ST_CENTROID work, this was requested, so let's do it here too.

* Use normal switch on enums

* Cleanup some static utility methods

Now all code paths that can convert a constant string to a geometry use the same code.

* Fixed bugs with non-quantized coordinates, and cleaned up code a little

* Fixed failing test after change to evaluator class names

* Refactored SpatialRelatesFunction into three files, and made evaluatorRules static

This was a general cleanup, making the code more organized, but did also achieve static evaluator rules so we don't re-created these on every query parsing.

* Fixed compile error after rebase

* Removed ConstantAndConstant support, using fold() correctly instead

* better error on circles

* Make sure compound predicates are supported in use-doc-values pushdown

* Testing ENRICH with ST_INTERSECTS

This required adding new data for an ENRICH index, and this data could be tested with a few other related tests, which were also added.

* Added missing mixed-cluster rules for testing only with 8.14

* Fixed some mixed-cluster issues where we failed to mark test for only 8.14

Also added an interesting polygon-polygon intersection case from real data.

* Fix flaky test where cartesian polygons were generated from geo

* Remove support for string literals in ST_INTERSECTS

* Fix failing tests after removing string support

* Removed unused code from previous string literal support (WKT parsing)

* Support case where both fields are points and doc-values

If we have an ST_INTERSECTS and an ST_CENTROID, the centroid asks to load the points as doc-values, and the ST_INTERSECTS needs to therefor support two doc-values points.

* Disallow more than one field from doc-values for ST_INTERSECTS

* Remove unused evaluator classes

* Add tests for multiple doc-values if not in same intersects

* Fix errors after rebase on main

* Fixed bug in missing support for spatial function expressions in EVAL

When a spatial aggregate expects doc-values, this was not being communicated to spatial functions in EVAL, only in WHERE.

* Reduce flaky tests when reading directly from enrich source indices

The test framework does not expect enrich source indices to be used directly in queries, leading to duplicated results on multi-node clusters, so we edit the queries to be less sensitive to this case.

* Fixed failing test

* Code style

* Fixed test file name and added function name annotation

* Added documentation for st_intersects

* Fixed failing show functions test

* Code review changes, notably simplifying the type resolution

* Fixed broken docs link
2024-03-19 17:58:37 +01:00
Fang Xing
e6d1c90501
[ES|QL] Add mv_sort (#106095)
* add mv_sort
2024-03-13 12:04:12 -04:00
Fang Xing
8d839e3b52
add mv_slice and mv_zip (#106147) 2024-03-11 23:02:57 -04:00
Craig Taverner
8d93a934f6
Add two new OGC functions ST_X and ST_Y (#105768)
* Add two new OGC functions ST_X and ST_Y

Recently Nik did work that involved extracting the X and Y coordinates from geo_point data using `to_string(field)` followed by a DISSECT command to re-parse the string to get the X and Y coordinates.

This is much more efficiently achieved using existing known OGC functions `ST_X` and `ST_Y`.

* Update docs/changelog/105768.yaml

* Fixed invalid changelog yaml

* Fixed mixed cluster tests

* Fixed tests and added docs

* Removed false impression that these functions were different for geo/cartesian

With the use of WKB as the core type in the compute engine, many spatial functions are actually the same between these two types, so we should not give the impression they are different.

* Code review comments and reduced object creation.

* Revert temporary StringUtils hack, and fix bug in x/y extraction from WKB

* Revert object creation reduction

* Fixed mistakes in documentation
2024-03-06 11:19:54 +01:00
Craig Taverner
85cd204317
Fix automatic generation of spatial function types files (#105766)
* Fix automatic generation of spatial function types files

The automatic mapping of spatial function names from class names was not working for spatial types, so the automatic generation of these files did not happen, and in fact existing files were deleted.

In addition, the generation of aggregation functions types does not yet exist at all, so the st_centroid.asciidoc file was always deleted. Until such support exists, this files contents will be moved back into the function definition file.

The railroad diagrams for syntax are now also created, however, not all functions in the documentation actually use these, and certainly none of the `TO_*` type-casting functions do, so we'll not include links to them from the docs, and leave that to the docs team to decide. Personally, while these diagrams are pretty, they contain no additional informational content, and in fact give a cluttered impression to the documentation visual appeal.

* Refined to use an annotation which is more generic
2024-03-05 18:04:09 +01:00
Bogdan Pintea
f26691f987
ESQL: Mark a few features as experimental (#105263)
Mark the following features as experimental in the docs:
* `AUTO_BUCKET()`
* `SHOW FUNCTIONS`
* unsigned_long type
2024-02-07 17:28:13 -08:00
Fang Xing
0fb5dee75b
[ES|QL] Add function log(base, value) (#104913)
Add a new scalar function log
2024-02-06 13:03:53 -05:00
Abdon Pijpelink
980bc500b0
[DOCS] Support for nested functions in ES|QL STATS...BY (#104788)
* Document nested expressions for stats

* More docs

* Apply suggestions from review

- count-distinct.asciidoc
  - Content restructured, moving the section about approximate counts to end of doc.

- count.asciidoc
  - Clarified that omitting the `expression` parameter in `COUNT` is equivalent to `COUNT(*)`, which counts the number of rows.

- percentile.asciidoc
  - Moved the note about `PERCENTILE` being approximate and non-deterministic to end of doc.

- stats.asciidoc
  - Clarified the `STATS` command
  -  Added a note indicating that individual `null` values are skipped during aggregation

* Comment out mentioning a buggy behavior

* Update sum with inline function example, update test file

* Fix typo

* Delete line

* Simplify wording

* Fix conflict fix typo

---------

Co-authored-by: Liam Thompson <leemthompo@gmail.com>
Co-authored-by: Liam Thompson <32779855+leemthompo@users.noreply.github.com>
2024-01-30 19:29:12 +01:00
Craig Taverner
b0f978f41e
Support points as input types to the TO_GEOSHAPE and TO_CARTESIANSHAPE functions (#104799)
* Support points as input types to TO_GEOSHAPE and TO_CARTESIAN_SHAPE

* Update docs for TO_GEOSHAPE and TO_GEOPOINT
2024-01-29 15:26:40 +01:00
Abdon Pijpelink
ef8c1e3ef0
[DOCS] Add DATE_DIFF function (#104794) 2024-01-29 09:51:46 +01:00
Abdon Pijpelink
e87c49cb4b
[DOCS] Improve ES|QL functions reference for functions E-Z (#104623)
* Functions E-Z

* Incorporate changes from #103686

* More functions

* More functions

* Update docs/reference/esql/functions/floor.asciidoc

Co-authored-by: Liam Thompson <32779855+leemthompo@users.noreply.github.com>

* Update docs/reference/esql/functions/left.asciidoc

Co-authored-by: Liam Thompson <32779855+leemthompo@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Alexander Spies <alexander.spies@elastic.co>

* Review feedback

* Fix geo_shape description

* Change 'colum'/'field' into 'expressions'

* Review feedback

* One more

---------

Co-authored-by: Liam Thompson <32779855+leemthompo@users.noreply.github.com>
Co-authored-by: Alexander Spies <alexander.spies@elastic.co>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2024-01-25 16:32:24 +01:00
Craig Taverner
eb1c490264
ESQL: Support reading points from doc-values for STATS (#104218)
* Add initial structure for ST_CENTROID

* Revert "Revert stab at implementing forStats for doc-values vs source"

This reverts commit cfc4341bf4.

* Refined csv-spect tests with st_centroid

* Spotless disagrees with intellij

* Fixes after reverting fieldmapper code to test GeoPointFieldMapper

* Get GeoPointFieldMapperTests working again after enabling doc-values reading

* Simplify after rebase on main

In particular, field-mappers that do not need to know about fields can have simpler calls.

* Support local physical planning of forStats attributes for spatial aggregations

* Get st_centroid aggregation working on doc-values

We changed it to produce BytesRef, so we don't (yet) need any doc-values types.

* Create both DocValues and SourceValues versions of st_centroid

* Support physical planning of DocValues and SourceValues SpatialCentroid

* Improve test for physical planning of DocValues in SpatialCentroid

* Fixed show functions for st_centroid

* More st_centroid tests with mv_expand

To test single and multi-value centroids

* Fix st_centroid from point literals

The blocks contained BytesRef byte[] with multiple values, and we were ignoring the offsets when decoding, so decoding the first value over and over instead of decoding the subsequent values.

* Teach CsvTests to handle spatial types alternative loading from doc-values

Spatial GEO_POINT and CARTESIAN_POINT load from doc-values in some cases. If the physical planner has planned for this, we need the CsvTests to also take that into account, changing the type of the point field from BytesRefBlock to LongBlock.

* Fixed failing NodeSubclassTests

Required making the new constructor public and enabling Set as a valid parameter in the test framework.

* More complex st_centroid tests and fixed bug with multiple aggs

When there were multiple agregations in the same STATS, we were inadvertently re-ordering them, causing the wrong Blocks to be fed to the wrong aggregator in the coordinator node.

* Update docs/changelog/104218.yaml

* Fix automatically generated changelog file

* Fixed failing test

The nodes can now sometimes be Set, which is also a Collection, but not a List, and therefor never can be a subset of the children.

* More tests covering more combinations including MV_EXPAND and grouping

* Added cartesian st_centroid with grouping test

We could not add MV_EXPAND tests since the cartesian data does not have multi-value columns, but the geo_point tests are sufficient for this since they share the same code.

* Reduce flaky tests by sorting results

* Reduce flaky tests by sorting results

* Added tests for stats on stats to ensure planner coped

* Add unit tests to ensure doc-values in query planning complex cases

* Some minor updates from code review

* Fixes after rebase on main

* Get correct error message on unsupported geo_shape for st_centroid

* Refined point vs shape differences after merging main

* Added basic docs

* Delete docs/changelog/104218.yaml

* Revert "Delete docs/changelog/104218.yaml"

This reverts commit 4bc596a442.

* Fixed broken docs tag link

* Simplify BlockReaderSupport in MapperTestCase from code review

* Moved spatial aggregations into a sub-package

* Added some more code review updates, including nested tests

* Get nested functions working, if only from source values for now

* Code review update

* Code review update

* Added second location column to airports for wider testing

* Use second location in tests, including nulls

Includes a test fix for loading and converting nulls to encoded longs.

* Fixed bug supporting multi spatial aggregations in the local node

The local physical planner only marked a single field for stats loading, but marked all spatial aggregations for stats loading, which load to only one aggregation getting the right data, while the rest would get the wrong data.

* Renamed forStats to fieldExtractPreference for clarity

Now the planner decides whether to load data from doc-values. To remove the confusion of preferDocValues==false in the non-spatial cases, we use an ENUM with the default value of NONE, to make it clear we're leaving the choice up to the field type in all non-spatial cases.

* EsqlSpecIT was failing on very high precision centroids on different computers

This was not reproducible on the development machine, but CI machines were sufficiently different to lead to very tiny precision changes over very large Kahan summations. We fixed this by reducing the need for precision checks in clustered integration tests.

* Delete docs/changelog/104218.yaml

* Revert "Delete docs/changelog/104218.yaml"

This reverts commit 12c6980881.

* Fixed changelog entry
2024-01-23 16:04:45 +01:00
Craig Taverner
9ac356bbcf
Update docs with support for geo_shape and cartesian_shape  (#104480)
* Document to_geoshape and to_cartesianshape

* Note that geo_point and point are now supported Elasticsearch types

* Fix doc links
2024-01-18 13:00:38 +01:00
Ignacio Vera
585face0cf
ESQL: Support loading shapes from source into WKB blocks (#104269)
This commit adds support for reading geo_shape and shape fields into wkb blocks so they can use top project the 
data to the result of a ES|QL query.
2024-01-17 14:55:37 +01:00
Luigi Dell'Aquila
ad28dc9a6c
ESQL: Add TO_UPPER and TO_LOWER functions (#104309) 2024-01-15 11:58:57 +01:00
Ignacio Vera
f64147f6c1
ESQL: Remove the possibility of CartesianPoint or GeoPoint literal to a long (#104197) 2024-01-11 14:25:48 +01:00
Marco Liberati
3145e9f9fc
[ES|QL] Annotate all ESQL functions (for SHOW FUNCTIONS) (#103686)
* 🔧 Initial annotations

* ✏️ Add substring doc

* 🏷️ Fix imports

* ✏️ Add annotations for string fns

* ♻️ Fix issues

* :rotatin_light: Fix linting issues

* ✏️ Add more annotations

* :rotatin_light: Fix linting issues

* ♻️ Add missing import

* ✏️ Add more annotations

* 🚨 Fix linting

*  Fix many tests for new annotations

*  Fix more tests

* 🐛 Fix missing flag

*  Annotate new functions

*  fix more tests

*  Fix signature issue

*  Make all csv tests pass

*  Fix remaining tests

*  New assets from annotations

*  Refactor test

*  Fix updated signature
2024-01-11 10:15:30 +01:00
Bogdan Pintea
9f6e5a4ccf
ESQL: Add Warning tests for all remaining functions (#103739)
This adds unit tests cases for all the functions that were missing tests
checking on the correct generation of the Warning headers in case the
execution raised an Exception that lead to a `null` result.
2024-01-10 22:27:13 +01:00
Mark Tozzi
282f0f0a00
[ESQL] Remove is_nan, is_finite, and is_infinite (#104091)
A while ago we decided we weren't going to support NaN or infinite values in the language. Removing these functions is part of that effort.
2024-01-09 14:51:32 -05:00
Nik Everett
5ef5dca334
ESQL: MV_FIRST and MV_LAST (#103928)
This creates the `MV_FIRST` and `MV_LAST` functions that return the
first and last values from a multivalue field. They are noops from a
single valued field. They are quite similar to `MV_MIN` and `MV_MAX`
except they work on positional data rather than relative size. That
sounds like a large distinction, but in practice our multivalued fields
are often sorted. And when they operate on sorted arrays `MV_MIN` does
*the same* thing as `MV_FIRST`.

But there are some cases where it really does matter - say you are
`SPLIT`ing something - so `MV_FIRST(SPLIT("foo;bar;baz", ";"))` gets you
`foo` like you'd expect. No sorting needed.

Relates to #103879
2024-01-09 08:46:34 -05:00
Luigi Dell'Aquila
770fc19b14
ESQL: add date_diff function (#104118)
Same as https://github.com/elastic/elasticsearch/pull/103208

Fixes #101942

We had to revert it after a Checkstyle failure (strange it didn't pop up
in the CI before merging)
2024-01-09 07:03:58 -05:00
David Turner
943b2eae70 Revert "Esql/create DATE_DIFF function (#103208)"
This reverts commit ec2e18536d.
2024-01-09 09:50:48 +00:00