更新时间:2022-12-14 GMT+08:00

采集数据时报错HoodieKeyException

问题

创建Hudi表时,是否可以使用包含空记录的可空字段作为主键?

回答

不可以,会抛HoodieKeyException异常。

Caused by: org.apache.hudi.exception.HoodieKeyException: recordKey value: "null" for field: "name" cannot be null or empty.
at org.apache.hudi.keygen.SimpleKeyGenerator.getKey(SimpleKeyGenerator.java:58)
at org.apache.hudi.HoodieSparkSqlWriter$$anonfun$1.apply(HoodieSparkSqlWriter.scala:104)
at org.apache.hudi.HoodieSparkSqlWriter$$anonfun$1.apply(HoodieSparkSqlWriter.scala:100)