Repository navigation
[fix](information_schema) List OLAP tables without partitions in table_options - #70522
Conversation
|
run buildall |
|
/review |
There was a problem hiding this comment.
Static review of PR #70522 at bb7447d82e42f884c7843015685ee99a9700dffa: no new actionable findings. No existing inline findings were present or independently confirmed as blocking. All four changed files and the relevant producer/consumer, initialization, locking and test paths were inspected.
The change restores one table-options row for an internal OLAP table with no partitions and preserves one row per partition otherwise. The inspected flow is:
information_schema.table_options
-> BE SchemaTableOptionsScanner / SchemaPerDbScanner
-> FE fetchSchemaTableData -> TABLE_OPTIONS dispatch
-> tableOptionsForInternalCatalog (table read lock)
-> empty: one table-level row
-> nonempty: existing per-partition rows
-> thirteen typed cells -> BE block
| Critical checkpoint | Conclusion |
|---|---|
| Goal and supporting tests | The empty branch emits a complete row with partition count 0. Added FE tests cover empty AUTO RANGE and populated LIST; regression covers empty AUTO RANGE, AUTO LIST and manual RANGE. Inspected, not executed. |
| Scope and reuse | Focused branch plus a shared helper; moved table-level cells retain their values. |
| Concurrency and locking | Request-local rows; existing table read lock covers the collection and metadata. DDL publication uses the write lock. No new nested lock, RPC, IO or journal wait inside the lock. |
| Lifecycle and initialization | Keys, partition columns and default distribution exist before catalog publication and do not depend on a partition. No new static state, async work or resource lifetime. |
| Configuration | None added. |
| Compatibility | Existing thirteen-cell schema and types retained; no new storage format or function symbol. |
| Thrift/protobuf field IDs | No definition changes; cross-branch ID checks are inapplicable. |
| Parallel paths | Cloud uses the same producer. External tables already emit per-table rows; populated and temporary-partition behavior is preserved. |
| Conditional checks | The empty-collection state is reachable for AUTO/manual partitioned tables, and the comment explains the branch. |
| Test coverage | New unit tests check zero/nonzero cardinality and metadata. Ordered regression snapshots retain RANGE, LIST, unpartitioned, HASH/RANDOM and privilege cases. Dedicated transition/concurrent-DDL tests are absent; those paths were inspected statically. |
| Expected results | All six added rows match DDL/getters, including empty key/range fields; existing snapshots are consistent. Output-generation provenance was not independently verified. |
| Observability | Existing RPC exception logging and error status propagation remain sufficient for this local metadata change. |
| Transactions and persistence | Read-only metadata generation; no EditLog, commit, replay or failover behavior changed. |
| Data writes and atomicity | No writes or new shared mutable state. |
| FE/BE variable propagation | No new variable or sending path; cell order and types match FE schema and BE scanner. |
| Performance | Nonempty cost is unchanged; an empty table adds one metadata row with no new external work. |
| Other issues and core invariants | No additional defect substantiated after recheck. No change to committed-row visibility, visible-version limits or delete bitmaps; Java response objects have ordinary request lifetime, and errors still propagate through the existing RPC boundary. |
No additional user review focus was supplied. Review scope was static only: no builds, tests or benchmarks ran, and no source files were modified. No unresolved candidate or required static coverage gap remains.
Review converged after 1 round(s).
…e_options ### Background `information_schema.table_options` describes each internal OLAP table: its key model (`TABLE_MODEL`, `TABLE_MODEL_KEY`), distribution, bucket and partition counts, and, since apache#56122, its partitioning (`PARTITION_METHOD`, `PARTITION_EXPRESSION`, `PARTITION_KEY`, `RANGE`). apache#56122 made the FE emit one row per partition, so a table with N partitions has N rows that repeat the table-level columns, and an unpartitioned table, which always has its one implicit partition, has one row. A RANGE or LIST partitioned table can have no partition at all: an AUTO PARTITION table before its first load, or a table created with `PARTITION BY RANGE(k) ()` before any `ADD PARTITION`. ### What problem does this PR solve? Issue Number: None Related PR: apache#56122 (introduced the bug) PR Type: Bugfix Problem Summary: On master, a partitioned OLAP table with no partition has no row in `information_schema.table_options`, although `information_schema.tables` lists it. Clients that read the key model from this table lose such tables; the OpenMetadata Doris connector, for example, builds primary keys from `TABLE_MODEL` and `TABLE_MODEL_KEY` and finds none for an AUTO PARTITION table that has not been loaded yet. This PR keeps one row per partition and adds one table-level row, with `PARTITION_NUM` 0, for a table without partitions. ### Details - **Frequency:** Always. `CREATE TABLE t (dt DATETIME NOT NULL, k INT NOT NULL) UNIQUE KEY(dt, k) AUTO PARTITION BY RANGE (date_trunc(dt, 'day')) () DISTRIBUTED BY HASH(k) BUCKETS 1 PROPERTIES ("replication_num" = "1"); SELECT * FROM information_schema.table_options WHERE TABLE_NAME = 't';` returns an empty set until a load creates the first partition. - **Root cause:** `MetadataGenerator.tableOptionsForInternalCatalog` builds every row inside the loop over `OlapTable.getAllPartitions()` (apache#56122). For a table with no partition the loop body never runs, so the table contributes no row. - **Why existing tests missed it:** Unit tests: no FE unit test read `table_options`. Regression: `query_p0/system/test_table_options` (P0 and cloud P0) has RANGE and LIST tables with three partitions each and unpartitioned tables, which always have one partition; none of its tables has zero partitions, so the `.out` that apache#56122 regenerated could not show a missing table. - **Fix:** when `getAllPartitions()` is empty, emit one row before the per-partition loop. Its `PARTITION_EXPRESSION` is the partition columns, the value the table's rows carry once partitions exist, rather than the string `NULL` that marks an unpartitioned table; `PARTITION_KEY` and `RANGE` are empty, as for unpartitioned tables. - **Other paths and branches:** `information_schema.partitions` lists partitions, so a table without partitions has no row there by design. `table_properties`, `information_schema.tables`, `SHOW TABLE STATUS`, and the external-catalog rows of `table_options` are one row per table: not affected. Cloud mode runs the same code. branch-3.1, branch-4.0, branch-4.1, and branch-4.2 lack apache#56122 and emit one row per table, so only master has the bug. ### Testing - Regression `query_p0/system/test_table_options`: three tables without partitions were added (AUTO RANGE, AUTO LIST, and `PARTITION BY RANGE(k1) ()`); `select_check_1` and `select_check_2` list them, and the regenerated `.out` adds only their six rows. On the unfixed FE the suite fails (`Check tag 'select_check_1' failed, line 2 ... Expect cell is: auto_list_table_no_partition But real is: duplicate_table`); on the fixed FE it passes. The privilege checks (`select_check_3` to `select_check_5`) are unchanged. - FE UT `TableOptionsMetadataGeneratorTest` checks the single row of an AUTO RANGE table without partitions (`PARTITION_NUM` 0, `PARTITION_EXPRESSION` `dt`, empty `PARTITION_KEY` and `RANGE`) and that a LIST table with two partitions keeps one row per partition. With the fix: 2 tests, 0 failures; with `MetadataGenerator` reverted to master, `testTableWithoutPartitionHasOneRow` fails with `expected: <1> but was: <0>`. - Both ran locally. The regression suite ran on a single-FE, single-BE cluster: an FE built from this PR and a BE built from 6991e76 (the change is FE-only); the unfixed FE is the same jar with `MetadataGenerator` compiled from master. ### Notes for Reviewers Most of the `MetadataGenerator` diff moves the table-level columns, `TABLE_CATALOG` through `PARTITION_METHOD`, into `newTableOptionsRow`, which the new row and the per-partition rows both use. The moved lines are unchanged except that the comment `key columTyp` now reads `TABLE_MODEL_KEY`; `git diff --color-moved` shows the move. ### Release note None ### Check List (For Author) - Behavior changed: No - Does this need documentation: No - Pre-submission status: Ready ### AI Disclosure - Tool: Claude Code (Claude Opus 5.5) - Generated: code, tests, this description - Human review: not stated - Prompts: As part of the OpenMetadata integration work, asked that Doris keep the per-partition rows of apache#56122 and only add a row for tables without partitions, so the connector can read every table's key model; asked for full local verification (an FE build, the regression suite and the FE unit test, each before and after the fix). Co-Authored-By: Claude Opus 5.5 <[email protected]>
bb7447d to
53c69f2
Compare
|
run buildall |
|
/review |
|
Codex automated review failed and did not complete. Error: Review setup stopped before context preparation ran; inspect the first failed or cancelled setup step. Please inspect the workflow logs and rerun the review after the underlying issue is resolved. |
Local pipeline review — ✅ PASSschema: doris-repo-review/v1
status: PASS
pr: apache/doris#70522
commit: 53c69f2d3d7fd917dd0985ceb62bdec930c8814e
base: c298259d425b0418568bc8f25bbb397dd34b1e16
reviewed_at: 2026-11-17T12:04+08:00
reviewer: morningman
model: gpt-6.1-sol
effort: xhigh
findings: {blocker: 0, major: 0, minor: 0, nit: 0}
rounds: 1
converged: trueNotes for maintainers
Reviewed locally with the |
|
PR approved by anyone and no changes requested. |
|
PR approved by at least one committer and no changes requested. |
Background
information_schema.table_optionsdescribes each internal OLAP table: its key model (TABLE_MODEL,TABLE_MODEL_KEY), distribution, bucket and partition counts, and, since #56122, its partitioning (PARTITION_METHOD,PARTITION_EXPRESSION,PARTITION_KEY,RANGE). #56122 made the FE emit one row per partition, so a table with N partitions has N rows that repeat the table-level columns, and an unpartitioned table, which always has its one implicit partition, has one row. A RANGE or LIST partitioned table can have no partition at all: an AUTO PARTITION table before its first load, or a table created withPARTITION BY RANGE(k) ()before anyADD PARTITION.What problem does this PR solve?
Issue Number: None
Related PR: #56122 (introduced the bug)
PR Type: Bugfix
Problem Summary:
On master, a partitioned OLAP table with no partition has no row in
information_schema.table_options, althoughinformation_schema.tableslists it. Clients that read the key model from this table lose such tables; the OpenMetadata Doris connector, for example, builds primary keys fromTABLE_MODELandTABLE_MODEL_KEYand finds none for an AUTO PARTITION table that has not been loaded yet. This PR keeps one row per partition and adds one table-level row, withPARTITION_NUM0, for a table without partitions.Details
CREATE TABLE t (dt DATETIME NOT NULL, k INT NOT NULL) UNIQUE KEY(dt, k) AUTO PARTITION BY RANGE (date_trunc(dt, 'day')) () DISTRIBUTED BY HASH(k) BUCKETS 1 PROPERTIES ("replication_num" = "1"); SELECT * FROM information_schema.table_options WHERE TABLE_NAME = 't';returns an empty set until a load creates the first partition.MetadataGenerator.tableOptionsForInternalCatalogbuilds every row inside the loop overOlapTable.getAllPartitions()([Enhancement](schema_table)Improve the field information of the information_schema.table_options table. #56122). For a table with no partition the loop body never runs, so the table contributes no row.table_options. Regression:query_p0/system/test_table_options(P0 and cloud P0) has RANGE and LIST tables with three partitions each and unpartitioned tables, which always have one partition; none of its tables has zero partitions, so the.outthat [Enhancement](schema_table)Improve the field information of the information_schema.table_options table. #56122 regenerated could not show a missing table.getAllPartitions()is empty, emit one row before the per-partition loop. ItsPARTITION_EXPRESSIONis the partition columns, the value the table's rows carry once partitions exist, rather than the stringNULLthat marks an unpartitioned table;PARTITION_KEYandRANGEare empty, as for unpartitioned tables.information_schema.partitionslists partitions, so a table without partitions has no row there by design.table_properties,information_schema.tables,SHOW TABLE STATUS, and the external-catalog rows oftable_optionsare one row per table: not affected. Cloud mode runs the same code. branch-3.1, branch-4.0, branch-4.1, and branch-4.2 lack [Enhancement](schema_table)Improve the field information of the information_schema.table_options table. #56122 and emit one row per table, so only master has the bug.Testing
query_p0/system/test_table_options: three tables without partitions were added (AUTO RANGE, AUTO LIST, andPARTITION BY RANGE(k1) ());select_check_1andselect_check_2list them, and the regenerated.outadds only their six rows. On the unfixed FE the suite fails (Check tag 'select_check_1' failed, line 2 ... Expect cell is: auto_list_table_no_partition But real is: duplicate_table); on the fixed FE it passes. The privilege checks (select_check_3toselect_check_5) are unchanged.TableOptionsMetadataGeneratorTestchecks the single row of an AUTO RANGE table without partitions (PARTITION_NUM0,PARTITION_EXPRESSIONdt, emptyPARTITION_KEYandRANGE) and that a LIST table with two partitions keeps one row per partition. With the fix: 2 tests, 0 failures; withMetadataGeneratorreverted to master,testTableWithoutPartitionHasOneRowfails withexpected: <1> but was: <0>.MetadataGeneratorcompiled from master.Notes for Reviewers
Most of the
MetadataGeneratordiff moves the table-level columns,TABLE_CATALOGthroughPARTITION_METHOD, intonewTableOptionsRow, which the new row and the per-partition rows both use. The moved lines are unchanged except that the commentkey columTypnow readsTABLE_MODEL_KEY;git diff --color-movedshows the move.Release note
None
Check List (For Author)
AI Disclosure