alex-plekhanov commented on a change in pull request #9826:
URL: https://github.com/apache/ignite/pull/9826#discussion_r820070744
##########
File path:
modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/DataTypesTest.java
##########
@@ -32,6 +33,77 @@
* Test SQL data types.
*/
public class DataTypesTest extends AbstractBasicIntegrationTest {
+ /** Tests UUID without index. */
+ @Test
+ public void testUUIDWithoutIndex() {
+ testUUID(false);
+ }
+
+ /** Tests UUID with the index. */
+ @Test
+ public void testUUIDWithIndex() {
+ testUUID(true);
+ }
+
+ /** Tests UUID type. */
+ private void testUUID(boolean indexed) {
+ try {
+ executeSql("CREATE TABLE t(id INT, name VARCHAR(255), uid UUID,
primary key (id))");
+
+ if (indexed)
+ executeSql("CREATE INDEX uuid_idx ON t (uid);");
+
+ executeSql("INSERT INTO t VALUES (1,
'fd10556e-fc27-4a99-b5e4-89b8344cb3ce', " +
+ "'9e120341-627f-32be-8393-58b5d655b751')");
+ // Name == UUID
+ executeSql("INSERT INTO t VALUES (2,
'123e4567-e89b-12d3-a456-426614174000', " +
+ "'123e4567-e89b-12d3-a456-426614174000')");
+
+ assertQuery("SELECT * FROM t")
+ .returns(1, "fd10556e-fc27-4a99-b5e4-89b8344cb3ce",
UUID.fromString("9e120341-627f-32be-8393-58b5d655b751"))
+ .returns(2, "123e4567-e89b-12d3-a456-426614174000",
UUID.fromString("123e4567-e89b-12d3-a456-426614174000"))
+ .check();
+
+ assertQuery("SELECT * FROM t WHERE uid <
'123e4567-e89b-12d3-a456-426614174000'")
+ .returns(1, "fd10556e-fc27-4a99-b5e4-89b8344cb3ce",
UUID.fromString("9e120341-627f-32be-8393-58b5d655b751"))
+ .check();
+
+ assertQuery("SELECT * FROM t WHERE
'123e4567-e89b-12d3-a456-426614174000' > uid")
+ .returns(1, "fd10556e-fc27-4a99-b5e4-89b8344cb3ce",
UUID.fromString("9e120341-627f-32be-8393-58b5d655b751"))
+ .check();
+
+ assertQuery("SELECT * FROM t WHERE name = uid")
+ .returns(2, "123e4567-e89b-12d3-a456-426614174000",
UUID.fromString("123e4567-e89b-12d3-a456-426614174000"))
+ .check();
+
+ assertQuery("SELECT * FROM t WHERE name != uid")
+ .returns(1, "fd10556e-fc27-4a99-b5e4-89b8344cb3ce",
UUID.fromString("9e120341-627f-32be-8393-58b5d655b751"))
+ .check();
+
+ assertQuery("SELECT count(*), uid FROM t group by uid order by
uid")
Review comment:
Please add also min/max aggregation test (`SELECT min(uid), max(uid)
FROM t`). `Accumulators` class should be fixed, see `VarBinaryMinMax` as an
example (perhaps we should generalize `VarBinaryMinMax` to avoid boilerplate
code).
--
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]