Skip to content

fix(query): add partition write regression tests - #20426

Merged
sundy-li merged 2 commits into
databendlabs:mainfrom
KKould:ci/partition-write-coverage
Sep 7, 2026
Merged

fix(query): add partition write regression tests#20426
sundy-li merged 2 commits into
databendlabs:mainfrom
KKould:ci/partition-write-coverage

Conversation

@KKould

@KKould KKould commented Sep 2, 2026

Copy link
Copy Markdown
Member

I hereby agree to the terms of the CLA available at: https://docs.databend.com/dev/policies/cla/

Summary

This test-only PR expands coverage for physical partition metadata and hash write layout edge cases:

  • Verify that a MERGE moving a row across a partition boundary preserves exact metadata for pruning.
  • Verify that missing DEFAULT and stored computed partition columns are materialized before hash routing and layout.
  • Verify that nullable partition values remain isolated by block and support IS NULL pruning.
  • Verify that multi-table INSERT keeps each target table's partition expression and metadata independent.

No production behavior is changed.

Current write-path support observed while adding these tests:

Write path Current status
INSERT SELECT / VALUES / OVERWRITE / CTAS Uses the common table write layout
COPY INTO table Uses the common local write layout; distributed cross-node partition routing is a separate concern
Multi-table INSERT Uses per-target chunk transforms rather than the common hash write layout
REPLACE INTO Uses an independent replace pipeline
MERGE unmatched INSERT Uses the mutation-specific append pipeline rather than the common hash write layout
Materialized-view refresh Inherits either the INSERT or MERGE path selected by its refresh strategy

This PR intentionally adds coverage only. Unifying the remaining write paths requires separate design work rather than statement-specific fixes.

Tests

  • Unit Test
  • Logic Test
  • Benchmark Test
  • No Test - Explain why

Added or extended these sqllogictest files:

  • tests/sqllogictests/suites/base/09_fuse_engine/09_0054_partition_by.test
  • tests/sqllogictests/suites/base/09_fuse_engine/09_0100_insert_multi_table.test
  • tests/sqllogictests/suites/ee/02_computed_column/02_0001_partition_by.test

Local execution was skipped; CI will run the logic-test suites.

Type of change

  • Bug Fix (non-breaking change which fixes an issue)
  • New Feature (non-breaking change which adds functionality)
  • Breaking Change (fix or feature that could cause existing functionality not to work as expected)
  • Documentation Update
  • Refactoring
  • Performance Improvement
  • Other: test coverage

AI assistance

  • AI usage: An AI coding agent helped inspect the write paths, draft the logic-test coverage, and prepare the PR summary. The responsible human reviewed the final test diff and selected the submission scope.
  • Responsible human: @KKould
  • The responsible human has read every line of this diff and can explain each change

This change is Reviewable

@github-actions github-actions Bot added the pr-build this PR changes build/testing/ci steps label Sep 2, 2026
@KKould
KKould requested a review from sundy-li September 2, 2026 02:53
@KKould KKould self-assigned this Sep 2, 2026
@KKould
KKould force-pushed the ci/partition-write-coverage branch from 0fd5b48 to d81879b Compare September 2, 2026 02:54
@KKould KKould changed the title ci(query): expand partition write coverage fix(query): add partition write regression tests Sep 2, 2026
@github-actions github-actions Bot added the pr-bugfix this PR patches a bug in codebase label Sep 2, 2026

@sundy-li sundy-li left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

发现 1 个阻塞问题:

  • [P1] 修正 stored computed column 的表达式类型 — tests/sqllogictests/suites/ee/02_computed_column/02_0001_partition_by.test:26
    p 声明为 INTInt32),但 Databend 将 id % 2 推导为 Int16,因此 CREATE TABLE 在 EE sqllogic CI 中直接失败:expected computed column expression have type Int32 NULL, but id % 2 has type Int16 NULL。请将表达式显式转换为 INT(例如 p INT AS ((id % 2)::INT) STORED),或让列类型与表达式类型一致,并重新运行相关 CI。

其余 diff 仅为测试新增;当前 linux / sqllogic / eeready 检查失败,所以本次 review 不予 approve。

@KKould
KKould requested a review from sundy-li September 2, 2026 09:17

@sundy-li sundy-li left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the latest head 4dd3ff2. The previous computed-column type issue is fixed by using SMALLINT, and all required CI checks pass, including linux / sqllogic / ee. No remaining blocking issues.

@sundy-li
sundy-li added this pull request to the merge queue Sep 7, 2026
Merged via the queue into databendlabs:main with commit b71dbbf Sep 7, 2026
183 of 187 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-bugfix this PR patches a bug in codebase pr-build this PR changes build/testing/ci steps

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants