Repository navigation
Fixes #37544: Doris view lineage resolves the internal catalog and parses Doris view DDL - #37706
Conversation
…L as views Doris names its own tables `internal`.`db`.`t` in the definitions of views and materialized views. Lineage took the internal catalog for the database and looked up <service>.internal.<db>.<t>, but the connector ingests the internal catalog as the database databaseName, default when unset, so no Doris view had lineage. Add a Doris table resolution that maps an exact `internal` qualifier to the database of the service, read from its databaseName once per service. Other catalog names and references without a service keep their names, and a service that cannot be read leaves the reference as it is, with a warning. The rule is recorded in docs/decisions/2026-11-13-doris-internal-catalog-names-the-service-database.md. Doris is parsed with the MySQL dialect. The DDL of an async materialized view, with its refresh, key, partition, distribution and PROPERTIES clauses, parses only as far as its tables, without column lineage, and a COMMENT on a backquoted column of a view drops that column's lineage. Add a view lineage parser factory that reads the DDL with sqlglot's Doris dialect, drops those clauses and the column comments, and parses the plain CREATE VIEW, keeping the original query, hash and masked query. Any other definition is parsed as before.
❌ PR checklist incompleteThis 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 |
Code Review ✅ Approved 🟡 Medium riskDoris lineage resolution and view-DDL normalization change table and column lineage; mistakes could link views to incorrect source tables or columns. Fixes Doris view lineage so the internal catalog resolves to the service database, and parses Doris view and materialized view DDL (including column comments and properties) for table and column lineage. No issues found. VerificationRules No rules evaluated Functional validation Not enabledAuto-approval Not enabledFor more verification details, comment OptionsDisplay: compact → Showing compact verification results. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
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).
Describe your changes:
Fixes #37544
Doris view lineage produced no edges, and the definitions of materialized views that #37705 ingests would not have produced column lineage either:
`internal`.`db`.`t`for its own tables. Lineage readinternalas the database and looked up<service>.internal.<db>.<t>, but the connector ingests the internal catalog as the databasedatabaseName,defaultwhen it is not set. No table matched, so no view had lineage. The only workaround wasdatabaseName: internal.BUILD ... REFRESH ..., a key clause,PARTITION BY,DISTRIBUTED BYandPROPERTIESbetween the column list andAS: sqlglot falls back to aCommand, sqlfluff reports it unparsable, and sqlparse finds the tables but turns the four-part column names (`internal`.`db`.`alias`.`col`) into<default>.internal.<col>, which match no column.COMMENTin the column list. Since Doris prints the column names with backquotes ([fix](view) Quote view column names in SHOW CREATE VIEW output apache/doris#66467, in 4.1.5 and later:(`region` comment 'sales region',`manager`, ...)), the parsers drop the lineage of every commented column.This change:
doris/resolution.py, loaded by service type like ClickHouse's. A reference whose database part is exactlyinternal(catalog names are case sensitive in Doris) resolves under the database of the service, read from the service'sdatabaseNameonce per service (boundedLRUCachewith the sharedLRU_CACHE_SIZE). Another catalog name is kept: it will name the database of that catalog once external catalogs are read (Doris: ingest external catalogs (Hive, Iceberg, JDBC, …) as databases #37549). A reference without a service keepsinternal, since no database is known; so does a reference whose service cannot be read, with a warning, and that failure is not cached. The rule is recorded inADR:2026-11-13-doris-internal-catalog-names-the-service-database, since external catalogs and any Doris-side lineage emitter have to name tables the same way.doris/lineage_utils.pywith a view lineage parser factory, plugged in throughDorisLineageSource.get_view_lineage_parser_factoryasADR:2026-11-05-connectors-adapt-view-lineage-parsingdescribes. It reads the definition with sqlglot'sdorisdialect; for a materialized view it drops the properties, and for any view it drops the column comments, then hands the parsers the plainCREATE VIEW name (columns) AS <query>in the MySQL dialect. The returned parser keeps the original query, query hash and masked query. A view without column comments, any other statement, and a definition sqlglot cannot read are parsed as before.Known limits:
-) makes the DDL unreadable; such a materialized view keeps native parsing, which gives its table-level edges but no column lineage. [fix](mtmv) Quote the materialized view name in SHOW CREATE MATERIALIZED VIEW apache/doris#70539 makes Doris quote the name.COUNT(*)has no column lineage, as for every connector.Part of #37537.
Type of change:
High-level design:
N/A — small change.
Tests:
Use cases covered
internalreferences resolve underdefaultand under a configureddatabaseName, never under another database of the service; the database name is read once per service.None,*) keepsinternaland reads no service; a service that cannot be read leaves the reference unresolved with a warning, and the next read succeeds.KEYclause, comments, hash and random distribution, partitioning by an expression, a join, a CTE withUNION ALL) and as Doris 4.1.3 prints it (column list without backquotes, with and without comments) parses with its source tables, target and column lineage, and keeps the original query, hash and masked query.-or reserved-word name, and DDL sqlglot cannot read parse as before.get_view_lineagewith the factory and the resolver) links a materialized view and a view to both source tables with their column lineage, with and withoutdatabaseName.Unit tests
ingestion/tests/unit/source/database/doris/test_doris_view_lineage.py, 22 tests. The DDL is what Doris master prints (PROPERTIES shortened). Resolution goes through the realOpenMetadataclient over a stubbed REST transport.mainthe module does not import. With each part of the change removed in turn: without the resolver 5 tests fail, without the DDL rewrite 9, keeping the column comments 4, without the factory registered on the lineage source 3.make unit_ingestion ARGS="-n 0 tests/unit/source/database/doris tests/unit/topology/database/test_doris.py tests/unit/utils/test_table_binding_resolution.py tests/unit/entity_resolution tests/unit/lineage tests/unit/topology/database/test_clickhouse_lineage_utils.py": 731 passed, 2 skipped.test_all_connector_resolvers_load_without_specs_or_connector_driversloads the Doris resolver with the drivers blocked.doris/resolution.py, 96% ondoris/lineage_utils.py.Backend integration tests
Ingestion integration tests
Playwright (UI) tests
Manual testing performed
Started a local Apache Doris master build with test databases: views over tables, one of them with column comments, and 11 async materialized views covering every clause
SHOW CREATE MATERIALIZED VIEWprints (refresh triggers, incremental refresh, key clauses, partitioning, distribution, comments), a join, a CTE withUNION ALL, and a name printed without quotes.Ran view lineage end to end without a server: the Doris source's metadata path built the table entities, a stand-in for the OpenMetadata API served them, and
get_view_lineageran for every table the lineage producer picks (views and materialized views with a definition), with the Doris lineage source's parser factory:main(4 views)Every view and materialized view links to all its source tables, with a column lineage entry for each column read from a table, except
COUNT(*)columns, theCHAR(255)columns of one view that the connector drops onmain(Doris: CHAR(255) columns are silently dropped during metadata ingestion #37590), and the materialized view whose name is printed without quotes (table-level only).With
databaseName: doris_prod, the same edges linklocal_doris.doris_prod.*tables.Repeated step 2 on Doris 4.1.3 (
apache/doris:all-in-one-4.1.3), which has no incremental refresh: the 13 views and materialized views it can create get the same edges and column lineage as on master (18 edges, 31 column lineage entries with Fixes #37540: Doris materialized views, views and table DDL as Doris reports them #37705, 6 and 11 without), before and after. Doris 4.1.3 prints column lists without backquotes, which the parsers read with or without comments.make py_format_checkandmake static-checkspass (0 errors, no new warnings);scripts/harness/check_decision_records.pyreports the records clean.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.mdand 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/.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.


Confidence Score: 5/5
The PR appears safe to merge; no actionable issues were found.Summary
Fixes Doris view lineage by mapping the
internalcatalog to the service’s database and simplifying view definitions before parsing.internalcatalog names to the service database.morningman identifies two known limits: materialized-view names printed without required quotes retain table-level lineage only, and
COUNT(*)has no column lineage. No actionable issues found.Reviews (1) · Last reviewed commit: "Merge branch 'main' into doris-view-line..." · Reviewed by Greptile