MCPcopy Create free account
hub / github.com/rilldata/rill / QueryBatch

Method QueryBatch

runtime/server/batch_query.go:10–28  ·  view source on GitHub ↗
(req *runtimev1.QueryBatchRequest, srv runtimev1.QueryService_QueryBatchServer)

Source from the content-addressed store, hash-verified

8)
9
10func (s *Server) QueryBatch(req *runtimev1.QueryBatchRequest, srv runtimev1.QueryService_QueryBatchServer) error {
11 // TODO: Performance improvements:
12 // 1. Check for access upfront based on what is in the request
13 // 2. Check for cache and return those queries immediately before creating a goroutine
14 // 3. Use a goroutine pool with size equal to driver's concurrency to execute the queries
15
16 g, ctx := errgroup.WithContext(srv.Context())
17
18 for idx, qry := range req.Queries {
19 idx := idx
20 qry := qry
21 g.Go(func() error {
22 resp := s.forwardQuery(ctx, req.InstanceId, idx, qry)
23 return srv.Send(resp)
24 })
25 }
26
27 return g.Wait()
28}
29
30func (s *Server) forwardQuery(ctx context.Context, instID string, idx int, qry *runtimev1.Query) *runtimev1.QueryBatchResponse {
31 var err error

Callers

nothing calls this directly

Calls 3

forwardQueryMethod · 0.95
ContextMethod · 0.65
SendMethod · 0.65

Tested by

no test coverage detected