FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Refactor: extract common CREATE TABLE logic into AbstractTableGenerator by mrigger · Pull Request #1339 · sqlancer/sqlancer · GitHub

Refactor: extract common CREATE TABLE logic into AbstractTableGenerator - #1339

Merged
mrigger merged 4 commits into
mainfrom
refactor/abstract-table-generator
Apr 25, 2026
Merged

Refactor: extract common CREATE TABLE logic into AbstractTableGenerator#1339
mrigger merged 4 commits into
mainfrom
refactor/abstract-table-generator

Conversation

mrigger commented Apr 23, 2026

Copy link
Copy Markdown
Contributor

Introduce AbstractTableGenerator with appendCreateTable header helpers and appendColumnDefinitions / appendColumnDefinitionList iteration helpers that delegate to an overridable appendColumnDefinition(C) (default: "name type"). Convert four concrete table generators (QuestDB, HSQLDB, Databend, DuckDB) from plain classes to instance-based subclasses whose logic lives in buildStatement().

Public entry points (getQuery) are preserved so callers in the provider classes don't need to change. Generators with DB-specific shape (temporary/unlogged modifiers, in-place column building, partitioning, custom return types, etc.) are left alone.

mrigger and others added 4 commits April 25, 2026 23:30
Introduce AbstractTableGenerator<C> with appendCreateTable header helpers
and appendColumnDefinitions / appendColumnDefinitionList iteration
helpers that delegate to an overridable appendColumnDefinition(C)
(default: "name type"). Convert four concrete table generators
(QuestDB, HSQLDB, Databend, DuckDB) from plain classes to instance-based
subclasses whose logic lives in buildStatement().

Public entry points (getQuery) are preserved so callers in the provider
classes don't need to change. Generators with DB-specific shape
(temporary/unlogged modifiers, in-place column building, partitioning,
custom return types, etc.) are left alone.
…leGenerator

Follow-up to the initial four migrations. Presto and YCQL fit the
canonical CREATE TABLE [IF NOT EXISTS] <name>(col type[, ...]) shape
directly. Spark needs the columns pre-built before iteration so that
appendColumnDefinitions can call back into the overridden
appendColumnDefinition; this is safe because Spark's DEFAULT clause
uses generateConstant, which does not reference other columns.

Hive is left alone: its CHECK/DEFAULT constraints use generateExpression
which reads the columnsToBeAdded list incrementally, so pre-building
would change expression-generation behavior.
Add short Javadoc to each helper showing what SQL fragment it emits, so
subclass authors can pick the right entry point at a glance.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
mrigger force-pushed the refactor/abstract-table-generator branch from 1682faa to 220835e Compare April 25, 2026 15:41
mrigger merged commit 17b282a into main Apr 25, 2026
22 of 26 checks passed
mrigger deleted the refactor/abstract-table-generator branch April 25, 2026 16:11
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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant


Back | FazBrowse Home | New Git URL