소스 검색

[hive] Support fetching table list from various SQL servers

Some return more columns like isTemporary, so we just keep the
first column in the result set (it is always the table name)
Romain Rigaux 10 년 전
부모
커밋
1aa9cae
1개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 2
      apps/beeswax/src/beeswax/server/dbms.py

+ 2 - 2
apps/beeswax/src/beeswax/server/dbms.py

@@ -175,7 +175,7 @@ class HiveServer2Dbms(object):
 
   def get_tables(self, database='default', table_names='*'):
     identifier = self.to_matching_wildcard(table_names)
-    identifier = "'%s'" % identifier if identifier != '*' else '' # Filter not always supported
+    identifier = "'%s'" % identifier if identifier != '*' else '' # Filter not supported in SparkSql
 
     hql = "SHOW TABLES IN `%s` %s" % (database, identifier) # self.client.get_tables(database, table_names) is too slow
     query = hql_query(hql)
@@ -186,7 +186,7 @@ class HiveServer2Dbms(object):
     if handle:
       result = self.fetch(handle, rows=5000)
       self.close(handle)
-      tables = [name for table in result.rows() for name in table]
+      tables = [table[0] for table in result.rows()] # We only keep the first column as the name, SparkSql returns multiple columns
       if len(tables) <= APPLY_NATURAL_SORT_MAX.get():
         tables = apply_natural_sort(tables)
       return tables