Browse Source

HUE-4781 [notebook] Fix export to hdfs to use download_cell_limit from beeswax.conf

krish 9 years ago
parent
commit
75279c2547

+ 2 - 2
apps/beeswax/src/beeswax/data_export.py

@@ -61,7 +61,7 @@ def download(handle, format, db, id=None):
   return resp
 
 
-def upload(path, handle, user, db, fs):
+def upload(path, handle, user, db, fs, max_cells=-1):
   """
   upload(query_model, path, user, db, fs) -> None
 
@@ -72,7 +72,7 @@ def upload(path, handle, user, db, fs):
   else:
     fs.do_as_user(user.username, fs.create, path)
 
-  content_generator = HS2DataAdapter(handle, db, max_cells=-1, start_over=True)
+  content_generator = HS2DataAdapter(handle, db, max_cells=max_cells, start_over=True)
   for header, data in content_generator:
     dataset = export_csvxls.dataset(None, data)
     fs.do_as_user(user.username, fs.append, path, dataset.csv)

+ 3 - 2
desktop/libs/notebook/src/notebook/connectors/hiveserver2.py

@@ -39,7 +39,7 @@ LOG = logging.getLogger(__name__)
 try:
   from beeswax import data_export
   from beeswax.api import _autocomplete, _get_sample_data
-  from beeswax.conf import CONFIG_WHITELIST as hive_settings
+  from beeswax.conf import CONFIG_WHITELIST as hive_settings, DOWNLOAD_CELL_LIMIT
   from beeswax.data_export import upload
   from beeswax.design import hql_query, strip_trailing_semicolon, split_statements
   from beeswax import conf as beeswax_conf
@@ -413,8 +413,9 @@ class HS2Api(Api):
     db = self._get_db(snippet)
 
     handle = self._get_handle(snippet)
+    max_cells = DOWNLOAD_CELL_LIMIT.get()
 
-    upload(target_file, handle, self.request.user, db, self.request.fs)
+    upload(target_file, handle, self.request.user, db, self.request.fs, max_cells=max_cells)
 
     return '/filebrowser/view=%s' % target_file