Skip to content

Move storage_impl.h and storage_traits.h into the vocabulary layer's tiers - #1560

Merged
trueqbit merged 4 commits into
devfrom
refactor/schema-algorithms
Oct 4, 2026
Merged

trueqbit merged 4 commits into
devfrom
refactor/schema-algorithms

Conversation

@trueqbit

@trueqbit trueqbit commented Oct 3, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Neither storage_impl.h nor storage_traits.h is about the storage object. Both compute over the schema, the tuple of mapped database objects. This PR places their contents by the rules in docs/internals/vocabulary-layer.md and gives them schema_* names instead of storage_*, as planned there.

Was Now Tier
storage_traits::storage_mapped_columns_impl column_field_types_t, in vocabulary/algorithms/column_field_types.h vocabulary algorithm: computes over a single table definition
storage_traits::storage_mapped_column_expressions_impl column_field_expressions_t, same file vocabulary algorithm
storage_traits::storage_mapped_columns schema_mapped_column_field_types, in schema/algorithms/table_lookup.h schema algorithm: looks up the table first
storage_traits::storage_mapped_column_expressions schema_mapped_column_field_expressions, same file schema algorithm
lookup_table_name() (declared in table_lookup.h, defined in storage_impl.h) defined in schema/algorithms/table_lookup.h schema algorithm
find_column_name(), materialize_column_pointer(), is_column_unique() schema/algorithms/column_lookup.h schema algorithm
tables_index_sequence, views_index_sequence, foreign_keys_count() schema/algorithms/table_filters.h schema algorithm
column_field_expression_t (schema/column.h) the projection member_pointer_type_t, in vocabulary/projections/nested_types.h projection
  • column_field_expression_t had only one user, the column expressions computation. Replacing it with a plain projection means the new vocabulary algorithm doesn't depend on schema/column.h.
  • column_result.h and column_expression.h now reach schema/column.h later in the amalgamation than before, because storage_traits.h no longer pulls it in. The column names they and the headers before column.h use are forward-declared in vocabulary/node_fwd.h and traits/grammar_traits_fwd.h.
  • The vocabulary doc describes the new files, and its open-work item for storage_traits.h is removed as done. AGENTS.md no longer lists storage_impl.h.

Test plan

  • tests/static_tests/select_return_type.cpp checks schema_mapped_column_field_types (formerly storage_mapped_columns), and adds checks for schema_mapped_column_field_expressions on a mapped and an unmapped type.
  • select(asterisk<T>()) and the asterisk column result tests exercise both through column_result_t / column_expression_type.
  • The find_column_name tests (tests/storage_tests.cpp, tests/logger_tests.cpp) and the CTE tests cover the column lookups. The foreign key tests cover foreign_keys_count().

🤖 Generated with Claude Code

…iers

Neither header is about the storage object; both compute over the schema,
the tuple of mapped database objects.

storage_traits.h:
- The per-table computations become the vocabulary algorithms
  column_field_types_t and column_field_expressions_t, in
  vocabulary/algorithms/column_field_types.h.
- The lookup of the table first is schema-wide: storage_mapped_columns and
  storage_mapped_column_expressions become schema_mapped_columns and
  schema_mapped_column_expressions in schema/algorithms/table_lookup.h, out
  of the storage_traits namespace.
- column_field_expression_t, whose only user they were, gives way to the
  plain projection member_pointer_type_t, so that the vocabulary layer does
  not depend on schema/column.h.

storage_impl.h:
- lookup_table_name() is defined in table_lookup.h, where it was already
  declared.
- find_column_name(), materialize_column_pointer() and is_column_unique()
  move to schema/algorithms/column_lookup.h.
- tables_index_sequence, views_index_sequence and foreign_keys_count() move
  to schema/algorithms/table_filters.h.

The vocabulary doc and AGENTS.md describe the new places, and the doc's
open-work item for storage_traits.h is done.

Co-Authored-By: Claude Opus 5.5
@trueqbit
trueqbit marked this pull request as draft October 3, 2026 18:53
…orithms

schema_mapped_columns and schema_mapped_column_expressions become
schema_mapped_column_field_types and schema_mapped_column_field_expressions,
matching the column_field_types_t and column_field_expressions_t they apply
to the table found for a lookup type.

Co-Authored-By: Claude Opus 5.5
@trueqbit
trueqbit marked this pull request as ready for review October 4, 2026 07:10
@trueqbit
trueqbit requested a review from fnc12 October 4, 2026 07:29
@trueqbit
trueqbit merged commit 3da1fad into dev Oct 4, 2026
20 checks passed
@trueqbit
trueqbit deleted the refactor/schema-algorithms branch October 4, 2026 09:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants