[英]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.我有一个 Flink 表,我想为其编写一个 select 查询,该查询将基于某些字段返回 JSON Object。
Here is the query I want to do (based on calcite syntax: https://calcite.apache.org/docs/reference.html#constructor-functions ):这是我想做的查询(基于方解石语法: 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:但是当我尝试将此查询与 Flink 一起使用时,我收到以下错误:
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.
我在 Flink 文档中找不到任何关于此的内容。
JSON_OBJECT is supported in Flink 1.15: Flink 1.15 支持 JSON_OBJECT:
https://nightlies.apache.org/flink/flink-docs-master/docs/dev/table/functions/systemfunctions/#json-functions https://nightlies.apache.org/flink/flink-docs-master/docs/dev/table/functions/systemfunctions/#json-functions
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.