Sfoglia il codice sorgente

HUE-9143 [frontend] Adjust the executor to support the quick query component

Johan Ahlen 5 anni fa
parent
commit
ddb1552429

+ 1 - 0
desktop/core/src/desktop/js/apps/notebook2/execution/executable.js

@@ -386,6 +386,7 @@ export default class Executable {
       result: {
         handle: this.handle
       },
+      executor: this.executor.toJs(),
       status: this.status,
       id: id || UUID(),
       statement_raw: statement,

+ 13 - 4
desktop/core/src/desktop/js/apps/notebook2/execution/executor.js

@@ -24,10 +24,9 @@ class Executor {
   /**
    * @param options
    * @param {boolean} [options.isSqlEngine] (default false)
-   * @param {string} options.sourceType
-   * @param {ContextCompute} options.compute
-   * @param {ContextNamespace} options.namespace
-   * @param {string} options.statement
+   * @param {observable<string>} options.sourceType
+   * @param {observable<ContextCompute>} options.compute
+   * @param {observable<ContextNamespace>} options.namespace
    * @param {string} [options.database]
    * @param {function} [options.defaultLimit]
    * @param {boolean} [options.isOptimizerEnabled] - Default false
@@ -52,6 +51,16 @@ class Executor {
     };
   }
 
+  cancelAll() {
+    this.executables.forEach(existingExecutable => existingExecutable.cancelBatchChain());
+  }
+
+  setExecutables(executables) {
+    this.cancelAll();
+    this.executables = executables;
+    this.executables.forEach(executable => executable.notify());
+  }
+
   update(statementDetails, beforeExecute) {
     const executables = syncExecutables(this, statementDetails);