AMashenkov commented on code in PR #1629:
URL: https://github.com/apache/ignite-3/pull/1629#discussion_r1114780075
##########
modules/runner/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ItDataTypesTest.java:
##########
@@ -210,6 +214,120 @@ public void testDateTime() {
.returns("2021-11-07 01:30:00").check();
}
+ /** Test Binary type. */
+ @Test
+ public void testBinarySql() {
+ sql("CREATE TABLE tbl(b BINARY(3) PRIMARY KEY, v VARBINARY)");
+ byte[] val = {1, 2, 3};
+
+ // From parameters to internal, from internal to store, from store to
internal and from internal to user.
+ sql("INSERT INTO tbl VALUES (?, ?)", val, val);
+
+ List<List<Object>> res = sql("SELECT b, v FROM tbl");
+
+ assertEquals(1, res.size());
+ assertEquals(2, res.get(0).size());
+ assertTrue(Objects.deepEquals(val, res.get(0).get(0)));
+ assertTrue(Objects.deepEquals(val, res.get(0).get(1)));
+
+ sql("DELETE FROM tbl");
+
+ // From literal to internal, from internal to store, from store to
internal and from internal to user.
+ sql("INSERT INTO tbl VALUES (x'1A2B3C', x'AABBCC')");
+
+ res = sql("SELECT b, v FROM tbl");
+
+ assertEquals(1, res.size());
+ assertEquals(2, res.get(0).size());
+ assertTrue(Objects.deepEquals(new byte[]{0x1A, 0x2B, 0x3C},
res.get(0).get(0)));
+ assertTrue(Objects.deepEquals(new byte[]{(byte) 0xAA, (byte) 0xBB,
(byte) 0xCC}, res.get(0).get(1)));
+ }
+
+ /** Test Aggregation functions for Binary type. */
+ @Test
+ public void testBinaryAggregation() {
+ sql("CREATE TABLE tbl(p int PRIMARY KEY,b varbinary)");
+ sql("INSERT INTO tbl VALUES (1, NULL)");
+ sql("INSERT INTO tbl VALUES (2, x'010203')");
+ sql("INSERT INTO tbl VALUES (3, x'040506')");
Review Comment:
Can we check also
* binary of different length
* x'01' and x'FF'
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]