Bläddra i källkod

[impala] Only show the columns returned in the sample data

Nested columns do not appear in a SELECT * and would be missing
in the sample table.
Romain Rigaux 10 år sedan
förälder
incheckning
ce8c513

+ 1 - 0
apps/beeswax/src/beeswax/api.py

@@ -627,6 +627,7 @@ def describe_table(request, database, table):
     from metastore.views import describe_table
     return describe_table(request, database, table)
   except Exception, e:
+    LOG.exception('Describe table failed')
     raise PopupException(_('Problem accessing table metadata'), detail=e)
 
 

+ 3 - 3
apps/metastore/src/metastore/templates/describe_table.mako

@@ -134,13 +134,13 @@ ${ components.menubar() }
                   <thead>
                     <tr>
                       <th style="width: 10px"></th>
-                    % for col in table.cols:
-                      <th>${col.name}</th>
+                    % for col in sample.cols():
+                      <th>${ col }</th>
                     % endfor
                     </tr>
                   </thead>
                   <tbody>
-                  % for i, row in enumerate(sample):
+                  % for i, row in enumerate(sample.rows()):
                     <tr>
                       <td>${ i }</td>
                     % for item in row:

+ 3 - 3
apps/metastore/src/metastore/templates/sample.mako

@@ -29,13 +29,13 @@ from django.utils.translation import ugettext as _
     <thead>
       <tr>
         <th style="width: 10px"></th>
-        % for col in table.cols:
-          <th>${ col.name }</th>
+        % for col in sample.cols():
+          <th>${ col }</th>
         % endfor
       </tr>
     </thead>
     <tbody>
-      % for i, row in enumerate(sample):
+      % for i, row in enumerate(sample.rows()):
       <tr>
         <td>${ i }</td>
         % for item in row:

+ 2 - 1
apps/metastore/src/metastore/views.py

@@ -200,6 +200,7 @@ def describe_table(request, database, table):
   try:
     table = db.get_table(database, table)
   except Exception, e:
+    LOG.exception("Describe table error")
     if hasattr(e, 'message') and e.message:
       raise PopupException(_("Hive Error"), detail=e.message)
     else:
@@ -229,7 +230,7 @@ def describe_table(request, database, table):
     ],
     'table': table,
     'partitions': partitions,
-    'sample': table_data and list(table_data.rows()),
+    'sample': table_data,
     'error_message': error_message,
     'database': database,
     'has_write_access': has_write_access(request.user),

+ 1 - 1
apps/search/src/search/data_export.py

@@ -32,7 +32,7 @@ def download(results, format, collection):
   """
   download(results, format) -> HttpResponse
 
-  Transform the search result set to the specified format and dwonload.
+  Transform the search result set to the specified format and download.
   """
   if format not in DL_FORMATS:
     LOG.error('Unknown download format "%s"' % format)