You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2020/07/07 05:57:41 UTC

[GitHub] [incubator-doris] wutiangan commented on a change in pull request #4006: [Feature] Support InPredicate in delete statement

wutiangan commented on a change in pull request #4006:
URL: https://github.com/apache/incubator-doris/pull/4006#discussion_r450627407



##########
File path: fe/src/main/java/org/apache/doris/load/DeleteHandler.java
##########
@@ -569,6 +587,19 @@ private void checkDeleteV2(OlapTable table, Partition partition, List<Predicate>
                     sb.append(" IS NULL");
                 }
                 deleteConditions.add(sb.toString());
+            } else if (condition instanceof InPredicate) {
+                InPredicate inPredicate = (InPredicate) condition;
+                SlotRef slotRef = (SlotRef) inPredicate.getChild(0);
+                String columnName = slotRef.getColumnName();
+                StringBuilder strBuilder = new StringBuilder();
+                String notStr = inPredicate.isNotIn() ? "NOT " : "";
+                strBuilder.append(columnName).append(" " + notStr + "IN (");
+                for (int i = 1; i <= inPredicate.getInElementNum(); ++i) {
+                    strBuilder.append(inPredicate.getChild(i).toSql());
+                    strBuilder.append((i + 1 != inPredicate.getInElementNum()) ? ", " : "");

Review comment:
       the last loop is “ i == inPredicate.getInElementNum()”, should " i + 1 != inPredicate.getInElementNum()" modify "i != inPredicate.getInElementNum()"?




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

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



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org