adarshsanjeev opened a new pull request, #15689:
URL: https://github.com/apache/druid/pull/15689

   Druid currently does not allow export of tables in a programmatic manner. 
While is is possible to download results from a SELECT query, this relies on 
writing the results to a single query report, which cannot support large 
datasets. An export syntax which writes the results in a desired format 
directly to an external location (such as s3 or hdfs) would be useful. The 
scope could be explanded later to also have a directory structure that already 
partitions the data.
   
   
   This PR adds export capabilities to insert/replace statements by using 
EXTERN as a destination:
   ```
   (INSERT/REPLACE) INTO
   EXTERN(<external source function>)
   AS <format>[(key1=value1,key2=value2)]
   [OVERWRITE ALL]
   <select query>
   ```
   
   For example: A statement to export all rows from a table into S3 as CSV 
files would look like 
   ```
   REPLACE
   INTO EXTERN(s3(uri="s3://outputdirectory/", username=...))
   AS CSV
   OVERWRITE ALL
   SELECT * FROM wikipedia
   ```
   
   INSERT statements append to the files found at the destination, while 
replace deletes any files found at the root path and creates the new files.
   
   #### Release note
   <!-- Give your best effort to summarize your changes in a couple of 
sentences aimed toward Druid users. 
   
   If your change doesn't have end user impact, you can skip this section.
   
   For tips about how to write a good release note, see [Release 
notes](https://github.com/apache/druid/blob/master/CONTRIBUTING.md#release-notes).
   
   -->
   - Adds export syntax to MSQ, as a part of INSERT and REPLACE statements.
   
   <hr>
   
   ##### Key changed/added classes in this PR
    * `sql/src/main/codegen/includes/common.ftl`
    * `sql/src/main/codegen/includes/replace.ftl`
    * `IngestHandler`
   
   <hr>
   
   <!-- Check the items by putting "x" in the brackets for the done things. Not 
all of these items apply to every PR. Remove the items which are not done or 
not relevant to the PR. None of the items from the checklist below are strictly 
necessary, but it would be very helpful if you at least self-review the PR. -->
   
   This PR has:
   
   - [ ] been self-reviewed.
      - [ ] using the [concurrency 
checklist](https://github.com/apache/druid/blob/master/dev/code-review/concurrency.md)
 (Remove this item if the PR doesn't have any relation to concurrency.)
   - [ ] added documentation for new or modified features or behaviors.
   - [ ] a release note entry in the PR description.
   - [ ] added Javadocs for most classes and all non-trivial methods. Linked 
related entities via Javadoc links.
   - [ ] added or updated version, license, or notice information in 
[licenses.yaml](https://github.com/apache/druid/blob/master/dev/license.md)
   - [ ] added comments explaining the "why" and the intent of the code 
wherever would not be obvious for an unfamiliar reader.
   - [ ] added unit tests or modified existing tests to cover new code paths, 
ensuring the threshold for [code 
coverage](https://github.com/apache/druid/blob/master/dev/code-review/code-coverage.md)
 is met.
   - [ ] added integration tests.
   - [ ] been tested in a test Druid cluster.
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to