apache-flink - “表选项不包含选项键'连接器'”的另一种情况
问题描述
我已阅读链接表选项不包含选项键“连接器”
它说我们应该设置格式。
但我的场景是 datagen->hive。这是我完成的例子(现在错了)
drop table if exists datagen;
CREATE TABLE datagen (
f_sequence INT,
f_random INT,
f_random_str STRING,
ts AS localtimestamp,
WATERMARK FOR ts AS ts
) WITH (
'connector' = 'datagen',
-- optional options --
'rows-per-second'='5',
'fields.f_sequence.kind'='sequence',
'fields.f_sequence.start'='1',
'fields.f_sequence.end'='50',-- 这个地方限制了一共会产生的条数
'fields.f_random.min'='1',
'fields.f_random.max'='50',
'fields.f_random_str.length'='10'
);
SET table.sql-dialect=hive;
drop table if exists hive_table;
CREATE TABLE hive_table (
f_sequence INT,
f_random INT,
f_random_str STRING
) PARTITIONED BY (dt STRING, hr STRING, mi STRING) STORED AS parquet TBLPROPERTIES (
'partition.time-extractor.timestamp-pattern'='$dt $hr:$mi:00',
'sink.partition-commit.trigger'='partition-time',
'sink.partition-commit.delay'='1 min',
'sink.partition-commit.policy.kind'='metastore,success-file'
);
Flink SQL> insert into hive_table select f_sequence,f_random,f_random_str ,DATE_FORMAT(ts, 'yyyy-MM-dd'), DATE_FORMAT(ts, 'HH') ,DATE_FORMAT(ts, 'mm') from datagen;
[INFO] Submitting SQL update statement to the cluster...
[ERROR] Could not execute SQL statement. Reason:
org.apache.flink.table.api.ValidationException: Table options do not contain an option key 'connector' for discovering a connector.
上述链接的解决方案是否适合这种情况?
需要你的帮助,谢谢~!
解决方案
请SET table.sql-dialect=default;
在调用前使用insert into hive_table...
,使用 datagen 连接器的语句insert into hive_table...
不支持 hive 方言。
推荐阅读
- python - Python 用 Single Bcklash 替换 Double Backlash
- sql - 使用 SQL 从 Access 数据库中获取最大值
- c - 这里的模式是什么?我怎样才能在c中编写该代码?
- reactjs - 反应钩子状态:未定义
- php - Laravel CSS 样式表在某些路由中停止工作
- java - 在启动画面中显示图像
- reactjs - 无法使用弹性 UI 日期选择器对具有完整日历的未安装组件执行 React 状态更新
- python - 优化 pytorch 数据加载器以读取全高清图像中的小补丁
- xcode - 卷曲安装问题
- python - 如何调试 Keras ValueError:没有为任何变量提供渐变?