Skip to content

Commit 1832a13

Browse files
committed
unskip tests
1 parent dbe6a42 commit 1832a13

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

enginetest/queries/queries.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9352,6 +9352,20 @@ from typestable`,
93529352
{"0"}, {"1"}, {"0"}, {"1"},
93539353
},
93549354
},
9355+
// https://github.com/dolthub/dolt/issues/7095
9356+
// References in group by and having should be allowed to match select aliases
9357+
{
9358+
Query: "select y as z from xy group by (y) having AVG(z) > 0",
9359+
Expected: []sql.Row{{1}, {2}, {3}},
9360+
},
9361+
{
9362+
Query: "select y as z from xy group by (z) having AVG(z) > 0",
9363+
Expected: []sql.Row{{1}, {2}, {3}},
9364+
},
9365+
{
9366+
Query: "select y + 1 as z from xy group by (z) having AVG(z) > 1",
9367+
Expected: []sql.Row{{2}, {3}, {4}},
9368+
},
93559369
}
93569370

93579371
var KeylessQueries = []QueryTest{
@@ -9603,20 +9617,6 @@ FROM mytable;`,
96039617
{"DECIMAL"},
96049618
},
96059619
},
9606-
// https://github.com/dolthub/dolt/issues/7095
9607-
// References in group by and having should be allowed to match select aliases
9608-
{
9609-
Query: "select y as z from xy group by (y) having AVG(z) > 0",
9610-
Expected: []sql.Row{{1}, {2}, {3}},
9611-
},
9612-
{
9613-
Query: "select y as z from xy group by (z) having AVG(z) > 0",
9614-
Expected: []sql.Row{{1}, {2}, {3}},
9615-
},
9616-
{
9617-
Query: "select y + 1 as z from xy group by (z) having AVG(z) > 1",
9618-
Expected: []sql.Row{{2}, {3}, {4}},
9619-
},
96209620
}
96219621

96229622
var VersionedQueries = []QueryTest{

sql/planbuilder/aggregates.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,7 @@ func (b *Builder) buildAggFunctionArgs(inScope *scope, e *ast.FuncExpr, gb *grou
372372
var args []sql.Expression
373373
for _, arg := range e.Exprs {
374374
e := b.selectExprToExpression(inScope, arg)
375+
// if GetField is an alias, alias must be masking a column
375376
if gf, ok := e.(*expression.GetField); ok && gf.TableId() == 0 {
376377
e = b.selectExprToExpression(inScope.parent, arg)
377378
}

0 commit comments

Comments
 (0)