Hi Surendra,
in general we would like to encourage users to use the SQL type system
classes instead of RAW types. Otherwise they are simply black boxes in
the SQL engine. A STRING or ROW type might be more appropriate.
You can use
@DataTypeHint(value = "RAW") // defaults to Object.class
@DataTypeHint(value = "RAW", bridgedTo =JSONObject.class) // more
precise class information
the rawSerializer is usually not required and Kyro will be used in this
case.
Regards,
Timo
Am 06.05.22 um 10:36 schrieb yuxia:
Does the DatatypeHint with bridgedTo can meet your requirements?
For example:
'
public @DataTypeHint(
value = "RAW",
bridgedTo =JSONObject.class,
rawSerializer =JSONObjectSerializer.class) JSONObject
eval(String str) {
return JSONObject.parse(str);
}
'
You may need to provide a class likeJSONObjectSerializer 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.