Sylwester Lachiewicz created THRIFT-6176:
--------------------------------------------

             Summary: Go generator: struct field named isSetX collides with the 
generated IsSetX() accessor
                 Key: THRIFT-6176
                 URL: https://issues.apache.org/jira/browse/THRIFT-6176
             Project: Thrift
          Issue Type: Bug
          Components: Go - Compiler
    Affects Versions: 0.24.0
            Reporter: Sylwester Lachiewicz


A Thrift struct with a field {{y}} and a sibling field literally named 
{{isSetY}} generates a Go type that has both a field {{IsSetY}} and a method 
{{IsSetY()}}, which the Go compiler rejects:

{code}
field and method with the same name IsSetQueryParallelism
{code}

Real-world case: Apache Hive's {{hive_metastore.thrift}} (tag 
{{rel/release-4.2.1}}) declares 
{{WMNullableResourcePlan.isSetQueryParallelism}}, 
{{WMNullableResourcePlan.isSetDefaultPoolPath}} and 
{{WMNullablePool.isSetSchedulingPolicy}}. Together with THRIFT-2063 this keeps 
the Hive metastore IDL from building for Go without patching the IDL.

Expected: the generator mangles the field name (for example 
{{IsSetQueryParallelism_}}) the way it already avoids other reserved 
identifiers, or emits the accessor under a non-colliding name for that field.

Workaround: rename the fields in a local copy of the IDL; field IDs are 
unchanged so the wire format is unaffected.

_This issue was created with AI assistance._



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to