Эх сурвалжийг харах

HUE-4908 [editor] Support sample popup on Kudu tables

Romain Rigaux 8 жил өмнө
parent
commit
16ad708

+ 3 - 5
apps/beeswax/src/beeswax/api.py

@@ -136,11 +136,9 @@ def _autocomplete(db, database=None, table=None, column=None, nested=None):
         response = parse_tree
         # If column or nested type is scalar/primitive, add sample of values
         if parser.is_scalar_type(parse_tree['type']):
-          table_obj = db.get_table(database, table)
-          sample = db.get_sample(database, table_obj, column, nested)
-          if sample:
-            sample = set([row[0] for row in sample.rows()])
-            response['sample'] = sorted(list(sample))
+          sample = _get_sample_data(db, database, table, column)
+          if 'rows' in sample:
+            response['sample'] = sample['rows']
       else:
         raise Exception('Could not find column `%s`.`%s`.`%s`' % (database, table, column))
   except (QueryServerTimeoutException, TTransportException), e:

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

@@ -239,7 +239,7 @@ class HiveServer2Dbms(object):
 
 
   def get_column(self, database, table_name, column_name):
-    table = self.client.get_table(database, table_name)
+    table = self.get_table(database, table_name)
     for col in table.cols:
       if col.name == column_name:
         return col