Skip to content

Conversation

@iwanghc
Copy link
Collaborator

@iwanghc iwanghc commented Nov 10, 2025

User description

关联的 issue

https://github.com/actiontech/sqle-ee/issues/2572

描述你的变更

新增获取SQL中列选择性插件接口,并在MySQL插件中实现

确认项(pr提交后操作)

Tip

请在指定复审人之前,确认并完成以下事项,完成后✅


  • 我已完成自测
  • 我已记录完整日志方便进行诊断
  • 我已在关联的issue里补充了实现方案
  • 我已在关联的issue里补充了测试影响面
  • 我已确认了变更的兼容性,如果不兼容则在issue里标记 not_compatible
  • 我已确认了是否要更新文档,如果要更新则在issue里标记 need_update_doc


Description

  • 新增 SQL 列选择性接口

  • 添加 SQL 解析和列提取逻辑

  • 扩展 GRPC 与插件支持

  • 更新接口定义及 protobuf 消息


Diagram Walkthrough

flowchart LR
  A["新增 SQL 解析与实现"] --> B["mysql.go 中实现选择性接口"]
  A --> C["parser_helper.go 提取列信息"]
  C --> D["插件适配与 GRPC 处理"]
  D --> E["更新 proto 定义"]
Loading

File Walkthrough

Relevant files
Enhancement
6 files
mysql.go
添加 MysqlDriverImpl 的 GetSelectivityOfSQLColumns 方法             
+78/-0   
parser_helper.go
添加 ExtractColumnsFromSelectStmt 工具函数                                         
+103/-0 
driver_grpc_server.go
增加 GRPC 处理 GetSelectivityOfSQLColumns 接口                                 
+24/-0   
plugin_adapter_v2.go
实现 PluginImplV2 的 GetSelectivityOfSQLColumns 方法                   
+22/-0   
plugin_adapter_v1.go
添加 PluginImplV1 未实现的 GetSelectivityOfSQLColumns 方法             
+4/-0     
impl.go
添加 DriverImpl 的 GetSelectivityOfSQLColumns 方法桩                     
+4/-0     
Documentation
3 files
driver_interface.go
添加 Driver 接口 GetSelectivityOfSQLColumns 定义                             
+1/-0     
plugin_interface.go
添加 Plugin 接口 GetSelectivityOfSQLColumns 定义                             
+1/-0     
driver_v2.proto
增加 proto 消息和 rpc 接口定义                                                                       
+15/-0   
Tests
1 files
sqled_test.go
添加 mockDriver 的 GetSelectivityOfSQLColumns 测试方法                   
+4/-0     
Additional files
1 files
driver_v2.pb.go +296/-196

@github-actions
Copy link

PR Reviewer Guide 🔍

🎫 Ticket compliance analysis 🔶

2572 - Partially compliant

Compliant requirements:

  • 新增 SQL 列选择性接口
  • 添加 SQL 解析和列提取逻辑
  • 扩展 GRPC 与插件支持
  • 更新接口定义及 protobuf 消息

Non-compliant requirements:

  • 插件 v1 适配器中 GetSelectivityOfSQLColumns 方法未实现

Requires further human verification:

  • 请确认各接口在不同版本下的实际使用需求
⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

未实现函数

GetSelectivityOfSQLColumns 方法在插件 v1 适配器中返回 unimplement 错误,请审查是否需要实现或明确标注为不支持新接口

func (s *PluginImplV1) GetDatabaseDiffModifySQL(ctx context.Context, calibratedDSN *driverV2.DSN, objInfos []*driverV2.DatabasCompareSchemaInfo) ([]*driverV2.DatabaseDiffModifySQLResult, error) {
	return nil, fmt.Errorf("unimplement this method")
}

func (p *PluginImplV1) GetSelectivityOfSQLColumns(ctx context.Context, sql string) (map[string]map[string]float32, error) {
	return nil, fmt.Errorf("unimplement this method")
}
接口未实现

GetSelectivityOfSQLColumns 方法在 DriverImpl 中仅返回 nil,缺乏实际逻辑实现,请确认是否需要补充实现或增加注释说明

func (p *DriverImpl) GetSelectivityOfSQLColumns(ctx context.Context, sql string) (map[string]map[string]float32, error) {
	return nil, nil
}

@github-actions
Copy link

Failed to generate code suggestions for PR

@BugsGuru BugsGuru merged commit 0535d80 into main Nov 10, 2025
4 checks passed
@BugsGuru BugsGuru deleted the sqlfash_api_update_ce branch November 10, 2025 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants