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"); }
LOG.info("Fetching table metadata"); try { IMetaStoreClient metastoreClient = getParentSession().getMetaStoreClient(); String schemaPattern = convertSchemaPattern(schemaName); List<String> matchingDbs = metastoreClient.getDatabases(schemaPattern);
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); }
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) { this.tableTypes.addAll(tableTypes); } this.rowSet = RowSetFactory.create(RESULT_SET_SCHEMA, getProtocolVersion()); }
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) { this.tableTypes.addAll(tableTypes); } this.rowSet = RowSetFactory.create(RESULT_SET_SCHEMA, getProtocolVersion()); }
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) { this.tableTypes.addAll(tableTypes); } this.rowSet = RowSetFactory.create(RESULT_SET_SCHEMA, getProtocolVersion()); }
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) { this.tableTypes.addAll(tableTypes); } this.rowSet = RowSetFactory.create(RESULT_SET_SCHEMA, getProtocolVersion()); }
setState(OperationState.RUNNING); try { IMetaStoreClient metastoreClient = getParentSession().getMetaStoreClient(); String schemaPattern = convertSchemaPattern(schemaName); List<String> matchingDbs = metastoreClient.getDatabases(schemaPattern);
setState(OperationState.RUNNING); try { IMetaStoreClient metastoreClient = getParentSession().getMetaStoreClient(); String schemaPattern = convertSchemaPattern(schemaName); List<String> matchingDbs = metastoreClient.getDatabases(schemaPattern);
setState(OperationState.RUNNING); try { IMetaStoreClient metastoreClient = getParentSession().getMetaStoreClient(); String schemaPattern = convertSchemaPattern(schemaName); List<String> matchingDbs = metastoreClient.getDatabases(schemaPattern);
setState(OperationState.RUNNING); try { IMetaStoreClient metastoreClient = getParentSession().getMetaStoreClient(); String schemaPattern = convertSchemaPattern(schemaName); List<String> matchingDbs = metastoreClient.getDatabases(schemaPattern);
@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); } }