[frontend] Make sure a temporary source is created in the data catalog for temporary tables
@@ -396,11 +396,6 @@ var DataCatalog = (function () {
var identifiersToClean = [];
- var databaseIdentifier = generateEntryCacheId({
- namespace: options.namespace,
- path: ['default']
- });
-
var addEntryMeta = function (entry, sourceMeta) {
entry.sourceMeta = sourceMeta || entry.definition;
entry.sourceMetaPromise = $.Deferred().resolve(entry.sourceMeta).promise();
@@ -408,6 +403,40 @@ var DataCatalog = (function () {
entry.navigatorMetaPromise = $.Deferred().resolve(entry.navigatorMeta).promise();
};
+ var removeTable = function () {}; // noop until actually added
+
+ var sourceIdentifier = generateEntryCacheId({
+ namespace: options.namespace,
+ path: []
+ });
+
+ if (!self.temporaryEntries[sourceIdentifier]) {
+ var sourceDeferred = $.Deferred();
+ self.temporaryEntries[sourceIdentifier] = sourceDeferred.promise();
+ var sourceEntry = new DataCatalogEntry({
+ dataCatalog: self,
+ namespace: options.namespace,
+ compute: options.compute,
+ path: [],
+ definition: {
+ index: 0,
+ navOptLoaded: true,
+ type: 'source'
+ }
+ });
+ addEntryMeta(sourceEntry);
+ identifiersToClean.push(sourceIdentifier);
+ sourceEntry.childrenPromise = $.Deferred().resolve([]).promise();
+ sourceDeferred.resolve(sourceEntry);
+ }
+
+ self.temporaryEntries[sourceIdentifier].done(function (sourceEntry) {
+ sourceEntry.getChildren().done(function (existingTemporaryDatabases) {
+ var databaseIdentifier = generateEntryCacheId({
+ namespace: options.namespace,
+ path: ['default']
+ });
+
if (!self.temporaryEntries[databaseIdentifier]) {
var databaseDeferred = $.Deferred();
self.temporaryEntries[databaseIdentifier] = databaseDeferred.promise();
@@ -415,7 +444,7 @@ var DataCatalog = (function () {
dataCatalog: self,
namespace: options.namespace,
compute: options.compute,
- path: path,
+ path: ['default'],
definition: {
index: 0,
navOptLoaded: true,
@@ -426,10 +455,9 @@ var DataCatalog = (function () {
identifiersToClean.push(databaseIdentifier);
databaseEntry.childrenPromise = $.Deferred().resolve([]).promise();
databaseDeferred.resolve(databaseEntry);
+ existingTemporaryDatabases.push(databaseEntry);
}
- var removeTable = function () {}; // noop until actually added
-
self.temporaryEntries[databaseIdentifier].done(function (databaseEntry) {
databaseEntry.getChildren().done(function (existingTemporaryTables) {
var tableIdentifier = generateEntryCacheId({
@@ -514,6 +542,10 @@ var DataCatalog = (function () {
tableDeferred.resolve(tableEntry);
});
});
+ })
+
+
+ });
return {
delete: function () {
