public GetColumnsOperation newGetColumnsOperation(HiveSession parentSession, String catalogName, String schemaName, String tableName, String columnName) { GetColumnsOperation operation = new GetColumnsOperation(parentSession, catalogName, schemaName, tableName, columnName); 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 column metadata"); try { IMetaStoreClient metastoreClient = getParentSession().getMetaStoreClient(); String schemaPattern = convertSchemaPattern(schemaName); String tablePattern = convertIdentifierPattern(tableName, true); columnPattern = Pattern.compile(convertIdentifierPattern(columnName, false)); if (isAuthV2Enabled()) { List<HivePrivilegeObject> privObjs = getPrivObjs(db2Tabs); String cmdStr = "catalog : " + catalogName + ", schemaPattern : " + schemaName + ", tablePattern : " + tableName; authorizeMetaGets(HiveOperationType.GET_COLUMNS, privObjs, cmdStr); String debugMessage = getDebugMessage("column", RESULT_SET_SCHEMA); LOG.debug(debugMessage, rowData); LOG.debug("No column metadata has been returned."); setState(OperationState.FINISHED); LOG.info("Fetching column metadata has been successfully finished"); } catch (Exception e) { setState(OperationState.ERROR); throw new HiveSQLException(e);
@Override public OperationHandle getColumns(String catalogName, String schemaName, String tableName, String columnName) throws HiveSQLException { acquire(true, true); String addedJars = Utilities.getResourceFiles(sessionConf, SessionState.ResourceType.JAR); if (StringUtils.isNotBlank(addedJars)) { IMetaStoreClient metastoreClient = getSession().getMetaStoreClient(); metastoreClient.setHiveAddedJars(addedJars); } OperationManager operationManager = getOperationManager(); GetColumnsOperation operation = operationManager.newGetColumnsOperation(getSession(), catalogName, schemaName, tableName, columnName); 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; }
protected GetColumnsOperation(HiveSession parentSession, String catalogName, String schemaName, String tableName, String columnName) { super(parentSession, OperationType.GET_COLUMNS); this.catalogName = catalogName; this.schemaName = schemaName; this.tableName = tableName; this.columnName = columnName; this.rowSet = RowSetFactory.create(RESULT_SET_SCHEMA, getProtocolVersion(), false); LOG.info("Starting GetColumnsOperation with the following parameters: " + "catalogName={}, schemaName={}, tableName={}, columnName={}", catalogName, schemaName, tableName, columnName); }
@Override public OperationHandle getColumns(String catalogName, String schemaName, String tableName, String columnName) throws HiveSQLException { acquire(true); String addedJars = Utilities.getResourceFiles(hiveConf, SessionState.ResourceType.JAR); if (StringUtils.isNotBlank(addedJars)) { IMetaStoreClient metastoreClient = getSession().getMetaStoreClient(); metastoreClient.setHiveAddedJars(addedJars); } 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(true); } }
@Override public TableSchema getResultSetSchema() throws HiveSQLException { assertState(OperationState.FINISHED); return RESULT_SET_SCHEMA; }
protected GetColumnsOperation(HiveSession parentSession, String catalogName, String schemaName, String tableName, String columnName) { super(parentSession, OperationType.GET_COLUMNS); this.catalogName = catalogName; this.schemaName = schemaName; this.tableName = tableName; this.columnName = columnName; this.rowSet = RowSetFactory.create(RESULT_SET_SCHEMA, getProtocolVersion()); }
@Override public void runInternal() throws HiveSQLException { setState(OperationState.RUNNING); try { IMetaStoreClient metastoreClient = getParentSession().getMetaStoreClient(); String schemaPattern = convertSchemaPattern(schemaName); String tablePattern = convertIdentifierPattern(tableName, true); columnPattern = Pattern.compile(convertIdentifierPattern(columnName, false)); if (isAuthV2Enabled()) { List<HivePrivilegeObject> privObjs = getPrivObjs(db2Tabs); String cmdStr = "catalog : " + catalogName + ", schemaPattern : " + schemaName + ", tablePattern : " + tableName; authorizeMetaGets(HiveOperationType.GET_COLUMNS, 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 getColumns(String catalogName, String schemaName, String tableName, String columnName) throws HiveSQLException { acquire(true); String addedJars = Utilities.getResourceFiles(hiveConf, SessionState.ResourceType.JAR); if (StringUtils.isNotBlank(addedJars)) { IMetaStoreClient metastoreClient = getSession().getMetaStoreClient(); metastoreClient.setHiveAddedJars(addedJars); } 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(true); } }
@Override public TableSchema getResultSetSchema() throws HiveSQLException { assertState(OperationState.FINISHED); return RESULT_SET_SCHEMA; }
public GetColumnsOperation newGetColumnsOperation(HiveSession parentSession, String catalogName, String schemaName, String tableName, String columnName) { GetColumnsOperation operation = new GetColumnsOperation(parentSession, catalogName, schemaName, tableName, columnName); addOperation(operation); return operation; }
protected GetColumnsOperation(HiveSession parentSession, String catalogName, String schemaName, String tableName, String columnName) { super(parentSession, OperationType.GET_COLUMNS); this.catalogName = catalogName; this.schemaName = schemaName; this.tableName = tableName; this.columnName = columnName; this.rowSet = RowSetFactory.create(RESULT_SET_SCHEMA, getProtocolVersion()); }
@Override public void runInternal() throws HiveSQLException { setState(OperationState.RUNNING); try { IMetaStoreClient metastoreClient = getParentSession().getMetaStoreClient(); String schemaPattern = convertSchemaPattern(schemaName); String tablePattern = convertIdentifierPattern(tableName, true); columnPattern = Pattern.compile(convertIdentifierPattern(columnName, false)); if (isAuthV2Enabled()) { List<HivePrivilegeObject> privObjs = getPrivObjs(db2Tabs); String cmdStr = "catalog : " + catalogName + ", schemaPattern : " + schemaName + ", tablePattern : " + tableName; authorizeMetaGets(HiveOperationType.GET_COLUMNS, 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 getColumns(String catalogName, String schemaName, String tableName, String columnName) throws HiveSQLException { acquire(true); String addedJars = Utilities.getResourceFiles(hiveConf, SessionState.ResourceType.JAR); if (StringUtils.isNotBlank(addedJars)) { IMetaStoreClient metastoreClient = getSession().getMetaStoreClient(); metastoreClient.setHiveAddedJars(addedJars); } 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(true); } }
@Override public TableSchema getResultSetSchema() throws HiveSQLException { assertState(OperationState.FINISHED); return RESULT_SET_SCHEMA; }
public GetColumnsOperation newGetColumnsOperation(HiveSession parentSession, String catalogName, String schemaName, String tableName, String columnName) { GetColumnsOperation operation = new GetColumnsOperation(parentSession, catalogName, schemaName, tableName, columnName); addOperation(operation); return operation; }