Skip to content

Commit

Permalink
more test for DataFrame API
Browse files Browse the repository at this point in the history
  • Loading branch information
3cham committed May 3, 2024
1 parent d04857e commit 55f7e7e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

Implementation of ["How query engines work?"](https://howqueryengineswork.com/) for learning queries engine & kotlin.

Progress: ![](https://geps.dev/progress/32)
Progress: ![](https://geps.dev/progress/36)
15 changes: 15 additions & 0 deletions logical-plan/src/test/kotlin/DataFrameTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,21 @@ class DataFrameTest {
assertEquals(expected, actual)
}

@Test
fun `aggregate query`() {

val df =
csv()
.aggregate(
listOf(col("state")),
listOf(Min(col("salary")), Max(col("salary")), Count(col("salary"))))

assertEquals(
"Aggregate: groupExpr=[#state], aggregateExpr=[MIN(#salary), MAX(#salary), COUNT(#salary)]\n" +
"\tScan: employee.csv; projection=None\n",
format(df.logicalPlan()))
}

private fun csv(): DataFrame {
val csvSource = CsvDataSource(
File("../testdata", "employee.csv").absolutePath,
Expand Down

0 comments on commit 55f7e7e

Please sign in to comment.