feat(query): support session WAP branch routing#19971
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9efcdad9fd
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
Codex Review: Didn't find any major issues. Swish! ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
fix fix fix fix fix fix fix fix fix fix fix fix fix
|
@codex review |
|
Codex Review: Didn't find any major issues. You're on a roll. ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
|
It seems that SET enable_experimental_table_ref=1;
CREATE OR REPLACE DATABASE repro_describe_wap;
USE repro_describe_wap;
CREATE TABLE t(a INT, b STRING);
INSERT INTO t VALUES (1, 'base');
ALTER TABLE t CREATE BRANCH dev;
ALTER TABLE t/dev ADD COLUMN c INT;
UPDATE t/dev SET c = 10 WHERE a = 1;
INSERT INTO t/dev VALUES (2, 'branch', 20);
SET wap_branch = 'dev';
SELECT * FROM t ORDER BY a;
DESCRIBE t;
SHOW FIELDS FROM t;
DESCRIBE t/dev; |
I hereby agree to the terms of the CLA available at: https://docs.databend.com/dev/policies/cla/
Summary
Adds a wap_branch session setting to route unqualified table references through table branches for WAP workflows. Reads use the configured branch when it exists and fall back to the base table when it does not; writes target the configured branch and fail if the branch is missing.
This also keeps persisted definitions stable by suppressing session WAP routing when validating or replaying stored view/index SQL, including view schema inference, privilege checks, planner cache paths, CTE binding, DESCRIBE, system.columns, system.statistics, and CREATE TABLE LIKE view.
Adds sqllogictest coverage for read/write routing, explicit branch precedence, missing branch behavior, persisted view/index semantics, planner cache suppression, CTE suppression propagation, and view metadata consistency.
Tests
Type of change
This change is