You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2021/09/14 03:48:47 UTC

[GitHub] [incubator-doris] EmmyMiao87 opened a new pull request #6644: Support hdfs in select outfile clause

EmmyMiao87 opened a new pull request #6644:
URL: https://github.com/apache/incubator-doris/pull/6644


   ## Proposed changes
   
   Support hdfs in select outfile clause without broker.
   This PR implement a HDFS writer in BE which is used to write HDFS file directly without using broker.
   Also the hdfs outfile  clause syntax check has been added in FE.
   The syntax:
   ```
   select * from xx into outfile "hdfs://user/outfile_" format as csv properties ("hdfs.fs.dafultFS" = "xxx", "hdfs.hdfs_user" = "xxx");
   ```
   Note that all hdfs configurations need to carry a prefix `hdfs.`.
   
   ## Types of changes
   
   What types of changes does your code introduce to Doris?
   _Put an `x` in the boxes that apply_
   
   - [ ] Bugfix (non-breaking change which fixes an issue)
   - [x] New feature (non-breaking change which adds functionality)
   - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
   - [x] Documentation Update (if none of the other choices apply)
   - [ ] Code refactor (Modify the code structure, format the code, etc...)
   - [ ] Optimization. Including functional usability improvements and performance improvements.
   - [ ] Dependency. Such as changes related to third-party components.
   - [ ] Other.
   
   ## Checklist
   
   _Put an `x` in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code._
   
   - [ ] I have created an issue on (Fix #ISSUE) and described the bug/feature there in detail
   - [x] Compiling and unit tests pass locally with my changes
   - [ ] I have added tests that prove my fix is effective or that my feature works
   - [ ] If these changes need document changes, I have updated the document
   - [ ] Any dependent changes have been merged
   
   
   


-- 
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@doris.apache.org

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



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


[GitHub] [incubator-doris] morningman merged pull request #6644: Support hdfs in select outfile clause

Posted by GitBox <gi...@apache.org>.
morningman merged pull request #6644:
URL: https://github.com/apache/incubator-doris/pull/6644


   


-- 
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@doris.apache.org

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



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


[GitHub] [incubator-doris] EmmyMiao87 commented on a change in pull request #6644: Support hdfs in select outfile clause

Posted by GitBox <gi...@apache.org>.
EmmyMiao87 commented on a change in pull request #6644:
URL: https://github.com/apache/incubator-doris/pull/6644#discussion_r713567211



##########
File path: be/src/runtime/result_file_sink.cpp
##########
@@ -119,6 +116,9 @@ Status ResultFileSink::prepare(RuntimeState* state) {
 
     }
     RETURN_IF_ERROR(_writer->init(state));
+    for (int i = 0; i < _channels.size(); ++i) {

Review comment:
       Yes, if the _writer failed to init, the channel should not be inited before closed. Otherwise, the be will core in destructor




-- 
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@doris.apache.org

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



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


[GitHub] [incubator-doris] EmmyMiao87 commented on a change in pull request #6644: Support hdfs in select outfile clause

Posted by GitBox <gi...@apache.org>.
EmmyMiao87 commented on a change in pull request #6644:
URL: https://github.com/apache/incubator-doris/pull/6644#discussion_r713566579



##########
File path: be/src/runtime/file_result_writer.cpp
##########
@@ -131,12 +132,14 @@ Status FileResultWriter::_create_next_file_writer() {
 Status FileResultWriter::_create_file_writer(const std::string& file_name) {
     if (_storage_type == TStorageBackendType::LOCAL) {
         _file_writer = new LocalFileWriter(file_name, 0 /* start offset */);
-    } else if (_storage_type == TStorageBackendType::BROKER){
+    } else if (_storage_type == TStorageBackendType::BROKER) {
         _file_writer =
                 new BrokerWriter(_state->exec_env(), _file_opts->broker_addresses,
                                  _file_opts->broker_properties, file_name, 0 /*start offset*/);
     } else if (_storage_type == TStorageBackendType::S3) {
         _file_writer =  new S3Writer(_file_opts->broker_properties, file_name, 0 /* offset */);
+    } else if (_storage_type == TStorageBackendType::HDFS) {
+        _file_writer = new HDFSWriter(const_cast<std::map<std::string, std::string>&>(_file_opts->broker_properties), file_name);

Review comment:
       The HDFS writer needs to parse properties so here is a ```const_cast```




-- 
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@doris.apache.org

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



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


[GitHub] [incubator-doris] morningman commented on a change in pull request #6644: Support hdfs in select outfile clause

Posted by GitBox <gi...@apache.org>.
morningman commented on a change in pull request #6644:
URL: https://github.com/apache/incubator-doris/pull/6644#discussion_r713558952



##########
File path: be/src/runtime/file_result_writer.cpp
##########
@@ -131,12 +132,14 @@ Status FileResultWriter::_create_next_file_writer() {
 Status FileResultWriter::_create_file_writer(const std::string& file_name) {
     if (_storage_type == TStorageBackendType::LOCAL) {
         _file_writer = new LocalFileWriter(file_name, 0 /* start offset */);
-    } else if (_storage_type == TStorageBackendType::BROKER){
+    } else if (_storage_type == TStorageBackendType::BROKER) {
         _file_writer =
                 new BrokerWriter(_state->exec_env(), _file_opts->broker_addresses,
                                  _file_opts->broker_properties, file_name, 0 /*start offset*/);
     } else if (_storage_type == TStorageBackendType::S3) {
         _file_writer =  new S3Writer(_file_opts->broker_properties, file_name, 0 /* offset */);
+    } else if (_storage_type == TStorageBackendType::HDFS) {
+        _file_writer = new HDFSWriter(const_cast<std::map<std::string, std::string>&>(_file_opts->broker_properties), file_name);

Review comment:
       Why need a `const_cast` here but `S3Writer` don't?

##########
File path: be/src/runtime/result_file_sink.cpp
##########
@@ -119,6 +116,9 @@ Status ResultFileSink::prepare(RuntimeState* state) {
 
     }
     RETURN_IF_ERROR(_writer->init(state));
+    for (int i = 0; i < _channels.size(); ++i) {

Review comment:
       So this is a bug?




-- 
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@doris.apache.org

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



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


[GitHub] [incubator-doris] github-actions[bot] commented on pull request #6644: Support hdfs in select outfile clause

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #6644:
URL: https://github.com/apache/incubator-doris/pull/6644#issuecomment-925854523






-- 
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@doris.apache.org

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



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