我正在尝试让 Trino/Presto 与 Kafka 一起工作。 Trino 和 Presto 教程都讨论了“使用 tpch 数据”加载主题,并通过使用名为 kafka-tpch 的客户端对此进行了说明。 github page 和 maven 上都没有 kafka-tpch 的描述。然而,教程显示了参数
--prefix tpch. --tpch-type tiny
。有谁知道这些是什么意思吗?
我正在使用 Trino 的舵图,我认为我可以将 Kafka 注册为目录
"kafka": |
connector.name=kafka
kafka.table-names=newtopic
kafka.nodes=0.kafka.io:31120,1.kafka.io:31120
kafka.default-schema=public
kafka.hide-internal-columns=false
因此,我可以做
SHOW tables
,这给了我[['newtopic']]
。我也可以做 DESCRIBE newtopic
这给了我 [['_partition_id', 'bigint', '', 'Partition Id'], ['_partition_offset', 'bigint', '', 'Offset for the message within the partition'], ['_message_corrupt', 'boolean', '', 'Message data is corrupt'], ['_message', 'varchar', '', 'Message text'], ['_headers', 'map(varchar, array(varbinary))', '', 'Headers of the message as map'], ['_message_length', 'bigint', '', 'Total number of message bytes'], ['_key_corrupt', 'boolean', '', 'Key data is corrupt'], ['_key', 'varchar', '', 'Key text'], ['_key_length', 'bigint', '', 'Total number of key bytes'], ['_timestamp', 'timestamp(3)', '', 'Message timestamp']]
据我所知。
SELECT _message FROM newtopic LIMIT 10
给出 TrinoExternalError(type=EXTERNAL, name=KAFKA_SPLIT_ERROR, message="Cannot list splits for table 'newtopic' reading topic 'newtopic'", query_id=20220219_110406_00002_9jm62)
我的
newtopic
测试数据非常简单,它是使用 confluence-kafka python 客户端和以下代码片段生成的:
for e in 'abcdefghijklmnopqrstuvwxyz':
data = {'test-string' : e}
p.poll(0)
p.produce('newtopic', json.dumps(data).encode('utf-8'), callback=kafka_delivery_report)
TPC-H是基准测试规范。
使用 Kafka 或 Presto/Trino 不是必需的,但您可以在源代码中看到它只是产生一堆数据https://github.com/hgschmie/kafka-tpch/blob/master/src/main/ java/de/softwareforge/kafka/LoadCommand.java#L131
显示的
--prefix
标志是使用 kafka-tpch 实用程序时放置在 Kafka 主题名称上的字符串文字。正如我所说,这不是必需的;该文档只是展示了一种一次性将大量数据输入 Kafka 的方法。
这个问题解决了吗?我也有同样的错误。