-
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
Closed
johnedquinn
wants to merge
4
commits into
partiql:v1
from
johnedquinn:v1-conformance-compilation-error
Closed
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
4fba7e6
Adds a CompilationErrorHandling flag to evaluator
johnedquinn 2cd476c
Adds support for evaluation of RexOpMissing
johnedquinn 3c80d0e
Removes unnecessary evaluation session properties
johnedquinn 5b2ab76
Reverts changes for RexOpErr
johnedquinn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
partiql-eval/src/main/kotlin/org/partiql/eval/internal/operator/rex/ExprError.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
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) | ||
} | ||
} | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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