Add test case
This commit is contained in:
parent
0b4a6cb0c4
commit
5ed56e4009
2 changed files with 26 additions and 1 deletions
|
@ -176,7 +176,9 @@ object Query {
|
||||||
Aggregation(AggregationOperator.size, e)
|
Aggregation(AggregationOperator.size, e)
|
||||||
|
|
||||||
inline def min: Agg[Long] = Aggregation(AggregationOperator.min, 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)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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"
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue