Merge branch 'main-2.x' into db/panic-at-the-cursor
commit
9a9c1e69c0
|
@ -617,11 +617,8 @@ func (b *exprIteratorBuilder) callIterator(ctx context.Context, expr *influxql.C
|
||||||
}
|
}
|
||||||
inputs = append(inputs, input)
|
inputs = append(inputs, input)
|
||||||
case *influxql.SubQuery:
|
case *influxql.SubQuery:
|
||||||
// Identify the name of the field we are using.
|
|
||||||
arg0 := expr.Args[0].(*influxql.VarRef)
|
|
||||||
|
|
||||||
opt.Ordered = false
|
opt.Ordered = false
|
||||||
input, err := buildExprIterator(ctx, arg0, b.ic, []influxql.Source{source}, opt, b.selector, false)
|
input, err := buildExprIterator(ctx, expr.Args[0], b.ic, []influxql.Source{source}, opt, b.selector, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -2882,6 +2882,14 @@ func TestSelect(t *testing.T) {
|
||||||
},
|
},
|
||||||
now: mustParseTime("1970-01-01T00:02:30Z"),
|
now: mustParseTime("1970-01-01T00:02:30Z"),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
// This caused a panic in 1.11.7 and earlier versions
|
||||||
|
name: "Multiple_Subqueries_Fail",
|
||||||
|
q: `SELECT ABS(a_count - b_count) FROM
|
||||||
|
(SELECT COUNT(DISTINCT a_id) AS a_count FROM (SELECT last(v0), tag0 AS a_id FROM m0 GROUP BY tag0) FILL(0)),
|
||||||
|
(SELECT COUNT(DISTINCT b_id) as b_count FROM (SELECT last(v0), tag0 AS a_id FROM m0 GROUP BY tag0) FILL(0))`,
|
||||||
|
err: `invalid expression type: *influxql.Distinct`,
|
||||||
|
},
|
||||||
} {
|
} {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
if tt.onlyArch != "" && runtime.GOARCH != tt.onlyArch {
|
if tt.onlyArch != "" && runtime.GOARCH != tt.onlyArch {
|
||||||
|
|
Loading…
Reference in New Issue