Browse Source

HUE-8758 [connector] Switch from sourceType to connector only in the data catalog and entries

Johan Ahlen 5 năm trước cách đây
mục cha
commit
3e669d12ed
37 tập tin đã thay đổi với 144 bổ sung136 xóa
  1. 9 9
      apps/metastore/src/metastore/templates/metastore.mako
  2. 7 1
      apps/pig/src/pig/templates/app.mako
  3. 0 1
      desktop/core/src/desktop/js/apps/notebook/snippet.js
  4. 0 1
      desktop/core/src/desktop/js/apps/table_browser/app.js
  5. 1 2
      desktop/core/src/desktop/js/apps/table_browser/metastoreNamespace.js
  6. 1 1
      desktop/core/src/desktop/js/apps/table_browser/metastoreSource.js
  7. 1 1
      desktop/core/src/desktop/js/apps/table_browser/metastoreTable.js
  8. 1 3
      desktop/core/src/desktop/js/catalog/catalogUtils.js
  9. 16 20
      desktop/core/src/desktop/js/catalog/dataCatalog.js
  10. 26 16
      desktop/core/src/desktop/js/catalog/dataCatalogEntry.js
  11. 18 0
      desktop/core/src/desktop/js/catalog/multiTableEntry.js
  12. 0 1
      desktop/core/src/desktop/js/catalog/optimizer/localStrategy.js
  13. 5 6
      desktop/core/src/desktop/js/jquery/plugins/jquery.hiveautocomplete.js
  14. 2 3
      desktop/core/src/desktop/js/ko/bindings/ace/aceLocationHandler.js
  15. 3 4
      desktop/core/src/desktop/js/ko/components/assist/assistDbEntry.js
  16. 1 2
      desktop/core/src/desktop/js/ko/components/assist/assistDbNamespace.js
  17. 2 4
      desktop/core/src/desktop/js/ko/components/assist/ko.assistDashboardPanel.js
  18. 3 4
      desktop/core/src/desktop/js/ko/components/assist/ko.assistDbPanel.js
  19. 1 3
      desktop/core/src/desktop/js/ko/components/assist/ko.assistEditorContextPanel.js
  20. 1 2
      desktop/core/src/desktop/js/ko/components/contextPopover/asteriskContextTabs.js
  21. 5 4
      desktop/core/src/desktop/js/ko/components/contextPopover/dataCatalogContext.js
  22. 4 5
      desktop/core/src/desktop/js/ko/components/contextPopover/ko.contextPopover.js
  23. 2 2
      desktop/core/src/desktop/js/ko/components/ko.catalogEntriesList.js
  24. 1 1
      desktop/core/src/desktop/js/ko/components/ko.catalogEntriesList.test.js
  25. 11 9
      desktop/core/src/desktop/js/ko/components/ko.contextSelector.js
  26. 2 2
      desktop/core/src/desktop/js/ko/components/ko.fieldSamples.js
  27. 1 1
      desktop/core/src/desktop/js/ko/components/ko.fieldSamples.test.js
  28. 0 1
      desktop/core/src/desktop/js/ko/components/ko.historyPanel.js
  29. 1 1
      desktop/core/src/desktop/js/ko/components/ko.navProperties.test.js
  30. 1 1
      desktop/core/src/desktop/js/ko/components/ko.navTags.test.js
  31. 1 2
      desktop/core/src/desktop/js/ko/components/ko.pollingCatalogEntriesList.js
  32. 0 9
      desktop/core/src/desktop/js/sql/autocompleteResults.js
  33. 3 1
      desktop/core/src/desktop/js/sql/autocompleteResults.test.js
  34. 3 2
      desktop/core/src/desktop/js/sql/sqlUtils.js
  35. 7 5
      desktop/core/src/desktop/static/desktop/js/jquery.hiveautocomplete.js
  36. 3 6
      desktop/libs/indexer/src/indexer/templates/importer.mako
  37. 1 0
      desktop/libs/notebook/src/notebook/templates/editor_components.mako

+ 9 - 9
apps/metastore/src/metastore/templates/metastore.mako

@@ -372,9 +372,9 @@ ${ components.menubar(is_embeddable) }
         </div>
 
         % if is_embeddable:
-          <button href="javascript: void(0);" class="btn btn-default" data-bind="publish: { 'open.link': '${ url('indexer:importer_prefill', source_type='manual', target_type='database') }' + '/?sourceType=' + catalogEntry().getSourceType() + '&namespace=' + catalogEntry().namespace.id + '&compute=' + catalogEntry().compute.id  }" title="${_('Create a new database')}"><i class="fa fa-plus"></i> ${_('New')}</button>
+          <button href="javascript: void(0);" class="btn btn-default" data-bind="publish: { 'open.link': '${ url('indexer:importer_prefill', source_type='manual', target_type='database') }' + '/?sourceType=' + catalogEntry().getConnector().type + '&namespace=' + catalogEntry().namespace.id + '&compute=' + catalogEntry().compute.id  }" title="${_('Create a new database')}"><i class="fa fa-plus"></i> ${_('New')}</button>
         % elif ENABLE_NEW_CREATE_TABLE.get():
-          <button class="btn btn-default" data-bind="attr: { 'href': '${ url('indexer:importer_prefill', source_type='manual', target_type='database') }' + '/?sourceType=' + catalogEntry().getSourceType() + '&namespace=' + catalogEntry().namespace.id + '&compute=' + catalogEntry().compute.id }" title="${_('Create a new database')}"><i class="fa fa-plus"></i> ${_('New')}</button>
+          <button class="btn btn-default" data-bind="attr: { 'href': '${ url('indexer:importer_prefill', source_type='manual', target_type='database') }' + '/?sourceType=' + catalogEntry().getConnector().type + '&namespace=' + catalogEntry().namespace.id + '&compute=' + catalogEntry().compute.id }" title="${_('Create a new database')}"><i class="fa fa-plus"></i> ${_('New')}</button>
         % else:
           <button href="${ url('beeswax:create_database') }" class="btn btn-default" title="${_('Create a new database')}"><i class="fa fa-plus"></i> ${_('New')}</button>
         % endif
@@ -504,9 +504,9 @@ ${ components.menubar(is_embeddable) }
         % if has_write_access:
           <button id="dropBtn" class="btn toolbarBtn" title="${_('Drop the selected tables')}" data-bind="click: function () { $('#dropTable').modal('show'); }, disable: selectedTables().length === 0"><i class="fa fa-times"></i>  ${_('Drop')}</button>
           % if is_embeddable:
-            <button href="javascript: void(0);" class="btn btn-default" data-bind="publish: { 'open.link': '${ url('indexer:importer_prefill', source_type='all', target_type='table') }' + catalogEntry.name + '/?sourceType=' + catalogEntry.getSourceType() + '&namespace=' + catalogEntry.namespace.id + '&compute=' + catalogEntry.compute.id }" title="${_('Create a new table')}"><i class="fa fa-plus"></i> ${_('New')}</button>
+            <button href="javascript: void(0);" class="btn btn-default" data-bind="publish: { 'open.link': '${ url('indexer:importer_prefill', source_type='all', target_type='table') }' + catalogEntry.name + '/?sourceType=' + catalogEntry.getConnector().type + '&namespace=' + catalogEntry.namespace.id + '&compute=' + catalogEntry.compute.id }" title="${_('Create a new table')}"><i class="fa fa-plus"></i> ${_('New')}</button>
           % elif ENABLE_NEW_CREATE_TABLE.get():
