hadoop - java.io.IOException: org.apache.thrift.protocol.TProtocolException: Cannot write a TUnion with no set value -


i using thrift scheme store thrift bundles pail file in hadoop cluster. seems working correctly. thrift bundle being created without errors.

although,i using kafka send bundle , while serializing,the serializer function converts bundle in byte array.i getting above mentioned error @ point. why kafka in bundle object converting in byte array. or there way can convert object byte array safely.if can please provide it.the error :

java.io.ioexception: org.apache.thrift.protocol.tprotocolexception: cannot write tunion no set value! 

following writeobject function throwing error

private void writeobject(java.io.objectoutputstream out)         throws java.io.ioexception {     try {         write(new org.apache.thrift.protocol.tcompactprotocol(                 new org.apache.thrift.transport.tiostreamtransport(out)));     } catch (org.apache.thrift.texception te) {         throw new java.io.ioexception(te);     } } 

the message quite clear: there somewhere union object no value set. 1 value must set thrift unions.

thrift union example, see *.thrift file:

union foo {   1: string bar   2: bool baz } 

this condition raised error:

public void write(tprotocol oprot, tunion struct) throws texception {   if (struct.getsetfield() == null || struct.getfieldvalue() == null) {     throw new tprotocolexception("cannot write tunion no set value!");   }    // ... more code ... } 

can't tell object given code, deep in stack. @ code calls writeobject(), walk upwards. @ place in code data not set should, or value set null value - illegal thrift. if need indicator null values fopr use case, consider boolean flag.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -