flyte icon indicating copy to clipboard operation
flyte copied to clipboard

[BUG] Integer type cannot be reserved when changing python dict type to struct_pb2

Open highfly22 opened this issue 3 years ago • 3 comments

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

highfly22 avatar Sep 14 '22 10:09 highfly22

Thank you for opening your first issue here! 🛠

welcome[bot] avatar Sep 14 '22 10:09 welcome[bot]

@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.

eapolinario avatar Sep 17 '22 00:09 eapolinario

@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.

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.

highfly22 avatar Sep 19 '22 02:09 highfly22

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! 🙏

github-actions[bot] avatar Sep 04 '23 00:09 github-actions[bot]

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! 🙏

github-actions[bot] avatar Sep 12 '23 01:09 github-actions[bot]

Closing this in favor of https://github.com/flyteorg/flyte/issues/4505.

eapolinario avatar Jun 05 '24 22:06 eapolinario