Does the DatatypeHint with bridgedTo can meet your requirements? 
For example: 
' 
public @DataTypeHint( 
value = "RAW", 
bridgedTo = JSONObject .class, 
rawSerializer = JSONObject Serializer.class) JSONObject eval(String str) { 
return JSONObject .parse(str); 
} 
' 
You may need to provide a class like JSONObject Serializer that extends 
TypeSerializerSingleton. 


Best regards, 
Yuxia 


发件人: "Surendra Lalwani" <surendra.lalw...@swiggy.in> 
收件人: "User" <user@flink.apache.org> 
发送时间: 星期五, 2022年 5 月 06日 下午 4:40:19 
主题: How to return JSON Object from UDF 

Hi Team, 

I am using Flink 1.13.6 and I have created a UDF and I want to return 
JSONObject from that UDF or basically an Object but it doesn't seems to work as 
there is no datatype hint compatible to Object. in earlier flink versions when 
DataTypeHint wasn't there, it used to work. Any help would be appreciated. 

Thanks and Regards , 
Surendra Lalwani 



IMPORTANT NOTICE: This e-mail, including any attachments, may contain 
confidential information and is intended only for the addressee(s) named above. 
If you are not the intended recipient(s), you should not disseminate, 
distribute, or copy this e-mail. Please notify the sender by reply e-mail 
immediately if you have received this e-mail in error and permanently delete 
all copies of the original message from your system. E-mail transmission cannot 
be guaranteed to be secure as it could be intercepted, corrupted, lost, 
destroyed, arrive late or incomplete, or contain viruses. Company accepts no 
liability for any damage or loss of confidential information caused by this 
email or due to any virus transmitted by this email or otherwise. 

Reply via email to