0

我可以从 presto 的 kafka 主题中获取数据,如下属性:

/etc/kafka/mytable.json

{
    "tableName": "mytable",
    "schemaName": "mykafka",
    "topicName": "mykafka.mytable",
    "message": {
        "dataFormat": "json",
        "fields": [
            {
                "name": "id",
                "mapping": "id",
                "type": "INTEGER"
            },
            {
                "name": "name",
                "mapping": "name",
                "type": "VARCHAR"
            }
        ]
    }

它在获取数据时起作用。select * from kafka.mykafka."mytable"

但是当我想插入数据时,它给出了这个错误:

insert into kafka.mykafka."mytable"(id,name) values(111,'presto db test');


Query 20211007_053816_00016_x6wzd, FAILED, 1 node
Splits: 2 total, 1 done (50.00%)
0:00 [0 rows, 0B] [0 rows/s, 0B/s]

Query 20211007_053816_00016_x6wzd failed: unknown data format 'dummy'

我该如何处理?

提前致谢

4

1 回答 1

0

虽然 Presto 主要用于使用适当的连接器查询来自不同数据源的数据,但似乎也可以使用 Presto 插入数据。虽然这对于 MySQL 等数据源来说很简单,但对于 Kafka 来说就有点棘手,因为它涉及到编码。有关更多详细信息,请参阅https://trino.io/docs/current/connector/kafka.html#kafka-inserts

于 2022-03-05T15:06:55.647 回答