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

   ## Proposed changes
   
   Issue Number: close #xxx
   
   <!--Describe your changes.-->
   1. 对hive中所有类型,除了binary(doris本身就没有binary)外都支持。
   ```sql
   CREATE TABLE ywtest.test (
     a ARRAY<TINYINT>,
     b ARRAY<SMALLINT>,
     c ARRAY<INT>,
     d ARRAY<BIGINT>,
     e ARRAY<BOOLEAN>,
     f ARRAY<FLOAT>,
     g ARRAY<DOUBLE>,
     h ARRAY<STRING>,
     i ARRAY<TIMESTAMP>,
     j ARRAY<DATE>
   )
   stored as textfile;
   
   INSERT INTO ywtest.test VALUES
   (
       ARRAY(tinyint(1), tinyint(2), tinyint(3)), 
       ARRAY(smallint(10), smallint(20), smallint(30), smallint(40)), 
       ARRAY(100, 200, 300), 
       ARRAY(bigint(100000000000000), bigint(20000000000000), 
bigint(30000000000000), bigint(40000000000000)), 
       ARRAY(true, false, true),
       ARRAY(float(1.23), float(4.56), float(7.89)), 
       ARRAY(double(10.1), double(20.2), double(30.3)), 
       ARRAY("apple", "banana", "orange"),
       ARRAY(TIMESTAMP("2023-07-04 12:00:00"), TIMESTAMP("2023-07-05 
12:00:00"), TIMESTAMP("2023-07-06 12:00:00")),
       ARRAY(date("2023-07-04"), date("2023-07-05"), date("2023-07-06"))
   ),
   (
       ARRAY(tinyint(10), tinyint(20), tinyint(30)), 
       ARRAY(smallint(100), smallint(200), smallint(300), smallint(400)), 
       ARRAY(1000, 2000, 3000), 
       ARRAY(bigint(1000000000000000), bigint(200000000000000), 
bigint(300000000000000), bigint(400000000000000)), 
       ARRAY(true, true,true, true),
       ARRAY(float(12.3), float(45.6), float(78.9)), 
       ARRAY(double(100.1), double(200.2), double(300.3)), 
       ARRAY("abc", "eeee", "sdads"),
       ARRAY(TIMESTAMP("2023-07-02 12:00:00"), TIMESTAMP("2023-07-02 
12:00:00"), TIMESTAMP("2023-07-02 12:00:00")),
       ARRAY(date("2021-07-04"), date("2021-07-05"), date("2021-07-06"))
   ),
   (
       ARRAY(tinyint(1), tinyint(2), tinyint(3)), 
       ARRAY(smallint(10), smallint(20), smallint(30), smallint(40)), 
       ARRAY(100, 200, 300), 
       ARRAY(bigint(100000000000000), bigint(20000000000000), 
bigint(30000000000000), bigint(40000000000000)), 
       ARRAY(true, false, true),
       ARRAY(float(12.3), float(45.6), float(78.9)), 
       ARRAY(double(100.1), double(200.2), double(300.3)), 
       ARRAY("abc", "eeee", "sdads"),
       ARRAY(TIMESTAMP("2023-07-02 12:00:00"), TIMESTAMP("2023-07-02 
12:00:00"), TIMESTAMP("2023-07-02 12:00:00")),
       ARRAY(date("2021-07-04"), date("2021-07-05"), date("2021-07-06"))
   );
   
   ```
   doris上显示结果:
   
   ```sql
   mysql> select * from ywtest.test\G;
   *************************** 1. row ***************************
   a: [1, 2, 3]
   b: [10, 20, 30, 40]
   c: [100, 200, 300]
   d: [100000000000000, 20000000000000, 30000000000000, 40000000000000]
   e: [1, 0, 1]
   f: [1.23, 4.56, 7.89]
   g: [10.1, 20.2, 30.3]
   h: ["apple", "banana", "orange"]
   i: [2023-07-04 12:00:00.000000, 2023-07-05 12:00:00.000000, 2023-07-06 
12:00:00.000000]
   j: [2023-07-04, 2023-07-05, 2023-07-06]
   *************************** 2. row ***************************
   a: [10, 20, 30]
   b: [100, 200, 300, 400]
   c: [1000, 2000, 3000]
   d: [1000000000000000, 200000000000000, 300000000000000, 400000000000000]
   e: [1, 1, 1, 1]
   f: [12.3, 45.6, 78.9]
   g: [100.1, 200.2, 300.3]
   h: ["abc", "eeee", "sdads"]
   i: [2023-07-02 12:00:00.000000, 2023-07-02 12:00:00.000000, 2023-07-02 
12:00:00.000000]
   j: [2021-07-04, 2021-07-05, 2021-07-06]
   *************************** 3. row ***************************
   a: [1, 2, 3]
   b: [10, 20, 30, 40]
   c: [100, 200, 300]
   d: [100000000000000, 20000000000000, 30000000000000, 40000000000000]
   e: [1, 0, 1]
   f: [12.3, 45.6, 78.9]
   g: [100.1, 200.2, 300.3]
   h: ["abc", "eeee", "sdads"]
   i: [2023-07-02 12:00:00.000000, 2023-07-02 12:00:00.000000, 2023-07-02 
12:00:00.000000]
   j: [2021-07-04, 2021-07-05, 2021-07-06]
   3 rows in set (0.02 sec)
   ```
   2. 支持分隔符的指定。
   ```sql
   hive> show create table ywtest.cyw14;
   OK
   CREATE TABLE `ywtest.cyw14`(
     `id` int, 
     `arr` array<array<int>>, 
     `info` int)
   ROW FORMAT SERDE 
     'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe' 
   WITH SERDEPROPERTIES ( 
     'collection.delim'=',.', 
     'field.delim'='\t', 
     'line.delim'='\n', 
     'serialization.format'='\t') 
   STORED AS INPUTFORMAT 
     'org.apache.hadoop.mapred.TextInputFormat' 
   OUTPUTFORMAT 
     'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat'
   LOCATION
     'hdfs://HDFS8000871/usr/hive/warehouse/ywtest.db/cyw14'
   TBLPROPERTIES (
     'transient_lastDdlTime'='1688454532')
   Time taken: 0.095 seconds, Fetched: 19 row(s)
   ```
   doris上显示结果:
   ```sql
   mysql> select * from ywtest.cyw14;
   +------+-----------------------------------+------+
   | id   | arr                               | info |
   +------+-----------------------------------+------+
   |    1 | [[1, 2, 3], [4, 5, 6], [8, 9, 0]] |   11 |
   |    2 | [[11, 22, 33], [44, 55, 66]]      |   22 |
   +------+-----------------------------------+------+
   2 rows in set (0.02 sec)
   ```
   
   
   3. 支持array嵌套array.
   doris上显示结果:
   ```sql
   mysql> select * from ywtest.cyw3;
   
+-----------------------------------------------------------------+----------------------------------------------------+
   | info                                                            | str      
                                          |
   
+-----------------------------------------------------------------+----------------------------------------------------+
   | [[[1], [2, 4]], [[12222, 12313, 123131, 4211], [1, 2], [2, 3]]] | 
[["hello", "world"], ["hive", "hive", "hivetext"]] |
   
+-----------------------------------------------------------------+----------------------------------------------------+
   1 row in set (0.01 sec)
   ```
   
   
   
   ## Further comments
   
   If this is a relatively large or complex change, kick off the discussion at 
[d...@doris.apache.org](mailto:d...@doris.apache.org) by explaining why you 
chose the solution you did and what alternatives you considered, etc...
   
   


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

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