Repository navigation
Add SQLite input/output format - #104510
Conversation
|
Workflow [PR], commit [60f71b8] Summary: ✅
AI ReviewSummaryThis PR adds SQLite input/output format support and tightens the Findings💡 Nits
Final Verdict
LLVM Coverage ReportMeasured on commit 60f71b8.
Changed lines: Changed C/C++ lines covered: 1537/1699 (90.46%) · Uncovered code |
|
The |
Register `SQLite` as an input and output format backed by the SQLite serialization API. Add format settings, documentation, and stateless tests for table names, schema inference, more data types, and roundtrip behavior.
…o that it is more consistent with other data format such as arrow file
…y to have regression
…to avoid sqlite's Double-quoted String Literals issue.
…ormat that should be verified.
|
🕵 Pushed The one conflict, in Checks: the merge changes the same 208 files as the branch. Its diff against CI on |
Resolve the conflict with the move of the settings changes history into the setting declarations (ee6b44f): the history records this PR added to `SettingsChangesHistory.cpp` now live as trailing arguments of the `DECLARE` of each setting. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A query-backed `ENGINE = SQLite(path, query('...'))` source is read-only, so
materializing an empty database on `CREATE TABLE` with an explicit column list
only defers the failure to the first `SELECT`. Keep `allow_create` off for
`table_or_query.isQuery`, so the `CREATE` fails closed like the schema-inference
path, and extend `05137` with the explicit-schema query-backed case.
Addresses review: ClickHouse#104510 (comment)
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…ety only for filtered columns Concurrent `INSERT`s into one `SQLite` database failed with `database is locked`: every sink has its own connection and a deferred `BEGIN` only takes the writer lock on the first `sqlite3_step`, where SQLITE_BUSY cannot be retried inside an explicit transaction. Chunk transactions now start with `BEGIN IMMEDIATE`, and `BEGIN IMMEDIATE` / `COMMIT` are retried on SQLITE_BUSY with a bounded, cancellable wait (`executeSQLiteRetryOnBusy`). Polling alone starves a writer while others commit back to back, so the writers of this server are additionally queued on a per-database mutex keyed on `sqlite3_db_filename`. The pushdown-safety gate probed every physical column (with a `pragma_table_list` lookup each) on every table-backed read. It now checks only the columns referenced by the `WHERE` / `PREWHERE` of the query tree (nothing for a filterless read), and `isStrictTable` is looked up once per read. Tests: `05259_sqlite_storage_concurrent_inserts`, `05260_sqlite_pushdown_filter_referenced_columns`. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…a paths `openSQLiteDB` always used `SQLITE_OPEN_READWRITE`, so a plain `SELECT`, `DESCRIBE` or `SHOW TABLES` through the `sqlite` table function, the `SQLite` table engine or the `SQLite` database engine could modify the file: a read-write connection rolls back and deletes a hot journal left by a crashed writer. Replace the `allow_create` flag with `SQLiteOpenMode` (`ReadOnly`, `ReadWrite`, `ReadWriteCreate`) and use `ReadOnly` for every connection that only reads data or metadata. Only `StorageSQLite::write` opens the file read-write, and only a genuine `CREATE` with an explicit column list (or `CREATE DATABASE`) may create it. A read over a hot journal now fails with `attempt to write a readonly database` and leaves the file untouched, like the `SQLite` input format. Also add a test for `Bool` in `FORMAT SQLite`: it is already declared as `INTEGER` (`Bool` is stored as `UInt8`, so `WhichDataType::isUInt` is true) and inferred back as a number. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
🕵 Addressed the AI review on
All 93 |
…EGIN IMMEDIATE` Mirror the transaction strategy of the `SQLite` storage sink in the direct local-file `FORMAT SQLite` path: `BEGIN IMMEDIATE` and `COMMIT` go through `executeSQLiteRetryOnBusy`, so another connection holding a lock on the same database makes the export wait (bounded, cancellable) instead of failing with `database is locked`. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
🕵 @groeneai, investigate the failure: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=104510&sha=57cdb7bea0267392d81b549665ebf98cc0d145a7&name_0=PR&name_1=Stateless%20tests%20(arm_binary%2C%20parallel) ( |
|
The fix is already in progress: #116920. It is not merged yet, so this build did not have it. I reproduced the failure on master The same read without parallel replicas passed 150 of 150. Each range the coordinator assigns reuses the part's stream and raises its read bound, and |
The `Documentation` of the `SQLite` table engine and table function said that a `NULL` first value and an empty result give `String`. That is only true for a column without a declared type: `declaredTypeAgreesWithStorageClass` keeps a declared numeric type in both cases, as pinned by `05238_sqlite_query_schema_null_first_row`. Generated docs will be refreshed by the autogeneration workflow. Related: ClickHouse#104510 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
After merging master: - `tryReadFloatText` is gone from master (precise parsing is the default); use `tryReadFloatTextPrecise`. - The legacy `docs/en` tree was removed and every format must carry structured documentation (`04514_every_format_must_have_documentation`). Move the page into `setDocumentation`, add `docs/reference/formats/OpenMetrics.mdx` with the autogenerated region, the `navigation.json` entry and the overview-table row, and rewrite the links to the `/reference/...` routes (as done for `SQLite` in ClickHouse#104510). - The `TimeSeries` outer column `time_series` was renamed to `samples` (version 3), and the metrics target became metric families with a `metric_family` column. The format mirrors the engine's outer columns, so the points column is now `samples`; `time_series` is still accepted, as in `TimeSeries` tables of version 2 and earlier. - `SELECT * FROM <TimeSeries table>` works on master now, so make `SELECT * ... FORMAT OpenMetrics` and `INSERT ... FORMAT OpenMetrics` round-trip: the writer takes the `__name__` tag as the sample name instead of emitting it as a label, accepts the metadata-only rows returned for each metric family, and accepts `LowCardinality` string columns. The skipped integration test for this is replaced by a stateless test, and the remaining integration test uses `timeSeriesMetricFamilies` and `metric_family`. Review feedback from `clickhouse-gh`: - Reject raw control characters in quoted label values on input; the writer cannot emit them. - Validate metric family names in `# HELP`, `# TYPE` and `# UNIT`. - Reject `# TYPE` tokens outside the OpenMetrics type vocabulary. - Enforce the per-type sample-name suffix rule on output for `counter`, `histogram`, `gaugehistogram`, `summary` and `info` (sample name = family name + suffix), with one suffix table shared with the reader's family folding; require `le` on histogram buckets (on input too) and `quantile` on bare summary samples. - Convert between `DateTime64` scales and milliseconds with overflow checks instead of unchecked multiplication. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Adds SQLite input/output format support, including schema inference, direct local-file access, and fail-closed predicate pushdown for the SQLite table engine and table function.
Closes: #33763
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Workflow [PR]
Sync PR [sync-upstream/pr/104510]
Version info
26.10.1.1133-master(included in26.10and later)