mymeiyi commented on code in PR #30512:
URL: https://github.com/apache/doris/pull/30512#discussion_r1477168640


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java:
##########
@@ -2495,8 +2495,22 @@ public ColumnDefinition visitColumnDef(ColumnDefContext 
ctx) {
         //comment should remove '\' and '(") at the beginning and end
         String comment = ctx.comment != null ? 
ctx.comment.getText().substring(1, ctx.comment.getText().length() - 1)
                 .replace("\\", "") : "";
-        boolean isAutoInc = ctx.AUTO_INCREMENT() != null;
-        return new ColumnDefinition(colName, colType, isKey, aggType, 
!isNotNull, isAutoInc, defaultValue,
+        long autoIncInitValue = -1;
+        if (ctx.AUTO_INCREMENT() != null) {
+            if (ctx.autoIncInitValue != null) {
+                // AUTO_INCREMENT(Value) Value >= 0.
+                autoIncInitValue = 
Long.valueOf(ctx.autoIncInitValue.getText());
+                if (autoIncInitValue < 0) {
+                    throw new AnalysisException("AUTO_INCREMENT start value 
can not be negative.");
+                }
+            } else {
+                // AUTO_INCREMENT default 1.
+                autoIncInitValue = Long.valueOf(1);
+            }
+        } else {
+            autoIncInitValue = Long.valueOf(-1);

Review Comment:
   The else can be removed



-- 
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: commits-unsubscr...@doris.apache.org

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


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

Reply via email to