Skip to content

Build against KipData/KiteSQL main; gate missing dialect hooks - #2

Merged
alexskinner merged 3 commits into
mainfrom
cursor/upstream-kitesql-main-c55f
Nov 28, 2026
Merged

alexskinner merged 3 commits into
mainfrom
cursor/upstream-kitesql-main-c55f

Conversation

@alexskinner

Copy link
Copy Markdown
Owner

Summary

Stops depending on alexskinner/KiteSQL by pinning kite_sql to KipData/KiteSQL main (2a57f09) and porting this crate onto the upstream dialect API. Behaviour that still needs hooks upstream does not have is kept behind optional hook-* Cargo features (off by default) so the default build and CI stay green.

Merged from the fork copy

Compared this repo (1210-line lib.rs, pin 8065036 / dual-mode) with alexskinner/KiteSQL kite_sql_mysql on main (1312 lines) and the durability pin ed8d138 (same 1210-line dialect as dual-mode):

  • Brought in mysql_comparison_type, boolean_text, and begin_commits_active_transaction wiring (fork main additions that map to upstream #406 / #409).
  • Copied on_duplicate_key_update.slt and on_duplicate_key_update_fixes.slt into tests/slt_mysql/ for when upsert lands (hook-upsert; not run in default CI).
  • Other src/ modules matched between this repo and the fork pins; no further source merge was required beyond the API port.

Port to upstream APIs

  • SqlDialect::parse: sqlparser MySQL parse → AST rewrite → Display → SqlParser::with_type_mapper(self).with_set_autocommit() (Lower is private; Display+reparse is the practical path).
  • DataTypeMapper: BIT, text types, BINARY, SERIAL → LogicalType.
  • comparison_type / boolean_text / begin_commits_active_transaction.
  • Prefix indexes: accepted by upstream parser/binder (#407); no dialect flag needed.
  • with_mysql() → DataBaseBuilder::dialect(MySqlDialect); install_mysql_functions via Database::load(CatalogKind::ScalarFunction(..)).
  • Fixed-arity MySQL scalars kept enabled under default; variadic/accepts_* forms gated.

Gated features (why)

Feature Why gated
hook-functions Needs #412 implicit-cast lookup + accepts_arity / accepts_any_args / return_type_for; FunctionRegistry/packs
hook-collation No dialect text_collation hook on upstream
hook-nulls-first No nulls_first hook
hook-numeric-typing No number_literal / arithmetic_return_type / avg_return_type
hook-column-display No ColumnTypeSpec / display-type catalog mapping
hook-identity No identity / AUTO_INCREMENT / LAST_INSERT_ID hooks
hook-diagnostics No diagnostics / map_diagnostic / StatementPolicy
hook-upsert #408 not merged

Enabling these against current upstream main will not compile until the hooks exist. Documented in README Upstream status.

Test results (default features)

  • cargo check / cargo clippy --all-targets -- -D warnings: pass
  • cargo test: pass (hook-dependent integration cases #[ignore])
  • cargo test --test slt_default: pass (backticks, tinyint_1, text_types, bit_type, serial_type, limit_offset, like_escape_case, cast_target_types, alter_table_add_column)

CI updated to exercise the default feature set only (not --all-features).

Could not fully port yet

  • Full MySQL collation, NULL ordering, exact DECIMAL/AVG typing, display types, identity/LAST_INSERT_ID, warning codes, ON DUPLICATE KEY UPDATE, UDAFs, statement undo log.
  • Many function integration tests and SLT suites remain ignored / out of the default SLT allowlist until #412 and the other hooks land.
  • comparison_coercion.slt still fails on cases beyond comparison_type (e.g. boolean arithmetic in predicates).
Open in Web Open in Cursor 

cursoragent and others added 3 commits November 27, 2026 23:45
…nImpl

Drop PersistencePolicy, FunctionPack, and accepts_* from the default build;
register fixed-arity Concat/ConcatWs/Round/Length/Hex/IsNull overloads and
gate true variadics plus LAST_INSERT_ID behind hook features.

Co-authored-by: Alex Skinner <alexskinner@users.noreply.github.com>
Implement parse via sqlparser rewrite then SqlParser Display+reparse,
DataTypeMapper, comparison_type/boolean_text/begin_commits hooks,
with_mysql() dialect builder, and install_mysql_functions. Drop fork-only
trait methods; keep numeric helpers for tests and future hooks.

Co-authored-by: Alex Skinner <alexskinner@users.noreply.github.com>
Pin kite_sql to upstream main, port SqlDialect::parse / DataTypeMapper /
comparison coercion / session autocommit, register fixed-arity functions via
Database::load, and keep behaviour that needs missing upstream hooks behind
hook-* features. CI and SLT cover the default feature set only.

Co-authored-by: Alex Skinner <alexskinner@users.noreply.github.com>
@alexskinner
alexskinner merged commit bbe4adc into main Nov 28, 2026
3 checks passed
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