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

partial eval: support negated expressions with support rules #623

Closed
tsandall opened this issue Feb 19, 2018 · 0 comments
Closed

partial eval: support negated expressions with support rules #623

tsandall opened this issue Feb 19, 2018 · 0 comments

Comments

@tsandall
Copy link
Member

Today, negated expressions are not partially evaluated; the plugged expression is saved and partial evaluation continues in the current query.

In some cases, it's advantageous to partially evaluate negated expressions and produce support rules.

Example

Query:

x = 1; not p[x]

Policy:

p[x] {
  input.a = y
  x = r[y]
}

r = {"foo": 0, "bar": 1, "baz": 2}

Result:

x = 1; not support.p[1]

Support:

package support

p[1] {
  input.a = "bar"
}
@tsandall tsandall added this to the v0.8 milestone Mar 5, 2018
tsandall added a commit to tsandall/opa that referenced this issue Mar 8, 2018
Previously, partial evaluation would save negated expressions and not
perform any inlining. With these changes, partial evaluation inlines
negated expressions into support rules and rewrites the original
expression to refer to the support rule.

These changes will improve the coverage of partial evaluation which
improves the applicability of rule indexing and other optimizations.

Fixes open-policy-agent#623
tsandall added a commit that referenced this issue Mar 8, 2018
Previously, partial evaluation would save negated expressions and not
perform any inlining. With these changes, partial evaluation inlines
negated expressions into support rules and rewrites the original
expression to refer to the support rule.

These changes will improve the coverage of partial evaluation which
improves the applicability of rule indexing and other optimizations.

Fixes #623
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant