How to use the catalog/dataCatalog.applyCancellable function in catalog

To help you get started, we’ve selected a few catalog examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cloudera / hue / desktop / core / src / desktop / js / sql / sqlWorkerHandler.js View on Github external
location.resolveCatalogEntry = function(options) {
    if (!options) {
      options = {};
    }
    if (location.resolvePathPromise && !location.resolvePathPromise.cancelled) {
      dataCatalog.applyCancellable(location.resolvePathPromise, options);
      return location.resolvePathPromise;
    }

    if (!location.identifierChain && !location.colRef && !location.colRef.identifierChain) {
      if (!location.resolvePathPromise) {
        location.resolvePathPromise = $.Deferred()
          .reject()
          .promise();
      }
      return location.resolvePathPromise;
    }

    const promise = sqlUtils.resolveCatalogEntry({
      sourceType: sourceType,
      namespace: namespace,
      compute: compute,
github cloudera / hue / desktop / core / src / desktop / js / sql / sqlUtils.js View on Github external
const resolveCatalogEntry = options => {
  const cancellablePromises = [];
  const deferred = $.Deferred();
  const promise = new CancellablePromise(deferred, undefined, cancellablePromises);
  dataCatalog.applyCancellable(promise, options);

  if (!options.identifierChain) {
    deferred.reject();
    return promise;
  }

  const findInTree = (currentEntry, fieldsToGo) => {
    if (fieldsToGo.length === 0) {
      deferred.reject();
      return;
    }

    let nextField;
    if (currentEntry.getType() === 'map') {
      nextField = 'value';
    } else if (currentEntry.getType() === 'array') {