<commit_before>package com.continuuity.hive;

import com.continuuity.common.utils.PortDetector;
import org.apache.hadoop.hive.conf.HiveConf;
import org.apache.hive.service.server.HiveServer2;
import org.junit.ClassRule;
import org.junit.rules.ExternalResource;
import org.junit.rules.TemporaryFolder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.concurrent.TimeUnit;

/**
 * Starts up an embedded hive server for testing.
 */
public class EmbeddedHiveServer extends ExternalResource {
  private static final Logger LOG = LoggerFactory.getLogger(EmbeddedHiveServer.class);

  private HiveServer2 hiveServer2;
  private int serverPort;

  @ClassRule
  public static TemporaryFolder temporaryFolder = new TemporaryFolder();

  public int getServerPort() {
    return serverPort;
  }

  @Override
  protected void before() throws Throwable {
    // TODO: use dynamic tmp dir for warehouse dir
    HiveConf hiveConf = new HiveConf();<commit_msg>Adding comment as to why dynamic tmp folder cannot be used for embedded hive meta store.<commit_after>package com.continuuity.hive;

import com.continuuity.common.utils.PortDetector;
import org.apache.hadoop.hive.conf.HiveConf;
import org.apache.hive.service.server.HiveServer2;
import org.junit.ClassRule;
import org.junit.rules.ExternalResource;
import org.junit.rules.TemporaryFolder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.concurrent.TimeUnit;

/**
 * Starts up an embedded hive server for testing.
 */
public class EmbeddedHiveServer extends ExternalResource {
  private static final Logger LOG = LoggerFactory.getLogger(EmbeddedHiveServer.class);

  private HiveServer2 hiveServer2;
  private int serverPort;

  @ClassRule
  public static TemporaryFolder temporaryFolder = new TemporaryFolder();

  public int getServerPort() {
    return serverPort;
  }

  @Override
  protected void before() throws Throwable {
    // TODO: use dynamic tmp dir for warehouse dir
    // Currently not possible to dynamically set hive.metastore.warehouse.dir since the HiveConf object does not
    // passed on to Hive Meta Store. Instead Hive Meta Store instantiates its own HiveConf.
    HiveConf hiveConf = new HiveConf();
{'fraction_non_alphanumeric': 0.07747747747747748, 'fraction_numerical': 0.0045045045045045045, 'mean_word_length': 4.739018087855297, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '17576', 'n_tokens_mistral': 658, 'n_tokens_neox': 642, 'n_words': 192}