Search in sources :

Example 6 with HiveSyncTool

use of org.apache.hudi.hive.HiveSyncTool in project hudi by apache.

the class KafkaConnectTransactionServices method syncHive.

private void syncHive() {
    HiveSyncConfig hiveSyncConfig = KafkaConnectUtils.buildSyncConfig(new TypedProperties(connectConfigs.getProps()), tableBasePath);
    String url;
    if (!StringUtils.isNullOrEmpty(hiveSyncConfig.syncMode) && HiveSyncMode.of(hiveSyncConfig.syncMode) == HiveSyncMode.HMS) {
        url = hadoopConf.get(KafkaConnectConfigs.HIVE_METASTORE_URIS);
    } else {
        url = hiveSyncConfig.jdbcUrl;
    }
    LOG.info("Syncing target hoodie table with hive table(" + hiveSyncConfig.tableName + "). Hive URL :" + url + ", basePath :" + tableBasePath);
    LOG.info("Hive Sync Conf => " + hiveSyncConfig);
    FileSystem fs = FSUtils.getFs(tableBasePath, hadoopConf);
    HiveConf hiveConf = new HiveConf();
    hiveConf.addResource(fs.getConf());
    LOG.info("Hive Conf => " + hiveConf.getAllProperties().toString());
    new HiveSyncTool(hiveSyncConfig, hiveConf, fs).syncHoodieTable();
}
Also used : HiveSyncTool(org.apache.hudi.hive.HiveSyncTool) FileSystem(org.apache.hadoop.fs.FileSystem) HiveConf(org.apache.hadoop.hive.conf.HiveConf) HiveSyncConfig(org.apache.hudi.hive.HiveSyncConfig) TypedProperties(org.apache.hudi.common.config.TypedProperties)

Aggregations

HiveSyncTool (org.apache.hudi.hive.HiveSyncTool)6 HiveConf (org.apache.hadoop.hive.conf.HiveConf)3 HiveSyncConfig (org.apache.hudi.hive.HiveSyncConfig)3 FileSystem (org.apache.hadoop.fs.FileSystem)2 TypedProperties (org.apache.hudi.common.config.TypedProperties)2 Timer (com.codahale.metrics.Timer)1 HashSet (java.util.HashSet)1 Properties (java.util.Properties)1 AbstractSyncTool (org.apache.hudi.sync.common.AbstractSyncTool)1