You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think it's preferable to open an issue instead of a PR because:
We don't have time to address it right now and it's gonna be useful for tracking purposes
It probably requires discussion
Change
@lopezator asked in #359 if not checking the sanity of values inside known function overloads in Compile time was an expected behaviour. And it was, there is no constant value checking meaning that Compile (Parse+Check) won't complain about these kind of expressions: birth_date >= timestamp("invalid-date!").
Although @TristonianJones said that there would be a possibility in the future to include linting rules to Compile that doesn't fully solve our problem. We're using CEL to parse (& check!) the filter (https://google.aip.dev/160) attribute in our List API calls (https://google.aip.dev/132). Then with the resulting AST we convert it into our WHERE clause in the SQL SELECT statement.
The point is that if the AST is left unmodified the AST->SQL WHERE (or whatever filtering language) converting layers gets more complicated than they should because they need to take care about those intermediate functions by themselves.
Ideally for us, Compile would have an option to contract those constants and optimize the AST. But it could also be possible to achieve exactly the same optimized AST with the decorators thing @TristonianJones proposed here and letting cel-go users by writing that logic outside of the library.
Alternatives considered
Using cel.Program with Eval in combination of OptOptimize but it would only check if the expression is valid, the original AST unmodified.
The text was updated successfully, but these errors were encountered:
As a first step, the plan is to introduce validators (#762) to allow for custom AST validations to be run after type-check. Once the exprpb.Expr is migrated to a Go-native set of types, we'll expose optimizers which will allow you to constant fold or mutate the AST after the type-check and validators run. These features will only be available for type-checked expressions.
Feature request checklist
I think it's preferable to open an issue instead of a PR because:
Change
@lopezator asked in #359 if not checking the sanity of values inside known function overloads in
Compile
time was an expected behaviour. And it was, there is no constant value checking meaning thatCompile
(Parse
+Check
) won't complain about these kind of expressions:birth_date >= timestamp("invalid-date!")
.Although @TristonianJones said that there would be a possibility in the future to include linting rules to
Compile
that doesn't fully solve our problem. We're using CEL to parse (& check!) the filter (https://google.aip.dev/160) attribute in our List API calls (https://google.aip.dev/132). Then with the resulting AST we convert it into our WHERE clause in the SQL SELECT statement.The point is that if the AST is left unmodified the AST->SQL WHERE (or whatever filtering language) converting layers gets more complicated than they should because they need to take care about those intermediate functions by themselves.
Ideally for us,
Compile
would have an option to contract those constants and optimize the AST. But it could also be possible to achieve exactly the same optimized AST with the decorators thing @TristonianJones proposed here and lettingcel-go
users by writing that logic outside of the library.Alternatives considered
Using
cel.Program
withEval
in combination ofOptOptimize
but it would only check if the expression is valid, the original AST unmodified.The text was updated successfully, but these errors were encountered: