Could not determine output schema for query due to error: Can't find any functions with the name 'OUNT_DISTINCT'

huangapple go评论45阅读模式
英文:

Could not determine output schema for query due to error: Can't find any functions with the name 'OUNT_DISTINCT'

问题

I am following Confluent KSQLDB tutorials from here: https://www.youtube.com/watch?v=fXJw0jAyn7M&list=PLa7VYi0yPIH3ulxsOf5g43_QiB-HOg5_Y&index=4

我正在按照这里的Confluent KSQLDB教程进行学习:https://www.youtube.com/watch?v=fXJw0jAyn7M&list=PLa7VYi0yPIH3ulxsOf5g43_QiB-HOg5_Y&index=4

I've created a topic like below:

我创建了一个主题如下:

kafka-topics --create --bootstrap-server localhost:9092 --replication-factor 1 --partitions 1 --topic person_stats

Also, I've created a table like this:

此外,我创建了一个表格如下:

CREATE TABLE PERSON_STATS WITH (VALUE_FORMAT='AVRO') AS
SELECT PERSON,
LATEST_BY_OFFSET(LOCATION) AS LATEST_LOCATION,
COUNT(*) AS LOCATION_CHANGES,
OUNT_DISTINCT(LOCATION) AS UNIQUE_LOCATIONS
FROM MOVEMENTS
GROUP BY PERSON
EMIT CHANGES;

Getting below error:

出现以下错误:

Could not determine the output schema for the query due to an error: Can't find any functions with the name 'OUNT_DISTINCT'
Statement: CREATE TABLE PERSON_STATS WITH (KAFKA_TOPIC='PERSON_STATS', PARTITIONS=1, REPLICAS=1, VALUE_FORMAT='AVRO') AS SELECT
MOVEMENTS.PERSON PERSON,
LATEST_BY_OFFSET(MOVEMENTS.LOCATION) LATEST_LOCATION,
COUNT(*) LOCATION_CHANGES,
OUNT_DISTINCT(MOVEMENTS.LOCATION) UNIQUE_LOCATIONS
FROM MOVEMENTS MOVEMENTS
GROUP BY MOVEMENTS.PERSON
EMIT CHANGES;
ksql>

Any quick help?

是否可以提供一些快速的帮助?

英文:

I am following Confluent KSQLDB tutorials from here: https://www.youtube.com/watch?v=fXJw0jAyn7M&list=PLa7VYi0yPIH3ulxsOf5g43_QiB-HOg5_Y&index=4

I've created topic like below:

kafka-topics --create --bootstrap-server localhost:9092 --replication-factor 1 --partitions 1  --topic person_stats

Also, I've created

CREATE TABLE PERSON_STATS WITH (VALUE_FORMAT='AVRO') AS 
SELECT PERSON, 
       LATEST_BY_OFFSET(LOCATION) AS LATEST_LOCATION, 
       COUNT(*) AS LOCATION_CHANGES, 
       OUNT_DISTINCT(LOCATION) AS UNIQUE_LOCATIONS 
FROM MOVEMENTS
GROUP BY PERSON
EMIT CHANGES;

Getting below error:

Could not determine output schema for query due to error: Can't find any functions with the name 'OUNT_DISTINCT'
Statement: CREATE TABLE PERSON_STATS WITH (KAFKA_TOPIC='PERSON_STATS', PARTITIONS=1, REPLICAS=1, VALUE_FORMAT='AVRO') AS SELECT
  MOVEMENTS.PERSON PERSON,
  LATEST_BY_OFFSET(MOVEMENTS.LOCATION) LATEST_LOCATION,
  COUNT(*) LOCATION_CHANGES,
  OUNT_DISTINCT(MOVEMENTS.LOCATION) UNIQUE_LOCATIONS
FROM MOVEMENTS MOVEMENTS
GROUP BY MOVEMENTS.PERSON
EMIT CHANGES;
ksql>

Any quick help?

答案1

得分: 0

我已经能够通过以下方式修复它,运行正常

CREATE TABLE PERSON_STATS WITH (VALUE_FORMAT='AVRO') AS
  SELECT PERSON,
    LATEST_BY_OFFSET(LOCATION) AS LATEST_LOCATION,
    COUNT(*) AS LOCATION_CHANGES,
    COUNT_DISTINCT(LOCATION) AS UNIQUE_LOCATIONS
  FROM MOVEMENTS
GROUP BY PERSON
EMIT CHANGES;
英文:

I was able to fix it by using below, works fine

CREATE TABLE PERSON_STATS WITH (VALUE_FORMAT='AVRO') AS
  SELECT PERSON,
    LATEST_BY_OFFSET(LOCATION) AS LATEST_LOCATION,
    COUNT(*) AS LOCATION_CHANGES,
    COUNT_DISTINCT(LOCATION) AS UNIQUE_LOCATIONS
  FROM MOVEMENTS
GROUP BY PERSON
EMIT CHANGES;

huangapple
  • 本文由 发表于 2023年4月10日 21:42:01
  • 转载请务必保留本文链接:https://go.coder-hub.com/75977636.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定