You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by "lowka (via GitHub)" <gi...@apache.org> on 2025/03/19 14:07:38 UTC

[PR] IGNITE-24552: Failure upon creating a table with default TIMESTAMP column [ignite-3]

lowka opened a new pull request, #5450:
URL: https://github.com/apache/ignite-3/pull/5450

   
   ---
   
   Thank you for submitting the pull request.
   
   To streamline the review process of the patch and ensure better code quality
   we ask both an author and a reviewer to verify the following:
   
   ### The Review Checklist
   - [ ] **Formal criteria:** TC status, codestyle, mandatory documentation. Also make sure to complete the following:  
   \- There is a single JIRA ticket related to the pull request.  
   \- The web-link to the pull request is attached to the JIRA ticket.  
   \- The JIRA ticket has the Patch Available state.  
   \- The description of the JIRA ticket explains WHAT was made, WHY and HOW.  
   \- The pull request title is treated as the final commit message. The following pattern must be used: IGNITE-XXXX Change summary where XXXX - number of JIRA issue.
   - [ ] **Design:** new code conforms with the design principles of the components it is added to.
   - [ ] **Patch quality:** patch cannot be split into smaller pieces, its size must be reasonable.
   - [ ] **Code quality:** code is clean and readable, necessary developer documentation is added if needed.
   - [ ] **Tests code quality:** test set covers positive/negative scenarios, happy/edge cases. Tests are effective in terms of execution time and resources.
   
   ### Notes
   - [Apache Ignite Coding Guidelines](https://cwiki.apache.org/confluence/display/IGNITE/Java+Code+Style+Guide)


-- 
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: notifications-unsubscribe@ignite.apache.org

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


Re: [PR] IGNITE-24552: Failure upon creating a table with default TIMESTAMP column [ignite-3]

Posted by "lowka (via GitHub)" <gi...@apache.org>.
lowka commented on code in PR #5450:
URL: https://github.com/apache/ignite-3/pull/5450#discussion_r2016145654


##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/prepare/ddl/DdlSqlToCommandConverter.java:
##########
@@ -562,25 +555,40 @@ private CatalogCommand convertAlterColumn(IgniteSqlAlterColumn alterColumnNode,
             builder.nullable(!notNull);
         }
 
-        if (alterColumnNode.expression() != null) {
-            SqlNode expr = alterColumnNode.expression();
+        SqlNode defaultExpr = alterColumnNode.expression();
+        if (defaultExpr != null) {
+            String columnName = alterColumnNode.name().getSimple();
+            Pair<DefaultValue.Type, DeferredDefaultValue> resolveDfltFunc = convertDefaultExpression(defaultExpr, columnName, relType);
 
-            DeferredDefaultValue resolveDfltFunc;
+            if (resolveDfltFunc.getFirst() != Type.CONSTANT) {
+                throw new SqlException(STMT_VALIDATION_ERR, "Cannot set functional default: " + defaultExpr);

Review Comment:
   I agree with you on both points. 



-- 
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: notifications-unsubscribe@ignite.apache.org

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


Re: [PR] IGNITE-24552: Failure upon creating a table with default TIMESTAMP column [ignite-3]

Posted by "korlov42 (via GitHub)" <gi...@apache.org>.
korlov42 merged PR #5450:
URL: https://github.com/apache/ignite-3/pull/5450


-- 
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: notifications-unsubscribe@ignite.apache.org

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


Re: [PR] IGNITE-24552: Failure upon creating a table with default TIMESTAMP column [ignite-3]

Posted by "lowka (via GitHub)" <gi...@apache.org>.
lowka commented on code in PR #5450:
URL: https://github.com/apache/ignite-3/pull/5450#discussion_r2016862672


##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/prepare/ddl/DdlSqlToCommandConverter.java:
##########
@@ -562,25 +555,40 @@ private CatalogCommand convertAlterColumn(IgniteSqlAlterColumn alterColumnNode,
             builder.nullable(!notNull);
         }
 
-        if (alterColumnNode.expression() != null) {
-            SqlNode expr = alterColumnNode.expression();
+        SqlNode defaultExpr = alterColumnNode.expression();
+        if (defaultExpr != null) {
+            String columnName = alterColumnNode.name().getSimple();
+            Pair<DefaultValue.Type, DeferredDefaultValue> resolveDfltFunc = convertDefaultExpression(defaultExpr, columnName, relType);
 
-            DeferredDefaultValue resolveDfltFunc;
+            if (resolveDfltFunc.getFirst() != Type.CONSTANT) {
+                throw new SqlException(STMT_VALIDATION_ERR, "Cannot set functional default: " + defaultExpr);

Review Comment:
   Fixed.



-- 
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: notifications-unsubscribe@ignite.apache.org

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


Re: [PR] IGNITE-24552: Failure upon creating a table with default TIMESTAMP column [ignite-3]

Posted by "korlov42 (via GitHub)" <gi...@apache.org>.
korlov42 commented on code in PR #5450:
URL: https://github.com/apache/ignite-3/pull/5450#discussion_r2016117054


##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/prepare/ddl/DdlSqlToCommandConverter.java:
##########
@@ -562,25 +555,40 @@ private CatalogCommand convertAlterColumn(IgniteSqlAlterColumn alterColumnNode,
             builder.nullable(!notNull);
         }
 
-        if (alterColumnNode.expression() != null) {
-            SqlNode expr = alterColumnNode.expression();
+        SqlNode defaultExpr = alterColumnNode.expression();
+        if (defaultExpr != null) {
+            String columnName = alterColumnNode.name().getSimple();
+            Pair<DefaultValue.Type, DeferredDefaultValue> resolveDfltFunc = convertDefaultExpression(defaultExpr, columnName, relType);
 
-            DeferredDefaultValue resolveDfltFunc;
+            if (resolveDfltFunc.getFirst() != Type.CONSTANT) {
+                throw new SqlException(STMT_VALIDATION_ERR, "Cannot set functional default: " + defaultExpr);

Review Comment:
   The message is quite confusing: one might think the problem in particular expression while we don't allow assignment of non-constant default after table creation. Let's change it to something like "Non-constant default cannot be assigned after table creation" or something like that.
   
   BTW, does It make sense to move this validation to catalog?



-- 
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: notifications-unsubscribe@ignite.apache.org

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