JNSimba opened a new pull request, #61373:
URL: https://github.com/apache/doris/pull/61373

   ### What problem does this PR solve?
   
   ## Summary
   
     This PR adds gzip compression support to the Doris Go SDK for stream load.
   
     When `EnableGzip: true` is set in the config, the SDK automatically 
compresses
     the request body using gzip and adds the `compress_type: gz` HTTP header,
     without requiring the caller to pre-compress the data.
   
     #### Changes
   
     - `config/load_config.go`: Add `EnableGzip bool` field to `Config`. Add 
validation
       to reject `EnableGzip` when used with JSON format, since Doris only 
supports
       `compress_type` for CSV.
     - `loader/request_builder.go`: Compress the request body into a 
`bytes.Buffer` via
       `gzip.Writer` before creating the HTTP request. Using `*bytes.Reader` as 
the body
       ensures Go's `http.NewRequest` auto-sets `GetBody`, which is required 
for the HTTP
       client to replay the body when Doris FE issues a 307 redirect to BE.
     - `examples/gzip_example.go`: Add a runnable example demonstrating gzip 
CSV load.
     - `README.md`: Document the `EnableGzip` option with usage example and 
notes.
   
     #### Usage
   
     ```go
     config := &doris.Config{
         Endpoints:   []string{"http://127.0.0.1:8030"},
         User:        "root",
         Password:    "password",
         Database:    "test_db",
         Table:       "users",
         Format:      doris.DefaultCSVFormat(),
         EnableGzip:  true,
     }
   
   #### Notes
   
     - Only CSV format is supported. Using EnableGzip with JSON format returns 
an
     error at client creation time.
     - The compressed data is buffered in memory before sending. Since the SDK 
already
     buffers the original data internally for retry support, this does not 
introduce
     additional memory overhead in practice.
    
   
   ### Check List (For Author)
   
   - Test <!-- At least one of them must be included. -->
       - [ ] Regression test
       - [ ] Unit Test
       - [ ] Manual test (add detailed scripts or steps below)
       - [ ] No need to test or manual test. Explain why:
           - [ ] This is a refactor/code format and no logic has been changed.
           - [ ] Previous test can cover this change.
           - [ ] No code files have been changed.
           - [ ] Other reason <!-- Add your reason?  -->
   
   - Behavior changed:
       - [ ] No.
       - [ ] Yes. <!-- Explain the behavior change -->
   
   - Does this need documentation?
       - [ ] No.
       - [ ] Yes. <!-- Add document PR link here. eg: 
https://github.com/apache/doris-website/pull/1214 -->
   
   ### Check List (For Reviewer who merge this PR)
   
   - [ ] Confirm the release note
   - [ ] Confirm test cases
   - [ ] Confirm document
   - [ ] Add branch pick label <!-- Add branch pick label that this PR should 
merge into -->
   
   


-- 
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