This is an automated email from the ASF dual-hosted git repository.
zstan pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ignite-3.git
The following commit(s) were added to refs/heads/main by this push:
new bf8dca82da IGNITE-21982 Sql. Extend test coverage for SQL T021(BINARY
and VARBINARY data types). (#3813)
bf8dca82da is described below
commit bf8dca82da5d6335678a9aba6cf95f491deaae13
Author: Evgeniy Stanilovskiy <[email protected]>
AuthorDate: Mon May 27 09:15:24 2024 +0300
IGNITE-21982 Sql. Extend test coverage for SQL T021(BINARY and VARBINARY
data types). (#3813)
---
.../sql/function/blob/test_position.test | 48 ++++++++++++++++++++++
.../integrationTest/sql/types/blob/test_blob.test | 38 +++++++++++++++++
.../sql/types/blob/test_blob_cast.test | 2 +
3 files changed, 88 insertions(+)
diff --git
a/modules/sql-engine/src/integrationTest/sql/function/blob/test_position.test
b/modules/sql-engine/src/integrationTest/sql/function/blob/test_position.test
new file mode 100644
index 0000000000..6d724c4230
--- /dev/null
+++
b/modules/sql-engine/src/integrationTest/sql/function/blob/test_position.test
@@ -0,0 +1,48 @@
+# name: sql/function/blob/test_position.test
+# description: BLOB functions tests
+# feature: T021(BINARY and VARBINARY data types)
+# group: [blob]
+
+#sql standard, 6.30 <numeric value function> If <binary position expression>
is specified
+query T
+SELECT POSITION(x'03' IN x'0B03');
+----
+2
+
+query T
+SELECT POSITION(x'b0' IN x'0B03B0');
+----
+3
+
+query T
+SELECT POSITION(x'b0' IN x'0B03B0B0');
+----
+3
+
+query T
+SELECT POSITION(x'b0' IN x'0B03B0B0');
+----
+3
+
+query T
+SELECT POSITION(x'b0' IN x'0B03B0B0' FROM 4);
+----
+4
+
+query T
+SELECT POSITION(x'b0' IN x'0B03B0B0' FROM 100);
+----
+0
+
+query T
+SELECT POSITION(x'' IN x'0B03B0B0');
+----
+1
+
+query T
+SELECT POSITION(null IN x'0B03B0B0');
+----
+null
+
+statement error
+SELECT POSITION('a' IN x'0B03B0B0');
diff --git
a/modules/sql-engine/src/integrationTest/sql/types/blob/test_blob.test
b/modules/sql-engine/src/integrationTest/sql/types/blob/test_blob.test
index bfd3ea646e..37042782cd 100644
--- a/modules/sql-engine/src/integrationTest/sql/types/blob/test_blob.test
+++ b/modules/sql-engine/src/integrationTest/sql/types/blob/test_blob.test
@@ -1,5 +1,6 @@
# name: test/sql/types/blob/test_blob.test
# description: BLOB tests
+# feature: T021(BINARY and VARBINARY data types)
# group: [blob]
statement ok
@@ -87,3 +88,40 @@ SELECT CAST(x'0101' AS BINARY(0))
statement error: Length for type VARBINARY must be at least 1
SELECT CAST(x'0101' AS VARBINARY(0))
+statement ok
+CREATE TABLE all_blobs (c1 binary, c2 binary(10), c3 varbinary, c4
varbinary(10), c5 binary varying, c6 binary varying(10));
+
+statement ok
+INSERT INTO all_blobs VALUES (x'cc', x'ccaaffee', x'ccaaffee', x'ccaaffee',
x'ccaaffee', x'ccaaffee');
+
+query TTTTTT
+SELECT * FROM all_blobs;
+----
+cc ccaaffee ccaaffee ccaaffee ccaaffee ccaaffee
+
+statement ok
+DELETE FROM all_blobs
+
+skipif ignite3
+# https://issues.apache.org/jira/browse/IGNITE-22316
+# check standard section: <binary value expression> ::= <binary concatenation>
| <binary factor>
+query T
+SELECT x'12' || '10';
+----
+42
+
+query T
+select X'' || X'12'
+----
+12
+
+query T
+select X'11' || X'22';
+----
+1122
+
+query T
+select CAST(x'Aa' AS BINARY VARYING(1000));
+----
+aa
+
diff --git
a/modules/sql-engine/src/integrationTest/sql/types/blob/test_blob_cast.test
b/modules/sql-engine/src/integrationTest/sql/types/blob/test_blob_cast.test
index fb74587428..0c30e50a82 100644
--- a/modules/sql-engine/src/integrationTest/sql/types/blob/test_blob_cast.test
+++ b/modules/sql-engine/src/integrationTest/sql/types/blob/test_blob_cast.test
@@ -63,3 +63,5 @@ SELECT 1::bigint::VARBINARY
statement error
SELECT 1::decimal::VARBINARY
+statement error
+select CAST(x'Aa' AS integer);