This is an automated email from the ASF dual-hosted git repository.

vogievetsky pushed a commit to branch concat-data
in repository https://gitbox.apache.org/repos/asf/druid.git

commit 5f8e9f2ee8e6bfde1104d940173c994d08e0dd2e
Author: Vadim Ogievetsky <va...@ogievetsky.com>
AuthorDate: Thu May 2 09:19:06 2024 -0700

    concat data
---
 .../destination-pages-pane.tsx                      | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git 
a/web-console/src/views/workbench-view/destination-pages-pane/destination-pages-pane.tsx
 
b/web-console/src/views/workbench-view/destination-pages-pane/destination-pages-pane.tsx
index 8535db85a53..b58a75aea4b 100644
--- 
a/web-console/src/views/workbench-view/destination-pages-pane/destination-pages-pane.tsx
+++ 
b/web-console/src/views/workbench-view/destination-pages-pane/destination-pages-pane.tsx
@@ -82,9 +82,11 @@ export const DestinationPagesPane = React.memo(function 
DestinationPagesPane(
 
   const numTotalRows = destination?.numTotalRows;
 
-  function getPageUrl(pageIndex: number) {
+  function getResultUrl(pageIndex: number) {
     return UrlBaser.base(
-      
`/druid/v2/sql/statements/${id}/results?page=${pageIndex}&resultFormat=${desiredResultFormat}`,
+      `/druid/v2/sql/statements/${id}/results?${
+        pageIndex < 0 ? '' : `page=${pageIndex}&`
+      }resultFormat=${desiredResultFormat}`,
     );
   }
 
@@ -94,13 +96,10 @@ export const DestinationPagesPane = React.memo(function 
DestinationPagesPane(
     return 
`${id}_page_${pageNumberString}_of_${numPagesString}.${desiredExtension}`;
   }
 
-  async function downloadAllPages() {
+  async function downloadAllData() {
     if (!pages) return;
-    const numPages = pages.length;
-    for (let i = 0; i < pages.length; i++) {
-      downloadUrl(getPageUrl(i), getPageFilename(i, numPages));
-      await wait(100);
-    }
+    downloadUrl(getResultUrl(-1), `${id}_all_data.${desiredExtension}`);
+    await wait(100);
   }
 
   const numPages = pages.length;
@@ -139,8 +138,8 @@ export const DestinationPagesPane = React.memo(function 
DestinationPagesPane(
           <Button
             intent={Intent.PRIMARY}
             icon={IconNames.DOWNLOAD}
-            text={`Download all data (${pluralIfNeeded(numPages, 'file')})`}
-            onClick={() => void downloadAllPages()}
+            text="Download all data (concatenated)"
+            onClick={() => void downloadAllData()}
           />
         )}
       </p>
@@ -185,7 +184,7 @@ export const DestinationPagesPane = React.memo(function 
DestinationPagesPane(
                 icon={IconNames.DOWNLOAD}
                 text="Download"
                 minimal
-                href={getPageUrl(value)}
+                href={getResultUrl(value)}
                 download={getPageFilename(value, numPages)}
               />
             ),


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org
For additional commands, e-mail: commits-h...@druid.apache.org

Reply via email to