简体   繁体   English

没有数据进入从ksql二进制文件流构建的表中,如果我使用ksql提示符执行相同的操作,它会在那里吗?

[英]No data is getting into a table built over a stream from ksql binary, it get's there if I do the same with ksql prompt?

I'm trying to create a table over a stream using ksql binary. 我正在尝试使用ksql二进制文件在流上创建一个表。 The table gets created and starts running but when I query it there is no data inside the table. 该表已创建并开始运行,但当我查询它时,表中没有数据。 When I create the same using ksql prompt the table gets created I'm also able to query the data. 当我使用ksql提示创建相同的表时,表创建我也能够查询数据。

PS: I am setting this property SET 'auto.offset.reset'='earliest'; PS:我设置此属性SET'auto.offset.reset'='earliest'; to query the data form beginning. 查询数据表单的开头。

I tried both methods. 我尝试了两种方法。 It works when I create table using ksql prompt. 当我使用ksql提示创建表时,它工作。 Same command does not work when try to do the same with ksql binary. 尝试对ksql二进制文件执行相同操作时,相同的命令不起作用。

sudo echo "CREATE TABLE movie_table AS SELECT title, count(*) AS appearance FROM test WHERE year > 1988 GROUP BY title;" | sh /home/binary/ksql http://devopsksql.default.svc.cluster.local:8088
ksql> CREATE TABLE movie_table AS SELECT title, count(*)
 Message
---------------------------
 Table created and running
---------------------------

ksql> select * from MOVIE_TABLE;
^CQuery terminated

Same when I run with ksql prompt open it works as is. 当我用ksql提示符运行时它也一样工作。

I am expecting a way to create a table and query it without using the ksql prompt. 我期待一种方法来创建一个表并查询它而不使用ksql提示符。

You need to set SET 'auto.offset.reset'='earliest'; 你需要设置SET 'auto.offset.reset'='earliest'; before your CREATE query. 在您的CREATE查询之前。

If you want to interact with KSQL from a script I'd suggest using the REST API (eg via curl ) than trying to pipe to the ksql binary. 如果你想从脚本中与KSQL交互,我建议使用REST API(例如通过curl ),而不是试图管道到ksql二进制文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM