Repository navigation
Refuse a missing relation target before any row is read - #83
Merged
Merged
Conversation
A relation's target was checked only when the relation had a row to follow, so on a dataset without the table a stream answered the pages where nothing matched and failed on the first page where something did. The target is now checked with the other planned tables, whatever the rows. A selected column of the target had the same hole: only a scan checked it, and a relation with no row to follow scans nothing. The schema check now refuses a missing selected column as well. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
Closes #81.
A relation's target was checked only when the relation had a row to follow. Take a dataset without traces and
transactions: [{sighash: [...], traces: true}]. A chunk where no transaction matched answered as if the table were there. A chunk where one did failed withTableNotFound. So a stream over that dataset returned some pages and then failed.Execution::preparenow checks every relation's target together with the block table and the item tables, before any row is read. Whether the query fails no longer depends on which rows match.A selected column of a relation's target had the same gap. Only a scan checked that the column exists, and a relation with nothing to follow does no scan. The schema check in
preparenow refuses a missing selected column of any planned table. For the header and the item tables this only moves the error earlier, because their scan already raised the sameColumnNotFound.Behaviour change: if a dataset's chunks lack a table, a query that reaches that table through a relation now fails on every chunk. Before, it failed only on chunks where a row pointed at it. A query that names neither the table nor its columns is unaffected, and the engine still opens no table the query does not name.
Spec: INV-E4 now says that every table the query requests is needed, whatever the rows. INV-E3 says that a selected column is needed whether or not a row of its table is read. The CT-8 table, the coverage matrix and
docs/architecture.mdare updated to match.Tests:
a_missing_relation_table_is_an_error_without_inputsreplacesa_missing_relation_table_is_not_observed_without_inputs.a_relation_target_missing_a_selected_column_is_an_error_without_inputsis new. Each runs four shapes in which a relation has nothing to follow, in both JSON and Arrow:includeAllBlocksBefore the fix, all eight query/format combinations returned an answer. With either fix removed, its test fails.
CT-8 and
make spec-checkpass. The full suite (--features legacy-query -- --include-ignored, with the reference comparison) is still running; I will post the result here.🤖 Generated with Claude Code