ShinyWey opened a new issue, #29520:
URL: https://github.com/apache/doris/issues/29520

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/doris/issues?q=is%3Aissue) and found no 
similar issues.
   
   
   ### Version
   
   doris-2.0.3-rc06
   
   ### What's Wrong?
   
   导入本地csv文件, 出现以下问题
   
   {
       "TxnId": 14,
       "Label": "1513",
       "Comment": "",
       "TwoPhaseCommit": "false",
       "Status": "Fail",
       "Message": "[INTERNAL_ERROR]cancelled: closed\n\n\t0#  
doris::io::StreamLoadPipe::_append(std::shared_ptr<doris::ByteBuffer> const&, 
unsigned long) at /root/src/doris-2.0/be/src/common/status.h:0\n\t1#  
doris::io::StreamLoadPipe::append(std::shared_ptr<doris::ByteBuffer> const&) at 
/root/src/doris-2.0/be/src/io/fs/stream_load_pipe.cpp:162\n\t2#  
doris::StreamLoadAction::on_chunk_data(doris::HttpRequest*) at 
/root/src/doris-2.0/be/src/common/status.h:442\n\t3#  ?\n\t4#  
bufferevent_run_readcb_\n\t5#  ?\n\t6#  ?\n\t7#  event_base_loop\n\t8#  
std::_Function_handler<void (), 
doris::EvHttpServer::start()::$_0>::_M_invoke(std::_Any_data const&) at 
/var/local/ldb-toolchain/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/ext/atomicity.h:98\n\t9#
  doris::ThreadPool::dispatch_thread() at 
/root/src/doris-2.0/be/src/util/threadpool.cpp:0\n\t10# 
doris::Thread::supervise_thread(void*) at 
/var/local/ldb-toolchain/bin/../usr/include/pthread.h:562\n\t11# ?\n\t12# ?\n",
       "NumberTotalRows": 4064,
       "NumberLoadedRows": 4012,
       "NumberFilteredRows": 52,
       "NumberUnselectedRows": 0,
       "LoadBytes": 4921660,
       "LoadTimeMs": 965,
       "BeginTxnTimeMs": 0,
       "StreamLoadPutTimeMs": 3,
       "ReadDataTimeMs": 1,
       "WriteDataTimeMs": 64,
       "CommitAndPublishTimeMs": 0,
       "ErrorURL": 
"http://192.168.3.200:8040/api/_load_error_log?file=__shard_12/error_log_insert_stmt_d849a2e3b73e814c-88e6a9c48b526bbc_d849a2e3b73e814c_88e6a9c48b526bbc";
   }
   
   ### What You Expected?
   
   导入成功
   
   ### How to Reproduce?
   
   import requests
   from requests.auth import HTTPBasicAuth
   import base64
   import pandas as pd
   
   if __name__ == '__main__':
       database, table = 'bn_btcusdt_kline', 'test'
       username, password = 'test', '123456'
       url = 'http://192.168.3.200:8030/api/%s/%s/_stream_load' % (database, 
table)
       headers = {
           'Content-Type': 'text/plain; charset=UTF-8',
           'label': '1513',
           'format': 'csv',
           "column_separator": ',',
           'Expect': '100-continue',
           'Authorization': 'Basic ' + base64.b64encode((username + ':' + 
password).encode('utf-8')).decode('ascii')
       }
       auth = HTTPBasicAuth(username, password)
       session = requests.sessions.Session()
       session.should_strip_auth = lambda old_url, new_url: False  # Don't 
strip auth
   
       csv_file_path = 
'E:/dataset/test/data/spot/monthly/klines/BTCUSDT/1s/BTCUSDT-1s-2017-08.csv'
       selected_columns = [0, 6, 1, 2, 3, 4]  # 选择第一列和第三列
       df = pd.read_csv(csv_file_path, header=None, usecols=selected_columns)
       #
       df = df.iloc[:, [0, 5, 1, 4, 2, 3]]
   
       # df.iloc[:, 0] = pd.to_datetime(df.iloc[:, 0], unit='ms')
       # df.iloc[:, 1] = pd.to_datetime(df.iloc[:, 1], unit='ms')
   
       resp = session.request(
           'PUT', url=url,
           data=df.to_csv(header=None, index=False),  # 
open('/path/to/your/data.csv', 'rb'),
           headers=headers, auth=auth
       )
   
       # print(df.head(5).to_csv(header=None, index=False))
       # print(df.tail(5).to_csv(header=None, index=False))
       print(resp.status_code, resp.reason)
       print(resp.text)
   
   ### Anything Else?
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


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

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


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

Reply via email to