-            <button class="btn btn-default" data-bind="attr: { 'href': '${ url('indexer:importer_prefill', source_type='all', target_type='table') }' + catalogEntry.name + '/?sourceType=' + catalogEntry.getSourceType() + '&namespace=' + catalogEntry.namespace.id + '&compute=' + catalogEntry.compute.id }" title="${_('Create a new table')}"><i class="fa fa-plus"></i> ${_('New')}</button>
+            <button class="btn btn-default" data-bind="attr: { 'href': '${ url('indexer:importer_prefill', source_type='all', target_type='table') }' + catalogEntry.name + '/?sourceType=' + catalogEntry.getConnector().type + '&namespace=' + catalogEntry.namespace.id + '&compute=' + catalogEntry.compute.id }" title="${_('Create a new table')}"><i class="fa fa-plus"></i> ${_('New')}</button>
           % else:
             <button class="btn btn-default" data-bind="attr: { 'href': '/beeswax/create/import_wizard/' + catalogEntry.name }" title="${_('Create a new table from a file')}"><i class="fa fa-stack"></i> ${_('New from file')}</button>
             <button class="btn btn-default" data-bind="attr: { 'href': '/beeswax/create/create_table/' + catalogEntry.name }" title="${_('Create a new table manually')}"><i class="fa fa-plus"></i> ${_('New manually')}</button>
@@ -720,7 +720,7 @@ ${ components.menubar(is_embeddable) }
   <div style="padding: 5px 15px">
     <!-- ko hueSpinner: { spin: loadingViewSql, inline: true } --><!-- /ko -->
     <!-- ko ifnot: loadingViewSql -->
-    <div data-bind="highlight: { value: viewSql, formatted: true, dialect: catalogEntry.getSourceType() }"></div>
+    <div data-bind="highlight: { value: viewSql, formatted: true, dialect: catalogEntry.getDialect() }"></div>
     <!-- /ko -->
   </div>
 </script>
@@ -764,14 +764,14 @@ ${ components.menubar(is_embeddable) }
     <!-- /ko -->
     <!-- ko foreach: topJoins -->
     <tr>
-      <td><a href="javascript:void(0);" data-bind="text: tableName, sqlContextPopover: { sourceType: $parents[1].catalogEntry.getSourceType(), namespace: parents[1].catalogEntry.namespace, compute: parents[1].catalogEntry.compute, path: tablePath, offset: { top: -3, left: 3 }}"></a></td>
+      <td><a href="javascript:void(0);" data-bind="text: tableName, sqlContextPopover: { sourceType: $parents[1].catalogEntry.getConnector().type, namespace: parents[1].catalogEntry.namespace, compute: parents[1].catalogEntry.compute, path: tablePath, offset: { top: -3, left: 3 }}"></a></td>
       <td>
         <table class="metastore-join-column-table">
           <tbody data-bind="foreach: joinCols">
           <tr>
-            <td><a href="javascript:void(0);" data-bind="text: target, sqlContextPopover: { sourceType: $parents[2].catalogEntry.getSourceType(), namespace: $parents[2].catalogEntry.namespace, compute: parents[2].catalogEntry.compute, path: targetPath, offset: { top: -3, left: 3 }}"></a></td>
+            <td><a href="javascript:void(0);" data-bind="text: target, sqlContextPopover: { sourceType: $parents[2].catalogEntry.getConnector().type, namespace: $parents[2].catalogEntry.namespace, compute: parents[2].catalogEntry.compute, path: targetPath, offset: { top: -3, left: 3 }}"></a></td>
             <td class="metastore-join-arrow"><i class="fa fa-arrows-h"></i></td>
-            <td><a href="javascript:void(0);" data-bind="text: source, sqlContextPopover: { sourceType: $parents[2].catalogEntry.getSourceType(), namespace: $parents[2].catalogEntry.namespace, compute: parents[2].catalogEntry.compute, path: sourcePath, offset: { top: -3, left: 3 }}"></a></td>
+            <td><a href="javascript:void(0);" data-bind="text: source, sqlContextPopover: { sourceType: $parents[2].catalogEntry.getConnector().type, namespace: $parents[2].catalogEntry.namespace, compute: parents[2].catalogEntry.compute, path: sourcePath, offset: { top: -3, left: 3 }}"></a></td>
           </tr>
           </tbody>
         </table>
