[ https://issues.apache.org/jira/browse/THRIFT-2381?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13914024#comment-13914024 ]
sherlockhua commented on THRIFT-2381: ------------------------------------- Thank you for your reply, i found the golang code which generated by thrift from hbase/thrift2 have a binary type. just like follow: const ( STOP = 0 VOID = 1 BOOL = 2 BYTE = 3 I08 = 3 DOUBLE = 4 I16 = 6 I32 = 8 I64 = 10 STRING = 11 UTF7 = 11 STRUCT = 12 MAP = 13 SET = 14 LIST = 15 UTF8 = 16 UTF16 = 17 BINARY = 18 ) and the other language (like python), not have the binary type, like follow: STOP = 0 VOID = 1 BOOL = 2 BYTE = 3 I08 = 3 DOUBLE = 4 I16 = 6 I32 = 8 I64 = 10 STRING = 11 UTF7 = 11 STRUCT = 12 MAP = 13 SET = 14 LIST = 15 UTF8 = 16 UTF16 = 17 when i use the generate code, i call hbase interface, it's failed.the error message is follow: Required field 'table' was not present! Struct: get_args(table:null, get:null) when i modify all the binary type to string type, like follow: func (p *GetArgs) writeField1(oprot thrift.TProtocol) (err error) { 2016 if p.Table != nil { 2017 //if err := oprot.WriteFieldBegin("table", thrift.BINARY, 1); err != nil { 2018 if err := oprot.WriteFieldBegin("table", thrift.STRING, 1); err != nil { 2019 return fmt.Errorf("%T write field begin error 1:table: %s", p, err) 2020 } 2021 if err := oprot.WriteBinary(p.Table); err != nil { 2022 return fmt.Errorf("%T.table (1) field write error: %s", p) 2023 } 2024 if err := oprot.WriteFieldEnd(); err != nil { 2025 return fmt.Errorf("%T write field end error 1:table: %s", p, err) 2026 } 2027 } 2028 return err 2029 } and it works, can you tell me why the code generated by golang have binary type but it's does not work,thank you very much > code which generated by thrift2/hbase.thrift compile error > ---------------------------------------------------------- > > Key: THRIFT-2381 > URL: https://issues.apache.org/jira/browse/THRIFT-2381 > Project: Thrift > Issue Type: Bug > Environment: hbase-0.94.3 > thrift-0.9.1 > go version go1.1.2 linux/amd64 > ubuntu 3.5.0-23-generic > Reporter: sherlockhua > > command: > ./bin/thrift -gen go > ./hbase/hbase-thrift/src/main/resources/org/apache/hadoop/hbase/thrift2/hbase.thrift > complile error: > src/hbase/ttypes.go:1103: invalid map key type []byte > src/hbase/ttypes.go:1267: invalid map key type []byte > src/hbase/ttypes.go:1495: invalid map key type []byte > src/hbase/ttypes.go:1616: invalid map key type []byte > src/hbase/ttypes.go:1812: invalid map key type []byte > src/hbase/ttypes.go:1947: invalid map key type []byte > src/hbase/ttypes.go:2133: invalid map key type []byte > src/hbase/ttypes.go:2237: invalid map key type []byte > src/hbase/ttypes.go:2412: invalid map key type []byte > src/hbase/ttypes.go:2697: invalid map key type []byte > src/hbase/ttypes.go:2237: too many errors -- This message was sent by Atlassian JIRA (v6.1.5#6160)