本文介绍SQL与Catalog报错相关问题。
- MySQL Catalog加载很慢或者加载出来的表名为灰色如何解决?
- 报错:Cannot obtain STS token from EMR meta-service.
- 报错:RowTime field should not be null, please convert it to a non-null long value.
MySQL Catalog加载很慢或者加载出来的表名为灰色如何解决?
- 报错详情
MySQL Catalog创建成功但加载很慢或者加载出来的表名为灰色,注册Catalog失败,如图所示。
- 报错原因
从云产品到用户MySQL的网络特别卡,建立的连接经常断掉,造成了不稳定现象。
- 解决方案
以下三种优化方式可供您选择:
- 您需要判断云产品到MySQL走的公网带宽是否受限(例如有些配置是默认非常小的2 MB),以及是否存在跨Region访问的问题,详情可参见如何查看公网带宽情况?。
- 如果您的网络确实不佳,您可以将MySQL实例相关的interactive_timeout和wait_timeout参数的取值调大点。
- 创建时您可以添加WITH参数'connect.timeout'='120s'。
报错:Cannot obtain STS token from EMR meta-service.
- 报错详情
Caused by: MetaException(message:Initialize DlfMetaStoreClient failed: Initialize DlfMetaStoreClient failed: Cannot obtain STS token from EMR meta-service. Note that AK-Mode[dlf.catalog.akMode] can only used in EMR clusters, otherwise you should config the dlf.catalog.accessKeyId and dlf.catalog.accessKeySecret explicitly.) at com.aliyun.datalake.metastore.hive2.ProxyMetaStoreClient.createClient(ProxyMetaStoreClient.java:91) at com.aliyun.datalake.metastore.hive2.ProxyMetaStoreClient.<init>(ProxyMetaStoreClient.java:71) ... 41 more
- 报错原因
配置文件有误导致Hive Catalog初始化异常。
- 解决方案
- 找到hive-conf-dir目录下的hive-site.xml文件,删除如下property信息。
<property> <name>dlf.catalog.akMode</name> <value>EMR_AUTO</value> </property>
- 配置AccessKeyId和AccessKeySecret。
<property> <name>dlf.catalog.accessKeyId</name> <value>${AccessKeyId}</value> </property> <property> <name>dlf.catalog.accessKeySecret</name> <value>${AccessKeySecret}</value> </property>
- 找到hive-conf-dir目录下的hive-site.xml文件,删除如下property信息。
报错:RowTime field should not be null, please convert it to a non-null long value.
- 报错详情
2022-08-10 18:45:55,182 [flink-akka.actor.default-dispatcher-19] INFO org.apache.flink.runtime.executiongraph.ExecutionGraph [] - WatermarkAssigner(rowtime=[tsInMs], watermark=[WITHOFFSET(tsInMs, 0)]) with job vertex id 982161b1a590d7fd02ca6b6317c4**** (1/2) (2797311f5410de67f59aba510ae4****) switched from RUNNING to FAILED on job-82acab64-19c0-4e45-85cf-9bb49836****-taskmanager-1-1 @ 192.168.XX.XX (dataPort=39925). java.lang.RuntimeException: RowTime field should not be null, please convert it to a non-null long value. at org.apache.flink.table.runtime.operators.wmassigners.WatermarkAssignerOperator.processElement(WatermarkAssignerOperator.java:115) ~[flink-table-blink_2.11-1.13-vvr-4.0.14-2-SNAPSHOT.jar:1.13-vvr-4.0.14-2-SNAPSHOT] at org.apache.flink.streaming.runtime.tasks.OneInputStreamTask$StreamTaskNetworkOutput.emitRecord(OneInputStreamTask.java:205) ~[flink-dist_2.11-1.13-vvr-4.0.14-2-SNAPSHOT.jar:1.13-vvr-4.0.14-2-SNAPSHOT] at org.apache.flink.streaming.runtime.io.AbstractStreamTaskNetworkInput.processElement(AbstractStreamTaskNetworkInput.java:135) ~[flink-dist_2.11-1.13-vvr-4.0.14-2-SNAPSHOT.jar:1.13-vvr-4.0.14-2-SNAPSHOT] at org.apache.flink.streaming.runtime.io.AbstractStreamTaskNetworkInput.emitNext(AbstractStreamTaskNetworkInput.java:106) ~[flink-dist_2.11-1.13-vvr-4.0.14-2-SNAPSHOT.jar:1.13-vvr-4.0.14-2-SNAPSHOT]
- 报错原因
生成Watermark的Event time时间字段中存在NULL值脏数据。
- 解决方案
使用计算列过滤脏数据,代码示例如下。
ts as case when `datetime` is null then to_timestamp('1970-01-01 00:00:00') else `datetime`end