JackieTien97 commented on code in PR #14217:
URL: https://github.com/apache/iotdb/pull/14217#discussion_r1860081845


##########
integration-test/src/test/java/org/apache/iotdb/relational/it/db/it/IoTDBDeletionTableIT.java:
##########
@@ -570,6 +571,52 @@ public void testMultiDevice() throws SQLException {
     cleanData(testNum);
   }
 
+  @Test
+  public void testDeviceIdWithNull() throws SQLException {
+    int testNum = 14;
+    try (Connection connection = 
EnvFactory.getEnv().getConnection(BaseEnv.TABLE_SQL_DIALECT);
+        Statement statement = connection.createStatement()) {
+      statement.execute("use test");
+      statement.execute(
+          "create table t" + testNum + " (id1 string id, id2 string id, s1 
int32 measurement)");
+      // id1 is null for this record
+      statement.execute("insert into t" + testNum + " (time, id2, s1) values 
(1, '1', 1)");
+      statement.execute("insert into t" + testNum + " (time, id2, s1) values 
(2, '', 2)");
+      statement.execute("flush");
+
+      statement.execute("delete from t" + testNum + " where id1 = NULL and 
time <= 1");

Review Comment:
   should be id1 IS NULL



##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/AnalyzeUtils.java:
##########
@@ -540,13 +547,14 @@ private static IDPredicate getIdPredicate(
     String rightHandValue;
     if (right instanceof StringLiteral) {
       rightHandValue = ((StringLiteral) right).getValue();
+    } else if (right instanceof NullLiteral) {
+      rightHandValue = null;

Review Comment:
   result of XXX = NULL is NULL, so in such case, we should never delete any 
rows.



-- 
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]

Reply via email to