@@ -1034,7 +1034,7 @@ ${ components.menubar(is_embeddable) }
   }
 
   function queryAndWatch(catalogEntry) {
-    queryAndWatchUrl('/notebook/browse/' + catalogEntry.path.join('/') + '/', catalogEntry.getSourceType(),
+    queryAndWatchUrl('/notebook/browse/' + catalogEntry.path.join('/') + '/', catalogEntry.getConnector().type,
             catalogEntry.namespace && catalogEntry.namespace.id, catalogEntry.compute)
   }
 </script>

+ 7 - 1
apps/pig/src/pig/templates/app.mako

@@ -1018,7 +1018,13 @@ ${ commonshare() | n,unicode }
       var apiHelper = window.apiHelper;
       contextCatalog.getNamespaces({ sourceType: 'hive' }).done(function (context) {
         // TODO: Namespace and compute selection
-        dataCatalog.getChildren({ namespace: context.namespaces[0], compute: context.namespaces[0].computes[0], sourceType: 'hive', path: ['default'], silenceErrors: true }).done(function (childEntries) {
+        dataCatalog.getChildren({
+          namespace: context.namespaces[0],
+          compute: context.namespaces[0].computes[0],
+          connector: { type: 'hive' },
+          path: ['default'],
+          silenceErrors: true
+        }).done(function (childEntries) {
           availableTables = $.map(childEntries, function (entry) { return entry.name }).join(' ');
         });
       });

+ 0 - 1
desktop/core/src/desktop/js/apps/notebook/snippet.js

@@ -1075,7 +1075,6 @@ class Snippet {
             ignoreNextAssistDatabaseUpdate = true;
             dataCatalog
               .getEntry({
-                sourceType: self.type(),
                 namespace: self.namespace(),
                 compute: self.compute(),
                 connector: self.connector(),

+ 0 - 1
desktop/core/src/desktop/js/apps/table_browser/app.js

@@ -148,7 +148,6 @@ huePubSub.subscribe('app.dom.loaded', app => {
       .getEntry({
         namespace: viewModel.source().namespace().namespace,
         compute: viewModel.source().namespace().compute,
-        sourceType: viewModel.source().type,
         connector: connector,
         path: [],
         definition: { type: 'source' }

+ 1 - 2
desktop/core/src/desktop/js/apps/table_browser/metastoreNamespace.js

@@ -62,7 +62,7 @@ class MetastoreNamespace {
       });
 
     // TODO: Use connectors in the table browser
-    const connector = {};
+    const connector = { type: this.sourceType };
     if (this.sourceType === 'hive' || this.sourceType === 'impala') {
       connector.optimizer = 'api';
     }
@@ -71,7 +71,6 @@ class MetastoreNamespace {
         namespace: this.namespace,
         compute: this.compute,
         connector: connector,
-        sourceType: this.sourceType,
         path: [],
         definition: { type: 'source' }
       })

+ 1 - 1
desktop/core/src/desktop/js/apps/table_browser/metastoreSource.js

@@ -159,7 +159,7 @@ class MetastoreSource {
     huePubSub.subscribe('data.catalog.entry.refreshed', details => {
       const refreshedEntry = details.entry;
 
-      if (refreshedEntry.getSourceType() !== this.type) {
+      if (refreshedEntry.getConnector().type !== this.type) {
         return;
       }
 

+ 1 - 1
desktop/core/src/desktop/js/apps/table_browser/metastoreTable.js

@@ -394,7 +394,7 @@ class MetastoreTable {
       '/metastore/table/' +
         this.catalogEntry.path.join('/') +
         '/load?source_type=' +
-        this.catalogEntry.getSourceType()
+        this.catalogEntry.getConnector().type
     )
       .done(data => {
         $('#import-data-modal').html(data['data']);

+ 1 - 3
desktop/core/src/desktop/js/catalog/catalogUtils.js

@@ -31,9 +31,7 @@ const fetchAndSave = (apiHelperFunction, attributeName, entry, apiOptions) => {
       ? apiHelper[apiHelperFunction].bind(apiHelper)
       : apiHelperFunction;
   return func({
-    sourceType:
-      (entry.dataCatalog.connector && entry.dataCatalog.connector.type) ||
-      entry.dataCatalog.sourceType,
+    sourceType: entry.getConnector().type,
     compute: entry.compute,
     path: entry.path, // Set for DataCatalogEntry
     paths: entry.paths, // Set for MultiTableEntry

+ 16 - 20
desktop/core/src/desktop/js/catalog/dataCatalog.js

@@ -123,23 +123,25 @@ const mergeMultiTableEntry = function(multiTableCatalogEntry, storeEntry) {
 
 export class DataCatalog {
   /**
-   * @param {string} sourceType
    * @param {Connector} connector
    *
    * @constructor
    */
-  constructor(sourceType, connector) {
+  constructor(connector) {
     const self = this;
-    self.sourceType = sourceType;
+    if (!connector || !connector.type) {
+      throw new Error('DataCatalog created without connector or type');
+    }
     self.connector = connector;
+
     self.entries = {};
     self.temporaryEntries = {};
     self.multiTableEntries = {};
     self.store = localforage.createInstance({
-      name: 'HueDataCatalog_' + self.sourceType + '_' + STORAGE_POSTFIX
+      name: 'HueDataCatalog_' + self.connector.type + '_' + STORAGE_POSTFIX
     });
     self.multiTableStore = localforage.createInstance({
-      name: 'HueDataCatalog_' + self.sourceType + '_multiTable_' + STORAGE_POSTFIX
+      name: 'HueDataCatalog_' + self.connector.type + '_multiTable_' + STORAGE_POSTFIX
     });
   }
 
@@ -817,18 +819,17 @@ const sourceBoundCatalogs = {};
 /**
  * Helper function to get the DataCatalog instance for a given data source.
  *
- * @param {string} sourceType
  * @param {Connector} connector
  *
  * @return {DataCatalog}
  */
-const getCatalog = function(sourceType, connector) {
-  if (!sourceType) {
-    throw new Error('getCatalog called without sourceType');
+const getCatalog = function(connector) {
+  if (!connector || !connector.type) {
+    throw new Error('getCatalog called without connector with type');
   }
   return (
-    sourceBoundCatalogs[sourceType] ||
-    (sourceBoundCatalogs[sourceType] = new DataCatalog(sourceType, connector))
+    sourceBoundCatalogs[connector.type] ||
+    (sourceBoundCatalogs[connector.type] = new DataCatalog(connector))
   );
 };
 
@@ -840,7 +841,6 @@ export default {
    * Calling this returns a handle that allows deletion of any created entries by calling delete() on the handle.
    *
    * @param {Object} options
-   * @param {string} options.sourceType
    * @param {ContextNamespace} options.namespace - The context namespace
    * @param {ContextCompute} options.compute - The context compute
    * @param {Connector} options.connector
@@ -854,12 +854,11 @@ export default {
    * @return {Object}
    */
   addTemporaryTable: function(options) {
-    return getCatalog(options.sourceType, options.connector).addTemporaryTable(options);
+    return getCatalog(options.connector).addTemporaryTable(options);
   },
 
   /**
    * @param {Object} options
-   * @param {string} options.sourceType
    * @param {ContextNamespace} options.namespace - The context namespace
    * @param {ContextCompute} options.compute - The context compute
    * @param {Connector} options.connector
@@ -870,12 +869,11 @@ export default {
    * @return {Promise}
    */
   getEntry: function(options) {
-    return getCatalog(options.sourceType, options.connector).getEntry(options);
+    return getCatalog(options.connector).getEntry(options);
   },
 
   /**
    * @param {Object} options
-   * @param {string} options.sourceType
    * @param {ContextNamespace} options.namespace - The context namespace
    * @param {ContextCompute} options.compute - The context compute
    * @param {Connector} options.connector
@@ -884,7 +882,7 @@ export default {
    * @return {Promise}
    */
   getMultiTableEntry: function(options) {
-    return getCatalog(options.sourceType, options.connector).getMultiTableEntry(options);
+    return getCatalog(options.connector).getMultiTableEntry(options);
   },
 
   /**
@@ -892,7 +890,6 @@ export default {
    * getEntry then getChildren.
    *
    * @param {Object} options
-   * @param {string} options.sourceType
    * @param {ContextNamespace} options.namespace - The context namespace
    * @param {ContextCompute} options.compute - The context compute
    * @param {Connector} options.connector
@@ -908,7 +905,7 @@ export default {
   getChildren: function(options) {
     const deferred = $.Deferred();
     const cancellablePromises = [];
-    getCatalog(options.sourceType, options.connector)
+    getCatalog(options.connector)
       .getEntry(options)
       .done(entry => {
         cancellablePromises.push(
@@ -923,7 +920,6 @@ export default {
   },
 
   /**
-   * @param {string} sourceType
    * @param {Connector} connector
    *
    * @return {DataCatalog}

+ 26 - 16
desktop/core/src/desktop/js/catalog/dataCatalogEntry.js

@@ -218,14 +218,19 @@ class DataCatalogEntry {
   constructor(options) {
     const self = this;
 
+    if (!options.dataCatalog.connector) {
+      throw new Error('DataCatalogEntry created without connector');
+    }
+
     self.namespace = options.namespace;
     self.compute = options.compute;
     self.dataCatalog = options.dataCatalog;
+
     self.path =
       typeof options.path === 'string' && options.path
         ? options.path.split('.')
         : options.path || [];
-    self.name = self.path.length ? self.path[self.path.length - 1] : options.dataCatalog.sourceType;
+    self.name = self.path.length ? self.path[self.path.length - 1] : self.getConnector().type;
     self.isTemporary = options.isTemporary;
 
     self.definition = options.definition;
@@ -486,10 +491,8 @@ class DataCatalogEntry {
             }
           });
         }
-        if (
-          (self.getSourceType() === 'impala' || self.getSourceType() === 'hive') &&
-          self.isComplex()
-        ) {
+        // TODO: Move to connector attributes
+        if ((self.getDialect() === 'impala' || self.getDialect() === 'hive') && self.isComplex()) {
           (sourceMeta.type === 'map' ? ['key', 'value'] : ['item']).forEach(path => {
             if (sourceMeta[path]) {
               promises.push(
@@ -807,9 +810,10 @@ class DataCatalogEntry {
    */
   canHaveNavigatorMetadata() {
     const self = this;
+    // TODO: Move to connector attributes
     return (
       window.HAS_CATALOG &&
-      (self.getSourceType() === 'hive' || self.getSourceType() === 'impala') &&
+      (self.getDialect() === 'hive' || self.getDialect() === 'impala') &&
       (self.isDatabase() || self.isTableOrView() || self.isColumn())
     );
   }
@@ -821,10 +825,8 @@ class DataCatalogEntry {
    */
   getResolvedComment() {
     const self = this;
-    if (
-      self.navigatorMeta &&
-      (self.getSourceType() === 'hive' || self.getSourceType() === 'impala')
-    ) {
+    // TODO: Move to connector attributes
+    if (self.navigatorMeta && (self.getDialect() === 'hive' || self.getDialect() === 'impala')) {
       return self.navigatorMeta.description || self.navigatorMeta.originalDescription || '';
     }
     return (self.sourceMeta && self.sourceMeta.comment) || '';
@@ -1043,7 +1045,7 @@ class DataCatalogEntry {
     } else {
       apiHelper
         .updateSourceMetadata({
-          sourceType: self.getSourceType(),
+          sourceType: self.getConnector().type,
           path: self.path,
           properties: {
             comment: comment
@@ -1171,13 +1173,21 @@ class DataCatalogEntry {
   }
 
   /**
-   * Returns the source type of this entry.
+   * Returns the dialect of this entry.
    *
    * @return {string} - 'impala', 'hive', 'solr', etc.
    */
-  getSourceType() {
-    const self = this;
-    return self.dataCatalog.sourceType;
+  getDialect() {
+    return this.getConnector().dialect || this.getConnector().type; // .type for editor v1
+  }
+
+  /**
+   * Returns the connector for this entry
+   *
+   * @return {Connector}
+   */
+  getConnector() {
+    return this.dataCatalog.connector;
   }
 
   /**
@@ -1654,7 +1664,7 @@ class DataCatalogEntry {
     if (options && options.operation && options.operation !== 'default') {
       return catalogUtils.applyCancellable(
         apiHelper.fetchSample({
-          sourceType: self.dataCatalog.sourceType,
+          sourceType: self.getConnector().type,
           compute: self.compute,
           path: self.path,
           silenceErrors: options && options.silenceErrors,

+ 18 - 0
desktop/core/src/desktop/js/catalog/multiTableEntry.js

@@ -169,6 +169,24 @@ class MultiTableEntry {
     });
   }
 
+  /**
+   * Returns the dialect of this entry.
+   *
+   * @return {string} - 'impala', 'hive', 'solr', etc.
+   */
+  getDialect() {
+    return this.getConnector().dialect || this.getConnector().type; // .type for editor v1
+  }
+
+  /**
+   * Returns the connector for this entry
+   *
+   * @return {Connector}
+   */
+  getConnector() {
+    return this.dataCatalog.connector;
+  }
+
   /**
    * Gets the top aggregate UDFs for the entry. It will fetch it if not cached or if the refresh option is set.
    *

+ 0 - 1
desktop/core/src/desktop/js/catalog/optimizer/localStrategy.js

@@ -65,7 +65,6 @@ export default class LocalStrategy extends BaseStrategy {
 
     dataCatalog
       .getEntry({
-        sourceType: this.connector.type,
         connector: this.connector,
         path: path,
         namespace: { id: 'default' }

+ 5 - 6
desktop/core/src/desktop/js/jquery/plugins/jquery.hiveautocomplete.js

@@ -191,9 +191,10 @@ Plugin.prototype.init = function() {
       validateTimeout = window.setTimeout(() => {
         $.when(self.namespaceDeferred, self.computeDeferred).done((namespace, compute) => {
           const target = path.pop();
+          // TODO: Use connectors in hiveautocomplete
           dataCatalog
             .getChildren({
-              sourceType: self.options.apiHelperType,
+              connector: { type: self.options.apiHelperType },
               namespace: namespace,
               compute: compute,
               path: path
@@ -325,7 +326,7 @@ Plugin.prototype.init = function() {
     $.when(self.namespaceDeferred, self.computeDeferred).done((namespace, compute) => {
       dataCatalog
         .getChildren({
-          sourceType: self.options.apiHelperType,
+          connector: { type: self.options.apiHelperType }, // TODO: Use connectors in hiveautocomplete
           namespace: namespace,
           compute: compute,
           path: []
@@ -345,10 +346,9 @@ Plugin.prototype.init = function() {
     $.when(self.namespaceDeferred, self.computeDeferred).done((namespace, compute) => {
       dataCatalog
         .getEntry({
-          sourceType: self.options.apiHelperType,
           namespace: namespace,
           compute: compute,
-          connector: {},
+          connector: { type: self.options.apiHelperType },
           path: [database]
         })
         .done(entry => {
@@ -362,10 +362,9 @@ Plugin.prototype.init = function() {
     $.when(self.namespaceDeferred, self.computeDeferred).done((namespace, compute) => {
       dataCatalog
         .getEntry({
-          sourceType: self.options.apiHelperType,
           namespace: namespace,
           compute: compute,
-          connector: {},
+          connector: { type: self.options.apiHelperType },
           path: [database, table]
         })
         .done(entry => {

+ 2 - 3
desktop/core/src/desktop/js/ko/bindings/ace/aceLocationHandler.js

@@ -182,7 +182,6 @@ class AceLocationHandler {
                     // Note, as cachedOnly is set to true it will call the successCallback right away (or not at all)
                     dataCatalog
                       .getEntry({
-                        sourceType: self.dialect(),
                         namespace: self.snippet.namespace(),
                         compute: self.snippet.compute(),
                         connector: self.snippet.connector(),
@@ -851,7 +850,7 @@ class AceLocationHandler {
     const deferred = $.Deferred();
     dataCatalog
       .getChildren({
-        sourceType: self.dialect(),
+        connector: self.snippet.connector(),
         namespace: self.snippet.namespace(),
         compute: self.snippet.compute(),
         temporaryOnly: self.snippet.autocompleteSettings.temporaryOnly,
@@ -969,7 +968,7 @@ class AceLocationHandler {
           if (typeof nextTable.subQuery === 'undefined') {
             dataCatalog
               .getChildren({
-                sourceType: self.dialect(),
+                connector: self.snippet.connector(),
                 namespace: self.snippet.namespace(),
                 compute: self.snippet.compute(),
                 temporaryOnly: self.snippet.autocompleteSettings.temporaryOnly,

+ 3 - 4
desktop/core/src/desktop/js/ko/components/assist/assistDbEntry.js

@@ -21,12 +21,11 @@ import huePubSub from 'utils/huePubSub';
 import sqlUtils from 'sql/sqlUtils';
 
 const findNameInHierarchy = (entry, searchCondition) => {
-  const sourceType = entry.sourceType;
   while (entry && !searchCondition(entry)) {
     entry = entry.parent;
   }
   if (entry) {
-    return sqlUtils.backTickIfNeeded(sourceType, entry.catalogEntry.name);
+    return sqlUtils.backTickIfNeeded(entry.catalogEntry.getDialect(), entry.catalogEntry.name);
   }
 };
 
@@ -479,7 +478,7 @@ class AssistDbEntry {
         '/metastore/tables/' +
         self.catalogEntry.name +
         '?source=' +
-        self.catalogEntry.getSourceType() +
+        self.catalogEntry.getConnector().type +
         '&namespace=' +
         self.catalogEntry.namespace.id;
     } else if (self.catalogEntry.isTableOrView()) {
@@ -489,7 +488,7 @@ class AssistDbEntry {
         '/' +
         self.catalogEntry.name +
         '?source=' +
-        self.catalogEntry.getSourceType() +
+        self.catalogEntry.getConnector().type +
         '&namespace=' +
         self.catalogEntry.namespace.id;
     } else {

+ 1 - 2
desktop/core/src/desktop/js/ko/components/assist/assistDbNamespace.js

@@ -216,7 +216,6 @@ class AssistDbNamespace {
 
       dataCatalog
         .getEntry({
-          sourceType: self.sourceType,
           namespace: self.namespace,
           compute: self.compute(),
           connector: self.connector,
@@ -277,7 +276,7 @@ class AssistDbNamespace {
       huePubSub.subscribe('data.catalog.entry.refreshed', details => {
         if (
           self.namespace.id !== details.entry.namespace.id ||
-          details.entry.getSourceType() !== self.sourceType
+          details.entry.getConnector().type !== self.sourceType
         ) {
           return;
         }

+ 2 - 4
desktop/core/src/desktop/js/ko/components/assist/ko.assistDashboardPanel.js

@@ -84,10 +84,9 @@ class AssistDashboardPanel {
 
       dataCatalog
         .getEntry({
-          sourceType: sourceType,
           namespace: collection.activeNamespace,
           compute: collection.activeCompute,
-          connector: {}, // TODO: Use connectors in assist dashboard panel
+          connector: { type: sourceType }, // TODO: Use connectors in assist dashboard panel
           path: [fakeParentName],
           definition: { type: 'database' }
         })
@@ -102,10 +101,9 @@ class AssistDashboardPanel {
           );
           dataCatalog
             .getEntry({
-              sourceType: sourceType,
               namespace: collection.activeNamespace,
               compute: collection.activeCompute,
-              connector: {}, // TODO: Use connectors in assist dashboard panel
+              connector: { type: sourceType }, // TODO: Use connectors in assist dashboard panel
               path: [
                 fakeParentName,
                 collectionName.indexOf('.') > -1 ? collectionName.split('.')[1] : collectionName

+ 3 - 4
desktop/core/src/desktop/js/ko/components/assist/ko.assistDbPanel.js

@@ -608,7 +608,7 @@ class AssistDbPanel {
 
     huePubSub.subscribe(ASSIST_DB_HIGHLIGHT_EVENT, catalogEntry => {
       huePubSub.publish(SHOW_LEFT_ASSIST_EVENT);
-      if (catalogEntry.getSourceType() === 'solr') {
+      if (catalogEntry.getDialect() === 'solr') {
         huePubSub.publish(ASSIST_SHOW_SOLR_EVENT);
       } else {
         huePubSub.publish(ASSIST_SHOW_SQL_EVENT);
@@ -617,7 +617,7 @@ class AssistDbPanel {
       window.setTimeout(() => {
         let foundSource;
         this.sources().some(source => {
-          if (source.sourceType === catalogEntry.getSourceType()) {
+          if (source.sourceType === catalogEntry.getConnector().type) {
             foundSource = source;
             return true;
           }
@@ -639,10 +639,9 @@ class AssistDbPanel {
             const assistDbNamespace = solrSource.selectedNamespace();
             dataCatalog
               .getEntry({
-                sourceType: 'solr',
                 namespace: assistDbNamespace.namespace,
                 compute: assistDbNamespace.compute(),
-                connector: {},
+                connector: { type: 'solr' },
                 path: []
               })
               .done(entry => {

+ 1 - 3
desktop/core/src/desktop/js/ko/components/assist/ko.assistEditorContextPanel.js

@@ -412,7 +412,6 @@ class AssistEditorContextPanel {
               } else {
                 dataCatalog
                   .getEntry({
-                    sourceType: activeLocations.type,
                     namespace: activeLocations.namespace,
                     compute: activeLocations.compute,
                     connector: this.connector(),
@@ -493,7 +492,6 @@ class AssistEditorContextPanel {
                               });
                               dataCatalog
                                 .getEntry({
-                                  sourceType: activeLocations.type,
                                   namespace: activeLocations.namespace,
                                   compute: activeLocations.compute,
                                   connector: self.connector,
@@ -586,7 +584,7 @@ class AssistEditorContextPanel {
     };
 
     huePubSub.subscribe('data.catalog.entry.refreshed', details => {
-      const sourceType = details.entry.getSourceType();
+      const sourceType = details.entry.getConnector().type;
       if (sources[sourceType]) {
         let completeRefresh = false;
         if (details.entry.isSource()) {

+ 1 - 2
desktop/core/src/desktop/js/ko/components/contextPopover/asteriskContextTabs.js

@@ -95,10 +95,9 @@ class AsteriskData {
         }
         dataCatalog
           .getEntry({
-            sourceType: sourceType,
             namespace: namespace,
             compute: compute,
-            connector: {}, // TODO: Add connector to asteriskContextTabs
+            connector: { type: sourceType }, // TODO: Add connector to asteriskContextTabs
             path: path
           })
           .done(entry => {

+ 5 - 4
desktop/core/src/desktop/js/ko/components/contextPopover/dataCatalogContext.js

@@ -110,9 +110,10 @@ class DataCatalogContext {
         })
     );
 
+    // TODO: Use connector attributes in dataCatalogContext
     if (
-      self.catalogEntry().getSourceType() === 'impala' ||
-      self.catalogEntry().getSourceType() === 'hive'
+      self.catalogEntry().getDialect() === 'impala' ||
+      self.catalogEntry().getDialect() === 'hive'
     ) {
       self.activePromises.push(
         self
@@ -192,7 +193,7 @@ class DataCatalogContext {
       '/hue/dashboard/browse/' +
         self.catalogEntry().path.join('.') +
         '?engine=' +
-        self.catalogEntry().getSourceType()
+        self.catalogEntry().getConnector().type
     );
     huePubSub.publish('context.popover.hide');
     huePubSub.publish('global.search.close');
@@ -206,7 +207,7 @@ class DataCatalogContext {
         (self.catalogEntry().isTableOrView() ? '/' : 's/') +
         self.catalogEntry().path.join('/') +
         '?source_type=' +
-        self.catalogEntry().getSourceType() +
+        self.catalogEntry().getConnector().type +
         '&namespace=' +
         self.catalogEntry().namespace.id
     );

+ 4 - 5
desktop/core/src/desktop/js/ko/components/contextPopover/ko.contextPopover.js

@@ -322,7 +322,7 @@ const SUPPORT_TEMPLATES = `
           <!-- /ko -->
 
           <!-- ko ifnot: $parent.commentExpanded -->
-              <!-- ko if: window.HAS_CATALOG && !isTemporary && (getSourceType() === 'hive' || getSourceType() === 'impala') -->
+              <!-- ko if: window.HAS_CATALOG && !isTemporary && (getDialect() === 'hive' || getDialect() === 'impala') -->
               <div data-bind="component: { name: 'nav-tags', params: { catalogEntry: $data, overflowEllipsis: true } }"></div>
               <!-- /ko -->
 
@@ -333,7 +333,7 @@ const SUPPORT_TEMPLATES = `
             <!-- /ko -->
 
             <!-- ko if: $parent.viewSqlVisible -->
-            <div class="context-popover-sql" data-bind="highlight: { value: $parent.viewSql, enableOverflow: true, formatted: true, dialect: getSourceType() }"></div>
+            <div class="context-popover-sql" data-bind="highlight: { value: $parent.viewSql, enableOverflow: true, formatted: true, dialect: getDialect() }"></div>
             <!-- /ko -->
             <!-- ko ifnot: $parent.viewSqlVisible -->
             <!-- ko component: { name: 'catalog-entries-list', params: { catalogEntry: $data, onClick: $parent.catalogEntry, onSampleClick: $parent.onSampleClick } } --><!-- /ko -->
@@ -357,7 +357,7 @@ const SUPPORT_TEMPLATES = `
               )}" class="fa fa-external-link"></i> ${I18n('Dashboard')}
             </a>
           <!-- /ko -->
-          <!-- ko if: catalogEntry().getSourceType() !== 'solr' && openActionsEnabled() -->
+          <!-- ko if: catalogEntry().getDialect() !== 'solr' && openActionsEnabled() -->
           <a class="inactive-action pointer" data-bind="click: openInTableBrowser">
             <i style="font-size: 11px;" title="${I18n(
               'Open in Table Browser...'
@@ -678,7 +678,7 @@ class ContextPopoverViewModel {
 
     if (
       self.isCatalogEntry &&
-      params.data.catalogEntry.getSourceType() === 'solr' &&
+      params.data.catalogEntry.getDialect() === 'solr' &&
       params.data.catalogEntry.isField()
     ) {
       self.isCollection = true;
@@ -930,7 +930,6 @@ class SqlContextContentsGlobalSearch {
         }
         dataCatalog
           .getEntry({
-            sourceType: sourceType,
             namespace: context.namespaces[0],
             compute: context.namespaces[0].computes[0],
             connector: connector,

+ 2 - 2
desktop/core/src/desktop/js/ko/components/ko.catalogEntriesList.js

@@ -137,7 +137,7 @@ const TEMPLATE = `
       <thead>
       <tr>
         <!-- ko template: 'entries-table-shared-headers' --><!-- /ko -->
-        <th data-bind="text: catalogEntry().getSourceType() !== 'solr' ? '${I18n(
+        <th data-bind="text: catalogEntry().getDialect() !== 'solr' ? '${I18n(
           'Table'
         )}' : '${I18n('Collection')}'"></th>
         <th>${I18n(
@@ -165,7 +165,7 @@ const TEMPLATE = `
       <thead>
       <tr>
         <!-- ko template: 'entries-table-shared-headers' --><!-- /ko -->
-        <th><span data-bind="text: catalogEntry().getSourceType() !== 'solr' ? '${I18n(
+        <th><span data-bind="text: catalogEntry().getDialect() !== 'solr' ? '${I18n(
           'Column'
         )}' : '${I18n(
   'Field'

+ 1 - 1
desktop/core/src/desktop/js/ko/components/ko.catalogEntriesList.test.js

@@ -33,7 +33,7 @@ describe('ko.catalogEntriesList.js', () => {
         isDatabase: () => false,
         getChildren: () => $.Deferred().resolve([]),
         getSample: () => $.Deferred().reject(),
-        getSourceType: () => 'impala',
+        getDialect: () => 'impala',
         loadNavigatorMetaForChildren: () => $.Deferred().reject(),
         loadOptimizerPopularityForChildren: () => $.Deferred().reject(),
         isTableOrView: () => false,

+ 11 - 9
desktop/core/src/desktop/js/ko/components/ko.contextSelector.js

@@ -143,7 +143,7 @@ const TYPES = Object.keys(TYPES_INDEX).map(key => {
  *   <!-- ko component: {
  *     name: 'hue-context-selector',
  *     params: {
- *       sourceType: 'impala',
+ *       connector: myConnectorObservable,
  *       compute: myComputeObservable,
  *       namespace: myNamespaceObservable,
  *     }
@@ -175,6 +175,11 @@ const HueContextSelector = function(params) {
 
   self.sourceType = params.sourceType;
   self.connector = params.connector;
+
+  // TODO: Use connector in HueContextSelector
+  if (!self.connector || !ko.unwrap(self.connector)) {
+    self.connector = ko.observable({ type: params.sourceType });
+  }
   self.disposals = [];
   self.hideLabels = params.hideLabels;
 
@@ -212,7 +217,7 @@ const HueContextSelector = function(params) {
   let refreshThrottle = -1;
 
   const refresh = function(sourceType) {
-    if (!sourceType || ko.unwrap(self.sourceType) === sourceType) {
+    if (!sourceType || ko.unwrap(self.connector).type === sourceType) {
       window.clearTimeout(refreshThrottle);
       refreshThrottle = window.setTimeout(() => {
         TYPES.forEach(self.reload.bind(self));
@@ -240,7 +245,7 @@ const HueContextSelector = function(params) {
   if (self.database) {
     huePubSub.subscribe('data.catalog.entry.refreshed', details => {
       if (details.entry.isSource()) {
-        if (ko.unwrap(self.sourceType) === details.entry.getSourceType()) {
+        if (ko.unwrap(self.connector).type === details.entry.getConnector().type) {
           self.reloadDatabases();
         }
       }
@@ -325,7 +330,7 @@ HueContextSelector.prototype.reload = function(type) {
   if (self[type.name]) {
     self[type.loading](true);
     self[type.lastPromise] = contextCatalog[type.contextCatalogFn]({
-      sourceType: ko.unwrap(self.sourceType)
+      sourceType: ko.unwrap(self.connector).type
     })
       .done(available => {
         // Namespaces response differs slightly from the others
@@ -410,9 +415,7 @@ HueContextSelector.prototype.reloadDatabases = function() {
       () => {
         window.clearTimeout(self.reloadDatabaseThrottle);
         self.reloadDatabaseThrottle = window.setTimeout(() => {
-          const connector = (self.connector && ko.unwrap(self.connector)) || {
-            type: ko.unwrap(self.sourceType)
-          };
+          const connector = ko.unwrap(self.connector);
           if (!self[TYPES_INDEX.namespace.name]()) {
             self.availableDatabases([]);
             self.loadingDatabases(false);
@@ -420,7 +423,6 @@ HueContextSelector.prototype.reloadDatabases = function() {
           }
           dataCatalog
             .getEntry({
-              sourceType: connector.type, // TODO: Drop when dataCatalog only needs connector
               namespace: self[TYPES_INDEX.namespace.name](),
               compute: self[TYPES_INDEX.compute.name](),
               connector: connector,
@@ -443,7 +445,7 @@ HueContextSelector.prototype.reloadDatabases = function() {
                 .always(() => {
                   let lastSelectedDb = apiHelper.getFromTotalStorage(
                     'assist_' +
-                      ko.unwrap(self.sourceType) +
+                      ko.unwrap(self.connector).type +
                       '_' +
                       self[TYPES_INDEX.namespace.name]().id,
                     'lastSelectedDb'

+ 2 - 2
desktop/core/src/desktop/js/ko/components/ko.fieldSamples.js

@@ -109,8 +109,8 @@ class FieldSamples {
 
     self.showOperations =
       !self.catalogEntry().isTemporary &&
-      (self.catalogEntry().getSourceType() === 'impala' ||
-        self.catalogEntry().getSourceType() === 'hive');
+      (self.catalogEntry().getDialect() === 'impala' ||
+        self.catalogEntry().getDialect() === 'hive');
 
     self.sampleClick = function(html) {
       self.onSampleClick(hueUtils.html2text(html));

+ 1 - 1
desktop/core/src/desktop/js/ko/components/ko.fieldSamples.test.js

@@ -35,7 +35,7 @@ describe('ko.fieldSamples.js', () => {
         loadNavigatorMetaForChildren: () => $.Deferred().reject(),
         loadOptimizerPopularityForChildren: () => $.Deferred().reject(),
         isTableOrView: () => false,
-        getSourceType: () => 'impala'
+        getDialect: () => 'impala'
       }
     });
 

+ 0 - 1
desktop/core/src/desktop/js/ko/components/ko.historyPanel.js

@@ -273,7 +273,6 @@ class HistoryPanel {
                 if (notebook.onSuccessUrl() === 'assist.db.refresh') {
                   dataCatalog
                     .getEntry({
-                      sourceType: snippet.type(),
                       namespace: snippet.namespace(),
                       compute: snippet.compute(),
                       connector: snippet.connector(),

+ 1 - 1
desktop/core/src/desktop/js/ko/components/ko.navProperties.test.js

@@ -31,7 +31,7 @@ describe('ko.navProperties.js', () => {
         loadNavigatorMetaForChildren: () => $.Deferred().reject(),
         loadOptimizerPopularityForChildren: () => $.Deferred().reject(),
         isTableOrView: () => false,
-        getSourceType: () => 'impala',
+        getDialect: () => 'impala',
         getNavigatorMeta: () =>
           $.Deferred().resolve({
             properties: {

+ 1 - 1
desktop/core/src/desktop/js/ko/components/ko.navTags.test.js

@@ -33,7 +33,7 @@ describe('ko.navTags.js', () => {
         loadNavigatorMetaForChildren: () => $.Deferred().reject(),
         loadOptimizerPopularityForChildren: () => $.Deferred().reject(),
         isTableOrView: () => false,
-        getSourceType: () => 'impala',
+        getDialect: () => 'impala',
         getNavigatorMeta: () =>
           $.Deferred().resolve({
             tags: ['testTag']

+ 1 - 2
desktop/core/src/desktop/js/ko/components/ko.pollingCatalogEntriesList.js

@@ -140,10 +140,9 @@ class PollingCatalogEntriesList {
 
     dataCatalog
       .getEntry({
-        sourceType: ko.unwrap(self.sourceType),
         namespace: ko.unwrap(self.namespace),
         compute: ko.unwrap(self.compute),
-        connector: {}, // TODO: Use connectors in polling catalog entries list
+        connector: { type: ko.unwrap(self.sourceType) }, // TODO: Use connectors in polling catalog entries list
         path: ko.unwrap(self.path)
       })
       .done(catalogEntry => {

+ 0 - 9
desktop/core/src/desktop/js/sql/autocompleteResults.js

@@ -549,7 +549,6 @@ class AutocompleteResults {
     const databasesDeferred = $.Deferred();
     dataCatalog
       .getEntry({
-        sourceType: self.dialect(),
         namespace: self.snippet.namespace(),
         compute: self.snippet.compute(),
         connector: self.snippet.connector(),
@@ -811,7 +810,6 @@ class AutocompleteResults {
 
         dataCatalog
           .getEntry({
-            sourceType: self.dialect(),
             namespace: self.snippet.namespace(),
             compute: self.snippet.compute(),
             connector: self.snippet.connector(),
@@ -1430,7 +1428,6 @@ class AutocompleteResults {
       if (paths.length) {
         dataCatalog
           .getMultiTableEntry({
-            sourceType: self.dialect(),
             namespace: self.snippet.namespace(),
             compute: self.snippet.compute(),
             connector: self.snippet.connector(),
@@ -1555,7 +1552,6 @@ class AutocompleteResults {
       if (paths.length) {
         dataCatalog
           .getMultiTableEntry({
-            sourceType: self.dialect(),
             namespace: self.snippet.namespace(),
             compute: self.snippet.compute(),
             connector: self.snippet.connector(),
@@ -1645,7 +1641,6 @@ class AutocompleteResults {
       if (paths.length) {
         dataCatalog
           .getMultiTableEntry({
-            sourceType: self.dialect(),
             namespace: self.snippet.namespace(),
             compute: self.snippet.compute(),
             connector: self.snippet.connector(),
@@ -1875,7 +1870,6 @@ class AutocompleteResults {
       if (paths.length) {
         dataCatalog
           .getMultiTableEntry({
-            sourceType: self.dialect(),
             namespace: self.snippet.namespace(),
             compute: self.snippet.compute(),
             connector: self.snippet.connector(),
@@ -1967,7 +1961,6 @@ class AutocompleteResults {
 
       dataCatalog
         .getEntry({
-          sourceType: self.dialect(),
           namespace: self.snippet.namespace(),
           compute: self.snippet.compute(),
           connector: self.snippet.connector(),
@@ -2280,7 +2273,6 @@ class AutocompleteResults {
 
       dataCatalog
         .getEntry({
-          sourceType: self.dialect(),
           namespace: self.snippet.namespace(),
           compute: self.snippet.compute(),
           connector: self.snippet.connector(),
@@ -2327,7 +2319,6 @@ class AutocompleteResults {
     if (path.length > 1 && (self.dialect() === DIALECT.impala || self.dialect() === DIALECT.hive)) {
       dataCatalog
         .getEntry({
-          sourceType: self.dialect(),
           namespace: self.snippet.namespace(),
           compute: self.snippet.compute(),
           connector: self.snippet.connector(),

+ 3 - 1
desktop/core/src/desktop/js/sql/autocompleteResults.test.js

@@ -235,7 +235,9 @@ describe('AutocompleteResults.js', () => {
       type: function() {
         return 'hive';
       },
-      connector: function() {},
+      connector: function() {
+        return { type: 'hive' };
+      },
       database: function() {
         return 'default';
       },

+ 3 - 2
desktop/core/src/desktop/js/sql/sqlUtils.js

@@ -731,9 +731,10 @@ const resolveCatalogEntry = options => {
     }
 
     cancellablePromises.push(
+      // TODO: Use connectors in sqlUtils
       dataCatalog
         .getChildren({
-          sourceType: options.sourceType,
+          connector: { type: options.sourceType },
           namespace: options.namespace,
           compute: options.compute,
           path: identifierChainToPath(nextTable.identifierChain),
@@ -768,9 +769,9 @@ const resolveCatalogEntry = options => {
   } else {
     dataCatalog
       .getEntry({
-        sourceType: options.sourceType,
         namespace: options.namespace,
         compute: options.compute,
+        connector: { type: options.sourceType }, // TODO: Use connector in sqlUtils
         path: [],
         cachedOnly: options && options.cachedOnly,
         cancellable: options && options.cancellable,

+ 7 - 5
desktop/core/src/desktop/static/desktop/js/jquery.hiveautocomplete.js

@@ -167,7 +167,7 @@
         validateTimeout = window.setTimeout(function () {
           $.when(self.namespaceDeferred, self.computeDeferred).done(function (namespace, compute) {
             var target = path.pop();
-            dataCatalog.getChildren({ sourceType: self.options.apiHelperType, namespace: namespace, compute: compute, path: path }).done(function (childEntries) {
+            dataCatalog.getChildren({ connector: connector, namespace: namespace, compute: compute, path: path }).done(function (childEntries) {
               if (childEntries.some(function (childEntry) { return childEntry.name === target })) {
                 onPathChange($el.val());
               }
@@ -273,19 +273,21 @@
     self.getDatabases = function (callback) {
       var self = this;
       $.when(self.namespaceDeferred, self.computeDeferred).done(function (namespace, compute) {
-        dataCatalog.getChildren({ sourceType: self.options.apiHelperType, namespace: namespace, compute: compute, path: [] }).done(function (dbEntries) {
+        dataCatalog.getChildren({ connector: { type: self.options.apiHelperType }, namespace: namespace, compute: compute, path: [] }).done(function (dbEntries) {
           callback($.map(dbEntries, function (entry) { return entry.name }));
         });
       })
     };
 
     // TODO: Use connector for hive autocomplete
-    const connector = {};
+    const connector = {
+      type: self.options.apiHelperType
+    };
 
     self.getTables = function (database, callback) {
       var self = this;
       $.when(self.namespaceDeferred, self.computeDeferred).done(function (namespace, compute) {
-        dataCatalog.getEntry({ sourceType: self.options.apiHelperType, connector: connector, namespace: namespace, compute: compute, path: [ database ] }).done(function (entry) {
+        dataCatalog.getEntry({ connector: connector, namespace: namespace, compute: compute, path: [ database ] }).done(function (entry) {
           entry.getSourceMeta().done(callback)
         });
       });
@@ -294,7 +296,7 @@
     self.getColumns = function (database, table, callback) {
       var self = this;
       $.when(self.namespaceDeferred, self.computeDeferred).done(function (namespace, compute) {
-        dataCatalog.getEntry({ sourceType: self.options.apiHelperType, connector: connector, namespace: namespace, compute: compute, path: [ database, table ] }).done(function (entry) {
+        dataCatalog.getEntry({ connector: connector, namespace: namespace, compute: compute, path: [ database, table ] }).done(function (entry) {
           entry.getSourceMeta().done(callback)
         });
       });

+ 3 - 6
desktop/libs/indexer/src/indexer/templates/importer.mako

@@ -1666,7 +1666,6 @@ ${ commonheader(_("Importer"), "indexer", user, request, "60px") | n,unicode }
           wizard.destination.fieldEditorPlaceHolder('${ _('Example: SELECT') }' + ' * FROM ' + sqlUtils.backTickIfNeeded(self.sourceType, tableName));
 
           var handle = dataCatalog.addTemporaryTable({
-            sourceType: self.sourceType,
             namespace: self.namespace(),
             compute: self.compute(),
             connector: { type: self.sourceType }, // TODO: Migrate importer to connectors
@@ -2143,9 +2142,8 @@ ${ commonheader(_("Importer"), "indexer", user, request, "60px") | n,unicode }
         var checkDbEntryExists = function () {
           wizard.computeSetDeferred.done(function () {
             dataCatalog.getEntry({
-              sourceType: self.sourceType,
               compute: wizard.compute(),
-              connector: {}, // TODO: Use connectors in the importer
+              connector: { type: self.sourceType }, // TODO: Use connectors in the importer
               namespace: wizard.namespace(),
               path: self.outputFormat() === 'table' ? [self.databaseName(), self.tableName()] : [],
             }).done(function (catalogEntry) {
@@ -2858,16 +2856,15 @@ ${ commonheader(_("Importer"), "indexer", user, request, "60px") | n,unicode }
                   if (!snippet.result.handle().has_more_statements) {
                     if (self.editorVM.selectedNotebook().onSuccessUrl()) {
                       var match = snippet.statement_raw().match(/CREATE TABLE `([^`]+)`/i);
-                      const connector = {} // TODO: Use connector in importer
                       if (match) {
                         var db = match[1];
-                        dataCatalog.getEntry({ sourceType: snippet.type(), connector: connector, namespace: self.namespace(), compute: self.compute(), path: [ db ]}).done(function (dbEntry) {
+                        dataCatalog.getEntry({ connector: snippet.connector(), namespace: self.namespace(), compute: self.compute(), path: [ db ]}).done(function (dbEntry) {
                           dbEntry.clearCache({ silenceErrors: true }).done(function () {
                             huePubSub.publish('open.link', self.editorVM.selectedNotebook().onSuccessUrl());
                           })
                         });
                       } else {
-                        dataCatalog.getEntry({ sourceType: snippet.type(), connector: connector, namespace: self.namespace(), compute: self.compute(), path: []}).done(function (sourceEntry) {
+                        dataCatalog.getEntry({ connector: snippet.connector(), namespace: self.namespace(), compute: self.compute(), path: []}).done(function (sourceEntry) {
                           sourceEntry.clearCache({ silenceErrors: true }).done(function () {
                             huePubSub.publish('open.link', self.editorVM.selectedNotebook().onSuccessUrl());
                           })

+ 1 - 0
desktop/libs/notebook/src/notebook/templates/editor_components.mako

@@ -902,6 +902,7 @@ ${ sqlSyntaxDropdown.sqlSyntaxDropdown() }
     <!-- ko component: {
       name: 'hue-context-selector',
       params: {
+        connector: connector,
         sourceType: type,
         compute: compute,
         namespace: namespace,