Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

[Enhancement] Honor search.allow_expensive_queries when planning a script pushdown

Aperta
#5,837 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@RyanL1997 ci sta già lavorando.

Dal 19/10/2026.

  • #5896 di @RyanL1997 — aperta

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
52/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
java
Ambito
database

Direzione di ricerca

Trace the engine-wide script pushdown paths and check how the plugin reads search settings during planning; the issue names no source files or tests. Use the provided text-field reproduction with search.allow_expensive_queries=false as the first check, then cover the binary and flat_object cases mentioned in the issue. Done means script pushdowns are not emitted when the setting is false, or the rejection clearly identifies the setting and responsible query part.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement performance
What is wrong

A filter PPL cannot express as a DSL query is planned as a script query. OpenSearch already lets an operator refuse those with search.allow_expensive_queries (default true), but the plugin never consults it. When it is false the shard rejects the script and the user gets an error that names neither the setting nor the part of the query responsible:

java.sql.SQLException: exception while executing query: Failed to fetch data from the index:
the background task failed or interrupted.
  Inner error: Failed to execute phase [query], all shards failed; shardFailures
  { ... QueryShardException[failed to create query: [script] queries cannot be executed
  when 'search.allow_expensive_queries' is set to false.] }

A filter the index can answer succeeds in the same state, so the gate already discriminates correctly at the DSL level — the plugin just does not handle the rejection. allow_expensive_queries appears nowhere in the plugin.

Reproduce

A stock mapping: a text field with no keyword sub-field, so equality cannot become a term.

PUT /txtonly
{"settings":{"number_of_shards":1},
 "mappings":{"properties":{"id":{"type":"keyword"},"msg":{"type":"text"}}}}

POST /txtonly/_doc/1?refresh=true
{"id":"a","msg":"hello world"}

PUT /_cluster/settings
{"transient":{"search.allow_expensive_queries":false}}
POST /_plugins/_ppl   {"query": "source=txtonly | where msg = 'hello world' | fields id"}
query with the setting true with it false
where msg = 'hello world' the row the error above
a filter the index can answer (where id = 'a') the row the row

Both engines reach it: the script pushdown is not Calcite-specific.

What it should do

Either of these; the first is preferable because the answer stays correct.

  1. Plan around it. When the setting is false, do not emit a script pushdown — leave the predicate to the coordinator, which is what the engine already does for every other predicate it cannot push down. Slower, still correct.
  2. Refuse clearly. Report that the query needs a script, name the setting, and say which part of the query caused it.
Scope

Engine-wide rather than specific to one field type: every script pushdown path is affected — a text field without a keyword sub-field as above, a binary field (#5757), and a field type with no doc values at all, such as the flat_object leaves added in #5830, where it was found.

Lingua principale
Java
Stelle
175
Fork
233
Merge medio
2g 16h
PR unite (30g)
39

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di opensearch-project/sql

Tutte le issue di opensearch-project/sql

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.