Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix x proto queries routing #438

Merged
merged 1 commit into from
Jan 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions router/qrouter/proxy_routing.go
Original file line number Diff line number Diff line change
@@ -223,6 +223,8 @@ func (qr *ProxyQrouter) routeByClause(ctx context.Context, expr lyx.Node, meta *
case *lyx.ColumnRef:
/* simple key-value pair */
switch rght := texpr.Right.(type) {
case *lyx.ParamRef:
// ignore
case *lyx.AExprConst:
alias, colname := lft.TableAlias, lft.ColName

24 changes: 23 additions & 1 deletion router/qrouter/proxy_routing_test.go
Original file line number Diff line number Diff line change
@@ -854,7 +854,7 @@ func TestInsertMultiDataspace(t *testing.T) {
})

_ = db.AddShardingRule(context.TODO(), &qdb.ShardingRule{
ID: "id1",
ID: "id2",
DataspaceId: dataspace2,
TableName: "",
Entries: []qdb.ShardingRuleEntry{
@@ -901,6 +901,28 @@ func TestInsertMultiDataspace(t *testing.T) {

for _, tt := range []tcase{
{
query: "SELECT curr_version from schema_version where i=2 and db_name=$1'",
exp: routingstate.ShardMatchState{
Route: &routingstate.DataShardRoute{
Shkey: kr.ShardKey{
Name: "sh1",
},
Matchedkr: &kr.KeyRange{
ShardID: "sh1",
ID: "id1",
Dataspace: dataspace1,
LowerBound: []byte("1"),
UpperBound: []byte("11"),
},
},
TargetSessionAttrs: "any",
},
dataspace: dataspace1,
err: nil,
},

{

query: "INSERT INTO xxxdst1(i) VALUES(5);",
dataspace: dataspace1,
exp: routingstate.ShardMatchState{