Преглед на файлове

[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