morningman commented on a change in pull request #6030:
URL: https://github.com/apache/incubator-doris/pull/6030#discussion_r654104497



##########
File path: fe/fe-core/src/main/java/org/apache/doris/load/DeleteHandler.java
##########
@@ -483,6 +484,24 @@ private SlotRef getSlotRef(Predicate condition) {
         }
         return slotRef;
     }
+    private void checkDateTime(PrimitiveType type, String value) throws 
DdlException {
+         if (type == PrimitiveType.DATE) {
+            String re = "^(\\d{4})-(0[1-9]|1[012])-([123]0|[012][1-9]|31)$";
+            if (! Pattern.matches(re, value)) {
+                throw new DdlException("Invalid column value[" + value + "], 
must like 'yyyy-MM-dd'");
+            }
+        } else if (type == PrimitiveType.DATETIME) {
+            String re = "^(\\d{4})-(0[1-9]|1[012])-([123]0|[012][1-9]|31) 
([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])$";
+            if (! Pattern.matches(re, value)) {

Review comment:
       ```suggestion
               if (!Pattern.matches(re, value)) {
   ```

##########
File path: fe/fe-core/src/main/java/org/apache/doris/load/DeleteHandler.java
##########
@@ -483,6 +484,24 @@ private SlotRef getSlotRef(Predicate condition) {
         }
         return slotRef;
     }
+    private void checkDateTime(PrimitiveType type, String value) throws 
DdlException {
+         if (type == PrimitiveType.DATE) {
+            String re = "^(\\d{4})-(0[1-9]|1[012])-([123]0|[012][1-9]|31)$";
+            if (! Pattern.matches(re, value)) {
+                throw new DdlException("Invalid column value[" + value + "], 
must like 'yyyy-MM-dd'");
+            }
+        } else if (type == PrimitiveType.DATETIME) {
+            String re = "^(\\d{4})-(0[1-9]|1[012])-([123]0|[012][1-9]|31) 
([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])$";
+            if (! Pattern.matches(re, value)) {
+                throw new DdlException("Invalid column value[" + value + "], 
must like 'yyyy-MM-dd HH:mm:ss'");
+            }
+        } else if (type == PrimitiveType.TIME) {
+            String re = "^([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])$";
+            if (! Pattern.matches(re, value)) {

Review comment:
       ```suggestion
               if (!Pattern.matches(re, value)) {
   ```

##########
File path: fe/fe-core/src/main/java/org/apache/doris/load/DeleteHandler.java
##########
@@ -483,6 +484,24 @@ private SlotRef getSlotRef(Predicate condition) {
         }
         return slotRef;
     }
+    private void checkDateTime(PrimitiveType type, String value) throws 
DdlException {
+         if (type == PrimitiveType.DATE) {
+            String re = "^(\\d{4})-(0[1-9]|1[012])-([123]0|[012][1-9]|31)$";
+            if (! Pattern.matches(re, value)) {

Review comment:
       ```suggestion
               if (!Pattern.matches(re, value)) {
   ```




-- 
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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to