@@ -25,6 +25,7 @@ import (
25
25
"github.com/matrixorigin/matrixone/pkg/common/moerr"
26
26
moruntime "github.com/matrixorigin/matrixone/pkg/common/runtime"
27
27
"github.com/matrixorigin/matrixone/pkg/container/vector"
28
+ "github.com/matrixorigin/matrixone/pkg/defines"
28
29
"github.com/matrixorigin/matrixone/pkg/util/executor"
29
30
"github.com/matrixorigin/matrixone/pkg/vectorindex"
30
31
"github.com/matrixorigin/matrixone/pkg/vectorindex/cache"
@@ -314,6 +315,15 @@ func runSql_fn(proc *process.Process, sql string) (executor.Result, error) {
314
315
if ! ok {
315
316
panic ("missing lock service" )
316
317
}
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
+
317
327
exec := v .(executor.SQLExecutor )
318
328
opts := executor.Options {}.
319
329
// 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) {
322
332
WithTxn (proc .GetTxnOperator ()).
323
333
WithDatabase (proc .GetSessionInfo ().Database ).
324
334
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 )
327
337
}
328
338
329
339
var runSql_streaming = runSql_streaming_fn
@@ -334,6 +344,15 @@ func runSql_streaming_fn(proc *process.Process, sql string, stream_chan chan exe
334
344
if ! ok {
335
345
panic ("missing lock service" )
336
346
}
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
+
337
356
exec := v .(executor.SQLExecutor )
338
357
opts := executor.Options {}.
339
358
// 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
342
361
WithTxn (proc .GetTxnOperator ()).
343
362
WithDatabase (proc .GetSessionInfo ().Database ).
344
363
WithTimeZone (proc .GetSessionInfo ().TimeZone ).
345
- WithAccountID (proc . GetSessionInfo (). AccountId ).
364
+ WithAccountID (accountId ).
346
365
WithStreaming (stream_chan , error_chan )
347
- return exec .Exec (proc . GetTopContext () , sql , opts )
366
+ return exec .Exec (topContext , sql , opts )
348
367
}
0 commit comments