-
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
Adds ExprError to new evaluator #1416
Adds ExprError to new evaluator #1416
Conversation
b4e5dfb
to
88b9e26
Compare
88b9e26
to
4304118
Compare
package org.partiql.eval.internal.operator.rex | ||
|
||
import org.partiql.errors.TypeCheckException | ||
import org.partiql.eval.internal.Environment | ||
import org.partiql.eval.internal.operator.Operator | ||
import org.partiql.value.PartiQLValue | ||
import org.partiql.value.PartiQLValueExperimental | ||
|
||
internal class ExprError( | ||
private val message: String, | ||
) : Operator.Expr { | ||
|
||
@OptIn(PartiQLValueExperimental::class) | ||
override fun eval(env: Environment): PartiQLValue { | ||
throw TypeCheckException(message) | ||
} | ||
} |
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 don't believe we should be catching all errors. The planner inserts a missing rex on errors that are type check exceptions at compile time. The other errors are truly unrecoverable things such as unresolved functions.
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.
Updated the compiler accordingly
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.
For some context, I initially added ExprError for both RexOpErr and RexOpMissing due to how it fixed failing conformance tests. But, now looking at the tests, I actually notice that those conformance tests are wrong. Specifically, in undefined-variable-behavior.ion
, all of these tests failed when I didn't compile RexOpErr into an ExprError. That being said, PartiQL Spec Section 10 actually highlights why these tests are wrong. We are good to go ahead with this change, and I'll update those tests.
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.
What I am saying is that the Compiler.kt fails to compile any query that contains a Rex.Op.Err.
If an error is a "mis-typing" error, then the planner inserts Rex.Op.Missing which the compiler may (or may not) recover from given the typing mode.
There should be no ExprError.kt
4304118
to
5b2ab76
Compare
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.
Compiler should blow up on Rex.Op.Err
Closed in favor of #1437 |
Relevant Issues
Description
Conformance comparison report-Cross Commit-EVAL
Conformance comparison report-Cross Engine
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.