Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit ebbe6dc
Author: John Ed Quinn <[email protected]>
Date:   Thu Oct 20 14:01:00 2022 -0700

    Update ISL to SNAPSHOT (#851)

commit a298d93
Author: Arash Maymandi <[email protected]>
Date:   Thu Oct 20 12:13:52 2022 -0700

    Add redaction for INSERT/UPSERT/REPLACE INTO << >> (#850)

    This commit enables statement redaction for INSERT, REPLACE, and UPSERT.

    See the following for more details:
    #849

commit fb4b29f
Merge: 05c1785 8f8d6d9
Author: Vladimir Gapeyev <[email protected]>
Date:   Thu Oct 20 10:31:39 2022 -0700

    Merge pull request #847 from partiql/issue-616

    Makes SqlException.errorContext non-nullable, resolving Issue #616.

commit 8f8d6d9
Author: Vladimir Gapeyev <[email protected]>
Date:   Wed Oct 19 11:32:54 2022 -0700

    Attempting to fix divergence in the git submodule test/partiql-tests.

commit 05c1785
Author: lziq <[email protected]>
Date:   Wed Oct 19 10:11:34 2022 -0700

    Applied comments in PR 822 (#836)

commit 89dacc2
Merge: 7ab757c 8255a07
Author: Vladimir Gapeyev <[email protected]>
Date:   Tue Oct 18 17:17:22 2022 -0700

    Merge branch 'main' into issue-616

commit 8255a07
Author: John Ed Quinn <[email protected]>
Date:   Tue Oct 18 14:15:15 2022 -0700

    Set next dev version (#846)

commit 7ab757c
Author: Vladimir Gapeyev <[email protected]>
Date:   Tue Oct 18 13:14:43 2022 -0700

    Makes SqlException.errorContext non-nullable, resolving Issue #616.

commit bc4dc47
Author: R. C. Howell <[email protected]>
Date:   Tue Oct 18 13:13:53 2022 -0700

    Bumps partiql-isl-kotlin to 0.2.2 (#845)

commit 55de098
Author: Alan Cai <[email protected]>
Date:   Mon Oct 17 14:01:40 2022 -0700

    Update conformance test runner skip list with ported `pts` tests (#829)

commit d8bcf1f
Author: R. C. Howell <[email protected]>
Date:   Mon Oct 17 09:15:21 2022 -0700

    v0.8.0 (#844)

    Creates 0.8.0 commit

commit b4b7e1f
Author: R. C. Howell <[email protected]>
Date:   Fri Oct 14 16:52:49 2022 -0700

    Moves partiql-grammar to org.partiql.lang.syntax.antlr so we don't vend a separate jar (#843)

commit 28d960f
Author: yliuuuu <[email protected]>
Date:   Thu Oct 13 16:07:57 2022 -0700

    fix subquery execution (#842)

commit 0b8d14a
Author: Arash Maymandi <[email protected]>
Date:   Thu Oct 13 16:04:55 2022 -0700

    Final changes for REPLACE/UPSERT/INSERT EXCLUDED (#831)

    This commit includes the following:
    - Support for INSERT INTO tbl ... ON CONFLICT DO REPLACE EXCLUDED and REPLACE INTO tbl ... evaluation.
    - Support for INSERT INTO tbl ... ON CONFLICT DO UPDATE EXCLUDED logical planning.
       - The reason that evaluation is excluded is b/c the logic is for update evaluation requires implementing merge with existing values which makes it more completed; since it's not part of the related ask (attached issue) we defer the implementation for now
    - Adds parsing support for AS alias for UPSERT INTO and REPLACE INTO statements.

commit 13f622f
Author: John Ed Quinn <[email protected]>
Date:   Thu Oct 13 15:50:06 2022 -0700

    Cleans up SORT and UNPIVOT factories (#839)

commit 17acf86
Author: John Ed Quinn <[email protected]>
Date:   Thu Oct 13 15:47:41 2022 -0700

    Updates changelog (#840)

commit 376bc18
Author: John Ed Quinn <[email protected]>
Date:   Thu Oct 13 14:45:45 2022 -0700

    Adds support for aggregations and grouping to the planner (#821)

commit 8be7a2d
Author: Alan Cai <[email protected]>
Date:   Wed Oct 12 13:37:59 2022 -0700

    Update README.md following addition of partiql-tests git submodule (#838)

commit 2210658
Merge: 5715a88 9fdc92c
Author: Vladimir Gapeyev <[email protected]>
Date:   Wed Oct 12 10:40:25 2022 -0700

    Merge pull request #797 from partiql/graph-match-expr

    Switched from MATCH-as-FROM-source to MATCH-as-expression

commit 9fdc92c
Author: Vladimir Gapeyev <[email protected]>
Date:   Wed Oct 12 10:36:39 2022 -0700

    Cleanup

commit 0dfc9ec
Author: Vladimir Gapeyev <[email protected]>
Date:   Tue Oct 11 14:09:36 2022 -0700

    Put back tests from the reverted commit,
    adjusting the success status as appropriate.

commit a7b42bf
Author: Vladimir Gapeyev <[email protected]>
Date:   Tue Oct 11 10:58:32 2022 -0700

    Revert "Allow unparethesized MATCH in more places."

    This reverts commit af6f6c3.

    It's hard or impossible to match this grammar addition in the partiql-lang-rust edition of the grammar.

commit 5715a88
Author: Josh Pschorr <[email protected]>
Date:   Fri Oct 7 13:41:00 2022 -0700

    Default sort & null spec in evaluator, not parser (#834)

commit af6f6c3
Author: Vladimir Gapeyev <[email protected]>
Date:   Thu Oct 6 23:11:09 2022 -0700

    Allow unparethesized MATCH in more places.

commit 9b26e9c
Author: Vladimir Gapeyev <[email protected]>
Date:   Thu Oct 6 16:00:58 2022 -0700

    Grammar tweaks to not require (and prohibit) parentheses around a pattern with commas.
    Instead, require commas around the whole MATCH expression in this case.

commit 1ce2669
Author: Vladimir Gapeyev <[email protected]>
Date:   Tue Oct 4 22:49:22 2022 -0700

    A couple more parsing tests, involving a bare edge pattern -[]->.

commit e552b92
Merge: 02b07cb a9e5a4e
Author: Vladimir Gapeyev <[email protected]>
Date:   Tue Oct 4 17:36:45 2022 -0700

    Merge branch 'main' into graph-match-expr.

    Resolved a conflict in
    	lang/src/org/partiql/lang/eval/physical/PhysicalPlanCompilerImpl.kt

commit a9e5a4e
Author: lziq <[email protected]>
Date:   Tue Oct 4 15:32:00 2022 -0700

    Removed snapshot from version (#828)

commit a0209df
Author: R. C. Howell <[email protected]>
Date:   Mon Oct 3 13:57:55 2022 -0700

    Adds PIVOT to PartiQLPlanner (#817)

commit 9a159a0
Author: yliuuuu <[email protected]>
Date:   Mon Oct 3 10:45:01 2022 -0700

    Adds UNPIVOT operator to PartiQLPlanner (#815)

    * support `unpivot` operator in planner

commit 07f4a27
Author: John Ed Quinn <[email protected]>
Date:   Fri Sep 30 17:02:57 2022 -0400

    Adds SORT operator to planner (#793)

commit f80e015
Author: Alan Cai <[email protected]>
Date:   Wed Sep 28 14:26:35 2022 -0700

    Add Kotlin conformance test runner (#809)

commit 882d7d2
Author: R. C. Howell <[email protected]>
Date:   Tue Sep 27 17:11:55 2022 -0700

    Remove state from planner (#813)

commit a871ba5
Author: R. C. Howell <[email protected]>
Date:   Tue Sep 27 10:42:13 2022 -0700

    Moves partiql-isl-kotlin to a library of partiql-lang-kotlin (#805)

commit cd16bf3
Author: lziq <[email protected]>
Date:   Mon Sep 26 15:38:08 2022 -0700

    Removed type names from ExprValueType (#808)

commit 2e19331
Author: R. C. Howell <[email protected]>
Date:   Mon Sep 26 08:23:20 2022 -0700

    Renames PhysicalExprToThunkConverter as PhysicalPlanCompiler (#801)

commit 706acd9
Author: lziq <[email protected]>
Date:   Fri Sep 23 10:03:51 2022 -0700

    Marked TypedOpBehavior.LEGACY as deprecated (#796)

commit 02b07cb
Author: Vladimir Gapeyev <[email protected]>
Date:   Fri Sep 23 09:58:05 2022 -0700

    Lint fixes.

commit f29f894
Author: Vladimir Gapeyev <[email protected]>
Date:   Thu Sep 22 21:16:56 2022 -0700

    Switched from MATCH-as-FROM-source to MATCH-as-expression.

commit 4b3ec94
Author: Vladimir Gapeyev <[email protected]>
Date:   Sun Sep 18 15:34:08 2022 -0700

    Rename AST node graph_match_expr ~~> gpml_pattern, and matchExpr ~~> gpmlPattern in the grammar.

    The new name is a tad more appropriate for the node's contents
    and will be clashing less with the upcoming new expression form graph_match.

commit 58e908d
Author: Arash Maymandi <[email protected]>
Date:   Thu Sep 22 15:32:20 2022 -0700

    Add experimental REPLACE/UPSERT INTO (#788)

    * Add experimental REPLACE/UPSERT INTO

    Adding the parsing capability for `REPLACE INTO` and `REPLACE INTO`.
    See the PR and associated Issue for more details.

commit 8bfaf20
Author: Arash Maymandi <[email protected]>
Date:   Thu Sep 22 14:38:16 2022 -0700

    Add logical plan support for DO REPLACE EXCLUDED (#792)

commit 96de8e7
Author: John Ed Quinn <[email protected]>
Date:   Wed Sep 21 14:45:58 2022 -0700

    Adds projection alias support to ORDER BY clause (#740)

    * Adds projection alias support to ORDER BY clause

commit 001a99b
Author: Arash Maymandi <[email protected]>
Date:   Wed Sep 21 12:59:42 2022 -0700

    Add an additional example for ExprFunction (#786)

    * Add an additional example for ExprFunction

    Adds an example for using a custom function for working with elements
    of lists and struct members.

commit 58dd2cb
Author: lziq <[email protected]>
Date:   Tue Sep 20 15:23:10 2022 -0700

    Refactor stivt code (#791)

commit 74b6cf6
Author: John Ed Quinn <[email protected]>
Date:   Mon Sep 19 10:49:12 2022 -0700

    Splits large tests to allow parallelization and speedup in builds (#779)

commit 16ccbc1
Author: lziq <[email protected]>
Date:   Fri Sep 16 09:52:18 2022 -0700

    Refactor STIVT Code Style (#782)
  • Loading branch information
lziq committed Oct 21, 2022
1 parent 99c419e commit e070ef7
Show file tree
Hide file tree
Showing 13 changed files with 92 additions and 37 deletions.
26 changes: 18 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]

### Added
- Extends statement redaction to support `INSERT/REPLACE/UPSERT INTO`.

### Changed
- Now `CompileOption` uses `TypedOpParameter.HONOR_PARAMETERS` as default.
Expand Down Expand Up @@ -80,14 +81,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
stage in the `PlannerPipeline` and to generate performance metrics for the individual phases of query planning. See
`PlannerPipe.Builder.plannerEventCallback` for details.
- Adds the following optimization passes, none of which are enabled by default:
- `FilterScanToKeyLookupPass` which performs a simple optimization common to most databases: it converts a filter
predicate covering a table's complete primary key into a single get-by-key operation, thereby avoiding a full table
scan. This may pass leave behind some useless `and` expressions if more `and` operands exist in the filter predicate
other than primary key field equality expressions.
- `RemoveUselessAndsPass`, which removes any useless `and` expressions introduced by the previous pass or by the
query author, e.g. `true and x.id = 42` -> `x.id = 42`), `true and true` -> `true`, etc.
- `RemoveUselessFiltersPass`, which removes useless filters introduced by the previous pass or by the query author
(e.g. `(filter (lit true) <bexpr>))` -> `<bexpr>`.
- `FilterScanToKeyLookupPass` which performs a simple optimization common to most databases: it converts a filter
predicate covering a table's complete primary key into a single get-by-key operation, thereby avoiding a full table
scan. This may pass leave behind some useless `and` expressions if more `and` operands exist in the filter predicate
other than primary key field equality expressions.
- `RemoveUselessAndsPass`, which removes any useless `and` expressions introduced by the previous pass or by the
query author, e.g. `true and x.id = 42` -> `x.id = 42`), `true and true` -> `true`, etc.
- `RemoveUselessFiltersPass`, which removes useless filters introduced by the previous pass or by the query author
(e.g. `(filter (lit true) <bexpr>))` -> `<bexpr>`.
- Add support for `UNPIVOT`, the behavior is expected to be compatible with the `evaluating compiler`.
- Adds support for GROUP BY (aggregations, group keys, etc)
- Adds support for ORDER BY in Planner
Expand All @@ -114,11 +115,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Removed
- README.md badge for travisci
<<<<<<< HEAD
- **Breaking Change**: removed [ExprValueType.typeNames] as needed by the future work of legacy parser removal and OTS
- **Breaking Change**: [PartiqlPhysical.Type.toTypedOpParameter()] now becomes an internal function
- **Breaking Change**: [PartiqlAst.Type.toTypedOpParameter()] is removed
- **Breaking Change**: [PartiqlAstSanityValidator] now becomes an internal class
- **Breaking Change**: [PartiqlPhysicalSanityValidator] is removed
||||||| 17fbd245
=======
- **Breaking Change**: removed [ExprValueType.typeNames] as needed by the future work of legacy parser removal and OTS
- **Breaking Change**: [PartiqlPhysical.Type.toTypedOpParameter()] now becomes an internal function
- **Breaking Change**: [PartiqlAst.Type.toTypedOpParameter()] is removed
- **Breaking Change**: [PartiqlAstSanityValidator] now becomes an internal class
- **Breaking Change**: [PartiqlPhysicalSanityValidator] is removed
>>>>>>> main
### Security

Expand Down
8 changes: 2 additions & 6 deletions lang/src/org/partiql/lang/SqlException.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import org.partiql.lang.errors.ErrorCode
import org.partiql.lang.errors.Property
import org.partiql.lang.errors.PropertyValueMap
import org.partiql.lang.errors.UNKNOWN
import org.partiql.lang.util.propertyValueMapOf

/**
* General exception class for the interpreter.
Expand All @@ -34,19 +33,16 @@ import org.partiql.lang.util.propertyValueMapOf
*
* @param message the message for this exception
* @param errorCode the error code for this exception
* @param errorContextArg context for this error, includes details like line & character offsets, among others.
* TODO: https://github.com/partiql/partiql-lang-kotlin/issues/616
* @param errorContext context for this error, includes details like line & character offsets, among others.
* @param cause for this exception
*/
open class SqlException(
override var message: String,
val errorCode: ErrorCode,
errorContextArg: PropertyValueMap? = null,
val errorContext: PropertyValueMap,
cause: Throwable? = null
) : RuntimeException(message, cause) {

val errorContext: PropertyValueMap = errorContextArg ?: propertyValueMapOf()

/**
* Indicates if this exception is due to an internal error or not.
*
Expand Down
2 changes: 1 addition & 1 deletion lang/src/org/partiql/lang/ast/passes/SemanticException.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import org.partiql.lang.util.propertyValueMapOf
class SemanticException(
message: String = "",
errorCode: ErrorCode,
errorContext: PropertyValueMap?,
errorContext: PropertyValueMap,
cause: Throwable? = null
) : SqlException(message, errorCode, errorContext, cause) {

Expand Down
28 changes: 28 additions & 0 deletions lang/src/org/partiql/lang/ast/passes/StatementRedactor.kt
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,13 @@ private class StatementRedactionVisitor(
}
}

override fun visitDmlOpInsert(node: PartiqlAst.DmlOp.Insert) {
when (node.values) {
is PartiqlAst.Expr.Bag -> redactBagInInserOpValues(node.values)
else -> redactExpr(node.values)
}
}

private fun redactExpr(node: PartiqlAst.Expr) {
if (node.isNAry()) {
redactNAry(node)
Expand Down Expand Up @@ -281,6 +288,27 @@ private class StatementRedactionVisitor(
}
}

/**
* For [PartiqlAst.DmlOp.Insert], redacts every element of VALUES clause BAG value; for struct elements in the bag, it
* follows the redaction rules that [redactStructInInsertValueOp] applies.
* For example, given:
* INSERT INTO tb <<{ 'hk': 'a', 'rk': 1, 'attr': { 'hk': 'a' }}>>"
* REPLACE INTO tb << { 'dummy1' : 'hashKey', 'dummy2' : 'rangeKey', 'dummyTestAttribute' : '123' } >>
*
* Expected:
* INSERT INTO tb <<{ 'hk': 'a', 'rk': 1, 'attr': { ***(Redacted): ***(Redacted) }}>>
* REPLACE INTO tb <<{ 'dummy1' : ***(Redacted), 'dummy2' : ***(Redacted), 'dummyTestAttribute' : ***(Redacted) }>>
*/
private fun redactBagInInserOpValues(bag: PartiqlAst.Expr.Bag) {
bag.values.map {
if (it is PartiqlAst.Expr.Struct) {
redactStructInInsertValueOp(it)
} else {
redactExpr(it)
}
}
}

/**
* For [PartiqlAst.DmlOp.InsertValue], only the outermost level of struct files could have a key attribute.
* For example, in the struct { 'hk': 'a', 'rk': 1, 'attr': { 'hk': 'a' }},
Expand Down
20 changes: 10 additions & 10 deletions lang/src/org/partiql/lang/eval/EvaluatingCompiler.kt
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ internal class EvaluatingCompiler(
private val compilationContextStack = Stack<CompilationContext>()

private val currentCompilationContext: CompilationContext
get() = compilationContextStack.peek() ?: throw EvaluationException(
get() = compilationContextStack.peek() ?: errNoContext(
"compilationContextStack was empty.", ErrorCode.EVALUATOR_UNEXPECTED_VALUE, internal = true
)

Expand Down Expand Up @@ -663,6 +663,7 @@ internal class EvaluatingCompiler(
throw EvaluationException(
cause = e,
errorCode = ErrorCode.EVALUATOR_ARITHMETIC_EXCEPTION,
errorContext = errorContextFrom(metas),
internal = true
)
}
Expand All @@ -678,7 +679,7 @@ internal class EvaluatingCompiler(
val computeThunk = thunkFactory.thunkFold(metas, argThunks) { lValue, rValue ->
val denominator = rValue.numberValue()
if (denominator.isZero()) {
err("% by zero", ErrorCode.EVALUATOR_MODULO_BY_ZERO, null, false)
err("% by zero", ErrorCode.EVALUATOR_MODULO_BY_ZERO, errorContextFrom(metas), false)
}

(lValue.numberValue() % denominator).exprValue()
Expand Down Expand Up @@ -1000,7 +1001,7 @@ internal class EvaluatingCompiler(
"${func.signature.arity.last} arguments, received: ${funcArgThunks.size}"
}

throw EvaluationException(
err(
message,
ErrorCode.EVALUATOR_INCORRECT_NUMBER_OF_ARGUMENTS_TO_FUNC_CALL,
errorContext,
Expand Down Expand Up @@ -1083,7 +1084,7 @@ internal class EvaluatingCompiler(
when (val value = env.current[bindingName]) {
null -> {
if (fromSourceNames.any { bindingName.isEquivalentTo(it) }) {
throw EvaluationException(
err(
"Variable not in GROUP BY or aggregation function: ${bindingName.name}",
ErrorCode.EVALUATOR_VARIABLE_NOT_INCLUDED_IN_GROUP_BY,
errorContextFrom(metas).also {
Expand All @@ -1101,7 +1102,7 @@ internal class EvaluatingCompiler(
is PartiqlAst.CaseSensitivity.CaseInsensitive ->
Pair(ErrorCode.EVALUATOR_BINDING_DOES_NOT_EXIST, "")
}
throw EvaluationException(
err(
"No such binding: ${bindingName.name}.$hint",
errorCode,
errorContextFrom(metas).also {
Expand Down Expand Up @@ -1151,7 +1152,7 @@ internal class EvaluatingCompiler(
return { env ->
val params = env.session.parameters
if (params.size <= index) {
throw EvaluationException(
err(
"Unbound parameter for ordinal: $ordinal",
ErrorCode.EVALUATOR_UNBOUND_PARAMETER,
errorContextFrom(metas).also {
Expand Down Expand Up @@ -1283,7 +1284,7 @@ internal class EvaluatingCompiler(

locationMeta?.let { fillErrorContext(errorContext, it) }

throw EvaluationException(
err(
"Validation failure for $asType",
ErrorCode.EVALUATOR_CAST_FAILED,
errorContext,
Expand Down Expand Up @@ -2114,10 +2115,9 @@ internal class EvaluatingCompiler(
val env = resolveEnvironment(row, offsetLocationMeta)
orderByItem.thunk(env)
}
} ?: err(
} ?: errNoContext(
"Order BY comparator cannot be null",
ErrorCode.EVALUATOR_ORDER_BY_NULL_COMPARATOR,
null,
internal = true
)

Expand Down Expand Up @@ -2916,7 +2916,7 @@ internal class EvaluatingCompiler(
"${procedure.signature.arity.last} arguments, received: ${args.size}"
}

throw EvaluationException(
err(
message,
ErrorCode.EVALUATOR_INCORRECT_NUMBER_OF_ARGUMENTS_TO_PROCEDURE_CALL,
errorContext,
Expand Down
9 changes: 5 additions & 4 deletions lang/src/org/partiql/lang/eval/Exceptions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ import org.partiql.lang.util.to
open class EvaluationException(
message: String,
errorCode: ErrorCode,
errorContext: PropertyValueMap? = null,
errorContext: PropertyValueMap = PropertyValueMap(),
cause: Throwable? = null,
override val internal: Boolean
) : SqlException(message, errorCode, errorContext, cause) {

constructor(
cause: Throwable,
errorCode: ErrorCode,
errorContext: PropertyValueMap? = null,
errorContext: PropertyValueMap = PropertyValueMap(),
internal: Boolean
) : this(
message = cause.message ?: "<NO MESSAGE>",
Expand All @@ -51,10 +51,11 @@ open class EvaluationException(
/**
* Shorthand for throwing function evaluation. Separated from [err] to avoid loosing the context unintentionally
*/
internal fun errNoContext(message: String, errorCode: ErrorCode, internal: Boolean): Nothing = err(message, errorCode, null, internal)
internal fun errNoContext(message: String, errorCode: ErrorCode, internal: Boolean): Nothing =
err(message, errorCode, PropertyValueMap(), internal)

/** Shorthand for throwing evaluation with context with an error code.. */
internal fun err(message: String, errorCode: ErrorCode, errorContext: PropertyValueMap?, internal: Boolean): Nothing =
internal fun err(message: String, errorCode: ErrorCode, errorContext: PropertyValueMap, internal: Boolean): Nothing =
throw EvaluationException(message, errorCode, errorContext, internal = internal)

internal fun expectedArgTypeErrorMsg(types: List<ExprValueType>): String = when (types.size) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ internal class MakeDateExprFunction(val valueFactory: ExprValueFactory) : ExprFu
err(
message = "Date field value out of range. $year-$month-$day",
errorCode = ErrorCode.EVALUATOR_DATE_FIELD_OUT_OF_RANGE,
errorContext = null,
errorContext = propertyValueMapOf(),
internal = false
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ internal class MakeTimeExprFunction(val valueFactory: ExprValueFactory) : ExprFu
err(
message = e.message,
errorCode = ErrorCode.EVALUATOR_TIME_FIELD_OUT_OF_RANGE,
errorContext = null,
errorContext = e.errorContext,
internal = false
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ internal class PhysicalPlanCompilerImpl(
val computeThunk = thunkFactory.thunkFold(metas, argThunks) { lValue, rValue ->
val denominator = rValue.numberValue()
if (denominator.isZero()) {
err("% by zero", ErrorCode.EVALUATOR_MODULO_BY_ZERO, errorContext = null, internal = false)
err("% by zero", ErrorCode.EVALUATOR_MODULO_BY_ZERO, errorContextFrom(metas), internal = false)
}

(lValue.numberValue() % denominator).exprValue()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ package org.partiql.lang.eval.physical.operators

import org.partiql.lang.errors.ErrorCode
import org.partiql.lang.eval.ExprValue
import org.partiql.lang.eval.err
import org.partiql.lang.eval.errNoContext
import org.partiql.lang.eval.physical.EvaluatorState
import org.partiql.lang.eval.relation.RelationIterator
import org.partiql.lang.eval.relation.RelationType
Expand Down Expand Up @@ -73,10 +73,9 @@ private fun getSortingComparator(sortKeys: List<CompiledSortKey>, state: Evaluat
state.load(row)
sortKey.value(state)
}
} ?: err(
} ?: errNoContext(
"Order BY comparator cannot be null",
ErrorCode.EVALUATOR_ORDER_BY_NULL_COMPARATOR,
null,
internal = true
)
}
20 changes: 20 additions & 0 deletions lang/test/org/partiql/lang/ast/passes/StatementRedactorTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,26 @@ class StatementRedactorTest : SqlParserTestBase() {
"INSERT INTO tb VALUE << 'value1', 'value2' >>",
"INSERT INTO tb VALUE << ***(Redacted), ***(Redacted) >>"
),
RedactionTestCase(
"INSERT INTO tb <<{ 'hk': 'a', 'rk': 1, 'attr': 'b' }>>",
"INSERT INTO tb <<{ 'hk': 'a', 'rk': 1, 'attr': ***(Redacted) }>>"
),
RedactionTestCase(
"INSERT INTO tb <<{ 'hk': 'a', 'rk': 1, 'attr': { 'hk': 'a' }}>>",
"INSERT INTO tb <<{ 'hk': 'a', 'rk': 1, 'attr': { ***(Redacted): ***(Redacted) }}>>"
),
RedactionTestCase(
"UPSERT INTO testTable2 << { 'dummy1' : 'hashKey', 'dummy2' : 'rangeKey', 'dummyTestAttribute' : '123' } >>",
"UPSERT INTO testTable2 << { 'dummy1' : ***(Redacted), 'dummy2' : ***(Redacted), 'dummyTestAttribute' : ***(Redacted) } >>"
),
RedactionTestCase(
"REPLACE INTO testTable2 << { 'dummy1' : 'hashKey', 'dummy2' : 'rangeKey', 'dummyTestAttribute' : '123' } >>",
"REPLACE INTO testTable2 << { 'dummy1' : ***(Redacted), 'dummy2' : ***(Redacted), 'dummyTestAttribute' : ***(Redacted) } >>"
),
RedactionTestCase(
"INSERT INTO testTable2 <<[2, 'some-name']>>",
"INSERT INTO testTable2 <<[***(Redacted), ***(Redacted)]>>"
),
// Update Assignment
RedactionTestCase(
"update nonExistentTable set foo = 'bar' where attr1='testValue'",
Expand Down
3 changes: 2 additions & 1 deletion lang/test/org/partiql/lang/eval/ExceptionWrappingTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import org.junit.Test
import org.partiql.lang.CompilerPipeline
import org.partiql.lang.ast.passes.SemanticException
import org.partiql.lang.errors.ErrorCode
import org.partiql.lang.errors.PropertyValueMap
import org.partiql.lang.types.FunctionSignature
import org.partiql.lang.types.StaticType

Expand All @@ -26,7 +27,7 @@ class ExceptionWrappingTest {

private val throwSemanticExceptionExprFunction = object : ExprFunction {
override fun callWithRequired(session: EvaluationSession, required: List<ExprValue>): ExprValue {
throw SemanticException("Intentionally throw a SemanticException", ErrorCode.SEMANTIC_AMBIGUOUS_BINDING, null)
throw SemanticException("Intentionally throw a SemanticException", ErrorCode.SEMANTIC_AMBIGUOUS_BINDING, PropertyValueMap())
}

override val signature: FunctionSignature
Expand Down
2 changes: 1 addition & 1 deletion lib/partiql-isl/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ plugins {
}

// lib subprojects are _currently_ versioned independently of partiql-lang-kotlin
version = "0.2.2"
version = "0.2.3-SNAPSHOT"
ext.isReleaseVersion = !version.endsWith("SNAPSHOT")

dependencies {
Expand Down

0 comments on commit e070ef7

Please sign in to comment.