You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ko...@apache.org on 2023/01/10 16:03:53 UTC

[ignite-3] branch main updated: [IGNITE-17972] SQL. Incorrect error message for explicit NULL values for NON NULL column (#1489)

This is an automated email from the ASF dual-hosted git repository.

korlov 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 9e46d58d56 [IGNITE-17972] SQL. Incorrect error message for explicit NULL values for NON NULL column (#1489)
9e46d58d56 is described below

commit 9e46d58d56c655f65c9b027bb6feb392ffbe54ab
Author: Max Zhuravkov <sh...@gmail.com>
AuthorDate: Tue Jan 10 20:03:47 2023 +0400

    [IGNITE-17972] SQL. Incorrect error message for explicit NULL values for NON NULL column (#1489)
---
 .../apache/ignite/internal/sql/engine/ItDmlTest.java | 11 +++++++++++
 .../calcite/runtime/CalciteResource.properties       | 20 ++++++++++++++++++++
 2 files changed, 31 insertions(+)

diff --git a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ItDmlTest.java b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ItDmlTest.java
index a77adc0454..e4c1005fb8 100644
--- a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ItDmlTest.java
+++ b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ItDmlTest.java
@@ -521,6 +521,17 @@ public class ItDmlTest extends AbstractBasicIntegrationTest {
         }
     }
 
+    @Test
+    public void testCheckNullValueErrorMessageForColumnWithDefaultValue() {
+        sql("CREATE TABLE tbl(key int DEFAULT 9 primary key, val varchar)");
+
+        var e = assertThrows(CalciteContextException.class,
+                () -> sql("INSERT INTO tbl (key, val) VALUES (NULL,'AA')"));
+
+        var expectedMessage = "From line 1, column 28 to line 1, column 45: Column 'KEY' does not allow NULLs";
+        assertEquals(expectedMessage, e.getMessage(), "error message");
+    }
+
     private void checkQueryResult(String sql, List<Object> expectedVals) {
         assertQuery(sql).returns(expectedVals.toArray()).check();
     }
diff --git a/modules/sql-engine/src/main/resources/org/apache/calcite/runtime/CalciteResource.properties b/modules/sql-engine/src/main/resources/org/apache/calcite/runtime/CalciteResource.properties
new file mode 100644
index 0000000000..140e83d36d
--- /dev/null
+++ b/modules/sql-engine/src/main/resources/org/apache/calcite/runtime/CalciteResource.properties
@@ -0,0 +1,20 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# Overrides messages used by Apache Calcite.
+#
+ColumnNotNullable=Column ''{0}'' does not allow NULLs