elasticsearch/docs/reference/esql/functions
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
..
signature ESQL: Prevent CONCAT from using a ton of memory (#99716) 2023-09-22 11:27:13 -04:00
types ESQL: Prevent CONCAT from using a ton of memory (#99716) 2023-09-22 11:27:13 -04:00
abs.asciidoc ESQL: Standardize font used in railroad diagrams (#98897) 2023-08-26 14:19:47 -04:00
acos.asciidoc ESQL: More docs (#98890) 2023-08-28 11:17:04 -04:00
asin.asciidoc ESQL: More docs (#98890) 2023-08-28 11:17:04 -04:00
atan.asciidoc ESQL: More docs (#98890) 2023-08-28 11:17:04 -04:00
atan2.asciidoc ESQL: More docs (#98890) 2023-08-28 11:17:04 -04:00
auto_bucket.asciidoc [DOCS] Some minor ES|QL docs fixes (#99423) 2023-09-11 16:20:10 +02:00
case.asciidoc Rename PROJECT command to KEEP (ESQL-1282) 2023-06-19 13:06:44 +02:00
ceil.asciidoc ESQL: Yet more function tests and docs (#99009) 2023-09-11 14:10:17 -04:00
cidr_match.asciidoc Move each function to its own file 2023-05-11 17:02:27 +02:00
coalesce.asciidoc ESQL: COALESCE function (#98542) 2023-08-17 13:51:44 -04:00
concat.asciidoc Rename PROJECT command to KEEP (ESQL-1282) 2023-06-19 13:06:44 +02:00
cos.asciidoc ESQL: More docs (#98890) 2023-08-28 11:17:04 -04:00
cosh.asciidoc ESQL: Standardize font used in railroad diagrams (#98897) 2023-08-26 14:19:47 -04:00
date_extract.asciidoc Add date_extract function (ESQL-1346) 2023-07-19 14:08:06 +02:00
date_format.asciidoc ESQL: Swap arguments of remaining date_xxx() functions (#99561) 2023-09-19 20:22:34 +02:00
date_parse.asciidoc Add date_extract function (ESQL-1346) 2023-07-19 14:08:06 +02:00
date_trunc.asciidoc ESQL: date_trunc(): swap order of arguments (#98624) 2023-08-22 18:20:05 +02:00
e.asciidoc ESQL: More docs (#98890) 2023-08-28 11:17:04 -04:00
ends_with.asciidoc Added esql ends_with implementation (#99613) 2023-09-18 11:29:20 -04:00
floor.asciidoc ESQL: More docs (#98890) 2023-08-28 11:17:04 -04:00
greatest.asciidoc ESQL: More docs (#98890) 2023-08-28 11:17:04 -04:00
is_finite.asciidoc Move each function to its own file 2023-05-11 17:02:27 +02:00
is_infinite.asciidoc Move each function to its own file 2023-05-11 17:02:27 +02:00
is_nan.asciidoc Move each function to its own file 2023-05-11 17:02:27 +02:00
least.asciidoc ESQL: More docs (#98890) 2023-08-28 11:17:04 -04:00
left.asciidoc ESQL: Implement 'right' function (#98974) 2023-09-08 17:27:59 +02:00
length.asciidoc Rename PROJECT command to KEEP (ESQL-1282) 2023-06-19 13:06:44 +02:00
log10.asciidoc ESQL: More docs (#98890) 2023-08-28 11:17:04 -04:00
ltrim.asciidoc ESQL: LTRIM, RTRIM and fix unicode whitespace (#98590) 2023-08-17 11:30:12 -04:00
mv_avg.asciidoc Docs: compress results into query (ESQL-1259) 2023-06-12 09:37:45 -05:00
mv_concat.asciidoc Docs: compress results into query (ESQL-1259) 2023-06-12 09:37:45 -05:00
mv_count.asciidoc Docs: compress results into query (ESQL-1259) 2023-06-12 09:37:45 -05:00
mv_dedupe.asciidoc Implement MV_DEDUPE (ESQL-1287) 2023-06-27 08:13:19 -05:00
mv_max.asciidoc Docs: compress results into query (ESQL-1259) 2023-06-12 09:37:45 -05:00
mv_median.asciidoc Docs: compress results into query (ESQL-1259) 2023-06-12 09:37:45 -05:00
mv_min.asciidoc Docs: compress results into query (ESQL-1259) 2023-06-12 09:37:45 -05:00
mv_sum.asciidoc Docs: compress results into query (ESQL-1259) 2023-06-12 09:37:45 -05:00
now.asciidoc Implement now() function (ESQL-1172) 2023-06-27 12:01:09 +02:00
pi.asciidoc ESQL: More docs (#98890) 2023-08-28 11:17:04 -04:00
pow.asciidoc [DOCS] Some minor ES|QL docs fixes (#99423) 2023-09-11 16:20:10 +02:00
right.asciidoc ESQL: Implement 'right' function (#98974) 2023-09-08 17:27:59 +02:00
round.asciidoc Move IS_NULL, POW, ROUND, STARTS_WITH, SUBSTRING code snippets to CSV files 2023-07-07 15:45:06 +02:00
rtrim.asciidoc ESQL: LTRIM, RTRIM and fix unicode whitespace (#98590) 2023-08-17 11:30:12 -04:00
sin.asciidoc ESQL: More docs (#98890) 2023-08-28 11:17:04 -04:00
sinh.asciidoc ESQL: More docs (#98890) 2023-08-28 11:17:04 -04:00
split.asciidoc Docs: convert the results into a table (ESQL-1143) 2023-05-17 16:00:15 -04:00
sqrt.asciidoc ESQL: More docs (#98890) 2023-08-28 11:17:04 -04:00
starts_with.asciidoc Move IS_NULL, POW, ROUND, STARTS_WITH, SUBSTRING code snippets to CSV files 2023-07-07 15:45:06 +02:00
substring.asciidoc Move IS_NULL, POW, ROUND, STARTS_WITH, SUBSTRING code snippets to CSV files 2023-07-07 15:45:06 +02:00
tan.asciidoc ESQL: More docs (#98890) 2023-08-28 11:17:04 -04:00
tanh.asciidoc ESQL: More docs (#98890) 2023-08-28 11:17:04 -04:00
tau.asciidoc ESQL: More docs (#98890) 2023-08-28 11:17:04 -04:00
to_boolean.asciidoc Docs: compress results into query (ESQL-1259) 2023-06-12 09:37:45 -05:00
to_datetime.asciidoc Add date_extract function (ESQL-1346) 2023-07-19 14:08:06 +02:00
to_degrees.asciidoc Add to_degrees and to_radians functions (ESQL-1496) 2023-08-03 04:23:15 +10:00
to_double.asciidoc Docs: compress results into query (ESQL-1259) 2023-06-12 09:37:45 -05:00
to_integer.asciidoc Docs: compress results into query (ESQL-1259) 2023-06-12 09:37:45 -05:00
to_ip.asciidoc Docs: compress results into query (ESQL-1259) 2023-06-12 09:37:45 -05:00
to_long.asciidoc Docs: compress results into query (ESQL-1259) 2023-06-12 09:37:45 -05:00
to_radians.asciidoc Add to_degrees and to_radians functions (ESQL-1496) 2023-08-03 04:23:15 +10:00
to_string.asciidoc ESQL: Yet more function tests and docs (#99009) 2023-09-11 14:10:17 -04:00
to_unsigned_long.asciidoc Add unsigned_long type support (ESQL-1289) 2023-07-04 15:45:10 +02:00
to_version.asciidoc ESQL: Yet more function tests and docs (#99009) 2023-09-11 14:10:17 -04:00
trim.asciidoc Reused example from spec file 2023-07-10 10:17:12 +02:00