[
https://issues.apache.org/jira/browse/THRIFT-1833?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13581789#comment-13581789
]
Alan Choi commented on THRIFT-1833:
-----------------------------------
Hi Todd,
Thanks for reviewing it.
1. There's an existing inconsistency here. _{struct_name}__isset is created
whenever there's a non-required field (around line 808). That means, it is
created even for "default" field. It is inconsistent with the comment "we treat
"default" fields as required". So, I think the is_optional is correct because
it is consistent with the _{struct_name}__isset creation.
2. I agree with you. I think != T_OPTIONAL makes more sense and it would make
things a lot more consistent. However, enforcing OPTIONAL field for union might
break existing stuff. At least, for HiveServer2 thrift API, it uses "default"
for all its union field. Any thought on it?
Thanks,
Alan
> Thrift generates incorrect C++ writer for union
> -----------------------------------------------
>
> Key: THRIFT-1833
> URL: https://issues.apache.org/jira/browse/THRIFT-1833
> Project: Thrift
> Issue Type: Bug
> Components: C++ - Compiler
> Affects Versions: 0.9
> Reporter: Alan Choi
> Attachments: Thrift-1833.diff
>
>
> The generated union struct c++ writer would write all union fields. This is
> incorrect. It should only write the field that has been set.
> It causes incompatibility between c++ and Java. A union written by C++ side
> cannot be read by the Java side.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira