-
Notifications
You must be signed in to change notification settings - Fork 62
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
Conversation
partiql-planner/src/main/kotlin/org/partiql/planner/PartiQLHeader.kt
Outdated
Show resolved
Hide resolved
Conformance comparison report
Number passing in both: 5372 Number failing in both: 446 Number passing in Base (234ff97) but now fail: 0 Number failing in Base (234ff97) but now pass: 0 |
private fun lt(): List<FunctionSignature.Scalar> = types.numeric.map { t -> | ||
binary("lt", BOOL, t, t) | ||
} | ||
} + listOf(binary("lt", ANY, ANY, ANY)) | ||
|
||
private fun lte(): List<FunctionSignature.Scalar> = types.numeric.map { t -> | ||
binary("lte", BOOL, t, t) | ||
} | ||
} + listOf(binary("lte", ANY, ANY, ANY)) | ||
|
||
private fun gt(): List<FunctionSignature.Scalar> = types.numeric.map { t -> | ||
binary("gt", BOOL, t, t) | ||
} | ||
} + listOf(binary("gt", ANY, ANY, ANY)) | ||
|
||
private fun gte(): List<FunctionSignature.Scalar> = types.numeric.map { t -> | ||
binary("gte", BOOL, t, t) | ||
} | ||
} + listOf(binary("gte", ANY, ANY, ANY)) | ||
|
||
private fun plus(): List<FunctionSignature.Scalar> = types.numeric.map { t -> | ||
binary("plus", t, t, t) | ||
} | ||
} + listOf(binary("plus", ANY, ANY, ANY)) | ||
|
||
private fun minus(): List<FunctionSignature.Scalar> = types.numeric.map { t -> | ||
binary("minus", t, t, t) | ||
} | ||
} + listOf(binary("minus", ANY, ANY, ANY)) | ||
|
||
private fun times(): List<FunctionSignature.Scalar> = types.numeric.map { t -> | ||
binary("times", t, t, t) | ||
} | ||
} + listOf(binary("times", ANY, ANY, ANY)) | ||
|
||
private fun div(): List<FunctionSignature.Scalar> = types.numeric.map { t -> | ||
binary("divide", t, t, t) | ||
} | ||
} + listOf(binary("divide", ANY, ANY, ANY)) | ||
|
||
private fun mod(): List<FunctionSignature.Scalar> = types.numeric.map { t -> | ||
binary("modulo", t, t, t) | ||
} | ||
} + listOf(binary("modulo", ANY, ANY, ANY)) | ||
|
||
private fun concat(): List<FunctionSignature.Scalar> = types.text.map { t -> | ||
binary("concat", t, t, t) | ||
} | ||
} + listOf(binary("concat", ANY, ANY, ANY)) | ||
|
||
private fun bitwiseAnd(): List<FunctionSignature.Scalar> = types.integer.map { t -> | ||
binary("bitwise_and", t, t, t) | ||
} | ||
} + listOf(binary("bitwise_and", ANY, ANY, ANY)) |
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.
These are slightly different functions. The return type is still BOOL, but the functions are MISSABLE because we could have a mis-typing case.
partiql-planner/src/main/kotlin/org/partiql/planner/PartiQLHeader.kt
Outdated
Show resolved
Hide resolved
// TODO | ||
private fun coalesce(): List<FunctionSignature.Scalar> = emptyList() | ||
|
||
// NULLIF(x, y) | ||
private fun nullIf(): List<FunctionSignature.Scalar> = types.nullable.map { t -> | ||
FunctionSignature.Scalar( | ||
name = "null_if", | ||
returns = t, | ||
parameters = listOf( | ||
FunctionParameter("value", t), | ||
FunctionParameter("nullifier", BOOL), // TODO: why is this BOOL? | ||
), | ||
isNullCall = true, | ||
isNullable = 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.
goodbye!!
name = "date_diff_${field.name.lowercase()}", | ||
returns = ANY, | ||
parameters = listOf( | ||
FunctionParameter("interval", INT), |
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.
Should interval also be ANY?
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.
good catch : )
Relevant Issues
Description
coalesce
andnullIf
will be rewrited to a case when expression.Other Information
Updated Unreleased Section in CHANGELOG: [YES/NO]
Any backward-incompatible changes? [YES/NO]
Any new external dependencies? [YES/NO]
Do your changes comply with the Contributing Guidelines
and Code Style Guidelines? [YES/NO]
Yes.
License Information
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.