-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[Fix](Serde) Support hive compatible output format #49036
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
754ba9c
fix 1
BePPPower 2c30ada
fix 2
BePPPower eb5ed02
fix 3
BePPPower e9544fa
fix 4
BePPPower 79ceb9d
fix 5
BePPPower c3c12b1
fix 6
BePPPower bcfdd2d
Merge branch 'master' into supportHiveComplexFormat
morningman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
regression-test/data/datatype_p0/serde/test_serde_dialect_hive.out
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| -- This file is automatically generated. You should know what you did if you want to edit this | ||
| -- !sql01 -- | ||
| 1 2 3 4 5 1.1 2.0 123456.123456789 2024-06-30 2024-06-30T10:10:11 2024-06-30T10:10:11.123456 59.50.185.152 ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff this is a string with , and " abc ef 123ndedwdw true [1,2,3,4,5] [1, 2, 3, null, 5] [1.1, 2.1, 3.1, null, 5] [1.10000, 2.10000, 3.00000, null, 5.12345] ["abc", "de, f"", null, ""] [{"k1":"v1", "k2":null, "k3":"", "k4":"a , "a"}, {"k1":"v1", "k2":null, "k3 , "abc":"", "k4":"a , "a"}] [["abc", "de, f"", null, ""], [], null] \N \N {"k1":"v1", "k2":null, "k3":"", "k4":"a , "a"} {"k1":[["abc", "de, f"", null, ""], [], null], "k2":null} {10:{"k1":[["abc", "de, f"", null, ""], [], null]}, 11:null} \N {"s_id":100, "s_name":"abc , "", "s_address":null} {"s_id":null, "s_name":["abc", "de, f"", null, ""], "s_address":""} ["2024-06-01", null, "2024-06-03"] ["2024-06-01 10:10:10.000", null, "2024-06-03 01:11:23.123"] [1, 1, 0, 0, 1, 0, 0] {"s_id":100, "s_name":"abc , "", "s_gender":1} {"k1":0, "k2":1, "k3":1, "k4":0} | ||
|
|
||
| -- !sql01 -- | ||
| 1 2 3 4 5 1.1 2.0 123456.123456789 2024-06-30 2024-06-30T10:10:11 2024-06-30T10:10:11.123456 59.50.185.152 ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff this is a string with , and " abc ef 123ndedwdw true [1,2,3,4,5] [1,2,3,null,5] [1.1,2.1,3.1,null,5] [1.10000,2.10000,3.00000,null,5.12345] ["abc","de, f"",null,""] [{"k1":"v1","k2":null,"k3":"","k4":"a , "a"},{"k1":"v1","k2":null,"k3 , "abc":"","k4":"a , "a"}] [["abc","de, f"",null,""],[],null] \N \N {"k1":"v1","k2":null,"k3":"","k4":"a , "a"} {"k1":[["abc","de, f"",null,""],[],null],"k2":null} {10:{"k1":[["abc","de, f"",null,""],[],null]},11:null} \N {"s_id":100,"s_name":"abc , "","s_address":null} {"s_id":null,"s_name":["abc","de, f"",null,""],"s_address":""} ["2024-06-01",null,"2024-06-03"] ["2024-06-01 10:10:10.000",null,"2024-06-03 01:11:23.123"] [true,true,false,false,true,false,false] {"s_id":100,"s_name":"abc , "","s_gender":true} {"k1":false,"k2":true,"k3":true,"k4":false} | ||
|
|
107 changes: 107 additions & 0 deletions
107
regression-test/suites/datatype_p0/serde/test_serde_dialect_hive.groovy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| // Licensed to the Apache Software Foundation (ASF) under one | ||
| // or more contributor license agreements. See the NOTICE file | ||
| // distributed with this work for additional information | ||
| // regarding copyright ownership. The ASF licenses this file | ||
| // to you under the Apache License, Version 2.0 (the | ||
| // "License"); you may not use this file except in compliance | ||
| // with the License. You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, | ||
| // software distributed under the License is distributed on an | ||
| // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| // KIND, either express or implied. See the License for the | ||
| // specific language governing permissions and limitations | ||
| // under the License. | ||
|
|
||
| suite("test_serde_dialect_hive", "p0") { | ||
|
|
||
| sql """create database if not exists test_serde_dialect_hive;""" | ||
| sql """use test_serde_dialect_hive;""" | ||
| sql """drop table if exists test_serde_dialect_hive_tbl""" | ||
| sql """ | ||
| create table if not exists test_serde_dialect_hive_tbl ( | ||
| c1 tinyint, | ||
| c2 smallint, | ||
| c3 int, | ||
| c4 bigint, | ||
| c5 largeint, | ||
| c6 float, | ||
| c7 double, | ||
| c8 decimal(27, 9), | ||
| c9 date, | ||
| c10 datetime, | ||
| c11 datetime(6), | ||
| c12 ipv4, | ||
| c13 ipv6, | ||
| c14 string, | ||
| c15 char(6), | ||
| c16 varchar(1024), | ||
| c17 boolean, | ||
| c18 json, | ||
| c19 array<int>, | ||
| c20 array<double>, | ||
| c21 array<decimal(10, 5)>, | ||
| c22 array<string>, | ||
| c23 array<map<string, string>>, | ||
| c24 array<array<string>>, | ||
| c25 array<struct<s_id:int(11), s_name:string, s_address:string>>, | ||
| c26 array<struct<s_id:struct<k1:string, k2:decimal(10,2)>, s_name:array<ipv4>, s_address:map<string, ipv6>>>, | ||
| c27 map<string, string>, | ||
| c28 map<string, array<array<string>>>, | ||
| c29 map<int, map<string, array<array<string>>>>, | ||
| c30 map<decimal(5, 3), array<struct<s_id:struct<k1:string, k2:decimal(10,2)>, s_name:array<string>, s_address:map<string, string>>>>, | ||
| c31 struct<s_id:int(11), s_name:string, s_address:string>, | ||
| c32 struct<s_id:int(11), s_name:array<string>, s_address:string>, | ||
| c33 array<date>, | ||
| c34 array<datetime(3)>, | ||
| c35 array<boolean>, | ||
| c36 struct<s_id:int(11), s_name:string, s_gender:boolean>, | ||
| c37 map<string, boolean> | ||
| ) | ||
| distributed by random buckets 1 | ||
| properties("replication_num" = "1"); | ||
| """ | ||
|
|
||
| sql """ | ||
| insert into test_serde_dialect_hive_tbl | ||
| (c1, c2,c3, c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16,c17,c18,c19,c20,c21,c22,c23,c24,c27,c28,c29,c31,c32,c33,c34,c35,c36,c37) | ||
| values( | ||
| 1,2,3,4,5,1.1,2.0000,123456.123456789,"2024-06-30", "2024-06-30 10:10:11", "2024-06-30 10:10:11.123456", | ||
| '59.50.185.152', | ||
| 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff', | ||
| 'this is a string with , and "', | ||
| 'abc ef', | ||
| ' 123ndedwdw', | ||
| true, | ||
| '[1, 2, 3, 4, 5]', | ||
| [1,2,3,null,5], | ||
| [1.1,2.1,3.1,null,5.00], | ||
| [1.1,2.1,3.00000,null,5.12345], | ||
| ['abc', 'de, f"', null, ''], | ||
| [{'k1': 'v1', 'k2': null, 'k3':'', 'k4':'a , "a'}, {'k1': 'v1', 'k2': null, 'k3 , "abc':'', 'k4':'a , "a'}], | ||
| [['abc', 'de, f"', null, ''],[],null], | ||
| {'k1': 'v1', 'k2': null, 'k3':'', 'k4':'a , "a'}, | ||
| {'k1': [['abc', 'de, f"', null, ''],[],null], 'k2': null}, | ||
| {10: {'k1': [['abc', 'de, f"', null, ''],[],null]}, 11: null}, | ||
| named_struct('s_id', 100, 's_name', 'abc , "', 's_address', null), | ||
| named_struct('s_id', null, 's_name', ['abc', 'de, f"', null, ''], 's_address', ''), | ||
| ['2024-06-01',null,'2024-06-03'], | ||
| ['2024-06-01 10:10:10',null,'2024-06-03 01:11:23.123'], | ||
| [true, true, false, false, true, false, false], | ||
| named_struct('s_id', 100, 's_name', 'abc , "', 's_gender', true), | ||
| {'k1': false, 'k2': true, 'k3':true, 'k4': false} | ||
| ); | ||
| """ | ||
|
|
||
| sql """set serde_dialect="doris";""" | ||
| qt_sql01 """select * from test_serde_dialect_hive_tbl""" | ||
| sql """set serde_dialect="hive";""" | ||
| qt_sql01 """select * from test_serde_dialect_hive_tbl""" | ||
|
|
||
| test { | ||
| sql """set serde_dialect="invalid"""" | ||
| exception "sqlDialect value is invalid" | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.