Repository navigation
feat(sql): expose the set-operation reader to the relational engine; UNION ALL reads agreeing dates of a non-default format - #422
Merged
Conversation
…UNION ALL reads agreeing dates of a non-default format The relational engine (softclient4es-arrow) must answer a set operation with the same verdict, types and values as core. Core's typing and value reading were private, so arrow re-implemented them and drifted. Core now exposes them, private[elastic], so both use ONE implementation. - MultiSearch.columnTree(requests, operators): each step of the operator tree with its type per column, and an `untyped` flag where DuckDB 1.5.5 gives that step no type. columnTypes and branchTypes are unchanged. - SetOperationValues.legReaders(requests, operators, version, unreadable): per leg and column, a function that reads a value as its branch's declared type, as the cluster's Elasticsearch major indexed it, at every depth, and also where the branches agree. One class per type. A value with several elements fails, as at a converting position. `unreadable` (Fail by default, or KeepAsStored) decides what happens to a date the reader cannot read. - Core's UNION ALL reads an agreeing date position, at every depth, when a branch's field has a non-default mapping format (epoch_second, a custom pattern), so the column holds dates instead of the stored numbers and text. A value the reader cannot read is kept as stored, so nothing core answered before fails. Ordinary agreeing columns are untouched, at no per-row cost. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
fupelaqu
marked this pull request as ready for review
October 8, 2026 22:50
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The relational engine (softclient4es-arrow) must answer a set operation with the same verdict, types and values as core. Core's set-operation typing and value reading were private, so arrow re-implemented them and drifted: 18 of 22 values stored in non-default forms differed. Core now exposes them,
private[elastic], so both paths use ONE implementation. Arrow #198 is the consumer.MultiSearch.columnTree(requests, operators)returns each step of the operator tree with its type per column, plus anuntypedflag where DuckDB 1.5.5 gives that step no type. Arrow casts there and leaves the other steps to DuckDB.columnTypesandbranchTypesare unchanged.SetOperationValues.legReaders(requests, operators, version, unreadable)gives, per leg and column, a function that reads a value as its branch's declared type, the way the cluster's Elasticsearch major indexed it.unreadable(Failby default, orKeepAsStored) decides what happens to a date the reader cannot read.UNION ALLreads an agreeing date position, at every depth, when a branch's field has a non-default mapping format (epoch_second, a custom pattern). The column then holds dates instead of the stored numbers and text.Measured
No regression vs
main(fc3558f), Elasticsearch 8.18.3, 180 statements on 3 routes. Agreeing and converting date columns, at the column and inside objects, over:epoch_second,epoch_millisand 9 custom-pattern formats;Every statement
mainanswers still answers. The converted dates equal Elasticsearch's indexed values (270 / 270).untypedagainst DuckDB 1.5.5:columnTypes/branchTypesbyte-identical tomain: 6,000 random statements, plus the 13,120-statement rule table.Reachable from arrow: a test in package
app.softnetwork.elastic.arrowcompiles and calls the new API.Tests:
sql/test1844 / 0 andcore/test1213 / 0;Cost:
API (additive,
private[elastic])MultiSearch.columnTree,MultiSearch.SetOperationNode;SetOperationValues.legReaders,SetOperationValues.Unreadable;SetOperationValuesis nowprivate[elastic].🤖 Generated with Claude Code