流数据写hive分区表是需要额外的参数配置的。Flink 1.11里具体的参数可以参考这两个文档:

https://ci.apache.org/projects/flink/flink-docs-release-1.11/dev/table/hive/hive_streaming.html#streaming-writing
https://ci.apache.org/projects/flink/flink-docs-release-1.11/dev/table/connectors/filesystem.html#streaming-sink

On Wed, Dec 23, 2020 at 9:17 AM kingdomad <[email protected]> wrote:

> 分区用的是记录中的字段,没有用到processing time或者event time去生成分区。
> 发现只要给hive的表加上以下这三个属性就可以马上提交分区到metastore了。
> 'sink.partition-commit.trigger'='process-time'
> 'sink.partition-commit.delay'='0s'
> 'sink.partition-commit.policy.kind'='metastore,success-file'
>
>
>
>
>
>
>
>
>
>
>
>
>
> --
>
> kingdomad
>
>
>
>
>
>
>
> 在 2020-12-21 23:27:49,"赵一旦" <[email protected]> 写道:
> >即使不是flink写入,其他方式写入也需要这样做的哈。
> >
> >r pp <[email protected]> 于2020年12月21日周一 下午9:28写道:
> >
> >> 程序中,创建表后,执行命令。
> >>
> >> kingdomad <[email protected]> 于2020年12月21日周一 下午4:55写道:
> >>
> >> >
> >>
> flink1.11.2写hive3.12的分区表,flink新创建的分区数据hive无法识别,在hdfs上能看到写入了文件,但是hive读取不了分区。
> >> > 需要执行msck repair table修复分区表后,hive才能读取到数据。
> >> > 求助大佬,要如何解决。
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> > --
> >> >
> >> > kingdomad
> >> >
> >> >
> >>
>


-- 
Best regards!
Rui Li

回复