chenlinzhong opened a new issue #8487:
URL: https://github.com/apache/incubator-doris/issues/8487


   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/incubator-doris/issues?q=is%3Aissue) and 
found no similar issues.
   
   
   ### Description
   
   - Add two new types to stream load boker load: csvwithnames and 
csvwithnamesandtypes
   - Add two new types to export: csvwithnames and csvwithnamesandtypes
   
   ### Use case
   
   ```
   MySQL [test_db]> show create table my_table
   ....
   CREATE TABLE `my_table` (
     `event_day` date NULL COMMENT "",
     `siteid` int(11) NULL DEFAULT "10" COMMENT "",
     `citycode` smallint(6) NULL COMMENT "",
     `username` varchar(32) NULL DEFAULT "" COMMENT "",
     `pv` bigint(20) SUM NULL DEFAULT "0" COMMENT ""
   ) ENGINE=OLAP
   AGGREGATE KEY(`event_day`, `siteid`, `citycode`, `username`)
   COMMENT "OLAP"
   DISTRIBUTED BY HASH(`siteid`) BUCKETS 10
   PROPERTIES (
   "replication_allocation" = "tag.location.default: 1",
   "in_memory" = "false",
   "storage_format" = "V2"
   )
   ```
   ## stream load
   ### case1:  csv file without header(default)
   curl --location-trusted -u root -H "label:123" -H "where: k1=20180601" -H 
"format:csv" -T testData.csv http://host:port/api/testDb/testTbl/_stream_load
   testData.csv
   ```
   2017-07-03,78,5,OlpJfkVz,176
   2017-07-03,73,18,iVM0NyAH,49
   2017-07-03,5,13,wvim4aqW,95
   ```
   
   ### case2: csv file with header:names
   curl --location-trusted -u root -H "label:123" -H "where: k1=20180601" -H 
"format:csvwithnames" -T testData.txt  
http://host:port/api/testDb/testTbl/_stream_load
   testData.csv
   ```
   event_day,siteid,citycode,username,pv
   2017-07-03,78,5,OlpJfkVz,176
   2017-07-03,73,18,iVM0NyAH,49
   2017-07-03,5,13,wvim4aqW,95
   ```
   ### case3: csv file with header:names and types
   curl --location-trusted -u root -H "label:123" -H "where: k1=20180601" -H 
"format:csvwithnamesandtypes" -T testData.txt  
http://host:port/api/testDb/testTbl/_stream_load
   testData.csv
   ```
   event_day,siteid,citycode,username,pv
   date,int,samllint,varchar,int
   2017-07-03,78,5,OlpJfkVz,176
   2017-07-03,73,18,iVM0NyAH,49
   2017-07-03,5,13,wvim4aqW,95
   ```
   ## broker load
   ### case1: csv file without header(default)
   ```
   LOAD LABEL  test_db.label1
   (
   DATA INFILE("hdfs://hdfs_host:hdfs_port/testData.csv")
   INTO TABLE my_table
   FORMAT AS "csv"
   (k1, k2, k3)
   )
   ```
   ### case2: csv file with header:names
   ```
   LOAD LABEL  test_db.label1
   (
   DATA INFILE("hdfs://hdfs_host:hdfs_port/testData.csv")
   INTO TABLE my_table
   FORMAT AS "csvwithnames"
   (k1, k2, k3)
   )
   ```
   ### case3: csv file with header:names and types
   ```
   LOAD LABEL  test_db.label1
   (
   DATA INFILE("hdfs://hdfs_host:hdfs_port/testData.csv")
   INTO TABLE my_table
   FORMAT AS "csvwithnamesandtypes"
   (k1, k2, k3)
   )
   ```
   
   ## export
   ```
   EXPORT TABLE testTbl TO "hdfs://hdfs_host:port/a/b/c" PROPERTIES ("label" = 
"mylabel", "column_separator"=",","format"="csv")
   EXPORT TABLE testTbl TO "hdfs://hdfs_host:port/a/b/c" PROPERTIES ("label" = 
"mylabel", "column_separator"=",","format"="csvwithnames")
   EXPORT TABLE testTbl TO "hdfs://hdfs_host:port/a/b/c" PROPERTIES ("label" = 
"mylabel", "column_separator"=",","format"="csvwithnamesandtypes")
   ```
   For more details, run the command "help export" on the MySQL terminal
   
   
   
   
   ### Related issues
   
   NO
   
   ### 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: [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