Skip to content

Commit

Permalink
branch-2.1: [test](jdbc catalog) add some jdbc query tvf test (#45991)
Browse files Browse the repository at this point in the history
cherry-pick #45938
  • Loading branch information
zy-kkk authored Dec 26, 2024
1 parent 7addefb commit bceebfc
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,38 @@ internal
db2_jdbc_catalog

-- !sample_table_desc --
BIGINT_COLUMN BIGINT Yes true \N
CHAR_COLUMN CHARACTER Yes true \N
CHAR_VARYING_COLUMN VARCHAR(255) Yes true \N
CLOB_COLUMN TEXT Yes true \N
DATE_COLUMN DATE Yes true \N
DECFLOAT_COLUMN DECIMAL(34, 0) Yes true \N
DECIMAL_COLUMN DECIMAL(31, 10) Yes true \N
DOUBLE_COLUMN DOUBLE Yes true \N
DOUBLE_PRECISION_COLUMN DOUBLE Yes true \N
FLOAT_COLUMN DOUBLE Yes true \N
ID_COLUMN INT No true \N
INT_COLUMN INT Yes true \N
LONG_VARCHARPHIC_COLUMN TEXT Yes true \N
LONG_VARCHAR_COLUMN VARCHAR(32700) Yes true \N
NUMERIC_COLUMN DECIMAL(5, 0) Yes true \N
REAL_COLUMN FLOAT Yes true \N
SMALLINT_COLUMN SMALLINT Yes true \N
TIMESTAMP_COLUMN DATETIME(6) Yes true \N
TIME_COLUMN TEXT Yes true \N
VARCHARPHIC_COLUMN TEXT Yes true \N
VARCHAR_COLUMN VARCHAR(255) Yes true \N
BIGINT_COLUMN bigint Yes true \N
CHAR_COLUMN character(255) Yes true \N
CHAR_VARYING_COLUMN varchar(255) Yes true \N
CLOB_COLUMN text Yes true \N
DATE_COLUMN date Yes true \N
DECFLOAT_COLUMN decimal(34,0) Yes true \N
DECIMAL_COLUMN decimal(31,10) Yes true \N
DOUBLE_COLUMN double Yes true \N
DOUBLE_PRECISION_COLUMN double Yes true \N
FLOAT_COLUMN double Yes true \N
ID_COLUMN int No true \N
INT_COLUMN int Yes true \N
LONG_VARCHARPHIC_COLUMN text Yes true \N
LONG_VARCHAR_COLUMN varchar(32700) Yes true \N
NUMERIC_COLUMN decimal(5,0) Yes true \N
REAL_COLUMN float Yes true \N
SMALLINT_COLUMN smallint Yes true \N
TIMESTAMP_COLUMN datetime(6) Yes true \N
TIME_COLUMN text Yes true \N
VARCHARPHIC_COLUMN text Yes true \N
VARCHAR_COLUMN varchar(255) Yes true \N

-- !sample_table_select --
\N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N
123 1234567890.1234567890 1 12345.6789 12345.679 1.2345678901234567E9 1.2345678901234567E9 123 12345 123456789012345 Varchar text Varcharphic text Long varchar text Long varcharphic text Char varying text Char text 2024-01-24 2024-01-24T12:34:56.789 12:34:56 Sample CLOB text
123 1234567890.1234567890 1 12345.6789 12345.679 1.2345678901234567E9 1.2345678901234567E9 123 12345 123456789012345 中文一 中文二 中文三 中文四 中文五 中文六 2024-01-24 2024-01-24T12:34:56.789 12:34:56 中文七

-- !sample_table_select_tvf --
1 123 1234567890.1234567890 1 12345.6789 12345.679 1.2345678901234567E9 1.2345678901234567E9 123 12345 123456789012345 Varchar text Varcharphic text Long varchar text Long varcharphic text Char varying text Char text 2024-01-24 2024-01-24T12:34:56.789 12:34:56 Sample CLOB text
2 \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N
3 123 1234567890.1234567890 1 12345.6789 12345.679 1.2345678901234567E9 1.2345678901234567E9 123 12345 123456789012345 中文一 中文二 中文三 中文四 中文五 中文六 2024-01-24 2024-01-24T12:34:56.789 12:34:56 中文七

-- !sample_table_insert --
\N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N
\N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N
Expand Down Expand Up @@ -62,3 +67,6 @@ mysql
-- !select_xml --
1000 <catalog><book><author> Gambardella Matthew</author><title>XML Developers Guide</title><genre>Computer</genre><price>44.95</price><publish_date>2000-10-01</publish_date><description>An in-depth look at creating application\n with XML</description></book></catalog>

-- !select_xml_tvf --
1000 <catalog><book><author> Gambardella Matthew</author><title>XML Developers Guide</title><genre>Computer</genre><price>44.95</price><publish_date>2000-10-01</publish_date><description>An in-depth look at creating application\n with XML</description></book></catalog>

Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,10 @@ doris3 20
1 111 123 7456123.89 573 34 673.43 34.1264 60.0 23.231 99 9999 999999999 999999999999999999 999 99999 9999999999 9999999999999999999 1 china beijing alice abcdefghrjkmnopq 123.45 12300 0.0012345 2022-01-21T05:23:01 2019-11-12T20:33:57.999 2019-11-12T20:33:57.999998 2019-11-12T20:33:57.999996 2019-11-12T20:33:57.999997 223-9 12 10:23:1.123457
2 \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N

-- !select_all_types_tvf --
1 111 123 7456123.89 573 34 673.43 34.1264 60 23.231 99 9999 999999999 999999999999999999 999 99999 9999999999 9999999999999999999 1 china beijing alice abcdefghrjkmnopq 123.45 12300 0.0012345 2022-01-21T05:23:01 2019-11-12T20:33:57.999 2019-11-12T20:33:57.999998 2019-11-12T20:33:57.999996 2019-11-12T20:33:57.999997 223-9 12 10:23:1.123457
2 \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N

-- !ctas --
1 111 123 7456123.89 573 34 673.43 34.1264 60.0 23.231 99 9999 999999999 999999999999999999 999 99999 9999999999 9999999999999999999 1 china beijing alice abcdefghrjkmnopq 123.45 12300 0.0012345 2022-01-21T05:23:01 2019-11-12T20:33:57.999 2019-11-12T20:33:57.999998 2019-11-12T20:33:57.999996 2019-11-12T20:33:57.999997 223-9 12 10:23:1.123457
2 \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2234,6 +2234,10 @@ doris3 20
1 abc def 2022-10-11 1 2 3 2022-10-22T10:59:59 34.123 false 12.123456 10.16.10.14/32 10.16.10.14 ff:ff:ff:ff:ff:aa 1010101010 01010 1 {"id": 1} (1.0,1.0) {1.0,1.0,1.0} [(1.0,1.0),(2.0,2.0)] (2.0,2.0),(1.0,1.0) ((1.0,1.0),(2.0,2.0),(2.0,1.0)) ((1.0,1.0),(2.0,2.0),(2.0,1.0)) <(0.0,0.0),1.0>
2 \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N 2 \N \N \N \N \N \N \N \N

-- !select_all_types_tvf --
1 abc def 2022-10-11 1 2 3 2022-10-22T10:59:59 34.123 false 12.123456 10.16.10.14/32 10.16.10.14 ff:ff:ff:ff:ff:aa 1010101010 01010 1 {"id": 1} (1.0,1.0) {1.0,1.0,1.0} [(1.0,1.0),(2.0,2.0)] (2.0,2.0),(1.0,1.0) ((1.0,1.0),(2.0,2.0),(2.0,1.0)) ((1.0,1.0),(2.0,2.0),(2.0,1.0)) <(0.0,0.0),1.0>
2 \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N 2 \N \N \N \N \N \N \N \N

-- !ctas --
1 abc def 2022-10-11 1 2 3 2022-10-22T10:59:59 34.123 false 12.123456 10.16.10.14/32 10.16.10.14 ff:ff:ff:ff:ff:aa 1010101010 01010 1 {"id": 1} (1.0,1.0) {1.0,1.0,1.0} [(1.0,1.0),(2.0,2.0)] (2.0,2.0),(1.0,1.0) ((1.0,1.0),(2.0,2.0),(2.0,1.0)) ((1.0,1.0),(2.0,2.0),(2.0,1.0)) <(0.0,0.0),1.0>
2 \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N 2 \N \N \N \N \N \N \N \N
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,6 @@ sys
2 alice 19
3 bob 20

-- !filter4_old --
2 alice 19
3 bob 20

-- !id --
2

Expand Down Expand Up @@ -130,6 +126,10 @@ timestamp_col text Yes true \N
-- !query_timestamp --
1

-- !all_types_tvf --
1 doris 18 0 1 1 123.123 123.123 123.123 12345678901234567890123456789012345678 12345678901234567890123456789012345678 1234567890123456789012345678.0123456789 1234567890123456789012345678.0123456789 Make Doris Great! Make Doris Great! Make Doris Great! Make Doris Great! Make Doris Great! Make Doris Great! 2023-01-17 16:49:05.123 2023-01-17T16:49:05 2023-01-17T16:49:05.123456 2023-01-17T16:49 2023-01-17 16:49:05 +08:00 Make Doris Great! Make Doris Great! 922337203685477.5807 214748.3647 false
2 \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N \N

-- !sql --
db_accessadmin
db_backupoperator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ suite("test_db2_jdbc_catalog", "p0,external,db2,external_docker,external_docker_
"type"="jdbc",
"user"="db2inst1",
"password"="123456",
"jdbc_url" = "jdbc:db2://${externalEnvIp}:${db2_port}/doris:allowNextOnExhaustedResultSet=1;resultSetHoldability=1",
"jdbc_url" = "jdbc:db2://${externalEnvIp}:${db2_port}/doris:allowNextOnExhaustedResultSet=1;resultSetHoldability=1;",
"driver_url" = "${driver_url}",
"driver_class" = "com.ibm.db2.jcc.DB2Driver"
);"""
Expand All @@ -215,6 +215,8 @@ suite("test_db2_jdbc_catalog", "p0,external,db2,external_docker,external_docker_

order_qt_sample_table_select """ select * except(ID_COLUMN) from ${sample_table} order by 1; """

order_qt_sample_table_select_tvf """ select * from query('catalog' = 'db2_jdbc_catalog', 'query' = 'select * from DORIS_TEST.SAMPLE_TABLE;') order by 1; """

sql """INSERT INTO ${sample_table} (
numeric_column,
decimal_column,
Expand Down Expand Up @@ -263,6 +265,8 @@ suite("test_db2_jdbc_catalog", "p0,external,db2,external_docker,external_docker_

order_qt_select_xml "select * from TEST.BOOKS;"

order_qt_select_xml_tvf "select * from query('catalog' = '${catalog_name}', 'query' = 'select * from TEST.BOOKS;') order by 1;"

sql """ drop catalog if exists ${catalog_name} """

db2_docker "DROP TABLE IF EXISTS doris_test.sample_table;"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ suite("test_oracle_jdbc_catalog", "p0,external,oracle,external_docker,external_d
// test select all types
order_qt_select_all_types """select * from ${test_all_types}; """

order_qt_select_all_types_tvf """select * from query('catalog' = '${catalog_name}', 'query' ='select * from ${test_all_types}') order by 1; """

// test test ctas
sql """ drop table if exists internal.${internal_db_name}.${test_ctas} """
sql """ create table internal.${internal_db_name}.${test_ctas}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ suite("test_pg_jdbc_catalog", "p0,external,pg,external_docker,external_docker_pg
// test select all types
order_qt_select_all_types """select * from ${test_all_types}; """

order_qt_select_all_types_tvf """ select * from query('catalog' = '${catalog_name}', 'query' = 'select * from catalog_pg_test.${test_all_types};') order by 1"""

// test test ctas
sql """ drop table if exists internal.${internal_db_name}.${test_ctas} """
sql """ create table internal.${internal_db_name}.${test_ctas}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ suite("test_sqlserver_jdbc_catalog", "p0,external,sqlserver,external_docker,exte
order_qt_desc_timestamp """desc dbo.test_timestamp; """
order_qt_query_timestamp """select count(timestamp_col) from dbo.test_timestamp; """

order_qt_all_types_tvf """ select * from query('catalog' = '${catalog_name}', 'query' = 'select * from all_type;') order by 1"""

sql """ drop catalog if exists ${catalog_name} """

Expand Down

0 comments on commit bceebfc

Please sign in to comment.