Browse Source

HUE-3259 [metastore] Table stats on table with partitions is always outdated and empty

Johan Ahlen 9 years ago
parent
commit
1ef1222893

+ 19 - 0
desktop/core/src/desktop/static/desktop/js/assist/tableStats.js

@@ -63,6 +63,25 @@
     self.loadingSamples = ko.observable(false);
     self.samples = ko.observable(null);
 
+    self.showAnalysis = ko.observable(false);
+
+    if (self.column === null) {
+      self.assistHelper.fetchTableDetails({
+        tableName: ko.isObservable(self.table) ? self.table() : self.table,
+        databaseName: ko.isObservable(self.database) ? self.database() : self.database,
+        sourceType: self.sourceType,
+        successCallback: function (data) {
+          self.showAnalysis(data.partition_keys.length === 0);
+        },
+        silenceErrors: true,
+        errorCallback: function () {
+          self.showAnalysis(true);
+        }
+      });
+    } else {
+      self.showAnalysis(true);
+    }
+
     self.activeTab.subscribe(function (newValue) {
       if (newValue === 'analysis' && self.statRows().length === 0) {
         self.fetchData();

+ 1 - 1
desktop/core/src/desktop/templates/table_stats.mako

@@ -92,7 +92,7 @@ from desktop.views import _ko
           <li data-bind="click: function () { activeTab('sample'); }, css: { 'active' : activeTab() === 'sample' }">
             <a class="inactive-action" href="#sampleTab" data-toggle="tab">${_('Sample')}</a>
           </li>
-          <li data-bind="click: function () { activeTab('analysis'); }, css: { 'active' : activeTab() === 'analysis' }">
+          <li data-bind="click: function () { activeTab('analysis'); }, css: { 'active' : activeTab() === 'analysis' }, visible: showAnalysis">
             <a class="inactive-action" href="#analysisTab" data-toggle="tab"><span class="pull-right stats-warning muted" data-bind="visible: inaccurate() && column == null && !isComplexType && !isView" rel="tooltip" data-placement="top" title="${ _('The column stats for this table are not accurate') }" style="margin-left: 8px"><i class="fa fa-exclamation-triangle"></i></span>${_('Analysis')} </a>
           </li>
           <!-- ko if: sourceType === 'hive' || sourceType === 'impala' -->