Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support ANY type in Header functions And Planning of Control Flow Functions. #1256

Merged
merged 6 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from 5 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
1 change: 1 addition & 0 deletions partiql-lang/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,6 @@ tasks.processTestResources {

tasks.shadowJar {
archiveBaseName.set("shadow")
exclude("**/*.kotlin_metadata")
yliuuuu marked this conversation as resolved.
Show resolved Hide resolved
archiveClassifier.set("")
}
8 changes: 5 additions & 3 deletions partiql-planner/src/main/kotlin/org/partiql/planner/Header.kt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public abstract class Header {
* For functions, output CREATE FUNCTION statements.
*/
override fun toString(): String = buildString {
functions.groupBy { it.name }.forEach {
(functions + operators + aggregations).groupBy { it.name }.forEach {
appendLine("-- [${it.key}] ---------")
appendLine()
it.value.forEach { fn -> appendLine(fn) }
Expand All @@ -58,23 +58,25 @@ public abstract class Header {
companion object {

@JvmStatic
internal fun unary(name: String, returns: PartiQLValueType, value: PartiQLValueType) =
internal fun unary(name: String, returns: PartiQLValueType, value: PartiQLValueType, isMissable: Boolean = false) =
FunctionSignature.Scalar(
name = name,
returns = returns,
parameters = listOf(FunctionParameter("value", value)),
isNullCall = true,
isNullable = false,
isMissable = isMissable
)

@JvmStatic
internal fun binary(name: String, returns: PartiQLValueType, lhs: PartiQLValueType, rhs: PartiQLValueType) =
internal fun binary(name: String, returns: PartiQLValueType, lhs: PartiQLValueType, rhs: PartiQLValueType, isMissable: Boolean = false) =
FunctionSignature.Scalar(
name = name,
returns = returns,
parameters = listOf(FunctionParameter("lhs", lhs), FunctionParameter("rhs", rhs)),
isNullCall = true,
isNullable = false,
isMissable = isMissable
)
}
}
Loading
Loading