Skip to content

Fixes #37542: Doris partitions follow the partition method and column type - #37686

Merged
Khairajani merged 4 commits into
open-metadata:mainfrom
morningman:doris-partition-details
Nov 19, 2026
Merged

Khairajani merged 4 commits into
open-metadata:mainfrom
morningman:doris-partition-details

Conversation

@morningman

@morningman morningman commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Describe your changes:

Fixes #37542

The Doris connector read partition details with one SHOW PARTITIONS per table, on a connection checked out of the pool for that call, took the PartitionKey of the first row and reported every partition column as TIME-UNIT without an interval. So LIST partitions and RANGE partitions on integer columns were reported as time units, AUTO and dynamic partitions lost their unit, a table with no partition yet (an AUTO PARTITION table before its first load) was reported as unpartitioned, and SHOW PARTITIONS ran on every view, where Doris rejects it.

This change:

  • Reads information_schema.tables joined with information_schema.partitions once per schema. The result is kept in an LRU cache with one entry per ingestion thread, since each of the threads workers ingests its own schema. PARTITION_METHOD tells LIST from RANGE; views, unpartitioned tables and LIST tables need no further query.
  • LIST partition columns are COLUMN-VALUE.
  • A RANGE partition column is TIME-UNIT when it is a DATE or DATETIME and INTEGER-RANGE when it is an integer, the only RANGE partition types Doris allows. The column types are the ones the connector already parses from SHOW FULL COLUMNS.
  • For an OLAP table that is RANGE partitioned or has no partition row, SHOW CREATE TABLE gives the interval: the unit of AUTO PARTITION BY RANGE (date_trunc(col, 'unit')) or dynamic_partition.time_unit (DAY, MONTH, ...). It also names the partition columns of a table without partitions. SHOW CREATE TABLE refuses materialized views, so they get no interval.
  • Before Doris 2.1.7 and 3.0.2, information_schema.partitions has no rows: every OLAP table then takes the SHOW CREATE TABLE path, and a table without a partition clause is unpartitioned.
  • If the per-schema query fails, a warning is logged and the schema's tables are ingested without partition details, as Fixes #37541: Doris primary keys follow the table model #37618 does for primary keys.

With partition auto-detection on (ADR:2026-10-16-profiler-auto-detects-partitions-only-for-declared-services), this changes what the profiler scopes:

  • Integer RANGE partitions are now INTEGER-RANGE, so their column metrics use the default 1–10000 range; before, the detection skipped them and profiled the whole table. A table partitioned on an integer date key such as 20260101 needs its partitioning set in the table profiler config, or auto-detection turned off.
  • LIST partitions on a DATE column are now COLUMN-VALUE and are no longer scoped to the last 3 days.
  • AUTO and dynamic partitions carry their unit, so MONTH and YEAR partitions get the 35- and 370-day windows instead of 3 days.

A materialized view with no partition yet is reported as unpartitioned: Doris lists no partition row for it, and its DDL names the partition column without RANGE or LIST. It is picked up once its first partition exists.

Part of #37537.

Type of change:

  • Bug fix

High-level design:

N/A — small change.

Tests:

Use cases covered

  • A LIST table, single or multi-column, and an AUTO PARTITION BY LIST table get COLUMN-VALUE partitions.
  • A RANGE table on a DATE column gets TIME-UNIT without an interval; on an integer column, INTEGER-RANGE; on (dt, id), one of each.
  • AUTO PARTITION BY RANGE (date_trunc(ts, 'day')) and a dynamic partition with time_unit = DAY get TIME-UNIT with interval DAY.
  • An AUTO PARTITION table without partitions gets its partition column from the DDL, with interval MONTH.
  • RANGE-partitioned materialized views get TIME-UNIT / INTEGER-RANGE by column type.
  • Views, unpartitioned tables and materialized views without partitions are not partitioned, and no per-table query runs for views or LIST tables.
  • Without partition rows (Doris before 2.1.7 / 3.0.2) the DDL gives the same result.
  • A failing partition query keeps the tables, without partition details, and is not retried per table.

Unit tests

  • I added unit tests for the new/changed logic.
  • File added: ingestion/tests/unit/source/database/doris/test_doris_partitions.py
    • a table-driven test that runs DorisSource.get_table_partition_details on real rows from Doris master (information_schema.tables joined with information_schema.partitions, SHOW CREATE TABLE, SHOW FULL COLUMNS; only the database connection is replaced), one case per partition shape;
    • tests of the statements each kind of table sends, that the partition query runs once per schema, and once per schema with two threads;
    • a test of the DDL path when information_schema.partitions has no rows;
    • a test that a failing partition query falls back to no partition details.
  • On main, all 28 tests fail; with this change they all pass.
  • make unit_ingestion ARGS="-n 0 tests/unit/source/database/doris tests/unit/topology/database/test_doris.py": 52 passed.
  • Coverage %: 70% on doris/metadata.py; every line and branch of the new code is covered, the uncovered lines predate this change.

