-
Notifications
You must be signed in to change notification settings - Fork 222
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
Input size estimates for more robust heuristic cost calculations #477
Comments
I tried out a quick prototype of this and was able to get it basically working. The biggest problem is that I needed to use a When I do this, there needs to be a clear way to map I haven't figured out how to address that yet. Some options I've considered:
I'm not thrilled with any of these options, TBH. (2) might be the most future proof against replacing the protobuf types with go structs, but I haven't found a way to associate the identifiers. (3) is complicated and I haven't proved to myself that the information needed is available. (1) is something I know how to implement, but relying on reference equality checks seems less than ideal. |
Hi Joe, Can you help me understand why you're using the
It had been assumed that all variables have a fixed cost of You might want to consider wiring your estimation changes into the Thoughts? |
It's not ideal actually. Given an OpenAPIv3 schema:
And a CEL expression: There would only be one declaration (var) with two fields that are both of type list[int]. So providing the type to the callback is ambiguous. Hence the list of options in my previous comment.
Yes, this looks like it's close to what I want.
If I can use the schema path to find the corresponding node in the OpenAPIv3 schema then I have what I need. Attribute seems like the right concept. I don't know how to handle this case:
For the inner sublist, it looks like the attribute is just "sublist"? I would need the "var1.list" path part as well to match it up with the OpenAPIv3 schema. |
Comprehension variables are harder to track. You would have access to the initial |
Closed, tracking remaining work as #504 |
Change
There is limited support for estimating the heuristic compute cost of an expression. Inferences are
limited though when dealing with lists and maps, particularly within comprehensions where the cost
is estimated to be infinite as the number of elements in the value is not known.
To aide in computation of cost, provide a call back that can return the max size of the declaration
provided to the CEL environment. The range of size will ensure that the min and max compute
costs can be more accurately computed in a majority of cases.
Example
Alternatives considered
Attaching a size directly to the
Decl
would be vastly preferred, but is not yet possible as all declarationsare based on protobuf objects. In the future, these proto-based declarations will likely be replaced with
Go-native structs, but this is a bigger refactor than is needed to provide this functionality.
The text was updated successfully, but these errors were encountered: