From.tableAliases is keyed by table.name, so two tables in one FROM that differ only by their quoted qualifier strip to the same bare index name and the ListMap keeps only the last entry.
Measured
SELECT a FROM "prod_us".orders o, "prod_eu".orders p
=> From.tableAliases = ListMap(orders -> p) alias `o` is silently gone
With o missing from the alias map, Identifier.update cannot resolve o.a: the name stays o.a and the query asks Elasticsearch for a field literally named o.a, which matches nothing. No error is raised.
Why it matters
This is the shape cross-cluster federation exists for — the same index name in two clusters — and it is the first thing a consumer of the qualifier information will write. The double-quoted spelling reaches it today; the backtick and JOIN spellings become reachable once quoted table names are supported.
Fix
Key the alias maps by the table's qualified reference where, and only where, the bare name is ambiguous — i.e. when one FROM uses that bare index name for more than one distinct qualified reference. Keying every qualified table by its qualified name unconditionally was measured to break consumers that legitimately look a table up by its bare index name (Identifier.table, and downstream softclient4es-extensions' materialized-view planner) for statements that work today.
SingleSearch.sources — the indices actually read — must not change.
Anything inside the sql module that compares Identifier.table against an index name has to speak the same key language, since Identifier.table is an alias-map key: TemporalLiterals' cross-index join-leg guard built its set from the bare join-source names and needs the same keying.
From.tableAliasesis keyed bytable.name, so two tables in oneFROMthat differ only by their quoted qualifier strip to the same bare index name and theListMapkeeps only the last entry.Measured
With
omissing from the alias map,Identifier.updatecannot resolveo.a: the name stayso.aand the query asks Elasticsearch for a field literally namedo.a, which matches nothing. No error is raised.Why it matters
This is the shape cross-cluster federation exists for — the same index name in two clusters — and it is the first thing a consumer of the qualifier information will write. The double-quoted spelling reaches it today; the backtick and
JOINspellings become reachable once quoted table names are supported.Fix
Key the alias maps by the table's qualified reference where, and only where, the bare name is ambiguous — i.e. when one
FROMuses that bare index name for more than one distinct qualified reference. Keying every qualified table by its qualified name unconditionally was measured to break consumers that legitimately look a table up by its bare index name (Identifier.table, and downstreamsoftclient4es-extensions' materialized-view planner) for statements that work today.SingleSearch.sources— the indices actually read — must not change.Anything inside the
sqlmodule that comparesIdentifier.tableagainst an index name has to speak the same key language, sinceIdentifier.tableis an alias-map key:TemporalLiterals' cross-index join-leg guard built its set from the bare join-source names and needs the same keying.