Skip to content

Commit 2ecb896

Browse files
committed
Merge branch 'hnsw_dev' into hnsw_index
2 parents 1bdf77c + 5795fff commit 2ecb896

File tree

2 files changed

+35
-6
lines changed

2 files changed

+35
-6
lines changed

pkg/sql/colexec/table_function/hnsw_create.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626
"github.com/matrixorigin/matrixone/pkg/container/batch"
2727
"github.com/matrixorigin/matrixone/pkg/container/types"
2828
"github.com/matrixorigin/matrixone/pkg/container/vector"
29+
"github.com/matrixorigin/matrixone/pkg/defines"
2930
"github.com/matrixorigin/matrixone/pkg/sql/colexec"
3031
"github.com/matrixorigin/matrixone/pkg/util/executor"
3132
"github.com/matrixorigin/matrixone/pkg/vectorindex"
@@ -239,6 +240,15 @@ func hnsw_runSql_fn(proc *process.Process, sql string) (executor.Result, error)
239240
if !ok {
240241
panic("missing lock service")
241242
}
243+
244+
//-------------------------------------------------------
245+
topContext := proc.GetTopContext()
246+
accountId, err := defines.GetAccountId(proc.Ctx)
247+
if err != nil {
248+
return executor.Result{}, err
249+
}
250+
//-------------------------------------------------------
251+
242252
exec := v.(executor.SQLExecutor)
243253
opts := executor.Options{}.
244254
// All runSql and runSqlWithResult is a part of input sql, can not incr statement.
@@ -247,6 +257,6 @@ func hnsw_runSql_fn(proc *process.Process, sql string) (executor.Result, error)
247257
WithTxn(proc.GetTxnOperator()).
248258
WithDatabase(proc.GetSessionInfo().Database).
249259
WithTimeZone(proc.GetSessionInfo().TimeZone).
250-
WithAccountID(proc.GetSessionInfo().AccountId)
251-
return exec.Exec(proc.GetTopContext(), sql, opts)
260+
WithAccountID(accountId)
261+
return exec.Exec(topContext, sql, opts)
252262
}

pkg/vectorindex/hnsw/search.go

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525
"github.com/matrixorigin/matrixone/pkg/common/moerr"
2626
moruntime "github.com/matrixorigin/matrixone/pkg/common/runtime"
2727
"github.com/matrixorigin/matrixone/pkg/container/vector"
28+
"github.com/matrixorigin/matrixone/pkg/defines"
2829
"github.com/matrixorigin/matrixone/pkg/util/executor"
2930
"github.com/matrixorigin/matrixone/pkg/vectorindex"
3031
"github.com/matrixorigin/matrixone/pkg/vectorindex/cache"
@@ -314,6 +315,15 @@ func runSql_fn(proc *process.Process, sql string) (executor.Result, error) {
314315
if !ok {
315316
panic("missing lock service")
316317
}
318+
319+
//-------------------------------------------------------
320+
topContext := proc.GetTopContext()
321+
accountId, err := defines.GetAccountId(proc.Ctx)
322+
if err != nil {
323+
return executor.Result{}, err
324+
}
325+
//-------------------------------------------------------
326+
317327
exec := v.(executor.SQLExecutor)
318328
opts := executor.Options{}.
319329
// All runSql and runSqlWithResult is a part of input sql, can not incr statement.
@@ -322,8 +332,8 @@ func runSql_fn(proc *process.Process, sql string) (executor.Result, error) {
322332
WithTxn(proc.GetTxnOperator()).
323333
WithDatabase(proc.GetSessionInfo().Database).
324334
WithTimeZone(proc.GetSessionInfo().TimeZone).
325-
WithAccountID(proc.GetSessionInfo().AccountId)
326-
return exec.Exec(proc.GetTopContext(), sql, opts)
335+
WithAccountID(accountId)
336+
return exec.Exec(topContext, sql, opts)
327337
}
328338

329339
var runSql_streaming = runSql_streaming_fn
@@ -334,6 +344,15 @@ func runSql_streaming_fn(proc *process.Process, sql string, stream_chan chan exe
334344
if !ok {
335345
panic("missing lock service")
336346
}
347+
348+
//-------------------------------------------------------
349+
topContext := proc.GetTopContext()
350+
accountId, err := defines.GetAccountId(proc.Ctx)
351+
if err != nil {
352+
return executor.Result{}, err
353+
}
354+
//-------------------------------------------------------
355+
337356
exec := v.(executor.SQLExecutor)
338357
opts := executor.Options{}.
339358
// All runSql and runSqlWithResult is a part of input sql, can not incr statement.
@@ -342,7 +361,7 @@ func runSql_streaming_fn(proc *process.Process, sql string, stream_chan chan exe
342361
WithTxn(proc.GetTxnOperator()).
343362
WithDatabase(proc.GetSessionInfo().Database).
344363
WithTimeZone(proc.GetSessionInfo().TimeZone).
345-
WithAccountID(proc.GetSessionInfo().AccountId).
364+
WithAccountID(accountId).
346365
WithStreaming(stream_chan, error_chan)
347-
return exec.Exec(proc.GetTopContext(), sql, opts)
366+
return exec.Exec(topContext, sql, opts)
348367
}

0 commit comments

Comments
 (0)