You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by "github-advanced-security[bot] (via GitHub)" <gi...@apache.org> on 2024/02/01 15:24:25 UTC

Re: [PR] Add export capabilities to MSQ with SQL syntax (druid)

github-advanced-security[bot] commented on code in PR #15689:
URL: https://github.com/apache/druid/pull/15689#discussion_r1474655343


##########
integration-tests-ex/cases/src/test/java/org/apache/druid/testsEx/msq/ITMultiStageQuery.java:
##########
@@ -176,4 +188,83 @@
 
     msqHelper.testQueriesFromFile(QUERY_FILE, datasource);
   }
+
+  @Test
+  public void testExport() throws Exception
+  {
+    String exportQuery =
+        StringUtils.format(
+            "REPLACE INTO extern(%s(basePath = '%s'))\n"
+            + "AS CSV\n"
+            + "OVERWRITE ALL\n"
+            + "SELECT page, added, delta\n"
+            + "FROM TABLE(\n"
+            + "  EXTERN(\n"
+            + "    '{\"type\":\"local\",\"files\":[\"/resources/data/batch_index/json/wikipedia_index_data1.json\"]}',\n"
+            + "    '{\"type\":\"json\"}',\n"
+            + "    '[{\"type\":\"string\",\"name\":\"timestamp\"},{\"type\":\"string\",\"name\":\"isRobot\"},{\"type\":\"string\",\"name\":\"diffUrl\"},{\"type\":\"long\",\"name\":\"added\"},{\"type\":\"string\",\"name\":\"countryIsoCode\"},{\"type\":\"string\",\"name\":\"regionName\"},{\"type\":\"string\",\"name\":\"channel\"},{\"type\":\"string\",\"name\":\"flags\"},{\"type\":\"long\",\"name\":\"delta\"},{\"type\":\"string\",\"name\":\"isUnpatrolled\"},{\"type\":\"string\",\"name\":\"isNew\"},{\"type\":\"double\",\"name\":\"deltaBucket\"},{\"type\":\"string\",\"name\":\"isMinor\"},{\"type\":\"string\",\"name\":\"isAnonymous\"},{\"type\":\"long\",\"name\":\"deleted\"},{\"type\":\"string\",\"name\":\"cityName\"},{\"type\":\"long\",\"name\":\"metroCode\"},{\"type\":\"string\",\"name\":\"namespace\"},{\"type\":\"string\",\"name\":\"comment\"},{\"type\":\"string\",\"name\":\"page\"},{\"type\":\"long\",\"name\":\"commentLength\"},{\"type\":\"string\",\"name\":\"countryName\"},{\"type\":
 \"string\",\"name\":\"user\"},{\"type\":\"string\",\"name\":\"regionIsoCode\"}]'\n"
+            + "  )\n"
+            + ")\n",
+            "localStorage", "/shared/export"
+        );
+
+    SqlTaskStatus exportTask = msqHelper.submitMsqTask(exportQuery);
+
+    msqHelper.pollTaskIdForSuccess(exportTask.getTaskId());
+
+    if (exportTask.getState().isFailure()) {
+      Assert.fail(StringUtils.format(
+          "Unable to start the task successfully.\nPossible exception: %s",
+          exportTask.getError()

Review Comment:
   ## Use of default toString()
   
   Default toString(): ErrorResponse inherits toString() from Object, and so is not suitable for printing.
   
   [Show more details](https://github.com/apache/druid/security/code-scanning/6532)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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