当前位置: 首页>>代码示例>>Java>>正文


Java CLIServiceClient类代码示例

本文整理汇总了Java中org.apache.hive.service.cli.CLIServiceClient的典型用法代码示例。如果您正苦于以下问题:Java CLIServiceClient类的具体用法?Java CLIServiceClient怎么用?Java CLIServiceClient使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CLIServiceClient类属于org.apache.hive.service.cli包,在下文中一共展示了CLIServiceClient类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: waitForStart

import org.apache.hive.service.cli.CLIServiceClient; //导入依赖的package包/类
private void waitForStart() throws InterruptedException, TimeoutException, HiveSQLException {
  int waitTime = 0;
  long pollPeriod = 100L;
  long startupTimeout = 1000L * 1000L;
  CLIServiceClient hiveClient = getClient();
  SessionHandle sessionHandle;
  do {
    Thread.sleep(pollPeriod);
    waitTime += pollPeriod;
    if (waitTime > startupTimeout) {
      throw new TimeoutException("Couldn't access new HiveServer2: " + getJdbcURL());
    }
    try {
      Map<String, String> sessionConf = new HashMap<>();
      sessionHandle = hiveClient.openSession("foo", "bar", sessionConf);
    } catch (Exception e) {
      continue;
    }
    hiveClient.closeSession(sessionHandle);
    break;
  } while (true);
}
 
开发者ID:ggear,项目名称:cloudera-framework,代码行数:23,代码来源:HiveServer.java

示例2: getClient

import org.apache.hive.service.cli.CLIServiceClient; //导入依赖的package包/类
@Override
public CLIServiceClient getClient() throws LensException {
  if (!connected) {
    try {
      log.info("HiveDriver connecting to HiveServer @ {}:{}",
        conf.getVar(HiveConf.ConfVars.HIVE_SERVER2_THRIFT_BIND_HOST),
        conf.getIntVar(HiveConf.ConfVars.HIVE_SERVER2_THRIFT_PORT));
      hs2Client = RetryingThriftCLIServiceClient.newRetryingCLIServiceClient(conf);
      log.info("HiveDriver connected to HiveServer @ {}:{}",
        conf.getVar(HiveConf.ConfVars.HIVE_SERVER2_THRIFT_BIND_HOST),
        conf.getIntVar(HiveConf.ConfVars.HIVE_SERVER2_THRIFT_PORT));

    } catch (HiveSQLException e) {
      throw new LensException(e);
    }
    connected = true;
  }
  return hs2Client;
}
 
开发者ID:apache,项目名称:lens,代码行数:20,代码来源:RemoteThriftConnection.java

示例3: getServiceClientInternal

import org.apache.hive.service.cli.CLIServiceClient; //导入依赖的package包/类
public CLIServiceClient getServiceClientInternal() {
  for (Service service : hiveServer2.getServices()) {
    if (service instanceof ThriftBinaryCLIService) {
      return new ThriftCLIServiceClient((ThriftBinaryCLIService) service);
    }
    if (service instanceof ThriftHttpCLIService) {
      return new ThriftCLIServiceClient((ThriftHttpCLIService) service);
    }
  }
  throw new IllegalStateException("HiveServer2 not running Thrift service");
}
 
开发者ID:bobfreitas,项目名称:hiveunit-mr2,代码行数:12,代码来源:MiniHS2.java

示例4: waitForStartup

import org.apache.hive.service.cli.CLIServiceClient; //导入依赖的package包/类
private void waitForStartup() throws Exception {
  int waitTime = 0;
  long startupTimeout = 1000L * 1000L;
  CLIServiceClient hs2Client = getServiceClientInternal();
  SessionHandle sessionHandle = null;
  do {
    Thread.sleep(500L);
    waitTime += 500L;
    if (waitTime > startupTimeout) {
      throw new TimeoutException("Couldn't access new HiveServer2: " + getJdbcURL());
    }
    try {
      Map <String, String> sessionConf = new HashMap<String, String>();
      /**
      if (isUseMiniKdc()) {
        getMiniKdc().loginUser(getMiniKdc().getDefaultUserPrincipal());
        sessionConf.put("principal", serverPrincipal);
      }
       */
      sessionHandle = hs2Client.openSession("foo", "bar", sessionConf);
    } catch (Exception e) {
      // service not started yet
      continue;
    }
    hs2Client.closeSession(sessionHandle);
    break;
  } while (true);
}
 
开发者ID:bobfreitas,项目名称:hiveunit-mr2,代码行数:29,代码来源:MiniHS2.java

示例5: getClient

import org.apache.hive.service.cli.CLIServiceClient; //导入依赖的package包/类
private CLIServiceClient getClient() {
  for (Service service : hiveServer.getServices()) {
    if (service instanceof ThriftBinaryCLIService) {
      return new ThriftCLIServiceClient((ThriftBinaryCLIService) service);
    }
    if (service instanceof ThriftHttpCLIService) {
      return new ThriftCLIServiceClient((ThriftHttpCLIService) service);
    }
  }
  throw new IllegalStateException("HiveServer2 not running Thrift service");
}
 
开发者ID:ggear,项目名称:cloudera-framework,代码行数:12,代码来源:HiveServer.java

示例6: getServiceClient

import org.apache.hive.service.cli.CLIServiceClient; //导入依赖的package包/类
public CLIServiceClient getServiceClient() {
  verifyStarted();
  return getServiceClientInternal();
}
 
开发者ID:bobfreitas,项目名称:hiveunit-mr2,代码行数:5,代码来源:MiniHS2.java

示例7: HivePersistentResultSet

import org.apache.hive.service.cli.CLIServiceClient; //导入依赖的package包/类
/**
 * Instantiates a new hive persistent result set.
 *
 * @param resultSetPath the result set path
 * @param opHandle      the op handle
 * @param client        the client
 * @throws HiveSQLException the hive sql exception
 */
public HivePersistentResultSet(Path resultSetPath, OperationHandle opHandle, CLIServiceClient client)
  throws HiveSQLException {
  this.path = resultSetPath;
  this.metadata = client.getResultSetMetadata(opHandle);
}
 
开发者ID:apache,项目名称:lens,代码行数:14,代码来源:HivePersistentResultSet.java

示例8: getClient

import org.apache.hive.service.cli.CLIServiceClient; //导入依赖的package包/类
/**
 * Gets the client.
 *
 * @return the client
 * @throws LensException the lens exception
 */
CLIServiceClient getClient() throws LensException;
 
开发者ID:apache,项目名称:lens,代码行数:8,代码来源:ThriftConnection.java


注:本文中的org.apache.hive.service.cli.CLIServiceClient类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。