-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[Enhance](Iceberg) Enhance branch/tag operations with validation and comprehensive test coverage #59917
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Enhance](Iceberg) Enhance branch/tag operations with validation and comprehensive test coverage #59917
Conversation
* update * add auth case
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
2863f9b to
d3d3328
Compare
|
run external |
FE Regression Coverage ReportIncrement line coverage |
|
run buildall |
TPC-H: Total hot run time: 32039 ms |
TPC-DS: Total hot run time: 174509 ms |
ClickBench: Total hot run time: 26.77 s |
FE UT Coverage ReportIncrement line coverage |
FE Regression Coverage ReportIncrement line coverage |
|
run buildall |
TPC-H: Total hot run time: 31535 ms |
TPC-DS: Total hot run time: 174087 ms |
ClickBench: Total hot run time: 26.93 s |
|
run buildall |
TPC-H: Total hot run time: 31934 ms |
FE Regression Coverage ReportIncrement line coverage |
TPC-DS: Total hot run time: 176797 ms |
ClickBench: Total hot run time: 26.82 s |
|
PR approved by at least one committer and no changes requested. |
|
PR approved by anyone and no changes requested. |
FE Regression Coverage ReportIncrement line coverage |
…comprehensive test coverage (#59917) - Related Pr: #51727 ### What problem does this PR solve? ## Overview This PR improves Iceberg table branch/tag functionality by adding input parameter validation, optimizing snapshot loading logic, and significantly expanding test coverage. ## Iceberg Logic Modifications ### 1. Optimize Snapshot Loading **File**: `fe/fe-core/src/main/java/org/apache/doris/nereids/StatementContext.java` - Modified `loadSnapshots` method signature to accept `specificTable` parameter - Supports loading snapshot for a specific table instead of iterating through all tables - Caller (`BindRelation.java:419`) passes the concrete table object, improving performance and precision ### 2. Enhanced Parameter Validation **File**: `fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java` Added parameter validation for branch/tag creation operations: - `RETAIN` time value must be greater than 0 - `SNAPSHOTS` (minimum snapshots to keep) must be greater than 0 - `RETENTION` time must be greater than 0 - Throws clear `IllegalArgumentException` with descriptive error messages ### 3. Branch/Tag Name Validation **File**: `fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/IcebergMetadataOps.java` - Validate branch name is not empty when creating a branch - Validate tag name is not empty when creating a tag - Throws `UserException` to notify users ### 4. Syntax Support Limitation **File**: `regression-test/suites/external_table_p0/iceberg/iceberg_branch_tag_operate.groovy` Clarified that `CREATE OR REPLACE BRANCH IF NOT EXISTS` syntax combination is not supported ## New Test Case Coverage This PR adds 10 comprehensive test suites covering the following scenarios: | Test File | Coverage | |-----------|----------| | `iceberg_branch_complex_queries.groovy` | Complex query scenarios with branch operations | | `iceberg_branch_cross_operations.groovy` | Cross operations between branches and tags | | `iceberg_branch_partition_operations.groovy` | Partition-related branch operations | | `iceberg_branch_retention_and_snapshot.groovy` | Snapshot expiration and retention policies | | `iceberg_branch_tag_auth.groovy` | Branch/tag permission and authorization | | `iceberg_branch_tag_edge_cases.groovy` | Edge cases and exception handling | | `iceberg_branch_tag_parallel_op.groovy` | Concurrent/parallel operations testing | | `iceberg_branch_tag_schema_change_extended.groovy` | Schema change scenarios | | `iceberg_branch_tag_system_tables.groovy` | System table query verification | | `iceberg_tag_retention_and_consistency.groovy` | Tag consistency validation | ## Improvements - **More precise snapshot loading**: Avoids unnecessary full table iteration - **Stronger parameter validation**: Catches configuration errors early with clear error messages - **Comprehensive test coverage**: Multi-dimensional validation from edge cases to concurrent operations Co-authored-by: zgxme <u143@qq.com>
What problem does this PR solve?
Overview
This PR improves Iceberg table branch/tag functionality by adding input parameter validation, optimizing snapshot loading logic, and significantly expanding test coverage.
Iceberg Logic Modifications
1. Optimize Snapshot Loading
File:
fe/fe-core/src/main/java/org/apache/doris/nereids/StatementContext.javaloadSnapshotsmethod signature to acceptspecificTableparameterBindRelation.java:419) passes the concrete table object, improving performance and precision2. Enhanced Parameter Validation
File:
fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.javaAdded parameter validation for branch/tag creation operations:
RETAINtime value must be greater than 0SNAPSHOTS(minimum snapshots to keep) must be greater than 0RETENTIONtime must be greater than 0IllegalArgumentExceptionwith descriptive error messages3. Branch/Tag Name Validation
File:
fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/IcebergMetadataOps.javaUserExceptionto notify users4. Syntax Support Limitation
File:
regression-test/suites/external_table_p0/iceberg/iceberg_branch_tag_operate.groovyClarified that
CREATE OR REPLACE BRANCH IF NOT EXISTSsyntax combination is not supportedNew Test Case Coverage
This PR adds 10 comprehensive test suites covering the following scenarios:
iceberg_branch_complex_queries.groovyiceberg_branch_cross_operations.groovyiceberg_branch_partition_operations.groovyiceberg_branch_retention_and_snapshot.groovyiceberg_branch_tag_auth.groovyiceberg_branch_tag_edge_cases.groovyiceberg_branch_tag_parallel_op.groovyiceberg_branch_tag_schema_change_extended.groovyiceberg_branch_tag_system_tables.groovyiceberg_tag_retention_and_consistency.groovyImprovements
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)