[英]how to do count in flink sql
I'd like to do count(0)in flink SQL, but it gives exception like我想在 flink SQL 中做 count(0),但它给出了类似的异常
org.apache.flink.client.program.ProgramInvocationException: The main method caused an error: SQL parse failed. org.apache.flink.client.program.ProgramInvocationException: 主要方法导致错误:SQL 解析失败。 UDT in DDL is not supported yet.
尚不支持 DDL 中的 UDT。
don't know is there anything wrong?不知道有什么问题吗?
expect the output should work fine期望 output 应该可以正常工作
INSERT INTO request_join
select requestId,count(0) from requests
GROUP BY TUMBLE(rowtime, INTERVAL '1' HOUR),requestId;
The schema of the table is here表的模式在这里
name: request_join
schema:
- '`requestId` VARCHAR'
- '`count` LONG'
properties:
'connector.type': 'kafka'
'connector.version': 'universal'
'connector.topic': 'request_join_test'
'connector.startup-mode': 'latest-offset'
'connector.properties.0.key': 'zookeeper.connect'
'connector.properties.0.value': '10.XXXXXXXXX'
'connector.properties.1.key': 'bootstrap.servers'
'connector.properties.1.value': '10.XXXXXXXXX'
'connector.properties.2.key': 'group.id'
'connector.properties.2.value': 'request_join_test'
'update-mode': 'append'
'format.type': 'json'
'format.json-schema': '{type: "object", properties: {requestId: { type: "string"},count:{type:
"number"}}}'
didn't find anything wrong, but it just doesn't work, if I do not count and delete the count from the schema it will work well so I'm sure the sql itself is good.没有发现任何问题,但它只是不起作用,如果我不计算并从架构中删除计数,它将运行良好,所以我确信 sql 本身是好的。
I checked the flink sql it says some of the functions are not supported in DDL, so don't flink support count?我查了flink sql 说有些功能在DDL中是不支持的,所以不支持flink吗? I can see from examples that it support SUM very well.
从例子中我可以看出它很好地支持了 SUM。
There is sth wrong with your schema, schema: - ' requestId
VARCHAR' - ' count
BIGINT'您的架构有问题,架构:-'
requestId
VARCHAR'-' count
BIGINT'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.