[BUG] Integer type cannot be reserved when changing python dict type to struct_pb2
Describe the bug
If I pass an argument as dict, then the argument can not be reserved the integer type. So I have to use YAML string directly.
>>> from flytekit.core.type_engine import DictTransformer
>>> DictTransformer.dict_to_generic_literal({'a' : 1})
scalar {
generic {
fields {
key: "a"
value {
number_value: 1.0
}
}
}
}
Expected behavior
I expect the result of the following code is integer 1 not float 1.0.
Additional context to reproduce
No response
Screenshots
No response
Are you sure this issue hasn't been raised already?
- [X] Yes
Have you read the Code of Conduct?
- [X] Yes
Thank you for opening your first issue here! 🛠
@highfly22 , can you expand on the problem here? In what context are you using the DictTransformer directly? Maybe give an example of how you're seeing this behavior.
@highfly22 , can you expand on the problem here? In what context are you using the
DictTransformerdirectly? Maybe give an example of how you're seeing this behavior.
I parse a YAML configuration file to dict, then pass it as context argument. The configuration contains some integer data. When I try to access the integer data, an invalid parameter exception is raised. Because the integer data has been casted to a float value.
So I make a new Class to wrapper the configuration, and serialize it into a string.
Hello 👋, This issue has been inactive for over 9 months. To help maintain a clean and focused backlog, we'll be marking this issue as stale and will close the issue if we detect no activity in the next 7 days. Thank you for your contribution and understanding! 🙏
Hello 👋, This issue has been inactive for over 9 months and hasn't received any updates since it was marked as stale. We'll be closing this issue for now, but if you believe this issue is still relevant, please feel free to reopen it. Thank you for your contribution and understanding! 🙏
Closing this in favor of https://github.com/flyteorg/flyte/issues/4505.