This is an automated email from the ASF dual-hosted git repository.

kxiao pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.0 by this push:
     new 1eb0991da03 [Fix](orc-reader) Fix orc decimal128 scale issue. (#25977)
1eb0991da03 is described below

commit 1eb0991da03f978d3f4921ce6ee69e3fa975ed9c
Author: Qi Chen <[email protected]>
AuthorDate: Thu Oct 26 21:50:18 2023 +0800

    [Fix](orc-reader) Fix orc decimal128 scale issue. (#25977)
---
 be/src/apache-orc                                    |   2 +-
 .../hive/scripts/create_preinstalled_table.hql       |  19 +++++++++++++++++++
 .../orc_table/orc_decimal_table/orc_decimal_table    | Bin 0 -> 1169 bytes
 .../data/external_table_p0/hive/test_hive_orc.out    |  18 ++++++++++++++++++
 .../external_table_p0/hive/test_hive_orc.groovy      |  10 ++++++++++
 5 files changed, 48 insertions(+), 1 deletion(-)

diff --git a/be/src/apache-orc b/be/src/apache-orc
index a7c0af50f8c..e52ba9094dd 160000
--- a/be/src/apache-orc
+++ b/be/src/apache-orc
@@ -1 +1 @@
-Subproject commit a7c0af50f8ca8ff7cddaf8675473a037f8b13143
+Subproject commit e52ba9094dd8fa3e86e6043e42d6d561fe092d7c
diff --git 
a/docker/thirdparties/docker-compose/hive/scripts/create_preinstalled_table.hql 
b/docker/thirdparties/docker-compose/hive/scripts/create_preinstalled_table.hql
index d7e93bb74ff..2fbdbbe6dbc 100644
--- 
a/docker/thirdparties/docker-compose/hive/scripts/create_preinstalled_table.hql
+++ 
b/docker/thirdparties/docker-compose/hive/scripts/create_preinstalled_table.hql
@@ -1743,5 +1743,24 @@ LOCATION
 
 msck repair table parquet_timestamp_nanos;
 
+CREATE TABLE `orc_decimal_table`(
+    id INT,
+    decimal_col1 DECIMAL(8, 4),
+    decimal_col2 DECIMAL(18, 6),
+    decimal_col3 DECIMAL(38, 12),
+    decimal_col4 DECIMAL(9, 0),
+    decimal_col5 DECIMAL(27, 9),
+    decimal_col6 DECIMAL(9, 0))
+ROW FORMAT SERDE
+  'org.apache.hadoop.hive.ql.io.orc.OrcSerde'
+STORED AS INPUTFORMAT
+  'org.apache.hadoop.hive.ql.io.orc.OrcInputFormat'
+OUTPUTFORMAT
+  'org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat'
+LOCATION
+  '/user/doris/preinstalled_data/orc_table/orc_decimal_table';
+
+msck repair table orc_decimal_table;
+
 
 show tables;
diff --git 
a/docker/thirdparties/docker-compose/hive/scripts/preinstalled_data/orc_table/orc_decimal_table/orc_decimal_table
 
b/docker/thirdparties/docker-compose/hive/scripts/preinstalled_data/orc_table/orc_decimal_table/orc_decimal_table
new file mode 100644
index 00000000000..c63a5e8ea37
Binary files /dev/null and 
b/docker/thirdparties/docker-compose/hive/scripts/preinstalled_data/orc_table/orc_decimal_table/orc_decimal_table
 differ
diff --git a/regression-test/data/external_table_p0/hive/test_hive_orc.out 
b/regression-test/data/external_table_p0/hive/test_hive_orc.out
index 4f1841c7d31..aff1b185cfb 100644
--- a/regression-test/data/external_table_p0/hive/test_hive_orc.out
+++ b/regression-test/data/external_table_p0/hive/test_hive_orc.out
@@ -83,6 +83,24 @@ tablets      tinyint_col     179     182     182     187     
183     181     177     183     177     187     183     202     202     186     
528
 -- !only_partition_col --
 3600   3600
 
+-- !decimals1 --
+1      1.1234  12.123456       123.123456789876        12      1234.123456789  
123
+2      1234.1234       123456789123.123456     
12345678912345678912345678.123456789876 123456789       
123456789123456789.123456780    987654321
+3      1234.0000       123456789123.000000     
12345678912345678912345678.000000000000 123456789       
123456789123456789.000000000    987654321
+4      0.0000  0.000000        123.123456789876        12      0E-9    123
+5      1.1234  12.123456       0E-12   0       1234.123456789  0
+
+-- !decimals2 --
+3      1234.0000       123456789123.000000     
12345678912345678912345678.000000000000 123456789       
123456789123456789.000000000    987654321
+
+-- !decimals3 --
+1      1.1234  12.123456       123.123456789876        12      1234.123456789  
123
+2      1234.1234       123456789123.123456     
12345678912345678912345678.123456789876 123456789       
123456789123456789.123456780    987654321
+
+-- !decimals4 --
+4      0.0000  0.000000        123.123456789876        12      0E-9    123
+5      1.1234  12.123456       0E-12   0       1234.123456789  0
+
 -- !select_top50 --
 4      55      999742610       400899305488827731      false   6.5976813E8     
7.8723304616937395E17   \N      base tennis pit vertical friday 
2022-08-19T07:29:58     \N      tablets smallint_col    2019-02-07      
[7.53124931825377e+17]  ["NbSSBtwzpxNSkkwga"]   tablets smallint_col
 2      49      999613702       105493714032727452      \N      6.3322381E8     
9.8642324410240179E17   Unveil bright recruit participate. Suspect impression 
camera mathematical revelation. Fault live2 elbow debt west hydrogen current.   
  how literary    2022-09-03T17:20:21     481707.1065     tablets boolean_col   
  2020-01-12      []      ["HoMrAnn", "wteEFvIwoZsVpVQdscMb", NULL, "zcGFmv", 
"kGEBBckbMtX", "hrEtCGFdPWZK"]      tablets boolean_col
diff --git a/regression-test/suites/external_table_p0/hive/test_hive_orc.groovy 
b/regression-test/suites/external_table_p0/hive/test_hive_orc.groovy
index 35877387f6c..64b919bff2a 100644
--- a/regression-test/suites/external_table_p0/hive/test_hive_orc.groovy
+++ b/regression-test/suites/external_table_p0/hive/test_hive_orc.groovy
@@ -66,6 +66,14 @@ suite("test_hive_orc", "all_types") {
         qt_only_partition_col """select count(p1_col), count(p2_col) from 
orc_all_types;"""
     }
 
+    // decimals
+    def decimals = {
+        qt_decimals1 """select * from orc_decimal_table order by id;"""
+        qt_decimals2 """select * from orc_decimal_table where id = 3 order by 
id;"""
+        qt_decimals3 """select * from orc_decimal_table where id < 3 order by 
id;"""
+        qt_decimals4 """select * from orc_decimal_table where id > 3 order by 
id;"""
+    }
+
     String enabled = context.config.otherConfigs.get("enableHiveTest")
     if (enabled != null && enabled.equalsIgnoreCase("true")) {
         try {
@@ -84,6 +92,7 @@ suite("test_hive_orc", "all_types") {
             search_in_int()
             search_mix()
             only_partition_col()
+            decimals()
 
             sql """drop catalog if exists ${catalog_name}"""
 
@@ -101,3 +110,4 @@ suite("test_hive_orc", "all_types") {
         }
     }
 }
+


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to