Skip to content

Commit 81f3c98

Browse files
committed
add cases
1 parent 164651a commit 81f3c98

File tree

4 files changed

+69
-0
lines changed

4 files changed

+69
-0
lines changed

regression-test/data/external_table_p0/jdbc/test_db2_jdbc_catalog.out

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,15 @@ mysql
7070
-- !select_xml_tvf --
7171
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>
7272

73+
-- !varbinary_desc --
74+
BLOB_COLUMN varbinary(1048576) Yes true \N
75+
ID_COLUMN int No true \N
76+
77+
-- !varbinary_select --
78+
1 0x48656C6C6F20576F726C6421
79+
80+
-- !varbinary_select_after_insert --
81+
1 0x48656C6C6F20576F726C6421
82+
2 0x48656C6C6F20576F726C6421
83+
3 \N
84+

regression-test/data/external_table_p0/jdbc/test_sqlserver_jdbc_catalog.out

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,3 +149,20 @@ information_schema
149149
mysql
150150
sys
151151

152+
-- !desc --
153+
binary_value varbinary(20) Yes true \N
154+
bit_value boolean No true \N
155+
id int No true \N
156+
varbinary_value varbinary(20) Yes true \N
157+
158+
-- !query --
159+
1 false 0x4D616B6520446F72697320477265617421000000 0x4D616B6520446F72697320477265617421
160+
2 true 0x4D616B6520446F72697320477265617421000000 0x4D616B6520446F72697320477265617421
161+
3 true 0x4D616B6520446F72697320477265617421000000 0x4D616B6520446F72697320477265617421
162+
163+
-- !query_after_insert --
164+
1 false 0x4D616B6520446F72697320477265617421000000 0x4D616B6520446F72697320477265617421
165+
2 true 0x4D616B6520446F72697320477265617421000000 0x4D616B6520446F72697320477265617421
166+
3 true 0x4D616B6520446F72697320477265617421000000 0x4D616B6520446F72697320477265617421
167+
4 true 0xABAB000000000000000000000000000000000000 0xAB
168+

regression-test/suites/external_table_p0/jdbc/test_db2_jdbc_catalog.groovy

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,40 @@ suite("test_db2_jdbc_catalog", "p0,external,db2,external_docker,external_docker_
269269

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

272+
273+
db2_docker """CREATE TABLE doris_test.VARBINARY_TABLE (
274+
id_column INT GENERATED ALWAYS AS IDENTITY,
275+
blob_column BLOB
276+
);"""
277+
278+
db2_docker """INSERT INTO doris_test.VARBINARY_TABLE (
279+
blob_column
280+
) VALUES (
281+
BLOB(X'48656C6C6F20576F726C6421') -- 'Hello World!'
282+
);"""
283+
284+
sql """drop catalog if exists test_db2_varbinary """
285+
286+
sql """create catalog if not exists test_db2_varbinary properties(
287+
"type"="jdbc",
288+
"user"="db2inst1",
289+
"password"="123456",
290+
"jdbc_url" = "jdbc:db2://${externalEnvIp}:${db2_port}/doris:allowNextOnExhaustedResultSet=1;resultSetHoldability=1;",
291+
"driver_url" = "${driver_url}",
292+
"driver_class" = "com.ibm.db2.jcc.DB2Driver",
293+
"enable.mapping.varbinary" = "true"
294+
);"""
295+
296+
sql """switch test_db2_varbinary"""
297+
sql """ use ${ex_db_name}"""
298+
order_qt_varbinary_desc """ desc VARBINARY_TABLE; """
299+
order_qt_varbinary_select """ select * from VARBINARY_TABLE order by ID_COLUMN;"""
300+
sql """ insert into VARBINARY_TABLE (blob_column) values (X'48656C6C6F20576F726C6421'); """
301+
sql """ insert into VARBINARY_TABLE (blob_column) values (NULL); """
302+
order_qt_varbinary_select_after_insert """ select * from VARBINARY_TABLE order by ID_COLUMN; """
303+
272304
db2_docker "DROP TABLE IF EXISTS doris_test.sample_table;"
305+
db2_docker "DROP TABLE IF EXISTS doris_test.VARBINARY_TABLE;"
273306
db2_docker "DROP SCHEMA doris_test restrict;"
274307
db2_docker "DROP TABLE IF EXISTS test.books;"
275308
db2_docker "DROP SCHEMA test restrict;"

regression-test/suites/external_table_p0/jdbc/test_sqlserver_jdbc_catalog.groovy

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,13 @@ suite("test_sqlserver_jdbc_catalog", "p0,external,sqlserver,external_docker,exte
9898

9999
order_qt_sql """ show databases from ${catalog_name} """
100100

101+
sql """ switch ${catalog_name} """
102+
sql """ use ${ex_db_name} """
103+
104+
order_qt_desc """ desc test_binary; """
105+
order_qt_query """ select * from test_binary order by id; """
106+
sql """ insert into test_binary values (4, 4, X"ABAB", X"AB") """
107+
order_qt_query_after_insert """ select * from test_binary order by id; """
101108
sql """ drop catalog if exists ${catalog_name} """
102109
}
103110
}

0 commit comments

Comments
 (0)