Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
getSample(options) {
const self = this;
// This prevents caching of any non-standard sample queries, i.e. DISTINCT etc.
if (options && options.operation && options.operation !== 'default') {
return catalogUtils.applyCancellable(
apiHelper.fetchSample({
sourceType: self.dataCatalog.sourceType,
compute: self.compute,
path: self.path,
silenceErrors: options && options.silenceErrors,
operation: options.operation
}),
options
);
}
// Check if parent has a sample that we can reuse
if (!self.samplePromise && self.isColumn()) {
const deferred = $.Deferred();
const cancellablePromises = [];
options
);
}
if (options && options.cachedOnly) {
return (
catalogUtils.applyCancellable(self.samplePromise, options) ||
$.Deferred()
.reject(false)
.promise()
);
}
if (options && options.refreshCache) {
return catalogUtils.applyCancellable(reloadSample(self, options), options);
}
return catalogUtils.applyCancellable(
self.samplePromise || reloadSample(self, options),
options
);
}
const genericNavOptGet = function(
multiTableEntry,
options,
promiseAttribute,
dataAttribute,
apiHelperFunction
) {
if (options && options.cachedOnly) {
return (
catalogUtils.applyCancellable(multiTableEntry[promiseAttribute], options) ||
$.Deferred()
.reject(false)
.promise()
);
}
if (options && options.refreshCache) {
return catalogUtils.applyCancellable(
genericNavOptReload(
multiTableEntry,
options,
promiseAttribute,
dataAttribute,
apiHelperFunction
),
options
);
const self = this;
if (!self.isTableOrView()) {
return $.Deferred()
.reject(false)
.promise();
}
if (options && options.cachedOnly) {
return (
catalogUtils.applyCancellable(self.partitionsPromise, options) ||
$.Deferred()
.reject(false)
.promise()
);
}
if (options && options.refreshCache) {
return catalogUtils.applyCancellable(reloadPartitions(self, options), options);
}
return catalogUtils.applyCancellable(
self.partitionsPromise || reloadPartitions(self, options),
options
);
}
multiTableEntry,
options,
promiseAttribute,
dataAttribute,
apiHelperFunction
) {
if (options && options.cachedOnly) {
return (
catalogUtils.applyCancellable(multiTableEntry[promiseAttribute], options) ||
$.Deferred()
.reject(false)
.promise()
);
}
if (options && options.refreshCache) {
return catalogUtils.applyCancellable(
genericNavOptReload(
multiTableEntry,
options,
promiseAttribute,
dataAttribute,
apiHelperFunction
),
options
);
}
return catalogUtils.applyCancellable(
multiTableEntry[promiseAttribute] ||
genericNavOptReload(
multiTableEntry,
options,
promiseAttribute,
getSourceMeta(options) {
const self = this;
if (options && options.cachedOnly) {
return (
catalogUtils.applyCancellable(self.sourceMetaPromise, options) ||
$.Deferred()
.reject(false)
.promise()
);
}
if (options && options.refreshCache) {
return catalogUtils.applyCancellable(reloadSourceMeta(self, options));
}
return catalogUtils.applyCancellable(
self.sourceMetaPromise || reloadSourceMeta(self, options),
options
);
}
if (navigatorMeta) {
deferred.resolve(
navigatorMeta.description || navigatorMeta.originalDescription || ''
);
} else {
resolveWithSourceMeta();
}
})
.fail(resolveWithSourceMeta)
);
}
} else {
resolveWithSourceMeta();
}
return catalogUtils.applyCancellable(
new CancellablePromise(deferred, undefined, cancellablePromises),
options
);
}
loadNavigatorMetaForChildren(options) {
const self = this;
options = catalogUtils.setSilencedErrors(options);
if (!self.canHaveNavigatorMetadata() || self.isField()) {
return $.Deferred()
.reject()
.promise();
}
if (self.navigatorMetaForChildrenPromise && (!options || !options.refreshCache)) {
return catalogUtils.applyCancellable(self.navigatorMetaForChildrenPromise, options);
}
const deferred = $.Deferred();
const cancellablePromises = [];
cancellablePromises.push(
self
.getChildren(options)
.done(children => {
const someHaveNavMeta = children.some(childEntry => {
return childEntry.navigatorMeta;
});
if (someHaveNavMeta && (!options || !options.refreshCache)) {
deferred.resolve(children);
return;