-
Notifications
You must be signed in to change notification settings - Fork 63
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 unary, logical, binary arithmetic, and concat operators #1325
Conversation
Conformance comparison report
Number passing in both: 5384 Number failing in both: 434 Number passing in Base (c7466e4) but now fail: 0 Number failing in Base (c7466e4) but now pass: 0 |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## partiql-plugin-impl #1325 +/- ##
======================================================
Coverage ? 49.27%
Complexity ? 1046
======================================================
Files ? 166
Lines ? 13395
Branches ? 2504
======================================================
Hits ? 6600
Misses ? 6138
Partials ? 657
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
plugins/partiql-plugin/src/main/kotlin/org/partiql/plugin/internal/fn/scalar/BinaryOpHelpers.kt
Outdated
Show resolved
Hide resolved
@@ -14,6 +22,8 @@ import org.partiql.value.PartiQLValueType.INT16 | |||
import org.partiql.value.PartiQLValueType.INT32 | |||
import org.partiql.value.PartiQLValueType.INT64 | |||
import org.partiql.value.PartiQLValueType.INT8 | |||
import java.math.BigDecimal | |||
import java.math.BigInteger | |||
|
|||
@OptIn(PartiQLValueExperimental::class, PartiQLFunctionExperimental::class) | |||
internal object FnDivide0 : PartiQLFunction.Scalar { |
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.
not sure these handle divide by zero, but perhaps that's out-of-scope for the initial PR. I think using reified type parameters would allow using the operators rather than a function call
binaryOpInt8(args) { lhs, rhs ->
if (rhs == 0) {
// handle error
}
val result = lhs / rhs
return int8Value(result)
}
Not sure that code works for byte division, but the point is to pass our own block rather than Byte::div so we can handle the unpacked arguments ourselves on a per-function basis. See check for an example
21180d7
to
f129381
Compare
584fc10
to
481dd89
Compare
plugins/partiql-plugin/src/main/kotlin/org/partiql/plugin/internal/fn/scalar/BinaryOpHelpers.kt
Outdated
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.
This all looks good. Note that it does assume we are doing null call handling in the call operator within eval. This assumption is probably the right call so that every operator doesn't have to repeat logic
Relevant Issues
Description
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.