public GetFunctionsOperation newGetFunctionsOperation(HiveSession parentSession, String catalogName, String schemaName, String functionName) { GetFunctionsOperation operation = new GetFunctionsOperation(parentSession, catalogName, schemaName, functionName); addOperation(operation); return operation; }
@Override public RowSet getNextRowSet(FetchOrientation orientation, long maxRows) throws HiveSQLException { assertState(new ArrayList<OperationState>(Arrays.asList(OperationState.FINISHED))); validateDefaultFetchOrientation(orientation); if (orientation.equals(FetchOrientation.FETCH_FIRST)) { rowSet.setStartOffset(0); } return rowSet.extractSubset((int)maxRows); } }
@Override public void runInternal() throws HiveSQLException { setState(OperationState.RUNNING); LOG.info("Fetching function metadata"); if (isAuthV2Enabled()) { IMetaStoreClient metastoreClient = getParentSession().getMetaStoreClient(); String schemaPattern = convertSchemaPattern(schemaName); List<String> matchingDbs; try { matchingDbs = metastoreClient.getDatabases(schemaPattern); } catch (TException e) { setState(OperationState.ERROR); throw new HiveSQLException(e); .getHivePrivDbObjects(matchingDbs); String cmdStr = "catalog : " + catalogName + ", schemaPattern : " + schemaName; authorizeMetaGets(HiveOperationType.GET_FUNCTIONS, privObjs, cmdStr); String debugMessage = getDebugMessage("function", RESULT_SET_SCHEMA); LOG.debug(debugMessage, rowData); LOG.debug("No function metadata has been returned"); setState(OperationState.FINISHED); LOG.info("Fetching function metadata has been successfully finished"); } catch (Exception e) { setState(OperationState.ERROR); throw new HiveSQLException(e);
@Override public OperationHandle getFunctions(String catalogName, String schemaName, String functionName) throws HiveSQLException { acquire(true, true); OperationManager operationManager = getOperationManager(); GetFunctionsOperation operation = operationManager .newGetFunctionsOperation(getSession(), catalogName, schemaName, functionName); OperationHandle opHandle = operation.getHandle(); try { addOpHandle(opHandle); operation.run(); return opHandle; } catch (HiveSQLException e) { removeOpHandle(opHandle); operationManager.closeOperation(opHandle); throw e; } finally { release(true, true); } }
@Override public TableSchema getResultSetSchema() throws HiveSQLException { assertState(new ArrayList<OperationState>(Arrays.asList(OperationState.FINISHED))); return RESULT_SET_SCHEMA; }
public GetFunctionsOperation(HiveSession parentSession, String catalogName, String schemaName, String functionName) { super(parentSession, OperationType.GET_FUNCTIONS); this.catalogName = catalogName; this.schemaName = schemaName; this.functionName = functionName; this.rowSet = RowSetFactory.create(RESULT_SET_SCHEMA, getProtocolVersion(), false); LOG.info( "Starting GetFunctionsOperation with the following parameters: catalogName={}, schemaName={}, functionName={}", catalogName, schemaName, functionName); }
@Override public OperationHandle getFunctions(String catalogName, String schemaName, String functionName) throws HiveSQLException { acquire(true); 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(true); } }
@Override public TableSchema getResultSetSchema() throws HiveSQLException { assertState(OperationState.FINISHED); return RESULT_SET_SCHEMA; }
public GetFunctionsOperation(HiveSession parentSession, String catalogName, String schemaName, String functionName) { super(parentSession, OperationType.GET_FUNCTIONS); this.catalogName = catalogName; this.schemaName = schemaName; this.functionName = functionName; this.rowSet = RowSetFactory.create(RESULT_SET_SCHEMA, getProtocolVersion(), false); }
@Override public void runInternal() throws HiveSQLException { setState(OperationState.RUNNING); if (isAuthV2Enabled()) { IMetaStoreClient metastoreClient = getParentSession().getMetaStoreClient(); String schemaPattern = convertSchemaPattern(schemaName); List<String> matchingDbs; try { matchingDbs = metastoreClient.getDatabases(schemaPattern); } catch (TException e) { setState(OperationState.ERROR); throw new HiveSQLException(e); .getHivePrivDbObjects(matchingDbs); String cmdStr = "catalog : " + catalogName + ", schemaPattern : " + schemaName; authorizeMetaGets(HiveOperationType.GET_FUNCTIONS, privObjs, cmdStr); setState(OperationState.FINISHED); } catch (Exception e) { setState(OperationState.ERROR); throw new HiveSQLException(e);
@Override public RowSet getNextRowSet(FetchOrientation orientation, long maxRows) throws HiveSQLException { assertState(new ArrayList<OperationState>(Arrays.asList(OperationState.FINISHED))); validateDefaultFetchOrientation(orientation); if (orientation.equals(FetchOrientation.FETCH_FIRST)) { rowSet.setStartOffset(0); } return rowSet.extractSubset((int)maxRows); } }
@Override public OperationHandle getFunctions(String catalogName, String schemaName, String functionName) throws HiveSQLException { acquire(true); 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(true); } }
@Override public TableSchema getResultSetSchema() throws HiveSQLException { assertState(OperationState.FINISHED); return RESULT_SET_SCHEMA; }
public GetFunctionsOperation newGetFunctionsOperation(HiveSession parentSession, String catalogName, String schemaName, String functionName) { GetFunctionsOperation operation = new GetFunctionsOperation(parentSession, catalogName, schemaName, functionName); addOperation(operation); return operation; }
public GetFunctionsOperation(HiveSession parentSession, String catalogName, String schemaName, String functionName) { super(parentSession, OperationType.GET_FUNCTIONS); this.catalogName = catalogName; this.schemaName = schemaName; this.functionName = functionName; this.rowSet = RowSetFactory.create(RESULT_SET_SCHEMA, getProtocolVersion()); }
@Override public void runInternal() throws HiveSQLException { setState(OperationState.RUNNING); if (isAuthV2Enabled()) { IMetaStoreClient metastoreClient = getParentSession().getMetaStoreClient(); String schemaPattern = convertSchemaPattern(schemaName); List<String> matchingDbs; try { matchingDbs = metastoreClient.getDatabases(schemaPattern); } catch (TException e) { setState(OperationState.ERROR); throw new HiveSQLException(e); .getHivePrivDbObjects(matchingDbs); String cmdStr = "catalog : " + catalogName + ", schemaPattern : " + schemaName; authorizeMetaGets(HiveOperationType.GET_FUNCTIONS, privObjs, cmdStr); setState(OperationState.FINISHED); } catch (Exception e) { setState(OperationState.ERROR); throw new HiveSQLException(e);
@Override public RowSet getNextRowSet(FetchOrientation orientation, long maxRows) throws HiveSQLException { assertState(OperationState.FINISHED); validateDefaultFetchOrientation(orientation); if (orientation.equals(FetchOrientation.FETCH_FIRST)) { rowSet.setStartOffset(0); } return rowSet.extractSubset((int)maxRows); } }
@Override public OperationHandle getFunctions(String catalogName, String schemaName, String functionName) throws HiveSQLException { acquire(true); 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(true); } }
@Override public TableSchema getResultSetSchema() throws HiveSQLException { assertState(OperationState.FINISHED); return RESULT_SET_SCHEMA; }
public GetFunctionsOperation newGetFunctionsOperation(HiveSession parentSession, String catalogName, String schemaName, String functionName) { GetFunctionsOperation operation = new GetFunctionsOperation(parentSession, catalogName, schemaName, functionName); addOperation(operation); return operation; }