-
Notifications
You must be signed in to change notification settings - Fork 60
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
Adds support for nullable casts and missable/missingCall functions #1422
Conversation
@@ -584,18 +584,21 @@ internal class PlanTyper( | |||
|
|||
// Type the arguments |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm curious if https://github.com/partiql/partiql-lang-kotlin/blob/v1/partiql-planner/src/main/kotlin/org/partiql/planner/internal/typer/PlanTyper.kt#L1357-L1405 can be a replacement for this? This is a lot of logic that isn't in V1. Ideally we can bring the latest to 0.14.+
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 to Robert's question. Can the same logic from v1
be ported to this PR/main
? Have a couple concerns that
- the PR may have a different typing behavior from the
v1
branch - the code changes may make it tricky to merge
main
intov1
(orv1
intomain
)
partiql-planner/src/main/kotlin/org/partiql/planner/internal/typer/TypeLattice.kt
Show resolved
Hide resolved
partiql-planner/src/test/kotlin/org/partiql/planner/internal/typer/operator/OpConcatTest.kt
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haven't looked at the tests in too much detail. Raising some initial concerns + questions in this review.
@@ -14,13 +14,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 | |||
### Deprecated | |||
|
|||
### Fixed | |||
- Fixes [#1398](https://github.com/partiql/partiql-lang-kotlin/issues/1398) by handling "missable" arguments to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: changelog entry added to the template and not the Unreleased
section below
@@ -57,6 +60,8 @@ public sealed class FunctionSignature( | |||
isNullable: Boolean = true, | |||
@JvmField public val isDeterministic: Boolean = true, | |||
@JvmField public val isNullCall: Boolean = false, | |||
@JvmField public val isMissable: Boolean = false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason isMissable
on the main
branch defaults to false
? FnSignature
on the v1
branch defaults to true
:
partiql-lang-kotlin/partiql-spi/src/main/kotlin/org/partiql/spi/fn/FnSignature.kt
Line 32 in 2879f3a
@JvmField public val isMissable: Boolean = true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A little confused w/ the divergence in behavior. Seems like all the functions defined in the PartiQLHeader
are all not "missible"?
* @property isMissable Indicates whether the function's operator may return MISSING. | ||
* @property isMissingCall Indicates behavior when any of the arguments are MISSING. If set to true, the function | ||
* will return MISSING. If false, the operator itself will handle the MISSING. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: for easier merging, may be helpful to use the same kdoc comments from the FnSignature
defined on v1
branch:
partiql-lang-kotlin/partiql-spi/src/main/kotlin/org/partiql/spi/fn/FnSignature.kt
Lines 19 to 20 in 2879f3a
* @property isMissable Flag indicating this function's operator may return a MISSING value. | |
* @property isMissingCall Flag indicating if any of the call arguments is MISSING, the return MISSING. |
@@ -182,15 +184,24 @@ internal object PartiQLHeader : Header() { | |||
unary("neg", t, t) | |||
} | |||
|
|||
private fun eq(): List<FunctionSignature.Scalar> = types.all.map { t -> | |||
private fun eq(): List<FunctionSignature.Scalar> = types.all.filterNot { it == ANY || it == MISSING }.map { t -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a divergence here between the modeling of functions between this PR and the v1
branch. E.g.
- For
eq
, thev1
branch includes all the types and they have the sameisNullable,
isMissingCall`, etc. configurationspartiql-lang-kotlin/partiql-spi/src/test/kotlin/org/partiql/spi/connector/sql/SqlHeader.kt
Lines 233 to 241 in 2879f3a
private fun eq(): List<FnSignature> = all.map { t -> FnSignature( name = "eq", returns = BOOL, parameters = listOf(FnParameter("lhs", t), FnParameter("rhs", t)), isNullable = false, isNullCall = true, ) } - For the logical ops, the
v1
branch uses the defaults forisMissable = true
andisMissingCall = true
, whereas this PR definesisMissable = false
andisMissingCall = false
I'm curious the reasoning for the modeling differences.
@@ -584,18 +584,21 @@ internal class PlanTyper( | |||
|
|||
// Type the arguments |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 to Robert's question. Can the same logic from v1
be ported to this PR/main
? Have a couple concerns that
- the PR may have a different typing behavior from the
v1
branch - the code changes may make it tricky to merge
main
intov1
(orv1
intomain
)
Closing as an alternative solution is being actively pursued. |
Relevant Issues
Description
v1
largely has these changes already, this is a port of its functionality.Other Information
and Code Style Guidelines? YES
License Information
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.