-
Notifications
You must be signed in to change notification settings - Fork 16
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
[BUG] CelDescriptorsUtil throwing duplicate key exception #351
Comments
Are you trying to leverage the utility class directly or are you running into this issue when evaluating an expression against an environment? If the former, the class is really meant to be used for internal use (it's missing the annotation, we'll mark it as such). If the latter, can you please provide a reproducible test case? |
I am not using this utility directly . when we directly pass file descriptor of the event message to cel container i.e. single file descriptor it fails to resolves references in expression from different packages , when we pass filedescriptors of each fields in the event message as list of file descriptor cel is able to resolve transitive dependent refrerences from different package . but now it throws duplicate key references error for wrapper types and other custom messages . As in CelDescriptorUtils it resolves message type of each file descriptor handling duplicates but creates a single collection resolving all file descriptors and duplicating types across file descriptors and finally throws exception in CelDescriptorUtils.descriptorCollectionMap Even if we set resolvetypedependency to true we start getting duplicate keys exception. Handling duplicate key issue in CelDescriptorUtils.descriptorCollectionMap works and fixes all issues and all filters working fine for us. Example How we are using CEL library we create Cel cel = CelFactory.standardCelBuilder() //then we validate expression // then we create program from the syntax tree created above // finally evaluate program.eval(ImmutableMap.of(eventRef, eventMessage); our event message is a DynamicMessage which Let me know if you need more information |
It'd help if you could either create a small test project somewhere demonstrating this problem or if you're able to reproduce on your end, feel free to open a PR. I understand where the issue might be happening but without a reproducible test case there's not much I can do. |
Please feel free to reopen with a reproducible test case if you're still experiencing this issue. |
Describe the bug
CelDescriptorUtil method descriptorCollectionToMap throws duplicate key exception .
As method getFileDescriptorsForDescriptors collect unique Messagetypes for individual filedescriptors but collects all message types for multiple filedescriptors again duplicating message types in the aggregated collection . And when it tries to convert this collection to a map in descriptorCollectionToMap throws duplicate key exception .
To Reproduce
I have a dynamic message with nested message types . As a fix we have collected unique filedescriptor
Check which components this affects:
Sample expression and input that reproduces the issue:
Test setup:
// test case in java
Expected behavior
When multiple filedecrptors are provided CelDescriptor should not throw duplicate key exception
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: