Thrift
  1. Thrift
  2. THRIFT-1528

Inconsistency in optional fields between Java/C# and python

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 0.8
    • Fix Version/s: 1.0
    • Component/s: Python - Compiler
    • Labels:
      None

      Description

      If a struct contains optional fields with default values the generated python code serialize differently than Java or C# code.

      In Java or C# optional fields are only serialized if a field was set by the client. If not the field is omited during serialization. This is possible because C#/Java maintains for each field a 'isset'-boolean which records if a field was set or not.

      However the generated python code does not have such a 'isset'-structure. It writes every field which is not equal None. As the constructor initialize the optional fields with their default value, these fields are written whether they are set or not.

        Activity

        Roger Meier made changes -
        Fix Version/s 1.0 [ 12318851 ]
        Roger Meier made changes -
        Priority Minor [ 4 ] Major [ 3 ]
        Nate Rosenblum made changes -
        Attachment 0001-Mark-defaulted-optionals-set-in-Java.patch [ 12576243 ]
        Nate Rosenblum made changes -
        Attachment 0002-Mark-defaulted-optionals-set-in-C-sharp.patch [ 12576244 ]
        Jens Geyer made changes -
        Summary Iconsistency in optional fields between Java/C# and python Inconsistency in optional fields between Java/C# and python
        Nate Rosenblum made changes -
        Field Original Value New Value
        Attachment 0001-Mark-defaulted-optionals-set-in-Java.patch [ 12576243 ]
        Attachment 0002-Mark-defaulted-optionals-set-in-C-sharp.patch [ 12576244 ]
        Stefan Gmeiner created issue -

          People

          • Assignee:
            Unassigned
            Reporter:
            Stefan Gmeiner
          • Votes:
            2 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

            • Created:
              Updated:

              Development