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

HUE-1337 [impala] Support refresh from 1.0 and 1.1

Romain Rigaux 12 жил өмнө
parent
commit
2aafca3

+ 26 - 2
apps/beeswax/src/beeswax/templates/execute.mako

@@ -222,9 +222,25 @@ ${layout.menubar(section='query')}
                           </li>
                           <li>
                             <div class="control-group">
-                              <button id="refresh-btn" class="btn btn-small" data-loading-text="${ _('Refreshing...') }" rel="tooltip" data-placement="right" data-original-title="${ _('Update the list of tables seen by Impala. It can take a few seconds...') }">
+                              <button id="refresh-btn" class="btn btn-small hide" data-loading-text="${ _('Refreshing...') }" rel="tooltip" data-placement="right" data-original-title="${ _('Update the list of tables seen by Impala. It can take a few seconds...') }">
+                                <i class="icon-refresh"></i>
                                 ${ _('Refresh') }
                               </button>
+                              <span id="refresh-tip">
+                                <i class="icon-refresh"></i>
+                                ${ _('Sync tables tips') }
+                              </span>
+                              <i id="refresh-tip" onclick="$('#refresh-btn,#refresh-tip').toggle('hide')"
+                                rel="tooltip" data-placement="right" data-original-title="${ _('Using an Impala version inferior to 1.1? Click to use the refresh button.') }"
+                                class="icon-plus-sign-alt" style="cursor: pointer;">
+                              </i>
+                              <div id="refresh-content" class="hide">
+                                <ul style="text-align: left;">
+                                  <li>"invalidate metadata" ${ _("invalidates the entire catalog metadata. All table metadata will be reloaded on the next access.") }</li>
+                                  <li>"invalidate metadata &lt;table&gt;" ${ _("invalidates the metadata, load on the next access") }</li>
+                                  <li>"refresh &lt;table&gt;" ${ _("refreshes the metadata immediately. It's an incremental refresh. Much faster") }</li>
+                                </ul>
+                              </div>
                             </div>
                           </li>
                         % endif
@@ -745,7 +761,8 @@ ${layout.menubar(section='query')}
             var _before = codeMirror.getRange({line: 0, ch: 0}, {line: codeMirror.getCursor().line, ch: codeMirror.getCursor().ch}).replace(/(\r\n|\n|\r)/gm, " ");
             CodeMirror.possibleTable = false;
             CodeMirror.tableFieldMagic = false;
-            if (_before.toUpperCase().indexOf(" FROM ") > -1 && _before.toUpperCase().indexOf(" ON ") == -1 && _before.toUpperCase().indexOf(" WHERE ") == -1) {
+            if (_before.toUpperCase().indexOf(" FROM ") > -1 && _before.toUpperCase().indexOf(" ON ") == -1 && _before.toUpperCase().indexOf(" WHERE ") == -1 ||
+                _before.toUpperCase().indexOf("REFRESH") > -1 || _before.toUpperCase().indexOf("METADATA") > -1 ) {
               CodeMirror.possibleTable = true;
             }
             CodeMirror.possibleSoloField = false;
@@ -896,6 +913,13 @@ ${layout.menubar(section='query')}
            .always(function() { $(_this).button('reset') });
           return false;
         });
+
+        $("#refresh-tip").popover({
+          'title': "${_('Missing some tables? In order to update the list of tables/metadata seen by Impala, execute one of these queries:')}",
+          'content': $("#refresh-content").html(),
+          'trigger': 'hover',
+          'html': true
+        });
       % endif
     });
 

+ 1 - 1
desktop/core/static/js/Source/jHue/codemirror-hql.js

