You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by "rpuch (via GitHub)" <gi...@apache.org> on 2023/06/02 08:20:40 UTC

[GitHub] [ignite-3] rpuch opened a new pull request, #2136: IGNITE-19630 Convert default value from Column to TableColumnDescriptor

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

   https://issues.apache.org/jira/browse/IGNITE-19630


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


[GitHub] [ignite-3] tkalkirill merged pull request #2136: IGNITE-19630 Convert default value from Column to TableColumnDescriptor

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


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


[GitHub] [ignite-3] tkalkirill commented on a diff in pull request #2136: IGNITE-19630 Convert default value from Column to TableColumnDescriptor

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


##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/schema/NonHistoricSchemas.java:
##########
@@ -104,7 +106,16 @@ public static TableColumnDescriptor columnDescriptor(Column column) {
                 column.name(),
                 column.type().spec().asColumnType(),
                 column.nullable(),
-                DefaultValue.constant(column.defaultValue())
+                defaultValue(column.defaultValueProvider())
         );
     }
+
+    private static DefaultValue defaultValue(DefaultValueProvider defaultValueProvider) {
+        if (defaultValueProvider instanceof FunctionalValueProvider) {
+            FunctionalValueProvider functionalProvider = (FunctionalValueProvider) defaultValueProvider;
+            return DefaultValue.functionCall(functionalProvider.name());
+        } else {
+            return DefaultValue.constant(defaultValueProvider.get());
+        }
+    }

Review Comment:
   ```suggestion
       private static DefaultValue defaultValue(DefaultValueProvider defaultValueProvider) {
           if (defaultValueProvider instanceof FunctionalValueProvider) {
               FunctionalValueProvider functionalProvider = (FunctionalValueProvider) defaultValueProvider;
               
               return DefaultValue.functionCall(functionalProvider.name());
           }
           
           return DefaultValue.constant(defaultValueProvider.get());
       }
   ```



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