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

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

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