Copilot commented on code in PR #1132:
URL: 
https://github.com/apache/skywalking-banyandb/pull/1132#discussion_r3245901838


##########
pkg/query/logical/measure/measure_plan_distributed.go:
##########
@@ -119,6 +119,7 @@ func newUnresolvedDistributed(query 
*measurev1.QueryRequest, pushDownAgg bool) l
 }
 
 func (ud *unresolvedDistributed) Analyze(s logical.Schema) (logical.Plan, 
error) {
+       indexMode := s.(*schema).measure.IndexMode

Review Comment:
   When `DistributedAnalyze` is called with multiple groups (`len(ss) > 1`), 
the schema passed to `Analyze` is built by `mergeSchema` 
(pkg/query/logical/measure/schema.go:186-192), which returns a `*schema` whose 
`measure` field is left nil. The new assertion `s.(*schema).measure.IndexMode` 
will then nil-pointer-deref and crash the liaison. The dquery dispatcher 
constructs one schema per group and forwards them to `DistributedAnalyze` 
(banyand/dquery/measure.go:59-79), so any multi-group measure query will 
trigger this panic.
   
   Consider either (a) carrying `IndexMode` through `mergeSchema` (e.g., 
requiring all merged schemas to agree on IndexMode and storing it on the merged 
`*schema`), or (b) guarding the access (`if ms := s.(*schema); ms.measure != 
nil { indexMode = ms.measure.IndexMode }`) and deriving IndexMode from 
`schemas[0]` in the multi-group case. Either way, please add a regression test 
that exercises the multi-group distributed path with `IndexMode=true`.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to