Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Build a JSON_Object value in Flink SQL

I have a Flink Table for which I want to write a select query that will return a JSON Object based on some fields.

Here is the query I want to do (based on calcite syntax : https://calcite.apache.org/docs/reference.html#constructor-functions):

SELECT 
    myIdField,
    aFloatField,
    JSON_OBJECT('aFieldName':aFloatField)
FROM myTable

But when I try to use this query with Flink, I get the following error :

org.apache.flink.table.api.ValidationException: SQL validation failed. No match found for function signature JSON_OBJECT(<null>, , )

What is the good way to do so ? I can't find anything about this in Flink documentation.

like image 656
Nakeuh Avatar asked Dec 20 '25 04:12

Nakeuh


1 Answers

JSON_OBJECT is supported in Flink 1.15:

https://nightlies.apache.org/flink/flink-docs-master/docs/dev/table/functions/systemfunctions/#json-functions

like image 169
twalthr Avatar answered Dec 21 '25 20:12

twalthr



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!