Search code examples
apache-flinkflink-streaming

How to add partition location in HiveCatalog in Flink?


I am adding partition using hiveCatalog and need to add a different location for that,how to add location parameter?

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);

Solution

  • Yes, This is the correct way to add location to have partition or can be use direct query using tableEnv.executeSql(query)