瀏覽代碼

[query] Stop fetching sample data of a view (#3498)

Ying Chen 2 年之前
父節點
當前提交
962ae057a3
共有 2 個文件被更改,包括 9 次插入0 次删除
  1. 5 0
      apps/beeswax/src/beeswax/api.py
  2. 4 0
      desktop/core/src/desktop/js/catalog/DataCatalogEntry.ts

+ 5 - 0
apps/beeswax/src/beeswax/api.py

@@ -733,6 +733,11 @@ def _get_sample_data(db, database, table, column, is_async=False, cluster=None,
       query_server = get_query_server_config('impala', connector=cluster)
       db = dbms.get(db.client.user, query_server, cluster=cluster)
 
+  if table_obj and table_obj.is_view:
+    response = {'status': -1}
+    response['message'] = _('Not getting sample data as this is a view which can be expensive when run.')
+    return response
+
   sample_data = db.get_sample(database, table_obj, column, generate_sql_only=is_async, operation=operation)
   response = {'status': -1}
 

+ 4 - 0
desktop/core/src/desktop/js/catalog/DataCatalogEntry.ts

@@ -1660,6 +1660,10 @@ export default class DataCatalogEntry {
       operation?: string;
     }
   ): CancellablePromise<Sample> {
+    if (this.isView()) {
+      return CancellablePromise.reject();
+    }
+
     if (this.samplePromise && this.samplePromise.cancelled) {
       this.samplePromise = undefined;
     }