-
Notifications
You must be signed in to change notification settings - Fork 66
Creates PRuntimeException and audits eval package #1719
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
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ import org.partiql.eval.Statement | |
import org.partiql.eval.compiler.Match | ||
import org.partiql.eval.compiler.PartiQLCompiler | ||
import org.partiql.eval.compiler.Strategy | ||
import org.partiql.eval.internal.helpers.PErrors | ||
import org.partiql.eval.internal.operator.Aggregate | ||
import org.partiql.eval.internal.operator.rel.RelOpAggregate | ||
import org.partiql.eval.internal.operator.rel.RelOpDistinct | ||
|
@@ -110,7 +111,7 @@ import org.partiql.plan.rex.RexVar | |
import org.partiql.spi.Context | ||
import org.partiql.spi.errors.PError | ||
import org.partiql.spi.errors.PErrorKind | ||
import org.partiql.spi.errors.PErrorListenerException | ||
import org.partiql.spi.errors.PRuntimeException | ||
import org.partiql.spi.types.PType | ||
import org.partiql.spi.value.Datum | ||
|
||
|
@@ -132,7 +133,7 @@ internal class StandardCompiler(strategies: List<Strategy>) : PartiQLCompiler { | |
else -> throw IllegalArgumentException("Only query statements are supported") | ||
} | ||
return statement | ||
} catch (e: PErrorListenerException) { | ||
} catch (e: PRuntimeException) { | ||
throw e | ||
} catch (t: Throwable) { | ||
val error = PError.INTERNAL_ERROR(PErrorKind.COMPILATION(), null, t) | ||
|
@@ -158,7 +159,15 @@ internal class StandardCompiler(strategies: List<Strategy>) : PartiQLCompiler { | |
private val root = compile(action.getRex(), Unit).catch() | ||
|
||
// execute with no parameters | ||
override fun execute(): Datum = root.eval(Environment()) | ||
override fun execute(): Datum { | ||
return try { | ||
root.eval(Environment()) | ||
} catch (e: PRuntimeException) { | ||
throw e | ||
} catch (t: Throwable) { | ||
throw PErrors.internalErrorException(t) | ||
} | ||
Comment on lines
+167
to
+169
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I haven't checked this locally but shouldn't the non- There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wdym? We are catching There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To rephrase, I was initially thinking that all the
I think this catch(throwable) is fine for now, but we should make sure exceptions we throw try to use the existing |
||
} | ||
} | ||
|
||
/** | ||
|
Uh oh!
There was an error while loading. Please reload this page.