ESQL: gate wildcard-to-dataset resolution in FROM behind a feature flag#154987
ESQL: gate wildcard-to-dataset resolution in FROM behind a feature flag#154987quackaplop wants to merge 1 commit into
Conversation
|
Pinging @elastic/es-analytical-engine (Team:Analytics) |
7db2bab to
29c91e4
Compare
🔍 Preview links for changed docs⏳ Building and deploying preview... View progress This comment will be updated with preview links when the build is complete. |
ℹ️ Important: Docs version tagging👋 Thanks for updating the docs! Just a friendly reminder that our docs are now cumulative. This means all 9.x versions are documented on the same page and published off of the main branch, instead of creating separate pages for each minor version. We use applies_to tags to mark version-specific features and changes. Expand for a quick overviewWhen to use applies_to tags:✅ At the page level to indicate which products/deployments the content applies to (mandatory) What NOT to do:❌ Don't remove or replace information that applies to an older version 🤔 Need help?
|
29c91e4 to
33ebd3d
Compare
33ebd3d to
7dbf1ca
Compare
7dbf1ca to
89d3e29
Compare
89d3e29 to
421c0d9
Compare
2e893c2 to
bdd1696
Compare
bdd1696 to
82d3237
Compare
82d3237 to
f4482b5
Compare
Add the esql_dataset_wildcards feature flag (off in release builds). When it is off, a dataset is reachable only by an exact name: a wildcard FROM pattern resolves to indices only, exactly as it did before datasets existed, so no existing index expression changes behaviour. An explicit dataset named alongside an index still produces the heterogeneous union; only accidental wildcard mixing is prevented. The restriction lives in dataset name matching (DatasetRewriter.resolve and anyPatternCouldMatchDataset), so a wildcard never reaches a dataset rather than being rejected after the fact. The flag is enabled for the esql test tasks so the wildcard-dataset path runs in release-tests.
f4482b5 to
8ecdcbe
Compare
What this is about
FROMcurrently lets a wildcard pattern resolve to datasets as well as indices, soFROM *(orFROM logs*) pulls in any dataset it happens to match. We want that off in released builds — a wildcard should mean "index-likes," exactly as it did before datasets existed — without disturbing any existing index behaviour.What this PR does
Adds a feature flag,
esql_dataset_wildcards(off by default in released builds, on in snapshot/dev). When it's off, a dataset is reachable only by an exact name:FROM *,FROM logs*, exclusions, aliases, data streams — all behave exactly as before datasets existed. A dataset a wildcard happened to match is simply dropped; the pattern flows to normal index resolution (which already excludes datasets). Nothing is rejected.FROM my_datasetreads the dataset.FROM my_dataset, my_indexstill produces the heterogeneous union — only accidental mixing via a wildcard is prevented, not deliberate explicit mixing.When the flag is on (snapshot/dev), wildcards match datasets exactly as today.
The restriction lives where dataset names are matched —
DatasetRewriter.resolve(filters resolved datasets to exact-named ones) andanyPatternCouldMatchDataset(a wildcard never triggers dataset resolution). So a wildcard never reaches a dataset in the first place, rather than being resolved and then rejected. This also means no dataset schema resolution happens for a wildcard query that resolves to indices only.Why matching, not a heterogeneity gate
An earlier version gated on "a FROM that resolves to both a dataset and an index." That fundamentally breaks
FROM *: the moment a dataset exists in the cluster, a bareFROM *matches it and the query fails — a regression for the most common query. You can't preserve "all index expressions work as today" with a post-hoc gate; the fix has to be in resolution. Treating datasets as name-only (not wildcard-swept), like hidden abstractions, leaves every index expression untouched and removes the need for any mix detection, authorization plumbing, or special data-stream handling.Does it work?
DatasetRewriterTestscover the flag-off paths: a wildcard matching only datasets excludes them (relation untouched); a wildcard spanning an index and a dataset resolves to the index only; a prefix wildcard does not reach a dataset; an exact dataset name still resolves; an explicit dataset + index still unions; and the flag defaults off in release builds. The existing wildcard-matches-datasets tests are pinned to the flag on.build.gradle— so the wildcard-dataset path is exercised in both snapshot and release-tests.DatasetRewriterTests, the dataset ITs,spotlessJavaCheck, andforbiddenApis(main / test / internalClusterTest).What's in the diff
DatasetRewriter: the flag constant, an exact-name filter inresolve, a flag-awareanyPatternCouldMatchDataset, and a package-privaterewriteUnsecuredoverload threading the flag for tests.EsqlResolveDatasetAction/DatasetResolver: read the flag and pass it into resolution.build.gradle: enable the flag for the esql test tasks.No wire/transport-version change.
To be backported to 9.5.