Skip to content
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

eval: improve offset validation #1600

Merged
merged 1 commit into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ private[stream] class ExprInterpreter(config: Config) {
case op: FilterExpr => invalidOperator(op); op
case op: DataExpr if !op.offset.isZero => invalidOperator(op); op
}

// Double check all data expressions do not have an offset. In some cases for named rewrites
// the check above may not detect the offset.
result.expr.dataExprs.filterNot(_.offset.isZero).foreach(invalidOperator)
}

// Perform host rewrites based on the Atlas hostname
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,14 @@ class EvaluatorSuite extends FunSuite {
invalidOperator("offset", "name,jvm.gc.pause,:eq,:sum,1w,:offset")
}

test("validate: unsupported operation `:offset` with math") {
invalidOperator("offset", "name,a,:eq,:sum,:dup,1w,:offset,:div")
}

test("validate: unsupported operation `:offset` with named rewrite and math") {
invalidOperator("offset", "name,a,:eq,:sum,:sdes-slower,:dup,1w,:offset,:div")
}

test("validate: unsupported operation `:integral`") {
invalidOperator("integral", "name,jvm.gc.pause,:eq,:sum,:integral")
}
Expand Down
Loading