Skip to content

Decouple dynamic_set_t from the table name collector and the serializer - #1561

Merged
trueqbit merged 1 commit into
devfrom
refactor/dynamic-set-decoupling
Oct 4, 2026
Merged

trueqbit merged 1 commit into
devfrom
refactor/dynamic-set-decoupling

Conversation

@trueqbit

@trueqbit trueqbit commented Oct 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

dynamic_set_t, the SET clause assembled at runtime with dynamic_set(storage), serializes each assignment as it is pushed back, since its assignments are of different types and can't be kept as a tuple. At the same time it collects the tables named on the assignments' left-hand side, which the serializer needs later for the UPDATE. Before this PR:

  • it kept a table_name_collector as a member;
  • push_back() was defined in ast/crud/set.h;
  • so this AST node header included table_name_collector.h, forward-declared iterate_ast(), and relied on serialize() being found later through ADL.

With this PR:

  • The node keeps only the result: dynamic_set_t::table_names, which clear() resets.
  • push_back() moves out of class into implementations/dynamic_set_definitions.h. It uses a local collector, and that header includes what its body uses: ast_iterator.h, table_name_collector.h and statement_serializer.h. The header is listed in the interface_definitions.h manifest, whose comment now mentions AST nodes alongside schema and storage classes.
  • collect_table_names() of a dynamic SET returns set.table_names.

ast/crud/set.h no longer depends on the collector, the AST traversal or the serializer. That leaves table_name_collector.h used only by serialization code, which prepares for grouping the serializer's helpers later.

TODO.md notes the remaining coupling: the node's type carries the serializer context, and it serializes eagerly. Keeping the assignments type-erased instead would let a dynamic SET be serialized and bound like any other node.

Test plan

  • New: tests/statement_serializer_tests/ast/set.cpp checks that push_back() collects the table names and clear() resets them.
  • Existing coverage of the dynamic SET: the serialization tests in the same file, tests/statement_serializer_tests/statements/update.cpp (UPDATE with a dynamic SET), and tests/storage_non_crud_tests.cpp.

🤖 Generated with Claude Code

dynamic_set_t serializes each assignment as it is pushed back, and collects
the tables named on its left-hand side at the same time. It held a
table_name_collector for that, and push_back() was defined in the node
header, which therefore included table_name_collector.h, forward-declared
iterate_ast() and relied on serialize() being found later.

- The node keeps only the collected table names, which clear() resets.
- push_back() is defined out of class in
  implementations/dynamic_set_definitions.h, with a local collector,
  included through the interface_definitions.h manifest.
- collect_table_names() of a dynamic SET returns its table names.

A test checks that the table names are collected and cleared. TODO.md notes
the remaining coupling: the node's type carries the serializer context,
and it serializes eagerly.

Co-Authored-By: Claude Opus 5.5
@trueqbit
trueqbit marked this pull request as draft October 3, 2026 19:48
@trueqbit
trueqbit marked this pull request as ready for review October 3, 2026 20:18
@trueqbit
trueqbit requested a review from fnc12 October 3, 2026 20:18
@trueqbit
trueqbit merged commit 676ad15 into dev Oct 4, 2026
20 checks passed
@trueqbit
trueqbit deleted the refactor/dynamic-set-decoupling branch October 4, 2026 06:13
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