Backend integration tests

  • Not applicable (no backend API changes).

Ingestion integration tests

Playwright (UI) tests

  • Not applicable (no UI changes).

Manual testing performed

  1. Started a local Apache Doris master build with test databases covering LIST (single, multi-column, AUTO), RANGE (DATE, integer, multi-column, AUTO with date_trunc, dynamic), an AUTO PARTITION table without partitions, unpartitioned tables, views and asynchronous materialized views (unpartitioned, RANGE on a date, RANGE on an integer, without partitions).

  2. Ran the Doris source's yield_table against it with a mocked OpenMetadata client, before and after this change:

    Table Before After
    t_uniq LIST (region) TIME-UNIT COLUMN-VALUE
    t_list_multi LIST (region, city) TIME-UNIT ×2 COLUMN-VALUE ×2
    t_auto_list AUTO LIST (city) TIME-UNIT COLUMN-VALUE
    t_types RANGE (k_date DATE) TIME-UNIT TIME-UNIT
    t_auto AUTO RANGE date_trunc(ts, 'day') TIME-UNIT TIME-UNIT, interval DAY
    t_dyn dynamic partition, DAY TIME-UNIT TIME-UNIT, interval DAY
    t_range_int RANGE (id INT) TIME-UNIT INTEGER-RANGE
    t_range_multi RANGE (dt, id) TIME-UNIT ×2 TIME-UNIT, INTEGER-RANGE
    t_auto_empty AUTO RANGE date_trunc(ts, 'month'), no partition not partitioned TIME-UNIT, interval MONTH
    mv_dyn / mv_month MV RANGE (dt DATE) TIME-UNIT TIME-UNIT
    mv_range_int MV RANGE (id INT) TIME-UNIT INTEGER-RANGE

    Views, unpartitioned tables and the materialized view without partitions stay unpartitioned; nothing else in the output changed.

  3. Doris's audit log for the same runs, schema om_verify (13 tables and views): before, 72 statements, including 13 SHOW PARTITIONS (4 of them on views, which fail) and 14 ROLLBACKs from returning the per-call connections; after, 48 statements: one partition query, SHOW CREATE TABLE and SHOW FULL COLUMNS for the 2 RANGE tables, no SHOW PARTITIONS.

  4. An account with only SELECT_PRIV gets the same partition details.

  5. make py_format_check and make static-checks pass (0 errors, no new warnings).

  6. Repeated steps 2 to 4 on Doris 4.1.3 (apache/doris:all-in-one-4.1.3): every table gets the same partition details as on master, before and after this change, with the same statement counts.

UI screen recording:

Not applicable — ingestion-only bug fix with no UI change.

Checklist:

  • I have read the CONTRIBUTING document.

  • My PR title is Fixes <issue-number>: <short explanation>

  • My PR is linked to a GitHub issue via Fixes #<issue-number> above.

  • I have commented on my code, particularly in hard-to-understand areas.

  • For JSON Schema changes: I updated the migration scripts or explained why it is not needed. (N/A: no schema change)

  • For a UI feature or feature task: as part of PR creation, I ran the PR build in Docker with sample data and embedded a verified GitHub-hosted recording plus build/health evidence above (or explained why this requirement is not applicable). (N/A: not a UI change)

  • I have added tests (unit / integration / Playwright as applicable) and listed them above.

  • Self-review: I reviewed the final diff against REVIEW.md and fixed every 🔴 finding, or answered it on the line below.

  • Decision check: if this PR decides something the next contributor could undo, it adds a record under docs/decisions/. (N/A: bug fix; the profiler scoping follows ADR:2026-10-16-profiler-auto-detects-partitions-only-for-declared-services)

  • I have added a test that covers the exact scenario we are fixing. For complex issues, comment the issue number in the test for future reference.

RetriggerView in GreptileConfidence Score: 5/5

The follow-up appears safe to merge; the previous connection recovery issue is addressed.

Summary

Doris now reports partitions by their method and column type, including AUTO and dynamic time units. The follow-up fixes connection recovery after failed partition queries.

  • Doris tables now report partition columns with the right type and time window.

The previous finding is addressed. No new actionable issues were found.

Reviews (2) · Last reviewed commit: "Roll back the Doris connection after a f..." · Reviewed by Greptile

