Skip to content
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
8 changes: 2 additions & 6 deletions PLANNER_MIGRATION_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,11 @@ Cel cel = CelFactory.plannerCelBuilder().build();
> (`standardCelBuilder`, `legacyCelBuilder`, `standardCelRuntimeBuilder`,
> `legacyCelRuntimeBuilder`) are deprecated.

If you are overriding `CelOptions`, ensure
`enableHeterogeneousNumericComparisons` is enabled, and remove any deprecated
options:
If you are overriding `CelOptions`, start from `CelOptions.current()` and remove
any deprecated options:

```java
CelOptions options = CelOptions.current()
// Ensure this is explicitly toggled on (enabled by default in planner
// builders)
.enableHeterogeneousNumericComparisons(true)
// Remove the following deprecated options if you have them set:
// .enableUnsignedLongs(...)
// .unwrapWellKnownTypesOnFunctionDispatch(...)
Expand Down
2 changes: 1 addition & 1 deletion bundle/src/main/java/dev/cel/bundle/CelFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public static CelBuilder plannerCelBuilder() {
CelCheckerLegacyImpl.newBuilder().setStandardEnvironmentEnabled(true)),
CelRuntimeImpl.newBuilder())
// CEL-Internal-2
.setOptions(CelOptions.current().enableHeterogeneousNumericComparisons(true).build());
.setOptions(CelOptions.DEFAULT);
}

/** Combines a prebuilt {@link CelCompiler} and {@link CelRuntime} into {@link Cel}. */
Expand Down
4 changes: 2 additions & 2 deletions common/src/main/java/dev/cel/common/CelOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ public static Builder current() {
.enableUnsignedLongs(true)
.enableRegexPartialMatch(true)
.enableTimestampEpoch(true)
.enableHeterogeneousNumericComparisons(true)
.errorOnDuplicateMapKeys(true)
.evaluateCanonicalTypesToNativeValues(true)
.errorOnIntWrap(true)
Expand Down Expand Up @@ -323,8 +324,7 @@ public abstract static class Builder {
* Enable the {@code less_equals_double_int64} and other cross-type numeric comparisons for
* {@code double}, {@code int64}, and {@code uint64} values.
*
* <p>This feature adds the declarations for these overloads to the CEL standard environment,
* but the runtime functions are enabled by default.
* <p>This option is enabled by default in {@link CelOptions#current}.
*
* <p>TODO: Remove this feature once it has been auto-enabled.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public static CelRuntimeBuilder legacyCelRuntimeBuilder() {
public static CelRuntimeBuilder plannerRuntimeBuilder() {
return CelRuntimeImpl.newBuilder()
// CEL-Internal-2
.setOptions(CelOptions.current().enableHeterogeneousNumericComparisons(true).build());
.setOptions(CelOptions.DEFAULT);
}

private CelRuntimeFactory() {}
Expand Down
Loading