Closed nik9000 closed 3 months ago
Pinging @elastic/es-analytical-engine (Team:Analytics)
I need to confirm this. I'm getting the error message from a log but it really look like someone did something like FROM * | KEEP a, b, c, d, ....., a1, b2,.....d1324
.
This reproduces it:
curl -uelastic:password -XDELETE localhost:9200/test
curl -uelastic:password -HContent-Type:application/json -XPOST localhost:9200/test/_doc -d'{"foo": "bar"}'
echo '{"query": "FROM test' > /tmp/query
for i in $(seq 1 300); do
echo -n '| KEEP f0'$i >> /tmp/query
for j in $(seq 1 300); do
echo -n ', f'$j$i >> /tmp/query
done
echo >> /tmp/query
done
echo '"}' >> /tmp/query
curl -uelastic:password -HContent-Type:application/json -XPOST localhost:9200/_query -d@/tmp/query
Determinizing automaton with 691104 states and 773832 transitions would require more than 10000 effort.
The numbers I used above are quite high to reproduce. This'll do it with much fewer fields:
curl -uelastic:password -XDELETE localhost:9200/test
curl -uelastic:password -HContent-Type:application/json -XPOST localhost:9200/test/_doc -d'{"foo": "bar"}'
echo '{"query": "FROM test' > /tmp/query
for i in $(seq 1 42); do
echo -n '| KEEP f0'$i >> /tmp/query
for j in $(seq 1 300); do
echo -n ', f'$j$i >> /tmp/query
done
echo >> /tmp/query
done
echo '"}' >> /tmp/query
curl -uelastic:password -HContent-Type:application/json -XPOST localhost:9200/_query -d@/tmp/query
We can make those examples work.
I think it's possible that there are other ways to cause this, so there's more to push here. I think.
I think we should do a few things:
field
and once like field*
. I know there's a reason, but it's expensive.foo*
case and group those into their own list and build them with makeStringUnion
and append a single *
pattern after those. I don't know what that'd do for the determinization process, but it sure feels like it'd be a lot kinder.
Description
This is what the error message looks like: