Title: Support `CelOptions.enableComprehension(boolean)` for feature parity with CEL-Cpp · Issue #484 · cel-expr/cel-java · GitHub
Open Graph Title: Support `CelOptions.enableComprehension(boolean)` for feature parity with CEL-Cpp · Issue #484 · cel-expr/cel-java
X Title: Support `CelOptions.enableComprehension(boolean)` for feature parity with CEL-Cpp · Issue #484 · cel-expr/cel-java
Description: Feature request checklist There are no issues that match the desired change The change is large enough it can't be addressed with a simple Pull Request If this is a bug, please file a Bug Report. Change To make CEL environment setup cons...
Open Graph Description: Feature request checklist There are no issues that match the desired change The change is large enough it can't be addressed with a simple Pull Request If this is a bug, please file a Bug Report. C...
X Description: Feature request checklist There are no issues that match the desired change The change is large enough it can't be addressed with a simple Pull Request If this is a bug, please file a Bug Repor...
Opengraph URL: https://github.com/cel-expr/cel-java/issues/484
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Support `CelOptions.enableComprehension(boolean)` for feature parity with CEL-Cpp","articleBody":"**Feature request checklist**\n\n- [x] There are no issues that match the desired change\n- [ ] The change is large enough it can't be addressed with a simple Pull Request\n- [x] If this is a bug, please file a [Bug Report](./ISSUE_TEMPLATE).\n\n**Change**\nTo make CEL environment setup consistent across CEL implementations, I propose to add a runtime option equivalent to CEL-cpp `InterpreterOptions.enable_comprehension` to CEL-Java and CEL-Go (corresponding ticket google/cel-go#1050).\n\n`CelOptions.enableComprehension` is `true` by default. Setting it to false will disable comprehension expressions (e.g. `exists()`, `all()` -- except `has()`). Under-the-hood it may simply call `comprehensionMaxIterations(0)` to disable comprehension expressions, and reset it to the default value to enable them.\n\n**Example**\n```java\nprivate static final CelRuntime CEL_RUNTIME = CelRuntimeFactory\n .standardCelRuntimeBuilder()\n .setOptions(CelOptions.current().enableComprehension(false).build())\n .build();\n```\n\n```java\n@Test\npublic void macros_comprehensionsDisabled() throws Exception {\n CelCompiler CEL_COMPILER = CelCompilerFactory.standardCelCompilerBuilder()\n .addVar(\"request\", SimpleType.ANY)\n .setResultType(SimpleType.BOOL)\n .setStandardMacros(CelStandardMacro.STANDARD_MACROS)\n .build();\n\n String expr = \"size(['foo', 'bar'].map(x, request[x])) == 2\";\n CelRuntime.Program program = CEL_RUNTIME.createProgram(CEL_COMPILER.compile(expr).getAst());\n\n Map\u003cString, ?\u003e input = ImmutableMap.of(\"request\", ImmutableMap.of(\"foo\", \"f\", \"bar\", \"b\"));\n CelEvaluationException celErr = assertThrows(CelEvaluationException.class, () -\u003e program.eval(input));\n\n assertThat(celErr.getErrorCode()).isEqualTo(CelErrorCode.ITERATION_BUDGET_EXCEEDED);\n}\n```\n\n**Related**\nInternal ref: go/grpc-cel-integration","author":{"url":"https://github.com/sergiitk","@type":"Person","name":"sergiitk"},"datePublished":"2024-10-24T01:08:26.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/484/cel-java/issues/484"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:11751b87-a77a-0bb3-3ddf-33a4a0b86bd3 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BBE0:3F0C56:83705:C0223:6A4DFA23 |
| html-safe-nonce | a224661891199cd7f1a8343ee745732e77f4077295b74a0f44d84a6c6a2825ec |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQkUwOjNGMEM1Njo4MzcwNTpDMDIyMzo2QTRERkEyMyIsInZpc2l0b3JfaWQiOiI4OTAwNTYzOTg0NTkzMDU4MzM5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 323d848ff8bad9b269d3bfe6bce281d7ec1af581507edf12c48e363e83a869dc |
| hovercard-subject-tag | issue:2610141060 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/cel-expr/cel-java/484/issue_layout |
| twitter:image | https://opengraph.githubassets.com/69421eea93f04ccb2041a80519a6590c56b50789e46c0f9ae28c431a7d0b4261/cel-expr/cel-java/issues/484 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/69421eea93f04ccb2041a80519a6590c56b50789e46c0f9ae28c431a7d0b4261/cel-expr/cel-java/issues/484 |
| og:image:alt | Feature request checklist There are no issues that match the desired change The change is large enough it can't be addressed with a simple Pull Request If this is a bug, please file a Bug Report. C... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | sergiitk |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5818716c93c6a2925b815402541a32814e43a7b1261c322b0c2df75224289566 |
| turbo-cache-control | no-preview |
| go-import | github.com/cel-expr/cel-java git https://github.com/cel-expr/cel-java.git |
| octolytics-dimension-user_id | 186625994 |
| octolytics-dimension-user_login | cel-expr |
| octolytics-dimension-repository_id | 587078119 |
| octolytics-dimension-repository_nwo | cel-expr/cel-java |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 587078119 |
| octolytics-dimension-repository_network_root_nwo | cel-expr/cel-java |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 4314b1df11fa8a565684f3a72dc971e3785da365 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width