feat(query): backport data lineage to v1.2.925 - #20417
Open
youngsofun wants to merge 17 commits into
Open
Conversation
feat(query): reject alter view query changes
feat(query): extract query lineage
* feat(query): persist lineage through history logs * feat(query): add get_lineage history traversal * test(query): cover lineage history traversal * test(logging): extend history startup timeout
* feat(query): support catalog and view table fields * fix(query): validate external catalog visibility by name * fix(query): skip external catalog visibility checks * fix(query): avoid external catalog RBAC lookup * test(query): check Iceberg fields before cleanup
Contributor
🤖 CI Job Analysis (Retry 4)
📊 Summary
🚫 MAX RETRIES REACHEDMaximum retry count (3) has been reached. Manual intervention required. 🔍 Job Details
🤖 AboutAutomated analysis using job annotations to distinguish infrastructure issues (auto-retried) from code/test issues (manual fixes needed). |
This was referenced Aug 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I hereby agree to the terms of the CLA available at: https://docs.databend.com/dev/policies/cla/
Summary
Backport the data-lineage feature series to
release/v1.2.925so it can be released asv1.2.925-patch-12.This includes plan-level lineage extraction, history-backed persistence, lineage traversal and neighbor lookup, catalog/View field resolution, permanent-by-default retention, View reconciliation with
REFRESH LINEAGE, dedicated lineage configuration, explicit materialized CTE extraction, system-source filtering, and the View-definition safety invariant.Motivation
v1.2.925-patch-11does not contain the data-lineage feature. Customers pinned to thev1.2.925maintenance line need the same lineage interfaces and persistence behavior without upgrading to a later release train. This backport brings the complete reviewed lineage series to that maintenance branch while preserving release-specific APIs and excluding unrelated main-branch features.Backported PRs
feat(query): reject alter view definition changesfeat(query): extract query lineage from plansfeat(query): add history-based data lineagerefactor(query): reshape lineage history metadatarefactor(query): clarify get lineage object outputfeat(query): add direct lineage neighbor lookupfeat(query): support catalog and view table fieldsfeat(query): retain lineage history by defaultfeat(query): refresh lineage for existing viewsfeat(query): configure lineage independentlyfeat(query): extract explicit materialized CTE lineagefix(query): ignore system sources in lineageReviewer guide
The first 12 commits preserve the source-PR order above. Review them against their linked source PRs, then review the release-only fixes separately:
7896fd3d13—fix(query): adapt lineage backport to v1.2.92536fe9dffbf—fix(query): correct expression scan column typo: behavior-neutral rename of a typo already present inrelease/v1.2.925, required by the current Typos check.56c3a2be7c—test(query): remove stale lineage harness source: completes the#20315test move by removing the obsolete history-test source path.cdfbfccb20—fix(query): correct inverted index comment typo: comment-only correction of another typo already present inrelease/v1.2.925and exposed by the current Typos check.ca1a4991a3changes only theDevworkflow base filter so this release-targeted PR can run full CI. It is temporary and will be removed after the run completes.For the four cherry-picks that required manual conflict resolution, the focused review areas are:
#20201: SQL lineage test helpers undersrc/query/sql/tests/it/frameworkandsrc/query/sql/tests/it/planner/lineage.rs. The production lineage implementation follows the source PR; only the release-local test harness location/API differs.#20235:interpreter_table_create.rs,table_function_factory.rs, andtests/logging/history_table/check_logs_table.sh. Verify that the existing temporary-table lifecycle,stream_backlog, and release history checks remain intact around the new lineage calls.#20315: theREFRESH LINEAGEAST/binder/plan/access/interpreter paths. Review this as an allowlist: only lineage wiring was added; no Materialized View variants or handlers from the source PR's newer main-branch context are present.#20322:src/query/sql/tests/it/planner/lineage.rs. Only the release-localinit_testing_globals_with_configimport path differs while capture moves to[lineage].Conflict choices that retain existing release code or omit unrelated main-branch code do not produce a standalone Git diff. They remain in their source commits so the intermediate commits do not intentionally introduce broken release behavior.
Backport conflict resolution
#20201: kept thev1.2.925SQL test harness undertests/it/frameworkinstead of importing the later main-branch move intotest-support; ported only lineage-specific test helpers. The metadata column iterator API adjustment is in the final release compatibility commit.#20235: preserved the release branch's CREATE TABLE temporary-table lifecycle and existingstream_backlogregistration; added only lineage target-ID propagation andget_lineage. Kept release history resource checks unchanged.#20315: added onlyREFRESH LINEAGEAST, binder, plan, access, and interpreter wiring. Materialized View parser/plan/access code present in the main-branch context was intentionally excluded.#20322: kept the release-local test initialization path while switching capture to the dedicated[lineage]configuration.fix(query): adapt lineage backport to v1.2.925:CatalogType::Paimonhandling is omitted because that variant is not present in this release, andcolumns_by_table_index()results are converted from the releaseVecAPI into iterators.Risk and compatibility
ALTER VIEW ... AS ...is rejected after this change.CREATE OR REPLACE VIEWremains the supported definition-replacement path. This prevents persisted lineage from becoming stale.[lineage]is the public configuration entry point. Older binaries ignore the TOML section during rolling upgrades; the new CLI option must not be passed to older binaries.Type of change
Related Issues
Source PRs: #20202, #20201, #20235, #20289, #20296, #20300, #20304, #20311, #20315, #20322, #20327, #20349.
Tests
Unit Tests
cargo test -p databend-common-sql --test it planner::lineage -- --nocapture(21 passed)cargo test -p databend-common-ast --test it test_statement -- --nocapture(2 passed)cargo test -p databend-common-config --lib(17 passed)cargo test -p databend-common-tracing --lib(13 passed)cargo check -p databend-common-sql --libStateless Tests
tests/lineageand will run in CI.cargo fmt --all -- --checkgit diff --checkbash -n tests/logging/history_table/check_logs_table.shtests/lineage/*.shscripts.AI assistance
This change is