@Override public void runInternal() throws HiveSQLException { setState(OperationState.RUNNING); LOG.info("Fetching table type metadata"); if (isAuthV2Enabled()) { authorizeMetaGets(HiveOperationType.GET_TABLETYPES, null); } try { for (TableType type : TableType.values()) { String tableType = tableTypeMapping.mapToClientType(type.toString()); rowSet.addRow(new String[] {tableType}); if (LOG.isDebugEnabled()) { String debugMessage = getDebugMessage("table type", RESULT_SET_SCHEMA); LOG.debug(debugMessage, tableType); } } if (LOG.isDebugEnabled() && rowSet.numRows() == 0) { LOG.debug("No table type metadata has been returned."); } setState(OperationState.FINISHED); LOG.info("Fetching table type metadata has been successfully finished"); } catch (Exception e) { setState(OperationState.ERROR); throw new HiveSQLException(e); } }
protected GetTablesOperation(HiveSession parentSession, String catalogName, String schemaName, String tableName, List<String> tableTypes) { super(parentSession, OperationType.GET_TABLES); this.catalogName = catalogName; this.schemaName = schemaName; this.tableName = tableName; String tableMappingStr = getParentSession().getHiveConf(). getVar(HiveConf.ConfVars.HIVE_SERVER2_TABLE_TYPE_MAPPING); tableTypeMapping = TableTypeMappingFactory.getTableTypeMapping(tableMappingStr); if (tableTypes != null) { tableTypeList = new ArrayList<String>(); for (String tableType : tableTypes) { tableTypeList.addAll(Arrays.asList(tableTypeMapping.mapToHiveType(tableType.trim()))); } } else { tableTypeList = null; } this.rowSet = RowSetFactory.create(RESULT_SET_SCHEMA, getProtocolVersion(), false); LOG.info("Starting GetTablesOperation with the following parameters: " + "catalogName={}, schemaName={}, tableName={}, tableTypes={}", catalogName, schemaName, tableName, tableTypeList != null ? tableTypeList.toString() : "null"); }
for (TableMeta tableMeta : metastoreClient.getTableMeta(dbName, tablePattern, tableTypeList)) { String tableType = tableTypeMapping.mapToClientType(tableMeta.getTableType()); rowSet.addRow(new Object[]{ DEFAULT_HIVE_CATALOG,
protected GetTablesOperation(HiveSession parentSession, String catalogName, String schemaName, String tableName, List<String> tableTypes) { super(parentSession, OperationType.GET_TABLES); this.catalogName = catalogName; this.schemaName = schemaName; this.tableName = tableName; String tableMappingStr = getParentSession().getHiveConf(). getVar(HiveConf.ConfVars.HIVE_SERVER2_TABLE_TYPE_MAPPING); tableTypeMapping = TableTypeMappingFactory.getTableTypeMapping(tableMappingStr); if (tableTypes != null) { tableTypeList = new ArrayList<String>(); for (String tableType : tableTypes) { tableTypeList.addAll(Arrays.asList(tableTypeMapping.mapToHiveType(tableType.trim()))); } } else { tableTypeList = null; } this.rowSet = RowSetFactory.create(RESULT_SET_SCHEMA, getProtocolVersion(), false); }
table.getDbName(), table.getTableName(), tableTypeMapping.mapToClientType(table.getTableType()), table.getParameters().get("comment") }; if (tableTypes.isEmpty() || tableTypes.contains( tableTypeMapping.mapToClientType(table.getTableType()))) { rowSet.addRow(rowData);
table.getDbName(), table.getTableName(), tableTypeMapping.mapToClientType(table.getTableType()), table.getParameters().get("comment") }; if (tableTypes.isEmpty() || tableTypes.contains( tableTypeMapping.mapToClientType(table.getTableType()))) { rowSet.addRow(rowData);
@Override public void runInternal() throws HiveSQLException { setState(OperationState.RUNNING); if (isAuthV2Enabled()) { authorizeMetaGets(HiveOperationType.GET_TABLETYPES, null); } try { for (TableType type : TableType.values()) { rowSet.addRow(new String[] {tableTypeMapping.mapToClientType(type.toString())}); } setState(OperationState.FINISHED); } catch (Exception e) { setState(OperationState.ERROR); throw new HiveSQLException(e); } }
@Override public void runInternal() throws HiveSQLException { setState(OperationState.RUNNING); if (isAuthV2Enabled()) { authorizeMetaGets(HiveOperationType.GET_TABLETYPES, null); } try { for (TableType type : TableType.values()) { rowSet.addRow(new String[] {tableTypeMapping.mapToClientType(type.toString())}); } setState(OperationState.FINISHED); } catch (Exception e) { setState(OperationState.ERROR); throw new HiveSQLException(e); } }
table.getDbName(), table.getTableName(), tableTypeMapping.mapToClientType(table.getTableType()), table.getParameters().get("comment") }; if (tableTypes.isEmpty() || tableTypes.contains( tableTypeMapping.mapToClientType(table.getTableType()))) { rowSet.addRow(rowData);
table.getDbName(), table.getTableName(), tableTypeMapping.mapToClientType(table.getTableType()), table.getParameters().get("comment") }; if (tableTypes.isEmpty() || tableTypes.contains( tableTypeMapping.mapToClientType(table.getTableType()))) { rowSet.addRow(rowData);
@Override public void runInternal() throws HiveSQLException { setState(OperationState.RUNNING); if (isAuthV2Enabled()) { authorizeMetaGets(HiveOperationType.GET_TABLETYPES, null); } try { for (TableType type : TableType.values()) { rowSet.addRow(new String[] {tableTypeMapping.mapToClientType(type.toString())}); } setState(OperationState.FINISHED); } catch (Exception e) { setState(OperationState.ERROR); throw new HiveSQLException(e); } }
@Override public void runInternal() throws HiveSQLException { setState(OperationState.RUNNING); if (isAuthV2Enabled()) { authorizeMetaGets(HiveOperationType.GET_TABLETYPES, null); } try { for (TableType type : TableType.values()) { rowSet.addRow(new String[] {tableTypeMapping.mapToClientType(type.toString())}); } setState(OperationState.FINISHED); } catch (Exception e) { setState(OperationState.ERROR); throw new HiveSQLException(e); } }
@Override public void runInternal() throws HiveSQLException { setState(OperationState.RUNNING); if (isAuthV2Enabled()) { authorizeMetaGets(HiveOperationType.GET_TABLETYPES, null); } try { for (TableType type : TableType.values()) { rowSet.addRow(new String[] {tableTypeMapping.mapToClientType(type.toString())}); } setState(OperationState.FINISHED); } catch (Exception e) { setState(OperationState.ERROR); throw new HiveSQLException(e); } }
@Override public void runInternal() throws HiveSQLException { setState(OperationState.RUNNING); try { IMetaStoreClient metastoreClient = getParentSession().getMetaStoreClient(); String schemaPattern = convertSchemaPattern(schemaName); List<String> matchingDbs = metastoreClient.getDatabases(schemaPattern); if(isAuthV2Enabled()){ List<HivePrivilegeObject> privObjs = HivePrivilegeObjectUtils.getHivePrivDbObjects(matchingDbs); String cmdStr = "catalog : " + catalogName + ", schemaPattern : " + schemaName; authorizeMetaGets(HiveOperationType.GET_TABLES, privObjs, cmdStr); } String tablePattern = convertIdentifierPattern(tableName, true); for (TableMeta tableMeta : metastoreClient.getTableMeta(schemaPattern, tablePattern, tableTypeList)) { rowSet.addRow(new Object[] { DEFAULT_HIVE_CATALOG, tableMeta.getDbName(), tableMeta.getTableName(), tableTypeMapping.mapToClientType(tableMeta.getTableType()), tableMeta.getComments(), null, null, null, null, null }); } setState(OperationState.FINISHED); } catch (Exception e) { setState(OperationState.ERROR); throw new HiveSQLException(e); } }