What I'm doing:
This pull request adds support for IF NOT EXISTS and IF EXISTS clauses to the CREATE GROUP PROVIDER and DROP GROUP PROVIDER SQL statements, ensuring these operations are idempotent and error-tolerant. It also introduces comprehensive unit tests to verify the correct behavior of these clauses, and updates the parser and semantic analyzer accordingly.
Enhancements to Group Provider DDL Statements:
Added support for IF NOT EXISTS to CREATE GROUP PROVIDER and IF EXISTS to DROP GROUP PROVIDER, allowing these statements to succeed silently if the provider already exists or does not exist, respectively. The implementation includes proper error handling and DDL exception messages for cases where these clauses are not specified. [1] [2]
Updated the SQL parser (AstBuilder) to recognize and propagate the IF NOT EXISTS and IF EXISTS flags in CreateGroupProviderStmt and DropGroupProviderStmt objects.
Enhanced the semantic analyzer to respect the new flags, throwing exceptions only when appropriate (i.e., when the flags are not set and the provider's existence does not match the operation). [1] [2]
Testing Improvements:
Added a new test class GroupProviderStatementTest with comprehensive unit tests covering all scenarios for the new IF NOT EXISTS and IF EXISTS functionality, including creation, dropping, legacy constructors, and sequential operations.
Error Handling:
Wrapped the execution of dropGroupProviderStatement in the DDL statement executor with error reporting to ensure runtime exceptions are properly managed.
What I'm doing:
This pull request primarily focuses on cleaning up and simplifying the AST (Abstract Syntax Tree) visitor interface in the SQL parser by removing deprecated code and unnecessary method overrides. The changes also include the removal of the deprecated AlterLoadErrorUrlClause class. These updates help reduce code redundancy and improve maintainability.
Key changes:
1. Removal of Deprecated and Redundant Code:
Deleted the deprecated AlterLoadErrorUrlClause class from the codebase, as it is no longer needed.
Removed numerous default method overrides for various visit*Statement methods in the AstVisitorExtendInterface that simply delegated to existing base methods, reducing boilerplate and simplifying the interface. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19]
2. Cleanup of Unused Imports:
Removed import statements for classes that are no longer referenced due to the method removals, further streamlining the code. [1] [2]
These changes collectively make the AST visitor interface easier to maintain and extend in the future by eliminating unnecessary code and focusing on essential logic.
## Why I'm doing:
Given a Julian date, our current approach to obtaining `trunc_to_quarter` or `trunc_to_month` is:
1. First decode it into year, month, and day.
2. Then, we adjust the corresponding month and day,
3. and finally compute the new Julian date from the adjusted year, month, and day.
However, in practice, it is unnecessary to compute a new Julian date from the adjusted values. Instead, we can directly calculate the offset between the target Julian and the current Julian based on the decoded year, month, and day.
benchmark: speedup around 50%
- trunc_to_month: https://quick-bench.com/q/fZiRaC7U1pHODHsWQuO1cvFN2qM
- trunc_to_quarter: https://quick-bench.com/q/Idw7wLB74k-5PNW2u4xcXNsoeKA
Signed-off-by: zihe.liu <ziheliu1024@gmail.com>
## Why I'm doing:
A tablet becomes unrepaired (stuck in VERSION_INCOMPLETE) after balance-triggered migration when the only valid source replica is marked DECOMMISSION.
### Scenario
1. Tablet x created on BE1 (single-replica table); ingestion starts.
2. Cluster balance migrates the tablet to BE2; old replica on BE1 becomes DECOMMISSION after migration.
3. During migration, ingestion on BE1 was still running; max committed version at that moment was 1, so the replica on BE2 is version 1.
4. Ingestion then finishes successfully on BE1 and advances its replica to version 2.
5. Replica on BE2 remains version 1 and is marked VERSION_INCOMPLETE.
6. Repair on BE2 fails because its only source (BE1) is in DECOMMISSION, so no eligible source is available → tablet cannot repair.
## What I'm doing:
Allow DECOMMISSION replicas to serve as temporary repair sources while they are healthy and accessible, until the target catches up or the replica is actually dropped.
Tighten source selection predicates: prefer latest, healthy replicas; include DECOMMISSION replicas as sources only when they are the sole candidates and have newer versions.
Ensure version reconciliation runs before finalizing decommission of the source replica.
Signed-off-by: sevev <qiangzh95@gmail.com>
What I'm doing:
This pull request refactors the handling of SQL SHOW statements to introduce a new abstract class, EnhancedShowStmt, which provides advanced query features such as filtering, sorting, and limiting results. All SHOW statement classes that support these features now extend EnhancedShowStmt instead of the original ShowStmt. The original ShowStmt class has been removed, and relevant code has been updated to use the new class. This change improves code clarity and extensibility for SHOW statements with advanced capabilities.
Key changes include:
Core Refactoring:
Introduced a new abstract class EnhancedShowStmt that extends the capabilities of SHOW statements with support for WHERE (predicate), ORDER BY, and LIMIT clauses, as well as transformation to SELECT statements. (fe/fe-core/src/main/java/com/starrocks/sql/ast/EnhancedShowStmt.java)
Removed the original ShowStmt abstract class, consolidating its logic into EnhancedShowStmt and updating the visitor interface accordingly. (fe/fe-core/src/main/java/com/starrocks/sql/ast/ShowStmt.java, fe/fe-core/src/main/java/com/starrocks/sql/ast/AstVisitorExtendInterface.java) [1] [2]
SHOW Statement Implementations:
Updated all SHOW statement classes that support advanced features (such as ShowTableStmt, ShowDbStmt, ShowColumnStmt, etc.) to extend EnhancedShowStmt instead of ShowStmt. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12]
Analyzer and Executor Updates:
Refactored analyzer and executor logic to check for EnhancedShowStmt instead of ShowStmt, ensuring that only enhanced statements receive advanced analysis and execution logic. (fe/fe-core/src/main/java/com/starrocks/qe/StmtExecutor.java, fe/fe-core/src/main/java/com/starrocks/qe/ShowExecutor.java, fe/fe-core/src/main/java/com/starrocks/sql/analyzer/ShowStmtAnalyzer.java) [1] [2] [3] [4]
Imports and Test Adjustments:
Updated imports throughout the codebase and in tests to use EnhancedShowStmt where applicable. (fe/fe-core/src/main/java/com/starrocks/qe/ShowExecutor.java, fe/fe-core/src/main/java/com/starrocks/sql/analyzer/ShowStmtAnalyzer.java, fe/fe-core/src/test/java/com/starrocks/sql/analyzer/AnalyzeShowTest.java) [1] [2] [3]
Signed-off-by: HangyuanLiu <460660596@qq.com>
Signed-off-by: sunny.xl <wxl24life@gmail.com>
Signed-off-by: Drake Wang <wxl24life@gmail.com>
Co-authored-by: Kevin Cai <caixh.kevin@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Why I'm doing:
starrocks-python-client support most of the python3 version, but there are some new features that is not compatibility for Python under 3.10
What I'm doing:
use Union for supporting type hints in python under 3.10
not setting kw_only for dataclasses in python under 3.10