如何在flink的hivecatalog中添加分区位置?

dldeef67  于 2021-03-24  发布在  Flink
关注(0)|答案(1)|浏览(746)

我正在使用hivecatalog添加分区,需要为其添加不同的位置,如何添加位置参数?

Map<String, String> partitionSpec = new HashMap<>();
        partitionSpec.put("hour", "2");
        Map<String, String> temp = new HashMap<>();
        partitionSpec.put("LOCATION","<hdfs location>"); //Is this correct way to add location for partition?
        catalog.createPartition(
                new ObjectPath(defaultDatabase, "flink_test1"),
                new CatalogPartitionSpec(partitionSpec),
                new CatalogPartitionImpl(temp, "partitionCommit"),
                true);
eh57zj3b

eh57zj3b1#

是的,这是正确的方法,添加位置有分区或可以使用tableEnv.executeSql(query)直接查询。

相关问题