Closed waynexia closed 1 week ago
[!NOTE]
Reviews paused
Use the following commands to manage reviews:
@coderabbitai resume
to resume automatic reviews.@coderabbitai review
to trigger a single review.
This update introduces several enhancements to the MatchesFunction
in a Rust codebase. It includes the registration of MatchesFunction
in the function registry, improvements to parsing logic for unary operators, and the introduction of new SQL test cases showcasing the practical application of the matches
function. The new enum variants and parsing logic changes bolster the function's pattern-matching capabilities.
File | Change Summary |
---|---|
src/common/function/src/function_registry.rs |
Added MatchesFunction to the imports and registered it in the FUNCTION_REGISTRY . |
src/common/function/src/scalars/matches.rs |
Introduced registration method for MatchesFunction , enhanced pattern and token parsing logic. |
tests/cases/standalone/common/select/matches.result , tests/cases/standalone/common/select/matches.sql |
Added SQL test cases demonstrating table creation, data insertion, selection with pattern matching, and table deletion. |
sequenceDiagram
participant Client as SQL Client
participant DB as Database
participant FuncReg as Function Registry
participant MatchesFunc as MatchesFunction
Client->>DB: CREATE TABLE test(id INT, name VARCHAR)
DB-->>Client: Table created
Client->>DB: INSERT INTO test VALUES (1, 'Alice'), (2, 'Bob')
DB-->>Client: Data inserted
Client->>FuncReg: Register MatchesFunction
FuncReg-->>MatchesFunc: Called register
Client->>DB: SELECT * FROM test WHERE name MATCHES 'A.*'
DB->>MatchesFunc: Evaluate pattern
MatchesFunc-->>DB: Matches result
DB-->>Client: Query result
Client->>DB: DROP TABLE test
DB-->>Client: Table dropped
In lines of code so neat and tight,
Patterns now match, with new insight.
From tables built, to rows we seek,
Our functions strong, no longer meek.
Registry grows, the test it shows,
Data flows where logic glows.
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
@coderabbitai pause
Attention: Patch coverage is 97.48954%
with 6 lines
in your changes missing coverage. Please review.
Project coverage is 84.88%. Comparing base (
aa4d10e
) to head (5ab443b
). Report is 1 commits behind head on main.
I hereby agree to the terms of the GreptimeDB CLA.
Refer to a related PR or issue link (optional)
What's changed and what's your intention?
The one last piece
Checklist
Summary by CodeRabbit
New Features
matches
function for advanced pattern matching in SQL queries.Bug Fixes
Must
,Negative
,Optional
) more effectively in pattern matching.Tests
matches
function.