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

jshao pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/gravitino.git


The following commit(s) were added to refs/heads/main by this push:
     new 5beaf0f30 [#5573] Add test cases for decimal, array, map, row, format 
in Trino CI for hive catalog (#5562)
5beaf0f30 is described below

commit 5beaf0f30d3a90ea065075dffb2fb0e0d431f831
Author: danhuawang <[email protected]>
AuthorDate: Mon Nov 18 14:59:59 2024 +0800

    [#5573] Add test cases for decimal, array, map, row, format in Trino CI for 
hive catalog (#5562)
    
    ### What changes were proposed in this pull request?
    
    1. Add some cases for complex data type
    2. Add some cases for different storage format
    
    ### Why are the changes needed?
    
    #5573
    
    ### Does this PR introduce _any_ user-facing change?
    
    N/A
    
    ### How was this patch tested?
    
    Test locally.
---
 .../testsets/hive/00008_decimal.sql                |  57 +++++++
 .../testsets/hive/00008_decimal.txt                |  62 ++++++++
 .../trino-ci-testset/testsets/hive/00009_array.sql |  65 ++++++++
 .../trino-ci-testset/testsets/hive/00009_array.txt |  71 +++++++++
 .../trino-ci-testset/testsets/hive/00010_map.sql   |  49 ++++++
 .../trino-ci-testset/testsets/hive/00010_map.txt   |  53 +++++++
 .../trino-ci-testset/testsets/hive/00011_row.sql   |  91 +++++++++++
 .../trino-ci-testset/testsets/hive/00011_row.txt   |  95 +++++++++++
 .../testsets/hive/00012_format.sql                 | 176 +++++++++++++++++++++
 .../testsets/hive/00012_format.txt                 |  53 +++++++
 10 files changed, 772 insertions(+)

diff --git 
a/trino-connector/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00008_decimal.sql
 
b/trino-connector/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00008_decimal.sql
new file mode 100644
index 000000000..7901ea41b
--- /dev/null
+++ 
b/trino-connector/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00008_decimal.sql
@@ -0,0 +1,57 @@
+CREATE SCHEMA gt_hive.gt_decimal_db1;
+
+USE gt_hive.gt_decimal_db1;
+
+CREATE TABLE test_decimal_bounds (amount DECIMAL(10, 2));
+
+INSERT INTO test_decimal_bounds VALUES (12345.67), (-9999999.99), (0.01);
+
+INSERT INTO test_decimal_bounds VALUES (123456789.00);  -- Exceeds precision
+
+SELECT * FROM test_decimal_bounds;
+
+CREATE TABLE test_decimal_aggregation (value DECIMAL(12, 3));
+
+INSERT INTO test_decimal_aggregation VALUES (1234.567), (8901.234), (567.890);
+
+SELECT SUM(value) FROM test_decimal_aggregation;
+
+SELECT AVG(value) FROM test_decimal_aggregation;
+
+CREATE TABLE test_decimal_arithmetic (val1 DECIMAL(5, 2), val2 DECIMAL(4, 1));
+
+INSERT INTO test_decimal_arithmetic VALUES (123.45,10.1);
+
+SELECT val1 + val2 FROM test_decimal_arithmetic;
+
+SELECT val1 * val2 FROM test_decimal_arithmetic;
+
+SELECT val1 / val2 FROM test_decimal_arithmetic;
+
+CREATE TABLE test_decimal_max_min (max_min_val DECIMAL(18, 4));
+
+INSERT INTO test_decimal_max_min VALUES (99999999999999.9999);
+
+INSERT INTO test_decimal_max_min VALUES (-99999999999999.9999);
+
+INSERT INTO test_decimal_max_min VALUES (100000000000000.0000); -- Exceeds max
+
+SELECT * FROM test_decimal_max_min ORDER BY max_min_val;
+
+CREATE TABLE test_decimal_nulls (nullable_val DECIMAL(8, 2));
+
+INSERT INTO test_decimal_nulls VALUES (NULL), (123.45), (NULL);
+
+SELECT * FROM test_decimal_nulls;
+
+DROP TABLE gt_hive.gt_decimal_db1.test_decimal_bounds;
+
+DROP TABLE gt_hive.gt_decimal_db1.test_decimal_aggregation;
+
+DROP TABLE gt_hive.gt_decimal_db1.test_decimal_arithmetic;
+
+DROP TABLE gt_hive.gt_decimal_db1.test_decimal_max_min;
+
+DROP TABLE gt_hive.gt_decimal_db1.test_decimal_nulls;
+
+DROP SCHEMA gt_hive.gt_decimal_db1;
\ No newline at end of file
diff --git 
a/trino-connector/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00008_decimal.txt
 
b/trino-connector/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00008_decimal.txt
new file mode 100644
index 000000000..6cecc4ab2
--- /dev/null
+++ 
b/trino-connector/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00008_decimal.txt
@@ -0,0 +1,62 @@
+CREATE SCHEMA
+
+USE
+
+CREATE TABLE
+
+INSERT: 3 rows
+
+<QUERY_FAILED> Cannot cast DECIMAL(11, 2) '123456789.00' to DECIMAL(10, 2)
+
+"12345.67"
+"-9999999.99"
+"0.01"
+
+CREATE TABLE
+
+INSERT: 3 rows
+
+"10703.691"
+
+"3567.897"
+
+CREATE TABLE
+
+INSERT: 1 row
+
+"133.55"
+
+"1246.845"
+
+"12.22"
+
+CREATE TABLE
+
+INSERT: 1 row
+
+INSERT: 1 row
+
+<QUERY_FAILED> Cannot cast DECIMAL(19, 4) '100000000000000.0000' to 
DECIMAL(18, 4)
+
+"-99999999999999.9999"
+"99999999999999.9999"
+
+CREATE TABLE
+
+INSERT: 3 rows
+
+""
+"123.45"
+""
+
+DROP TABLE
+
+DROP TABLE
+
+DROP TABLE
+
+DROP TABLE
+
+DROP TABLE
+
+DROP SCHEMA
\ No newline at end of file
diff --git 
a/trino-connector/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00009_array.sql
 
b/trino-connector/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00009_array.sql
new file mode 100644
index 000000000..77a60ea2d
--- /dev/null
+++ 
b/trino-connector/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00009_array.sql
@@ -0,0 +1,65 @@
+CREATE SCHEMA gt_hive.gt_array_db1;
+
+USE gt_hive.gt_array_db1;
+
+CREATE TABLE test_array_basic (int_array ARRAY(INTEGER));
+
+INSERT INTO test_array_basic VALUES (ARRAY[1, 2, 3]), (ARRAY[4, 5, NULL, 7]), 
(ARRAY[]);
+
+SELECT * FROM test_array_basic;
+
+SELECT int_array, CARDINALITY(int_array) AS array_length FROM test_array_basic;
+
+CREATE TABLE test_array_access (elements ARRAY(VARCHAR));
+
+INSERT INTO test_array_access VALUES (ARRAY['apple', 'banana', 'cherry']);
+
+SELECT elements[1] AS first_element, elements[2] AS second_element FROM 
test_array_access;
+
+SELECT * FROM test_array_basic WHERE contains(int_array, 2);
+
+CREATE TABLE test_array_concat (array1 ARRAY(INTEGER), array2 ARRAY(INTEGER));
+
+INSERT INTO test_array_concat VALUES (ARRAY[1, 2, 3], ARRAY[4, 5]);
+
+SELECT array1, array2, CONCAT(array1, array2) AS concatenated_array FROM 
test_array_concat;
+
+CREATE TABLE test_array_sort (unsorted_array ARRAY(INTEGER));
+
+INSERT INTO test_array_sort VALUES (ARRAY[3, 1, 2]), (ARRAY[9, 7, 8]);
+
+SELECT unsorted_array, array_sort(unsorted_array) AS sorted_array FROM 
test_array_sort;
+
+CREATE TABLE test_array_nulls (mixed_array ARRAY(INTEGER));
+
+INSERT INTO test_array_nulls VALUES (ARRAY[1, NULL, 3]), (ARRAY[NULL, NULL]);
+
+SELECT mixed_array, CARDINALITY(mixed_array) FROM test_array_nulls;
+
+CREATE TABLE test_array_agg (val INTEGER);
+
+INSERT INTO test_array_agg VALUES (1), (2), (3), (4);
+
+SELECT ARRAY_AGG(val) AS aggregated_array FROM test_array_agg;
+
+CREATE TABLE test_nested_array (nested_array ARRAY(ARRAY(VARCHAR)));
+
+INSERT INTO test_nested_array VALUES (ARRAY[ARRAY['a', 'b'], ARRAY['c', 'd']]);
+
+SELECT nested_array FROM test_nested_array;
+
+DROP TABLE gt_hive.gt_array_db1.test_array_basic;
+
+DROP TABLE gt_hive.gt_array_db1.test_array_access;
+
+DROP TABLE gt_hive.gt_array_db1.test_array_concat;
+
+DROP TABLE gt_hive.gt_array_db1.test_array_sort;
+
+DROP TABLE gt_hive.gt_array_db1.test_array_nulls;
+
+DROP TABLE gt_hive.gt_array_db1.test_array_agg;
+
+DROP TABLE gt_hive.gt_array_db1.test_nested_array;
+
+DROP SCHEMA gt_hive.gt_array_db1;
\ No newline at end of file
diff --git 
a/trino-connector/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00009_array.txt
 
b/trino-connector/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00009_array.txt
new file mode 100644
index 000000000..27c422586
--- /dev/null
+++ 
b/trino-connector/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00009_array.txt
@@ -0,0 +1,71 @@
+CREATE SCHEMA
+
+USE
+
+CREATE TABLE
+
+INSERT: 3 rows
+
+"[1, 2, 3]"
+"[4, 5, NULL, 7]"
+"[]"
+
+"[1, 2, 3]","3"
+"[4, 5, NULL, 7]","4"
+"[]","0"
+
+CREATE TABLE
+
+INSERT: 1 row
+
+"apple","banana"
+
+"[1, 2, 3]"
+
+CREATE TABLE
+
+INSERT: 1 row
+
+"[1, 2, 3]","[4, 5]","[1, 2, 3, 4, 5]"
+
+CREATE TABLE
+
+INSERT: 2 rows
+
+"[3, 1, 2]","[1, 2, 3]"
+"[9, 7, 8]","[7, 8, 9]"
+
+CREATE TABLE
+
+INSERT: 2 rows
+
+"[1, NULL, 3]","3"
+"[NULL, NULL]","2"
+
+CREATE TABLE
+
+INSERT: 4 rows
+
+"[1, 2, 3, 4]"
+
+CREATE TABLE
+
+INSERT: 1 row
+
+"[[a, b], [c, d]]"
+
+DROP TABLE
+
+DROP TABLE
+
+DROP TABLE
+
+DROP TABLE
+
+DROP TABLE
+
+DROP TABLE
+
+DROP TABLE
+
+DROP SCHEMA
\ No newline at end of file
diff --git 
a/trino-connector/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00010_map.sql
 
b/trino-connector/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00010_map.sql
new file mode 100644
index 000000000..bbd89b92b
--- /dev/null
+++ 
b/trino-connector/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00010_map.sql
@@ -0,0 +1,49 @@
+CREATE SCHEMA gt_hive.gt_map_db1;
+
+USE gt_hive.gt_map_db1;
+
+CREATE TABLE test_map_nulls (string_map MAP(VARCHAR, VARCHAR));
+
+INSERT INTO test_map_nulls VALUES (MAP(ARRAY['key1'], ARRAY[NULL]));
+
+INSERT INTO test_map_nulls VALUES (MAP(ARRAY[NULL], ARRAY['value1']));
+
+SELECT * FROM test_map_nulls;
+
+INSERT INTO test_map_nulls VALUES (MAP(ARRAY[], ARRAY[]));
+
+SELECT * FROM test_map_nulls ORDER BY cardinality(string_map);
+
+INSERT INTO test_map_nulls VALUES (MAP(ARRAY['dup', 'dup'], ARRAY['value1', 
'value2']));
+
+CREATE TABLE test_map_types (int_decimal_map MAP(INTEGER, DECIMAL(10, 2)));
+
+INSERT INTO test_map_types VALUES (MAP(ARRAY[1, 2147483647], ARRAY[12345.67, 
99999.99]));
+
+SELECT * FROM test_map_types;
+
+INSERT INTO test_map_nulls VALUES (MAP(ARRAY['k1', 'k2', 'k3'], ARRAY['v1', 
'v2', 'v3']));
+
+SELECT element_at(string_map, 'k1') AS key1_value, element_at(string_map, 
'k3') AS key3_value FROM test_map_nulls ORDER BY key1_value;
+
+CREATE TABLE test_map_complex (map_of_arrays MAP(VARCHAR, ARRAY(INTEGER)));
+
+INSERT INTO test_map_complex VALUES (MAP(ARRAY['a', 'b'], ARRAY[ARRAY[1, 2], 
ARRAY[3, 4, 5]]));
+
+SELECT * FROM test_map_complex;
+
+CREATE TABLE test_map_aggregation (map_data MAP(VARCHAR, INTEGER));
+
+INSERT INTO test_map_aggregation VALUES (MAP(ARRAY['a', 'b'], ARRAY[1, 2])), 
(MAP(ARRAY['a', 'b'], ARRAY[3, 4]));
+
+SELECT map_data['a'] AS key_a, SUM(map_data['b']) AS sum_b FROM 
test_map_aggregation GROUP BY map_data['a'] ORDER BY key_a;
+
+DROP TABLE gt_hive.gt_map_db1.test_map_nulls;
+
+DROP TABLE gt_hive.gt_map_db1.test_map_types;
+
+DROP TABLE gt_hive.gt_map_db1.test_map_complex;
+
+DROP TABLE gt_hive.gt_map_db1.test_map_aggregation;
+
+DROP SCHEMA gt_hive.gt_map_db1;
\ No newline at end of file
diff --git 
a/trino-connector/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00010_map.txt
 
b/trino-connector/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00010_map.txt
new file mode 100644
index 000000000..929dacfa1
--- /dev/null
+++ 
b/trino-connector/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00010_map.txt
@@ -0,0 +1,53 @@
+CREATE SCHEMA
+
+USE
+
+CREATE TABLE
+
+INSERT: 1 row
+
+<QUERY_FAILED> map key cannot be null
+
+"{key1=NULL}"
+
+INSERT: 1 row
+
+"{}"
+"{key1=NULL}"
+
+<QUERY_FAILED> Duplicate map keys (dup) are not allowed
+
+CREATE TABLE
+
+INSERT: 1 row
+
+"{2147483647=99999.99, 1=12345.67}"
+
+INSERT: 1 row
+
+"v1","v3"
+"",""
+"",""
+
+CREATE TABLE
+
+INSERT: 1 row
+
+"{a=[1, 2], b=[3, 4, 5]}"
+
+CREATE TABLE
+
+INSERT: 2 rows
+
+"1","2"
+"3","4"
+
+DROP TABLE
+
+DROP TABLE
+
+DROP TABLE
+
+DROP TABLE
+
+DROP SCHEMA
\ No newline at end of file
diff --git 
a/trino-connector/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00011_row.sql
 
b/trino-connector/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00011_row.sql
new file mode 100644
index 000000000..14c49edae
--- /dev/null
+++ 
b/trino-connector/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00011_row.sql
@@ -0,0 +1,91 @@
+CREATE SCHEMA gt_hive.gt_row_db1;
+
+USE gt_hive.gt_row_db1;
+
+CREATE TABLE test_row_basic (person ROW(id INTEGER, name VARCHAR));
+
+CREATE TABLE source_tb1 (id INTEGER, name VARCHAR);
+
+INSERT INTO source_tb1 VALUES (1, 'Alice'), (2, NULL);
+
+INSERT INTO test_row_basic SELECT ROW(id, name) FROM source_tb1;
+
+SELECT * FROM test_row_basic ORDER BY person.id;
+
+INSERT INTO source_tb1 VALUES (3, 'Bob');
+
+INSERT INTO test_row_basic SELECT ROW(id, name) FROM source_tb1;
+
+SELECT person.id AS person_id, person.name AS person_name FROM test_row_basic 
ORDER BY person.id;
+
+CREATE TABLE test_nested_row (
+    person ROW(id INTEGER, name VARCHAR, address ROW(street VARCHAR, city 
VARCHAR))
+);
+
+CREATE TABLE source_tb2 (id INTEGER, name VARCHAR, street VARCHAR, city 
VARCHAR);
+
+INSERT INTO source_tb2 VALUES (1, 'Alice', '123 Elm St', 'Springfield');
+
+INSERT INTO test_nested_row SELECT ROW(id, name, ROW(street, city)) FROM 
source_tb2;
+
+SELECT person.address.city AS city FROM test_nested_row;
+
+CREATE TABLE test_mixed_row (
+    data ROW(int_val INTEGER, str_val VARCHAR, arr_val ARRAY(INTEGER), map_val 
MAP(VARCHAR, INTEGER))
+);
+
+CREATE TABLE source_tb3 (int_val INTEGER, str_val VARCHAR, arr_val 
ARRAY(INTEGER), map_val MAP(VARCHAR, INTEGER));
+
+INSERT INTO source_tb3 VALUES (100, 'text', ARRAY[1, 2, 3], MAP(ARRAY['a', 
'b'], ARRAY[10, 20]));
+
+INSERT INTO test_mixed_row SELECT ROW(int_val, str_val, arr_val, map_val) FROM 
source_tb3;
+
+SELECT * FROM test_mixed_row;
+
+INSERT INTO source_tb1 VALUES (NULL, NULL);
+
+INSERT INTO test_row_basic SELECT ROW(id, name) FROM source_tb1;
+
+SELECT * FROM test_row_basic ORDER BY person.id;
+
+CREATE TABLE test_row_in_array_map (
+    row_array ARRAY(ROW(id INTEGER, name VARCHAR)),
+    row_map MAP(VARCHAR, ROW(age INTEGER, city VARCHAR))
+);
+
+CREATE TABLE source_tb5 (id INTEGER, name VARCHAR, age INTEGER, city VARCHAR);
+
+INSERT INTO source_tb5 VALUES (1, 'Alice', 30, 'NY'), (2, 'Bob', 40, 'LA');
+
+INSERT INTO test_row_in_array_map SELECT ARRAY[ROW(id, name)], 
MAP(ARRAY['person1'], ARRAY[ROW(age, city)]) FROM source_tb5;
+
+INSERT INTO test_row_in_array_map
+SELECT ARRAY_AGG(ROW(id, name)), MAP(ARRAY_AGG(person_key), ARRAY_AGG(ROW(age, 
city)))
+FROM (
+    SELECT id, name, age, city, CONCAT('person', CAST(ROW_NUMBER() OVER() AS 
VARCHAR)) AS person_key
+    FROM source_tb5
+) subquery;
+
+INSERT INTO source_tb1 VALUES (1, 'Alice'), (1, 'Alice'), (2, 'Bob');
+
+INSERT INTO test_row_basic SELECT ROW(id, name) FROM source_tb1;
+
+SELECT person.id, COUNT(*) FROM test_row_basic GROUP BY person.id ORDER BY 
person.id;
+
+DROP TABLE gt_hive.gt_row_db1.test_row_basic;
+
+DROP TABLE gt_hive.gt_row_db1.source_tb1;
+
+DROP TABLE gt_hive.gt_row_db1.test_nested_row;
+
+DROP TABLE gt_hive.gt_row_db1.test_mixed_row;
+
+DROP TABLE gt_hive.gt_row_db1.source_tb2;
+
+DROP TABLE gt_hive.gt_row_db1.source_tb3;
+
+DROP TABLE gt_hive.gt_row_db1.test_row_in_array_map;
+
+DROP TABLE gt_hive.gt_row_db1.source_tb5;
+
+DROP SCHEMA gt_hive.gt_row_db1;
\ No newline at end of file
diff --git 
a/trino-connector/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00011_row.txt
 
b/trino-connector/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00011_row.txt
new file mode 100644
index 000000000..2183ef438
--- /dev/null
+++ 
b/trino-connector/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00011_row.txt
@@ -0,0 +1,95 @@
+CREATE SCHEMA
+
+USE
+
+CREATE TABLE
+
+CREATE TABLE
+
+INSERT: 2 rows
+
+INSERT: 2 rows
+
+"{id=1, name=Alice}"
+"{id=2, name=NULL}"
+
+INSERT: 1 row
+
+INSERT: 3 rows
+
+"1","Alice"
+"1","Alice"
+"2",""
+"2",""
+"3","Bob"
+
+CREATE TABLE
+
+CREATE TABLE
+
+INSERT: 1 row
+
+INSERT: 1 row
+
+"Springfield"
+
+CREATE TABLE
+
+CREATE TABLE
+
+INSERT: 1 row
+
+INSERT: 1 row
+
+"{int_val=100, str_val=text, arr_val=[1, 2, 3], map_val={a=10, b=20}}"
+
+INSERT: 1 row
+
+INSERT: 4 rows
+
+"{id=1, name=Alice}"
+"{id=1, name=Alice}"
+"{id=1, name=Alice}"
+"{id=2, name=NULL}"
+"{id=2, name=NULL}"
+"{id=2, name=NULL}"
+"{id=3, name=Bob}"
+"{id=3, name=Bob}"
+"{id=NULL, name=NULL}"
+
+CREATE TABLE
+
+CREATE TABLE
+
+INSERT: 2 rows
+
+INSERT: 2 rows
+
+INSERT: 1 row
+
+INSERT: 3 rows
+
+INSERT: 7 rows
+
+"1","6"
+"2","5"
+"3","3"
+"","2"
+
+DROP TABLE
+
+DROP TABLE
+
+DROP TABLE
+
+DROP TABLE
+
+DROP TABLE
+
+DROP TABLE
+
+DROP TABLE
+
+DROP TABLE
+
+DROP SCHEMA
\ No newline at end of file
diff --git 
a/trino-connector/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00012_format.sql
 
b/trino-connector/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00012_format.sql
new file mode 100644
index 000000000..d36a4b2ca
--- /dev/null
+++ 
b/trino-connector/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00012_format.sql
@@ -0,0 +1,176 @@
+CREATE SCHEMA gt_hive.gt_format_db1;
+
+USE gt_hive.gt_format_db1;
+
+CREATE TABLE storage_formats_orc (
+c_boolean boolean,
+c_tinyint tinyint,
+c_smallint smallint,
+c_int  integer,
+c_bigint bigint,
+c_real real,
+c_double double,
+c_decimal_10_0 decimal(10,0),
+c_decimal_10_2 decimal(10,2),
+c_decimal_38_5 decimal(38,5),
+c_char char(10),
+c_varchar varchar(10),
+c_string varchar,
+c_binary varbinary,
+c_date date,
+c_timestamp timestamp,
+c_array array(integer),
+c_map map(varchar, varchar),
+c_row row(f1 integer, f2 varchar)
+) WITH (format='ORC');
+
+INSERT INTO storage_formats_orc
+VALUES 
(true,127,32767,2147483647,9223372036854775807,123.345,234.567,346,12345678.91,1234567890123456789012.34567,'ala
 ma    ','ala ma kot','ala ma kota',X'62696e61727920636f6e74656e74',DATE 
'2024-11-11',TIMESTAMP '2024-11-11 12:15:35.123',ARRAY[1, 2, 
3],MAP(ARRAY['foo'], ARRAY['bar']),ROW(42, 'Trino'));
+
+SELECT * FROM storage_formats_orc;
+
+CREATE TABLE storage_formats_textfile (
+c_boolean boolean,
+c_tinyint tinyint,
+c_smallint smallint,
+c_int  integer,
+c_bigint bigint,
+c_real real,
+c_double double,
+c_decimal_10_0 decimal(10,0),
+c_decimal_10_2 decimal(10,2),
+c_decimal_38_5 decimal(38,5),
+c_char char(10),
+c_varchar varchar(10),
+c_string varchar,
+c_binary varbinary,
+c_date date,
+c_timestamp timestamp,
+c_array array(integer),
+c_map map(varchar, varchar),
+c_row row(f1 integer, f2 varchar)
+) WITH (format='TextFile');
+
+INSERT INTO storage_formats_textfile
+VALUES 
(true,127,32767,2147483647,9223372036854775807,123.345,234.567,346,12345678.91,1234567890123456789012.34567,'ala
 ma    ','ala ma kot','ala ma kota',X'62696e61727920636f6e74656e74',DATE 
'2024-11-11',TIMESTAMP '2024-11-11 12:15:35.123',ARRAY[1, 2, 
3],MAP(ARRAY['foo'], ARRAY['bar']),ROW(42, 'Trino'));
+
+SELECT * FROM storage_formats_textfile;
+
+CREATE TABLE storage_formats_parquet (
+c_boolean boolean,
+c_tinyint tinyint,
+c_smallint smallint,
+c_int  integer,
+c_bigint bigint,
+c_real real,
+c_double double,
+c_decimal_10_0 decimal(10,0),
+c_decimal_10_2 decimal(10,2),
+c_decimal_38_5 decimal(38,5),
+c_char char(10),
+c_varchar varchar(10),
+c_string varchar,
+c_binary varbinary,
+c_date date,
+c_timestamp timestamp,
+c_array array(integer),
+c_map map(varchar, varchar),
+c_row row(f1 integer, f2 varchar)
+) WITH (format='PARQUET');
+
+INSERT INTO storage_formats_parquet VALUES 
(true,127,32767,2147483647,9223372036854775807,123.345,234.567,346,12345678.91,1234567890123456789012.34567,'ala
 ma    ','ala ma kot','ala ma kota',X'62696e61727920636f6e74656e74',DATE 
'2024-11-11',TIMESTAMP '2024-11-11 12:15:35.123',ARRAY[1, 2, 
3],MAP(ARRAY['foo'], ARRAY['bar']),ROW(42, 'Trino'));
+
+SELECT * FROM storage_formats_parquet;
+
+CREATE TABLE storage_formats_rcfile (
+c_boolean boolean,
+c_tinyint tinyint,
+c_smallint smallint,
+c_int  integer,
+c_bigint bigint,
+c_real real,
+c_double double,
+c_decimal_10_0 decimal(10,0),
+c_decimal_10_2 decimal(10,2),
+c_decimal_38_5 decimal(38,5),
+c_char char(10),
+c_varchar varchar(10),
+c_string varchar,
+c_binary varbinary,
+c_date date,
+c_timestamp timestamp,
+c_array array(integer),
+c_map map(varchar, varchar),
+c_row row(f1 integer, f2 varchar)
+) WITH (format='RCFile');
+
+INSERT INTO storage_formats_rcfile VALUES 
(true,127,32767,2147483647,9223372036854775807,123.345,234.567,346,12345678.91,1234567890123456789012.34567,'ala
 ma    ','ala ma kot','ala ma kota',X'62696e61727920636f6e74656e74',DATE 
'2024-11-11',TIMESTAMP '2024-11-11 12:15:35.123',ARRAY[1, 2, 
3],MAP(ARRAY['foo'], ARRAY['bar']),ROW(42, 'Trino'));
+
+SELECT * FROM storage_formats_rcfile;
+
+CREATE TABLE storage_formats_sequencefile (
+c_boolean boolean,
+c_tinyint tinyint,
+c_smallint smallint,
+c_int  integer,
+c_bigint bigint,
+c_real real,
+c_double double,
+c_decimal_10_0 decimal(10,0),
+c_decimal_10_2 decimal(10,2),
+c_decimal_38_5 decimal(38,5),
+c_char char(10),
+c_varchar varchar(10),
+c_string varchar,
+c_binary varbinary,
+c_date date,
+c_timestamp timestamp,
+c_array array(integer),
+c_map map(varchar, varchar),
+c_row row(f1 integer, f2 varchar)
+) WITH (format='SequenceFile');
+
+INSERT INTO storage_formats_sequencefile VALUES 
(true,127,32767,2147483647,9223372036854775807,123.345,234.567,346,12345678.91,1234567890123456789012.34567,'ala
 ma    ','ala ma kot','ala ma kota',X'62696e61727920636f6e74656e74',DATE 
'2024-11-11',TIMESTAMP '2024-11-11 12:15:35.123',ARRAY[1, 2, 
3],MAP(ARRAY['foo'], ARRAY['bar']),ROW(42, 'Trino')
+);
+
+SELECT * FROM storage_formats_sequencefile;
+
+CREATE TABLE storage_formats_avro (
+c_boolean boolean,
+c_tinyint integer,
+c_smallint integer,
+c_int  integer,
+c_bigint bigint,
+c_real real,
+c_double double,
+c_decimal_10_0 decimal(10,0),
+c_decimal_10_2 decimal(10,2),
+c_decimal_38_5 decimal(38,5),
+c_char char(10),
+c_varchar varchar(10),
+c_string varchar,
+c_binary varbinary,
+c_date date,
+c_timestamp timestamp,
+c_array array(integer),
+c_map map(varchar, varchar),
+c_row row(f1 integer, f2 varchar)
+) WITH (format='AVRO');
+
+INSERT INTO storage_formats_avro VALUES 
(true,127,32767,2147483647,9223372036854775807,123.345,234.567,346,12345678.91,1234567890123456789012.34567,'ala
 ma    ','ala ma kot','ala ma kota',X'62696e61727920636f6e74656e74',DATE 
'2024-11-11',TIMESTAMP '2024-11-11 12:15:35.123',ARRAY[1, 2, 
3],MAP(ARRAY['foo'], ARRAY['bar']),ROW(42, 'Trino'));
+
+SELECT * FROM storage_formats_avro;
+
+DROP TABLE gt_hive.gt_format_db1.storage_formats_orc;
+
+DROP TABLE gt_hive.gt_format_db1.storage_formats_textfile;
+
+DROP TABLE gt_hive.gt_format_db1.storage_formats_parquet;
+
+DROP TABLE gt_hive.gt_format_db1.storage_formats_rcfile;
+
+DROP TABLE gt_hive.gt_format_db1.storage_formats_sequencefile;
+
+DROP TABLE gt_hive.gt_format_db1.storage_formats_avro;
+
+DROP SCHEMA gt_hive.gt_format_db1;
diff --git 
a/trino-connector/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00012_format.txt
 
b/trino-connector/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00012_format.txt
new file mode 100644
index 000000000..95a31519f
--- /dev/null
+++ 
b/trino-connector/integration-test/src/test/resources/trino-ci-testset/testsets/hive/00012_format.txt
@@ -0,0 +1,53 @@
+CREATE SCHEMA
+
+USE
+
+CREATE TABLE
+
+INSERT: 1 row
+
+"true","127","32767","2147483647","9223372036854775807","123.345","234.567","346","12345678.91","1234567890123456789012.34567","ala
 ma    ","ala ma kot","ala ma kota","62 69 6e 61 72 79 20 63 6f 6e 74 65 6e 
74","2024-11-11","2024-11-11 12:15:35.123","[1, 2, 3]","{foo=bar}","{f1=42, 
f2=Trino}"
+
+CREATE TABLE
+
+INSERT: 1 row
+
+"true","127","32767","2147483647","9223372036854775807","123.345","234.567","346","12345678.91","1234567890123456789012.34567","ala
 ma    ","ala ma kot","ala ma kota","62 69 6e 61 72 79 20 63 6f 6e 74 65 6e 
74","2024-11-11","2024-11-11 12:15:35.123","[1, 2, 3]","{foo=bar}","{f1=42, 
f2=Trino}"
+
+CREATE TABLE
+
+INSERT: 1 row
+
+"true","127","32767","2147483647","9223372036854775807","123.345","234.567","346","12345678.91","1234567890123456789012.34567","ala
 ma    ","ala ma kot","ala ma kota","62 69 6e 61 72 79 20 63 6f 6e 74 65 6e 
74","2024-11-11","2024-11-11 12:15:35.123","[1, 2, 3]","{foo=bar}","{f1=42, 
f2=Trino}"
+
+CREATE TABLE
+
+INSERT: 1 row
+
+"true","127","32767","2147483647","9223372036854775807","123.345","234.567","346","12345678.91","1234567890123456789012.34567","ala
 ma    ","ala ma kot","ala ma kota","62 69 6e 61 72 79 20 63 6f 6e 74 65 6e 
74","2024-11-11","2024-11-11 12:15:35.123","[1, 2, 3]","{foo=bar}","{f1=42, 
f2=Trino}"
+
+CREATE TABLE
+
+INSERT: 1 row
+
+"true","127","32767","2147483647","9223372036854775807","123.345","234.567","346","12345678.91","1234567890123456789012.34567","ala
 ma    ","ala ma kot","ala ma kota","62 69 6e 61 72 79 20 63 6f 6e 74 65 6e 
74","2024-11-11","2024-11-11 12:15:35.123","[1, 2, 3]","{foo=bar}","{f1=42, 
f2=Trino}"
+
+CREATE TABLE
+
+INSERT: 1 row
+
+"true","127","32767","2147483647","9223372036854775807","123.345","234.567","346","12345678.91","1234567890123456789012.34567","ala
 ma    ","ala ma kot","ala ma kota","62 69 6e 61 72 79 20 63 6f 6e 74 65 6e 
74","2024-11-11","2024-11-11 12:15:35.123","[1, 2, 3]","{foo=bar}","{f1=42, 
f2=Trino}"
+
+DROP TABLE
+
+DROP TABLE
+
+DROP TABLE
+
+DROP TABLE
+
+DROP TABLE
+
+DROP TABLE
+
+DROP SCHEMA
\ No newline at end of file

Reply via email to