New in version 1.5.0.

Session Conf Advisor

Kyuubi supports inject session configs with custom config advisor. It is usually used to append or overwrite session configs dynamically, so administrators of Kyuubi can have an ability to control the user specified configs.

The steps of injecting session configs

  1. create a custom class which implements the org.apache.kyuubi.plugin.SessionConfAdvisor.
  2. compile and put the jar into $KYUUBI_HOME/jars
  3. adding configuration at kyuubi-defaults.conf:

    1. kyuubi.session.conf.advisor=${classname}

The org.apache.kyuubi.plugin.SessionConfAdvisor has a zero-arg constructor, holds one method with user and session conf and returns a new conf map.

  1. public interface SessionConfAdvisor {
  2. default Map<String, String> getConfOverlay(String user, Map<String, String> sessionConf) {
  3. return Collections.EMPTY_MAP;
  4. }
  5. }

The returned conf map will overwrite the original session conf.

Example

We have a custom class CustomSessionConfAdvisor:

  1. public class CustomSessionConfAdvisor implements SessionConfAdvisor {
  2. @Override
  3. Map<String, String> getConfOverlay(String user, Map<String, String> sessionConf) {
  4. if ("uly".equals(user)) {
  5. return Collections.singletonMap("spark.driver.memory", "1G");
  6. } else {
  7. return Collections.EMPTY_MAP;
  8. }
  9. }
  10. }

If a user uly creates a connection with:

  1. jdbc:hive2://localhost:10009/;hive.server2.proxy.user=uly;#spark.driver.memory=2G

The final Spark application will allocate 1G rather than 2G for the driver jvm.