xylaaaaa opened a new pull request, #71023: URL: https://github.com/apache/doris/pull/71023
### Background Doris reads Delta Lake data through Delta Kernel planning in FE and native file scanning in BE. Spark also exposes the Delta commit log as a typed `DESCRIBE HISTORY` result. ### What problem does this PR solve? Issue Number: #69884 Related PR: #69904 (native reader), #70536 (time travel) PR Type: Feature Problem Summary: Delta catalogs need SQL access to commit history. This PR exposes `t$history` with the 15 Spark history columns for filesystem and Unity Catalog tables, including ratified commits awaiting backfill. ### Details - **Change map.** 898 changed lines in production code, 563 in tests and fixtures, and 50 generated regression-output lines. The Delta connector resolves the history handle, selects the retained commit range, and projects log JSON. The native Delta reader fills Doris blocks from the resulting Thrift batches. - **Scope.** Columns keep the Spark names and include `TIMESTAMPTZ(6)`, two string maps, and the job and notebook structs. History retains each commit version even when its `commitInfo` action is absent. - **Design.** The existing connector SPI resolves the system table and checks base-table access. FE pins the upper version, uses in-commit timestamps where enabled, and adjusts legacy file mtimes in version order. BE reads inline batches of up to 1,000 rows and applies projected columns and residual filters. - **Usage.** `SELECT version, timestamp, operation FROM catalog_name.db_name.`table_name$history` ORDER BY version DESC;` - **Default behavior.** Simple version comparisons reduce the selected commit interval. Version-only scans can skip opening JSON bodies. Filtering by version preserves the earlier mtime context when timestamps are requested. - **Compatibility.** `TDeltaLakeFileDesc.history_rows` is optional at field ID 3. The field assignments were checked on `branch-deltalake`, master, and release branches 3.1, 4.0, 4.1, and 4.2. History uses the existing FE guard for BEs in smooth upgrade. - **UC endpoint.** For managed history scans, FE requests ratified commits from the Unity Catalog service configured by `deltalake.uc.uri`. Configuring the origin requires catalog creation or catalog property alteration privileges. The query requires `SELECT` on the base table and UC `READ` through the catalog connection. ### Testing - macOS arm64 FE and ASAN BE builds, with PCH disabled for the local BE build. - Delta FE unit tests. 131 connector tests and two metastore tests passed. Two optional planning diagnostics were skipped. - 20 targeted ASAN BE tests passed, including the native history reader, Delta Parquet reader, and deletion-vector tests. - `test_deltalake_history`, `test_deltalake_uc_history`, and `test_deltalake_uc` passed in a normal regression replay. Both history suites compared all 15 columns with Spark 4.0.1 and Delta 4.4.1. The UC suite verified the latest commit on Unity Catalog 0.7.0 with its numbered JSON withheld. The fixture paths are configured through `deltalakeHistoryReference` and `deltalakeUcHistoryReference`. - A local privilege probe confirmed that history reads follow the source-table `SELECT` grant. - Clang-format 16, build hygiene checks, and targeted clang-tidy passed. ### Notes for Reviewers Each scan uses its pinned snapshot coordinates. FE closes log iterators as it consumes each commit. BE refers to the current split's inline data for the reader lifetime and bypasses condition caching for this virtual range. `EXPLAIN` shows the history upper version and split count. `DESC` shows the 15 history columns. The generic `SHOW CREATE TABLE` system-table command renders the source table's DDL. ### Release note Delta Lake catalogs expose a read-only `t$history` system table for querying commit metadata and timestamps. ### Check List (For Author) - Behavior changed: Yes (see Details). - Does this need documentation: Yes. Include the history table in the Delta Lake connector documentation for the integration. - Pre-submission status: Ready. ### AI Disclosure - Tool: OpenAI Codex. - Generated: Implementation, tests, and PR description from the requested design. - Human review: Pending. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
