You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by "Vladsz83 (via GitHub)" <gi...@apache.org> on 2024/01/12 17:34:54 UTC

Re: [PR] IGNITE-21171 SQL Calcite: Fix column nullability for data types with … [ignite]

Vladsz83 commented on code in PR #11154:
URL: https://github.com/apache/ignite/pull/11154#discussion_r1450742074


##########
modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/TableDdlIntegrationTest.java:
##########
@@ -496,6 +496,35 @@ public void createTableAsSelectFromDistributedTable() {
         assertEquals(100L, sql("select count(*) from my_table2").get(0).get(0));
     }
 
+    /**
+     * Creates table with nullabale/not nullable columns and checks nullability.
+     */
+    @Test
+    public void createTableWithNullability() {
+        List<String> dataTypes = F.asList("INT", "FLOAT", "DOUBLE", "DECIMAL", "DECIMAL(10,2)", "VARCHAR",
+            "VARCHAR(10)", "CHAR", "CHAR(10)", "DATE", "TIME", "TIMESTAMP", "BINARY", "BINARY(10)", "VARBINARY",
+            "VARBINARY(10)", "UUID", "OTHER");
+
+        for (String dataType : dataTypes) {
+            try {
+                sql("CREATE TABLE my_table (id INT PRIMARY KEY, val " + dataType + ')');
+                sql("INSERT INTO my_table(id, val) VALUES (0, NULL)");
+            }
+            finally {
+                sql("DROP TABLE my_table");
+            }
+
+            try {
+                sql("CREATE TABLE my_table (id INT PRIMARY KEY, val " + dataType + " NOT NULL)");
+                assertThrows("INSERT INTO my_table(id, val) VALUES (0, NULL)", IgniteSQLException.class,

Review Comment:
   Does this duplicate alterTableAddNotNullColumn() or alterTableDropAddColumn() ?



-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org