-
Notifications
You must be signed in to change notification settings - Fork 515
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
98 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
...main/kotlin/app/cash/sqldelight/dialects/postgresql/grammar/mixins/WindowFunctionMixin.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package app.cash.sqldelight.dialects.postgresql.grammar.mixins | ||
|
||
import app.cash.sqldelight.dialects.postgresql.grammar.psi.PostgreSqlWindowFunctionExpr | ||
import com.alecstrong.sql.psi.core.psi.SqlCompositeElementImpl | ||
import com.alecstrong.sql.psi.core.psi.SqlFunctionExpr | ||
import com.intellij.lang.ASTNode | ||
|
||
internal abstract class WindowFunctionMixin( | ||
node: ASTNode, | ||
) : SqlCompositeElementImpl(node), | ||
PostgreSqlWindowFunctionExpr { | ||
val functionExpr get() = children.filterIsInstance<SqlFunctionExpr>().single() | ||
} |
6 changes: 6 additions & 0 deletions
6
dialects/postgresql/src/test/fixtures_postgresql/functions-aggregate/Test.s
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
CREATE TABLE myTable( | ||
myColumn REAL NOT NULL | ||
); | ||
|
||
SELECT percentile_disc(.5) WITHIN GROUP (ORDER BY myTable.myColumn) AS P5 | ||
FROM myTable; |
11 changes: 11 additions & 0 deletions
11
dialects/postgresql/src/test/fixtures_postgresql/functions-stats/Test.s
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
CREATE TABLE myTable( | ||
foo REAL NOT NULL, | ||
bar NUMERIC NOT NULL | ||
); | ||
|
||
SELECT | ||
corr(foo), | ||
stddev(bar), | ||
stddev(foo), | ||
regr_count(foo) | ||
FROM myTable GROUP BY foo, bar; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
...on-postgresql/src/main/sqldelight/app/cash/sqldelight/postgresql/integration/Functions.sq
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
CREATE TABLE myTable( | ||
foo REAL NOT NULL, | ||
bar NUMERIC NOT NULL | ||
); | ||
|
||
selectPercentile: | ||
SELECT percentile_disc(.5) WITHIN GROUP (ORDER BY foo) AS P5 | ||
FROM myTable; | ||
|
||
selectStats: | ||
SELECT | ||
corr(foo, bar), | ||
stddev(foo), | ||
regr_count(foo, bar) | ||
FROM myTable | ||
GROUP BY foo, bar; | ||
|
||
CREATE TABLE items_sold( | ||
make TEXT NOT NULL, | ||
model TEXT NOT NULL, | ||
sales INTEGER NOT NULL | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters