Commit graph

21 commits

Author SHA1 Message Date
Bogdan Pintea
4e2389fb2c
ESQL: Improve docs for the floating points is_xxx() funtions (#103691)
Improve the docs for is_nan, is_finite, is_infinite functions.
This also adjusts the CamelCase to snake_case conversion, to not
consider the last capital letter (like in `IsNaN`).
2024-01-03 12:18:15 +01:00
Nik Everett
16e9bbe2d3 ESQL: Update generated docs 2023-12-27 15:58:02 -05:00
Nik Everett
3b738905e1
ESQL: Add type tables for operators to docs (#103206)
This adds a tiny blurb for each operator to the docs with a railroad
diagram of the operator's syntax and a table of the input and output
types. This also fixes the tests to correctly generate the tables for
operators.
2023-12-11 10:51:38 -05:00
Nik Everett
6e0c031342
ESQL: Generate railroad diagrams for operators (#103143)
This enables the generation of railroad diagrams for unary minus and a
bunch of binary operators like `+`, `-`, `%`, and `>=`.

Relates to #100558
2023-12-08 09:24:34 -05:00
Bogdan Pintea
d3fefde0a3
ESQL: add unit tests for conversion functions. Extend TEXT type support for them (#102746)
This adds the missing unit tests for the conversion functions.
It also extends the type support by adding the `TEXT` type to those functions that support `KEYWORD` already (which also simplifies the testing, actually). Some functions did have it, some didn't; they now all do.

The change also fixes two defects resulting from better testing coverage: `ToInteger` and `ToUnsignedLong` had some missing necessary exceptions declarations in the decorators for the evaluators.
It also updates `ToInteger`'s `fromDouble()` conversion to use a newly added utility, so that the failed conversions contain the right message (`out of [integer] range`, instead of the confusing `out of [long] range`).

Related: #102488, #102552.
2023-12-04 13:58:23 +01:00
Nik Everett
e39fdba02e ESQL: Add newly generated signature
We're generating it now, we should commit it so the docs can have it.
2023-11-27 13:29:03 -05:00
Nhat Nguyen
774a05cc0a
Update doc fields for pow and date_extract function (#102554)
These two generated files have not been updated and committed.
2023-11-23 17:33:38 -08:00
Nik Everett
d46c386c86
ESQL: Extra tests for trim/ltrim/rtrim (#102308)
This adds some extra tests, docs, and descriptions for the `trim`,
`ltrim`, and `rtrim` functions.
2023-11-16 14:44:56 -05:00
Luigi Dell'Aquila
d53c0cbf82
ESQL: annotate trigonometric functions and auto_bucket() (SHOW FUNCTIONS) (#101460) 2023-10-27 16:35:44 +02:00
Nik Everett
46f95a67b4
ESQL: More MV_* tests (#100564)
This adds more tests for some of the `MV_` functions and updates their
docs now that the railroad diagram and table generated by the tests
covers all of the types.
2023-10-24 16:55:17 -04:00
Nik Everett
9620512a89
ESQL: Tests for large concat and many evals (#100159) 2023-10-03 14:41:40 -04:00
AlexB
2ccdae6745
Eval REPLACE function (#98909)
Co-authored-by: Alexandros Batsakis <abatsakis@splunk.com>
Co-authored-by: Andrei Stefan <andrei@elastic.co>
2023-09-29 17:41:20 +03:00
Nik Everett
5e3ab06151
ESQL: Prevent CONCAT from using a ton of memory (#99716)
This prevents `CONCAT` from using an unbounded amount of memory by
hooking it's temporary value into the circuit breaker. To do so, it
makes *all* `ExpressionEvaluator`s `Releasable`. Most of the changes in
this PR just plumb that through to every evaluator. The rest of the
changes correctly release evaluators after their use.

I considered another tactic but didn't like it as much, even though the
number of changes would be smaller - I could have created a fresh,
`Releasable` temporary value for every `Page`. It would be pretty
contained keep the releasable there. But I wanted to share the temporary
state across runs to avoid a bunch of allocations.

Here's a script that used to crash before this PR but is fine after:
```
curl -uelastic:password -XDELETE localhost:9200/test
curl -HContent-Type:application/json -uelastic:password -XPUT localhost:9200/test -d'{
   "mappings": {
      "properties": {
         "short": {
            "type": "keyword"
         }
      }
   }
}'
curl -HContent-Type:application/json -uelastic:password -XPUT localhost:9200/test/_doc/1?refresh -d'{"short": "short"}'

echo -n '{"query": "FROM test ' > /tmp/evil
for i in {0..9}; do
   echo -n '| EVAL short = CONCAT(short' >> /tmp/evil
   for j in {1..9}; do
      echo -n ', short' >> /tmp/evil
   done
   echo -n ')' >> /tmp/evil
done
echo '| EVAL len = LENGTH(short) | KEEP len"}'>> /tmp/evil
curl -HContent-Type:application/json -uelastic:password -XPOST localhost:9200/_query?pretty --data-binary @/tmp/evil
```
2023-09-22 11:27:13 -04:00
gheorghepucea
d58b9ea87d
Added esql ends_with implementation (#99613)
Added an implementation for `ends_with` function in esql.  `ends_with` -
Returns a boolean that indicates whether a keyword string ends with
another string. Also made sure that the docs look alright: 

<img width="1677" alt="Screenshot 2023-09-16 at 18 10 46"
src="eccd81e1-40a2-4a66-a514-cf3e4205f9da">
2023-09-18 11:29:20 -04:00
Nik Everett
936e69ddd5
ESQL: Yet more function tests and docs (#99009)
This adds tests, supported types, and a signature image for `to_string`
and `to_version`. It also fixes the resolution of functions who's names
contain an `_`

Finally, it updates the docs for `ceil` to render the image more nicely.
2023-09-11 14:10:17 -04:00
dreamquster
04381664c1
ESQL: Implement 'right' function (#98974)
Add the 'right' function, which extracts a substring beginning from its
right end (opposite function of 'left').
---------

Co-authored-by: Alexander Spies <alexander.spies@elastic.co>
2023-09-08 17:27:59 +02:00
Nik Everett
b73cc0c529
ESQL: Only generate syntax diagrams locally (#99059)
CI will skip building them. Lot's of CI machines don't have font support
so they can't generate these. But all local machine have a GUI so they
can.

Also, super-lazy initialize the font so CI don't bump into it by
accident.

Closes #99018
2023-08-30 14:44:14 -04:00
Nik Everett
4cd7f40712
ESQL: More docs (#98890)
Adds some more typed docs to the ESQL functions.
2023-08-28 11:17:04 -04:00
Alexander Spies
ca3dc3a882
ESQL: Add CEIL function (#98847)
Add the unary scalar function CEIL.

Analogously to FLOOR,  it rounds up its argument.

- Implement CEIL, add it to the function registry and make sure it is serializable.
- Add csv tests, unit tests and docs.
- Add additional csv tests with different data types and some edge cases for both CEIL and FLOOR
- Add unit tests and update docs for FLOOR.
2023-08-28 12:31:56 +02:00
Nik Everett
ff01fb680b
ESQL: Standardize font used in railroad diagrams (#98897)
Locks the railroad diagrams to always use the same font, this one named
`roboto mono`. This makes sure that when we render the railroad diagrams
we always size them the same way. Because everyone has a copy of roboto
mono. Because gradle resolves that dependency.
2023-08-26 14:19:47 -04:00
Nik Everett
649ceb74ab
ESQL docs: generate references for functions (#98856)
This generates a "railroad diagram" svg image that can be embedded into
the docs for any function to explain it's syntax. It's basic, but it's
something we can iterate on.

It also generates a table of supported types from the list of types that
we test. It can be included in the docs for reference as well.
2023-08-25 09:07:25 -04:00