Package org.apache.hive.service.cli.operation

Examples of org.apache.hive.service.cli.operation.OperationManager


  @Override
  public OperationHandle getCatalogs()
      throws HiveSQLException {
    acquire();

    OperationManager operationManager = getOperationManager();
    GetCatalogsOperation operation = operationManager.newGetCatalogsOperation(getSession());
    OperationHandle opHandle = operation.getHandle();
    try {
      operation.run();
      opHandleSet.add(opHandle);
      return opHandle;
    } catch (HiveSQLException e) {
      operationManager.closeOperation(opHandle);
      throw e;
    } finally {
      release();
    }
  }
View Full Code Here


  @Override
  public OperationHandle getSchemas(String catalogName, String schemaName)
      throws HiveSQLException {
    acquire();

    OperationManager operationManager = getOperationManager();
    GetSchemasOperation operation =
        operationManager.newGetSchemasOperation(getSession(), catalogName, schemaName);
    OperationHandle opHandle = operation.getHandle();
    try {
      operation.run();
      opHandleSet.add(opHandle);
      return opHandle;
    } catch (HiveSQLException e) {
      operationManager.closeOperation(opHandle);
      throw e;
    } finally {
      release();
    }
  }
View Full Code Here

  public OperationHandle getTables(String catalogName, String schemaName, String tableName,
      List<String> tableTypes)
          throws HiveSQLException {
    acquire();

    OperationManager operationManager = getOperationManager();
    MetadataOperation operation =
        operationManager.newGetTablesOperation(getSession(), catalogName, schemaName, tableName, tableTypes);
    OperationHandle opHandle = operation.getHandle();
    try {
      operation.run();
      opHandleSet.add(opHandle);
      return opHandle;
    } catch (HiveSQLException e) {
      operationManager.closeOperation(opHandle);
      throw e;
    } finally {
      release();
    }
  }
View Full Code Here

  @Override
  public OperationHandle getTableTypes()
      throws HiveSQLException {
    acquire();

    OperationManager operationManager = getOperationManager();
    GetTableTypesOperation operation = operationManager.newGetTableTypesOperation(getSession());
    OperationHandle opHandle = operation.getHandle();
    try {
      operation.run();
      opHandleSet.add(opHandle);
      return opHandle;
    } catch (HiveSQLException e) {
      operationManager.closeOperation(opHandle);
      throw e;
    } finally {
      release();
    }
  }
View Full Code Here

  @Override
  public OperationHandle getColumns(String catalogName, String schemaName,
      String tableName, String columnNamethrows HiveSQLException {
    acquire();

    OperationManager operationManager = getOperationManager();
    GetColumnsOperation operation = operationManager.newGetColumnsOperation(getSession(),
        catalogName, schemaName, tableName, columnName);
    OperationHandle opHandle = operation.getHandle();
    try {
      operation.run();
      opHandleSet.add(opHandle);
      return opHandle;
    } catch (HiveSQLException e) {
      operationManager.closeOperation(opHandle);
      throw e;
    } finally {
      release();
    }
  }
View Full Code Here

  @Override
  public OperationHandle getFunctions(String catalogName, String schemaName, String functionName)
      throws HiveSQLException {
    acquire();

    OperationManager operationManager = getOperationManager();
    GetFunctionsOperation operation = operationManager
        .newGetFunctionsOperation(getSession(), catalogName, schemaName, functionName);
    OperationHandle opHandle = operation.getHandle();
    try {
      operation.run();
      opHandleSet.add(opHandle);
      return opHandle;
    } catch (HiveSQLException e) {
      operationManager.closeOperation(opHandle);
      throw e;
    } finally {
      release();
    }
  }
View Full Code Here

public class TestHiveSession {

  @Test
  public void checkOperationClosing() throws Exception {
    OperationManager opMgr = new OperationManager();
    HiveSession session = new HiveSessionImpl("user", "passw", null);

    session.setOperationManager(opMgr);

    OperationHandle opHandle1 = session.executeStatement("use default", null);
    assertNotNull(opHandle1);
    assertEquals(OperationState.FINISHED, opMgr.getOperationState(opHandle1));

    OperationHandle opHandle2 = session.executeStatement("show databases", null);
    assertNotNull(opHandle2);
    assertEquals(OperationState.FINISHED, opMgr.getOperationState(opHandle2));

    session.closeOperation(opHandle1); // Don't close directly from opMgr!

    try {
      opMgr.getOperationState(opHandle1);
      fail("Shouldn't work!");
    } catch (Exception e) {
      assertTrue(e instanceof HiveSQLException);
    }

    session.close(); // Close all remaining associated operations

    try {
      opMgr.getOperationState(opHandle2);
      fail("Shouldn't work this way now that it's fixed (HIVE-4398)!");
    } catch (Exception e) {
      assertTrue(e instanceof HiveSQLException);
    }
  }
View Full Code Here

  @Override
  public synchronized void init(HiveConf hiveConf) {
    this.hiveConf = hiveConf;

    operationManager = new OperationManager();
    addService(operationManager);

    super.init(hiveConf);
  }
View Full Code Here

TOP

Related Classes of org.apache.hive.service.cli.operation.OperationManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.