Add test case

This commit is contained in:
jilen 2025-07-15 14:36:07 +08:00
parent 0b4a6cb0c4
commit 5ed56e4009
2 changed files with 26 additions and 1 deletions

View file

@ -176,7 +176,9 @@ object Query {
Aggregation(AggregationOperator.size, e)
inline def min: Agg[Long] = Aggregation(AggregationOperator.min, e)
inline def max: Agg[Long] = Aggregation(AggregationOperator.min, e)
inline def max: Agg[Long] = Aggregation(AggregationOperator.max, e)
}
}

View file

@ -154,4 +154,27 @@ class MirrorSqlContextSuite extends munit.FunSuite {
)
}
test("Aggregations - size") {
val o = testContext.io(Foos.size)
assertEquals(
o.sql,
"SELECT COUNT(*) FROM foo x"
)
}
test("Aggregations - min") {
val o = testContext.io(Foos.map(f => f.age).min)
assertEquals(
o.sql,
"SELECT MIN(f.age) FROM foo f"
)
}
test("Aggregations - max") {
val o = testContext.io(Foos.map(f => f.age).max)
assertEquals(
o.sql,
"SELECT MAX(f.age) FROM foo f"
)
}
}