diff --git a/go/test/endtoend/utils/utils.go b/go/test/endtoend/utils/utils.go index df015d03d7c..51c04733964 100644 --- a/go/test/endtoend/utils/utils.go +++ b/go/test/endtoend/utils/utils.go @@ -234,7 +234,7 @@ func WaitForAuthoritative(t *testing.T, ks, tbl string, readVSchema func() (*int for { select { case <-timeout: - return fmt.Errorf("schema tracking didn't mark table t2 as authoritative until timeout") + return fmt.Errorf("schema tracking didn't mark table %v.%v as authoritative until timeout", ks, tbl) default: res, err := readVSchema() require.NoError(t, err, res) @@ -340,7 +340,7 @@ func WaitForColumn(t testing.TB, vtgateProcess cluster.VtgateProcess, ks, tbl, c if !isMap { break } - if colName, exists := colDef["name"]; exists && colName == col { + if colName, exists := colDef["name"]; exists && strings.EqualFold(colName.(string), col) { return nil } } diff --git a/go/test/endtoend/vtgate/queries/tpch/tpch_test.go b/go/test/endtoend/vtgate/queries/tpch/tpch_test.go index b1dd4ef1e98..513aea94a86 100644 --- a/go/test/endtoend/vtgate/queries/tpch/tpch_test.go +++ b/go/test/endtoend/vtgate/queries/tpch/tpch_test.go @@ -131,6 +131,36 @@ order by l_returnflag, l_linestatus;`, }, + { + name: "Q11", + query: `select + ps_partkey, + sum(ps_supplycost * ps_availqty) as value +from + partsupp, + supplier, + nation +where + ps_suppkey = s_suppkey + and s_nationkey = n_nationkey + and n_name = 'MOZAMBIQUE' +group by + ps_partkey having + sum(ps_supplycost * ps_availqty) > ( + select + sum(ps_supplycost * ps_availqty) * 0.0001000000 + from + partsupp, + supplier, + nation + where + ps_suppkey = s_suppkey + and s_nationkey = n_nationkey + and n_name = 'MOZAMBIQUE' + ) +order by + value desc;`, + }, } for _, testcase := range testcases { diff --git a/go/vt/vtgate/engine/scalar_aggregation.go b/go/vt/vtgate/engine/scalar_aggregation.go index 85e90420ff9..929536b9cdf 100644 --- a/go/vt/vtgate/engine/scalar_aggregation.go +++ b/go/vt/vtgate/engine/scalar_aggregation.go @@ -80,7 +80,7 @@ func (sa *ScalarAggregate) NeedsTransaction() bool { // TryExecute implements the Primitive interface func (sa *ScalarAggregate) TryExecute(ctx context.Context, vcursor VCursor, bindVars map[string]*querypb.BindVariable, wantfields bool) (*sqltypes.Result, error) { - result, err := vcursor.ExecutePrimitive(ctx, sa.Input, bindVars, wantfields) + result, err := vcursor.ExecutePrimitive(ctx, sa.Input, bindVars, true) if err != nil { return nil, err } @@ -114,7 +114,7 @@ func (sa *ScalarAggregate) TryStreamExecute(ctx context.Context, vcursor VCursor var fields []*querypb.Field fieldsSent := !wantfields - err := vcursor.StreamExecutePrimitive(ctx, sa.Input, bindVars, wantfields, func(result *sqltypes.Result) error { + err := vcursor.StreamExecutePrimitive(ctx, sa.Input, bindVars, true, func(result *sqltypes.Result) error { // as the underlying primitive call is not sync // and here scalar aggregate is using shared variables we have to sync the callback // for correct aggregation.