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 = [];
if (val === 'failed') {
//self.isIndexing(false);
//self.indexingStarted(false);
//self.indexingError(true);
} else if (val === 'available') {
const snippet = notebook.snippets()[0];
if (!snippet.result.handle().has_more_statements) {
// TODO: Show finish notification and clicking on it does onSuccessUrl
// or if still on initial spinner we redirect automatically to onSuccessUrl
if (notebook.onSuccessUrl() && notebook.onSuccessUrl() !== 'assist.db.refresh') {
// TODO: Similar if in in FB directory, also refresh FB dir
huePubSub.publish('open.link', notebook.onSuccessUrl());
}
if (notebook.onSuccessUrl() === 'assist.db.refresh') {
dataCatalog
.getEntry({
sourceType: snippet.type(),
namespace: snippet.namespace(),
compute: snippet.compute(),
path: []
})
.done(entry => {
entry.clearCache({ invalidate: 'cache', cascade: true, silenceErrors: true });
});
} else if (notebook.onSuccessUrl()) {
huePubSub.publish(notebook.pubSubUrl());
}
notebook.close(); // TODO: Don't close when onSuccessUrl is editor?
} else {
// Perform last DROP statement execute
snippet.execute();
const fetchFieldsInternal = function(remainingPath, fetchedPath) {
if (!fetchedPath) {
fetchedPath = [];
}
if (remainingPath.length > 0) {
fetchedPath.push(remainingPath.shift());
// Parser sometimes knows if it's a map or array.
if (
remainingPath.length > 0 &&
(remainingPath[0] === 'item' || remainingPath[0].name === 'value')
) {
fetchedPath.push(remainingPath.shift());
}
}
dataCatalog
.getEntry({
sourceType: self.snippet.type(),
namespace: self.snippet.namespace(),
compute: self.snippet.compute(),
path: fetchedPath,
temporaryOnly: self.temporaryOnly
})
.done(catalogEntry => {
self.cancellablePromises.push(
catalogEntry
.getSourceMeta({ silenceErrors: true, cancellable: true })
.done(sourceMeta => {
if (
self.snippet.type() === 'hive' &&
typeof sourceMeta.extended_columns !== 'undefined' &&
sourceMeta.extended_columns.length === 1 &&
if (token.parseLocation) {
const endCoordinates = self.editor.renderer.textToScreenCoordinates(
pointerPosition.row,
token.start
);
let tooltipText =
token.parseLocation.type === 'asterisk' ? self.expandStar : self.contextTooltip;
let colType;
if (token.parseLocation.type === 'column') {
const tableChain = token.parseLocation.identifierChain.concat();
const lastIdentifier = tableChain.pop();
if (tableChain.length > 0 && lastIdentifier && lastIdentifier.name) {
const colName = lastIdentifier.name.toLowerCase();
// Note, as cachedOnly is set to true it will call the successCallback right away (or not at all)
dataCatalog
.getEntry({
sourceType: self.snippet.type(),
namespace: self.snippet.namespace(),
compute: self.snippet.compute(),
temporaryOnly: self.snippet.autocompleteSettings.temporaryOnly,
path: $.map(tableChain, identifier => {
return identifier.name;
})
})
.done(entry => {
entry
.getSourceMeta({ cachedOnly: true, silenceErrors: true })
.done(sourceMeta => {
if (sourceMeta && sourceMeta.extended_columns) {
sourceMeta.extended_columns.every(col => {
if (col.name.toLowerCase() === colName) {
inspectCreateNode : function(attr) {
attr.id = attr['catalog.id'];
attr.label = attr['catalog.label'];
attr.text = attr['catalog.id'] + " - " + attr['catalog.label'];
attr.code = attr['catalog.code'];
attr.status = attr['catalog.status'];
attr.cls = 'statustext-' + attr.status;
// create record and insert into own store
this.store.suspendEvents(false);
this.store.remove(this.store.getById(attr.id));
this.store.add([new this.recordClass(attr, attr.id)]);
this.store.resumeEvents();
}
});
inspectCreateNode : function(attr) {
attr.id = attr['catalog.id'];
attr.label = attr['catalog.label'];
attr.text = attr['catalog.id'] + " - " + attr['catalog.label'];
attr.code = attr['catalog.code'];
attr.status = attr['catalog.status'];
attr.cls = 'statustext-' + attr.status;
// create record and insert into own store
this.store.suspendEvents(false);
this.store.remove(this.store.getById(attr.id));
this.store.add([new this.recordClass(attr, attr.id)]);
this.store.resumeEvents();
}
});
inspectCreateNode : function(attr) {
attr.id = attr['catalog.id'];
attr.label = attr['catalog.label'];
attr.text = attr['catalog.id'] + " - " + attr['catalog.label'];
attr.code = attr['catalog.code'];
attr.status = attr['catalog.status'];
attr.cls = 'statustext-' + attr.status;
// create record and insert into own store
this.store.suspendEvents(false);
this.store.remove(this.store.getById(attr.id));
this.store.add([new this.recordClass(attr, attr.id)]);
this.store.resumeEvents();
}
});
inspectCreateNode : function(attr) {
attr.id = attr['catalog.id'];
attr.label = attr['catalog.label'];
attr.text = attr['catalog.id'] + " - " + attr['catalog.label'];
attr.code = attr['catalog.code'];
attr.status = attr['catalog.status'];
attr.cls = 'statustext-' + attr.status;
// create record and insert into own store
this.store.suspendEvents(false);
this.store.remove(this.store.getById(attr.id));
this.store.add([new this.recordClass(attr, attr.id)]);
this.store.resumeEvents();
}
});
inspectCreateNode : function(attr) {
attr.id = attr['catalog.id'];
attr.label = attr['catalog.label'];
attr.text = attr['catalog.id'] + " - " + attr['catalog.label'];
attr.code = attr['catalog.code'];
attr.status = attr['catalog.status'];
attr.cls = 'statustext-' + attr.status;
// create record and insert into own store
this.store.suspendEvents(false);
this.store.remove(this.store.getById(attr.id));
this.store.add([new this.recordClass(attr, attr.id)]);
this.store.resumeEvents();
}
});
inspectCreateNode : function(attr) {
attr.id = attr['catalog.id'];
attr.label = attr['catalog.label'];
attr.text = attr['catalog.id'] + " - " + attr['catalog.label'];
attr.code = attr['catalog.code'];
attr.status = attr['catalog.status'];
attr.cls = 'statustext-' + attr.status;
// create record and insert into own store
this.store.suspendEvents(false);
this.store.remove(this.store.getById(attr.id));
this.store.add([new this.recordClass(attr, attr.id)]);
this.store.resumeEvents();
}
});