Skip to content

Commit

Permalink
prototype
Browse files Browse the repository at this point in the history
Signed-off-by: Austen Lacy <[email protected]>
  • Loading branch information
austenLacy committed Jan 9, 2024
1 parent ab9da01 commit 8fddb23
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions go/vt/vtgate/engine/vindex_lookup.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,15 +212,19 @@ func (vr *VindexLookup) executeNonBatch(ctx context.Context, vcursor VCursor, id
func (vr *VindexLookup) executeBatch(ctx context.Context, vcursor VCursor, ids []sqltypes.Value) ([]*sqltypes.Result, error) {
results := make([]*sqltypes.Result, 0, len(ids))
// for integral types, batch query all ids and then map them back to the input order
vars, err := sqltypes.BuildBindVariable(ids)
if err != nil {
return nil, err
var idVars = make(map[string]*querypb.BindVariable, len(ids))
for _, id := range ids {
idVars[id.ToString()] = sqltypes.ValueBindVariable(id)
}
bindVars := map[string]*querypb.BindVariable{
vr.Arguments[0]: vars,

var bindVars = make(map[string]*querypb.BindVariable, len(vr.Arguments))

for _, arg := range vr.Arguments {
bindVars[arg] = idVars[arg]
}

var result *sqltypes.Result
var err error
if vr.Vindex.AutoCommitEnabled() {
result, err = vcursor.ExecutePrimitiveStandalone(ctx, vr.Lookup, bindVars, false)
} else {
Expand Down

0 comments on commit 8fddb23

Please sign in to comment.