Skip to content

Commit 4bae80b

Browse files
committed
feat: add GetSelectivityOfSQLColumns method to Plugin and Driver interfaces, and update proto definitions
1 parent 457f72b commit 4bae80b

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

sqle/driver/plugin_interface.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ type Plugin interface {
5151
Backup(ctx context.Context, backupStrategy string, sql string, backupMaxRows uint64) (backupSqls []string, executeResult string, err error)
5252

5353
RecommendBackupStrategy(ctx context.Context, sql string) (*RecommendBackupStrategyRes, error)
54+
GetSelectivityOfSQLColumns(ctx context.Context, sql string) (map[string] /*table name*/ map[string] /*column name*/ float32, error)
5455
}
5556

5657
type RecommendBackupStrategyRes struct {

sqle/driver/v2/driver_interface.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ type Driver interface {
9999

100100
Backup(ctx context.Context, req *BackupReq) (*BackupRes, error)
101101
RecommendBackupStrategy(ctx context.Context, req *RecommendBackupStrategyReq) (*RecommendBackupStrategyRes, error)
102+
GetSelectivityOfSQLColumns(ctx context.Context, sql string) (map[string] /*table name*/ map[string] /*column name*/ float32, error)
102103
}
103104

104105
const (

sqle/driver/v2/proto/driver_v2.proto

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ service Driver {
3939
rpc EstimateSQLAffectRows(EstimateSQLAffectRowsRequest) returns (EstimateSQLAffectRowsResponse); // Introduced from SQLE v2.2304.0
4040
rpc GetDatabaseObjectDDL(DatabaseObjectInfoRequest) returns (DatabaseSchemaObjectResponse);
4141
rpc GetDatabaseDiffModifySQL(DatabaseDiffModifyRequest) returns (DatabaseDiffModifyRponse);
42+
rpc GetSelectivityOfSQLColumns(GetSelectivityOfSQLColumnsRequest) returns (GetSelectivityOfSQLColumnsResponse);
4243
}
4344

4445
message Empty {}
@@ -476,4 +477,18 @@ message DatabaseDiffModifyRponse {
476477
message SchemaDiffModify {
477478
string schemaName = 1;
478479
repeated string modifySQLs = 2;
480+
}
481+
482+
message GetSelectivityOfSQLColumnsRequest {
483+
Session session = 1;
484+
string sql = 2;
485+
}
486+
487+
message SelectivityOfSQLColumns {
488+
string tableName = 1;
489+
map<string, float> selectivityOfColumns = 2;
490+
}
491+
492+
message GetSelectivityOfSQLColumnsResponse {
493+
repeated SelectivityOfSQLColumns selectivity = 1;
479494
}

0 commit comments

Comments
 (0)