:wave: Hello, team! I am trying to read data from ...
# troubleshooting
r
πŸ‘‹ Hello, team! I am trying to read data from a hive table and stream to the topic. As per the documentation I need to point to hive conf dir and create hive catalog using below code
Copy code
HiveCatalog hive = new HiveCatalog(name, defaultDatabase, hiveConfDir, version);
Is it possible to provide hive metastore connection object instead of modifying hive-site.xml ?
s
you can use
createHiveConf
and pass path of your modified hive-site.xml .
createHiveConf
will return
HiveConf
.
Copy code
public static HiveConf createHiveConf(
            @Nullable String hiveConfDir, @Nullable String hadoopConfDir)
Now you can pass the
HiveConf
to one of the overloaded constructor
Copy code
public HiveCatalog(
        String catalogName,
        @Nullable String defaultDatabase,
        @Nullable HiveConf hiveConf,
        String hiveVersion,
        boolean allowEmbedded)
r
@Samrat Deb Thanks for your response. Setting the below properties is enough or do I need to add any additional properties for creating hive conf
Copy code
public class HiveConfigUtil {

    private AppConfig appConfig;

    public HiveConfigUtil(AppConfig appConfig) {
        this.appConfig = appConfig;
    }

    public HiveConf getHiveConf() {
        HiveConf hiveConf = new HiveConf();
        hiveConf.set("hive.metastore.uris", appConfig.getHmsUrl());
        hiveConf.set("javax.jdo.option.ConnectionUserName", appConfig.getHmsUser());
        hiveConf.set("javax.jdo.option.ConnectionPassword", appConfig.getHmsPassword());
        return hiveConf;
    }
}
s
Best way to validate is try the changes