Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions client/space_lua/aggregates.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1602,7 +1602,7 @@ test("applyQuery: group by + select with aggregates", async () => {
data,
{
objectVariable: "p",
groupBy: [parseExpressionString("p.dept")],
groupBy: [{ expr: parseExpressionString("p.dept") }],
select: parseExpressionString(
"{ dept = key, total = sum(p.salary), n = count(p.salary) }",
),
Expand Down Expand Up @@ -1633,7 +1633,7 @@ test("applyQuery: group by + having with aggregate", async () => {
data,
{
objectVariable: "p",
groupBy: [parseExpressionString("p.dept")],
groupBy: [{ expr: parseExpressionString("p.dept") }],
having: parseExpressionString("count(p.name) > 1"),
},
new LuaEnv(),
Expand All @@ -1655,7 +1655,7 @@ test("applyQuery: group by without aggregates still works", async () => {
data,
{
objectVariable: "p",
groupBy: [parseExpressionString("p.dept")],
groupBy: [{ expr: parseExpressionString("p.dept") }],
select: parseExpressionString("key"),
},
new LuaEnv(),
Expand All @@ -1678,7 +1678,7 @@ test("applyQuery: having with compound expression", async () => {
data,
{
objectVariable: "p",
groupBy: [parseExpressionString("p.dept")],
groupBy: [{ expr: parseExpressionString("p.dept") }],
having: parseExpressionString("sum(p.salary) > 100"),
select: parseExpressionString("{ dept = key, total = sum(p.salary) }"),
},
Expand All @@ -1703,7 +1703,7 @@ test("applyQuery: implicit _ with group by + multiple aggregates", async () => {
const results = await applyQuery(
data,
{
groupBy: [parseExpressionString("_.category")],
groupBy: [{ expr: parseExpressionString("_.category") }],
select: parseExpressionString(
"{ cat = key, total = sum(_.price), best = max(_.price) }",
),
Expand Down Expand Up @@ -1737,7 +1737,7 @@ test("applyQuery: group by + having + order by + limit", async () => {
data,
{
objectVariable: "t",
groupBy: [parseExpressionString("t.tag")],
groupBy: [{ expr: parseExpressionString("t.tag") }],
having: parseExpressionString("count(t.page) > 1"),
orderBy: [{ expr: parseExpressionString("key"), desc: false }],
select: parseExpressionString("key"),
Expand All @@ -1761,7 +1761,7 @@ test("applyQuery: select with aggregate division (float result)", async () => {
data,
{
objectVariable: "p",
groupBy: [parseExpressionString("p.dept")],
groupBy: [{ expr: parseExpressionString("p.dept") }],
select: parseExpressionString(
"{ dept = key, avg_salary = sum(p.salary) / count(p.salary) }",
),
Expand Down
8 changes: 4 additions & 4 deletions client/space_lua/ast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,10 +311,10 @@ export type LuaQueryClause =
| LuaGroupByClause
| LuaHavingClause;

// Field list used by `from`, `select` and `group by` clauses
export type LuaFromClause = {
type: "From";
name?: string;
expression: LuaExpression;
fields: LuaTableField[];
} & ASTContext;

export type LuaWhereClause = {
Expand Down Expand Up @@ -348,12 +348,12 @@ export type LuaOrderBy = {

export type LuaSelectClause = {
type: "Select";
expression: LuaExpression;
fields: LuaTableField[];
} & ASTContext;

export type LuaGroupByClause = {
type: "GroupBy";
expressions: LuaExpression[];
fields: LuaTableField[];
} & ASTContext;

export type LuaHavingClause = {
Expand Down
Loading
Loading