@@ -285,7 +285,7 @@ CodeMirror.defineMode("sql", function (config, parserConfig) {
 
   CodeMirror.defineMIME("text/x-hiveql", {
     name: "sql",
-    keywords: set("add after all alter and archive as asc between bucket buckets by cascade change cli cluster clustered coalesce collection column columns comment create cross data database databases dbproperties deferred delimited dependency desc describe directory disable distinct distribute dot drop enable escaped exists explain export extended external fields fileformat first format formatted from full function functions grant group having idxproperties if ignore import in index indexes inpath insert into is items join keys lateral left like limit lines load local location locks map mapjoin msck not of offline on option order out outer overwrite partition partitioned partitions percent privileges protection rebuild recordreader recover reduce regexp rename repair replace restrict revoke right rlike role row schema schemas select semi separated serde serdeproperties set show skewed sort sorted stored sum table tables tablesample tblproperties temporary terminated to touch transform truncate unarchive union us user using view where with"),
+    keywords: set("add after all alter and archive as asc between bucket buckets by cascade change cli cluster clustered coalesce collection column columns comment create cross data database databases dbproperties deferred delimited dependency desc describe directory disable distinct distribute dot drop enable escaped exists explain export extended external fields fileformat first format formatted from full function functions grant group having idxproperties if ignore import in index indexes inpath insert into is items join keys lateral left like limit lines load local location locks map mapjoin msck not of offline on option order out outer overwrite partition partitioned partitions percent privileges protection rebuild recordreader recover reduce regexp rename repair replace restrict revoke right rlike role row schema schemas select semi separated serde serdeproperties set show skewed sort sorted stored sum table tables tablesample tblproperties temporary terminated to touch transform truncate unarchive union us user using view where with refresh invalidate metadata"),
     builtin: set("tinyint smallint int bigint boolean float double string binary timestamp decimal array map struct uniontype delimited serde sequencefile textfile rcfile inputformat outputformat"),
     functions: set("round floor ceil ceiling rand exp ln log10 log2 log pow power sqrt bin hex unhex conv abs pmod sin asin cos acos tan atan degrees radians positive negative sign e pi size map_keys map_values array_contains sort_array binary cast from_unixtime unix_timestamp to_date year month day hour minute second weekofyear datediff date_add date_sub from_utc_timestamp to_utc_timestamp ascii concat context_ngrams concat_ws find_in_set format_number get_json_object in_file instr length locate lower lcase lpad ltrim ngrams parse_url printf regexp_extract regexp_replace repeat reverse rpad rtrim sentences space split str_to_map substr substring translate trim upper ucase java_method reflect xpath xpath_short xpath_int xpath_long xpath_float xpath_double xpath_number xpath_string count sum avg min max variance var_samp stdev_pop stdev_samp covar_pop covar_samp corr percentile percentile_approx histogram_numeric collect_set inline explode json_tuple parse_url_tuple get_json_object"),
     atoms: set("false true null"),

+ 1 - 1
desktop/core/static/js/Source/jHue/codemirror-isql-hint.js

@@ -68,7 +68,7 @@
     });
   };
 
-  var impalaSQLKeywords = "ALL AND AS BY COMMENT CREATE DATABASE DATABASES DELIMITED DESCRIBE DISTINCT DROP EXISTS EXPLAIN EXTERNAL FIELDS FORMAT FROM GROUP HAVING IF INSERT INTO JOIN LIKE LIMIT LINES LOCATION NOT OR ORDER OVERWRITE PARTITIONED REFRESH ROW SCHEMA SCHEMAS SELECT SHOW STORED TABLE TABLES TERMINATED UNION USE WHERE";
+  var impalaSQLKeywords = "ALL AND AS BY COMMENT CREATE DATABASE DATABASES DELIMITED DESCRIBE DISTINCT DROP EXISTS EXPLAIN EXTERNAL FIELDS FORMAT FROM GROUP HAVING IF INSERT INTO JOIN LIKE LIMIT LINES LOCATION NOT OR ORDER OVERWRITE PARTITIONED REFRESH ROW SCHEMA SCHEMAS SELECT SHOW STORED TABLE TABLES TERMINATED UNION USE WHERE INVALIDATE METADATA";
   var impalaSQLKeywordsU = impalaSQLKeywords.split(" ");
   var impalaSQLKeywordsL = impalaSQLKeywords.toLowerCase().split(" ");