The Doris connector ran SHOW PARTITIONS for every table, views
included, on a connection of its own, and reported every partition
column as TIME-UNIT without an interval.

Read information_schema.tables joined with information_schema.partitions
once per schema instead. LIST partition columns are COLUMN-VALUE; a
RANGE partition column is TIME-UNIT on a DATE or DATETIME column and
INTEGER-RANGE on an integer one. For an OLAP table that is RANGE
partitioned or has no partition row, SHOW CREATE TABLE gives the unit
of an AUTO PARTITION date_trunc or of a dynamic partition, and the
partition columns of a table without partitions.
@morningman
morningman requested a review from a team as a code owner November 12, 2026 13:34
@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically.

Maintainers can bypass this check by adding the skip-pr-checks label.

@Khairajani Khairajani added the safe to test Add this label to run secure Github workflows on PRs label Nov 18, 2026
Resolve the Doris connector conflicts with open-metadata#37705 and open-metadata#37706: read the DDL
through _get_create_statement, and keep a failing per-table partition lookup
from dropping the table (it returns no partition details instead).
A table whose DDL or columns cannot be read is ingested without partition
details. The ADR now records how Doris reports LIST and RANGE partitions.
A lost connection leaves the thread's connection refusing every statement
until it is rolled back, so the next tables would fail with
PendingRollbackError instead of only losing their partition details.
@gitar-bot

gitar-bot Bot commented Nov 18, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 🟡 Medium risk 2 closed / 2 findings

Doris partition classification changes profiler date windows and integer ranges, so misclassified keys could cause profiles to omit or include unintended data.

Doris partition details now come from information_schema once per schema, with partition types taken from the partition method and column type, and SHOW CREATE TABLE supplying intervals. Partition lookup errors that previously dropped tables now keep them, and the partition-type mapping rule is recorded in the PR description. No open issues remain.

✅ 2 closed
✅ Bug: Partition lookup errors now drop the table, and it can be marked deleted

📄 ingestion/src/metadata/ingestion/source/database/doris/metadata.py:343-357
The old get_table_partition_details caught every exception and returned (False, None). The new version reads the DDL (_get_create_table), runs SHOW FULL COLUMNS (_get_columns) and indexes column_types[column_name] with no guard. Only the schema-level query has a try/except. Any failure on one table propagates to the try in CommonDbSourceService.yield_table (common_db_source.py:633-653). Triggers include a table dropped between listing and this call, a SHOW CREATE TABLE privilege error, .one() failing, or a partition column/expression name missing from SHOW FULL COLUMNS (KeyError). When that happens the table yields Either(left=...) instead of a CreateTableRequest, and register_record is skipped. With markDeletedTables on, that table is soft-deleted from OpenMetadata. A partition-metadata problem should cost only the partition details, not the table. Put the per-table DDL/column work inside a try that logs and returns (False, None), and look up column types with .get() so an unknown column is skipped or falls back.

✅ Quality: Doris partition-type mapping rule recorded only in the PR description

📄 ingestion/src/metadata/ingestion/source/database/doris/metadata.py:82-83 📄 ingestion/src/metadata/ingestion/source/database/doris/metadata.py:365-379
The PR changes the tablePartition contract that the profiler's auto-detection reads for Doris. The rule is: "LIST partition columns are COLUMN-VALUE; RANGE columns are TIME-UNIT for DATE/DATETIME and INTEGER-RANGE for integer types". The description also states the user-facing consequence: "integer RANGE partitions now use the default 1-10000 range, so tables partitioned on integer date keys such as 20260101 need their partitioning set in the table profiler config or auto-detection turned off". Neither rule is anywhere in the tree, and the description is lost on squash-merge. The Accepted record 2026-10-16-profiler-auto-detects-partitions-only-for-declared-services.md still says in its Context that "Doris and StarRocks report every partition key" as TIME-UNIT. A record or revision should assert something like: "Doris reports LIST partition columns as COLUMN-VALUE and RANGE columns as TIME-UNIT (DATE/DATETIME, carrying the AUTO/dynamic unit) or INTEGER-RANGE (integers); integer-encoded date keys get the 1–10000 integer window unless configured per table."

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@Khairajani
Khairajani enabled auto-merge (squash) November 19, 2026 08:35
@morningman

Copy link
Copy Markdown
Contributor Author

hi @Khairajani , thanks for your review!

@Khairajani
Khairajani merged commit d138046 into open-metadata:main Nov 19, 2026
52 of 54 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Doris: every partition column is typed TIME_UNIT, including LIST partitions

3 participants