You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2021/11/11 20:05:39 UTC

[GitHub] [ignite-3] sashapolo opened a new pull request #445: IGNITE-15884 Make TableIndexConfigurationSchema polymorphic

sashapolo opened a new pull request #445:
URL: https://github.com/apache/ignite-3/pull/445


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


-- 
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] ibessonov merged pull request #445: IGNITE-15884 Make TableIndexConfigurationSchema polymorphic

Posted by GitBox <gi...@apache.org>.
ibessonov merged pull request #445:
URL: https://github.com/apache/ignite-3/pull/445


   


-- 
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 pull request #445: IGNITE-15884 Make TableIndexConfigurationSchema polymorphic

Posted by GitBox <gi...@apache.org>.
tkalkirill commented on pull request #445:
URL: https://github.com/apache/ignite-3/pull/445#issuecomment-970267371


   Looks good.


-- 
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 change in pull request #445: IGNITE-15884 Make TableIndexConfigurationSchema polymorphic

Posted by GitBox <gi...@apache.org>.
tkalkirill commented on a change in pull request #445:
URL: https://github.com/apache/ignite-3/pull/445#discussion_r749616346



##########
File path: modules/configuration/src/main/java/org/apache/ignite/internal/configuration/util/ConfigurationNotificationsUtil.java
##########
@@ -662,69 +673,82 @@ public Void visitNamedListNode(String key, NamedListNode<?> newNamedList) {
      */
     private static Collection<DynamicConfiguration<InnerNode, ?>> mergeAnyConfigs(
             Collection<DynamicConfiguration<InnerNode, ?>> anyConfigs,
-            DynamicConfiguration<InnerNode, ?> anyConfig
+            @Nullable DynamicConfiguration<InnerNode, ?> anyConfig
     ) {
-        if (anyConfigs.isEmpty()) {
-            return List.of(anyConfig);
-        } else {
-            Collection<DynamicConfiguration<InnerNode, ?>> res = new ArrayList<>(anyConfigs.size() + 1);
-            
-            res.addAll(anyConfigs);
-            res.add(anyConfig);
-            
-            return res;
-        }
+        return Stream.concat(anyConfigs.stream(), Stream.of(anyConfig))

Review comment:
       I suggest not using streams here.




-- 
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] sashapolo commented on a change in pull request #445: IGNITE-15884 Make TableIndexConfigurationSchema polymorphic

Posted by GitBox <gi...@apache.org>.
sashapolo commented on a change in pull request #445:
URL: https://github.com/apache/ignite-3/pull/445#discussion_r750068433



##########
File path: modules/configuration/src/main/java/org/apache/ignite/internal/configuration/util/ConfigurationNotificationsUtil.java
##########
@@ -662,69 +673,82 @@ public Void visitNamedListNode(String key, NamedListNode<?> newNamedList) {
      */
     private static Collection<DynamicConfiguration<InnerNode, ?>> mergeAnyConfigs(
             Collection<DynamicConfiguration<InnerNode, ?>> anyConfigs,
-            DynamicConfiguration<InnerNode, ?> anyConfig
+            @Nullable DynamicConfiguration<InnerNode, ?> anyConfig
     ) {
-        if (anyConfigs.isEmpty()) {
-            return List.of(anyConfig);
-        } else {
-            Collection<DynamicConfiguration<InnerNode, ?>> res = new ArrayList<>(anyConfigs.size() + 1);
-            
-            res.addAll(anyConfigs);
-            res.add(anyConfig);
-            
-            return res;
-        }
+        return Stream.concat(anyConfigs.stream(), Stream.of(anyConfig))

Review comment:
       Unfortunately it can't: `anyConfigs` can contain `null`




-- 
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] sashapolo commented on a change in pull request #445: IGNITE-15884 Make TableIndexConfigurationSchema polymorphic

Posted by GitBox <gi...@apache.org>.
sashapolo commented on a change in pull request #445:
URL: https://github.com/apache/ignite-3/pull/445#discussion_r750059840



##########
File path: modules/configuration/src/main/java/org/apache/ignite/internal/configuration/util/ConfigurationNotificationsUtil.java
##########
@@ -662,69 +673,82 @@ public Void visitNamedListNode(String key, NamedListNode<?> newNamedList) {
      */
     private static Collection<DynamicConfiguration<InnerNode, ?>> mergeAnyConfigs(
             Collection<DynamicConfiguration<InnerNode, ?>> anyConfigs,
-            DynamicConfiguration<InnerNode, ?> anyConfig
+            @Nullable DynamicConfiguration<InnerNode, ?> anyConfig
     ) {
-        if (anyConfigs.isEmpty()) {
-            return List.of(anyConfig);
-        } else {
-            Collection<DynamicConfiguration<InnerNode, ?>> res = new ArrayList<>(anyConfigs.size() + 1);
-            
-            res.addAll(anyConfigs);
-            res.add(anyConfig);
-            
-            return res;
-        }
+        return Stream.concat(anyConfigs.stream(), Stream.of(anyConfig))

Review comment:
       Code with streams:
   ```
   return Stream.concat(anyConfigs.stream(), Stream.of(anyConfig))
           .filter(Objects::nonNull)
           .collect(Collectors.toList());
   ```
   Code without streams:
   ```
   var mergedConfigs = new ArrayList<DynamicConfiguration<InnerNode, ?>>(anyConfigs.size() + 1);
   
   for (DynamicConfiguration<InnerNode, ?> config : anyConfigs) {
       if (config != null) {
           mergedConfigs.add(config);
       }
   }
   
   if (anyConfig != null) {
       mergedConfigs.add(anyConfig);
   }
   
   return mergedConfigs;
   ```
   I think using streams is quite useful here        




-- 
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 pull request #445: IGNITE-15884 Make TableIndexConfigurationSchema polymorphic

Posted by GitBox <gi...@apache.org>.
tkalkirill commented on pull request #445:
URL: https://github.com/apache/ignite-3/pull/445#issuecomment-969924646


   Question: are index defaults necessary?


-- 
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] sashapolo commented on a change in pull request #445: IGNITE-15884 Make TableIndexConfigurationSchema polymorphic

Posted by GitBox <gi...@apache.org>.
sashapolo commented on a change in pull request #445:
URL: https://github.com/apache/ignite-3/pull/445#discussion_r750049356



##########
File path: modules/configuration/src/main/java/org/apache/ignite/internal/configuration/util/ConfigurationNotificationsUtil.java
##########
@@ -662,69 +673,82 @@ public Void visitNamedListNode(String key, NamedListNode<?> newNamedList) {
      */
     private static Collection<DynamicConfiguration<InnerNode, ?>> mergeAnyConfigs(
             Collection<DynamicConfiguration<InnerNode, ?>> anyConfigs,
-            DynamicConfiguration<InnerNode, ?> anyConfig
+            @Nullable DynamicConfiguration<InnerNode, ?> anyConfig
     ) {
-        if (anyConfigs.isEmpty()) {
-            return List.of(anyConfig);
-        } else {
-            Collection<DynamicConfiguration<InnerNode, ?>> res = new ArrayList<>(anyConfigs.size() + 1);
-            
-            res.addAll(anyConfigs);
-            res.add(anyConfig);
-            
-            return res;
-        }
+        return Stream.concat(anyConfigs.stream(), Stream.of(anyConfig))

Review comment:
       why not?




-- 
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 change in pull request #445: IGNITE-15884 Make TableIndexConfigurationSchema polymorphic

Posted by GitBox <gi...@apache.org>.
tkalkirill commented on a change in pull request #445:
URL: https://github.com/apache/ignite-3/pull/445#discussion_r750065124



##########
File path: modules/configuration/src/main/java/org/apache/ignite/internal/configuration/util/ConfigurationNotificationsUtil.java
##########
@@ -662,69 +673,82 @@ public Void visitNamedListNode(String key, NamedListNode<?> newNamedList) {
      */
     private static Collection<DynamicConfiguration<InnerNode, ?>> mergeAnyConfigs(
             Collection<DynamicConfiguration<InnerNode, ?>> anyConfigs,
-            DynamicConfiguration<InnerNode, ?> anyConfig
+            @Nullable DynamicConfiguration<InnerNode, ?> anyConfig
     ) {
-        if (anyConfigs.isEmpty()) {
-            return List.of(anyConfig);
-        } else {
-            Collection<DynamicConfiguration<InnerNode, ?>> res = new ArrayList<>(anyConfigs.size() + 1);
-            
-            res.addAll(anyConfigs);
-            res.add(anyConfig);
-            
-            return res;
-        }
+        return Stream.concat(anyConfigs.stream(), Stream.of(anyConfig))

Review comment:
       I think it might be something like:
   ```
           if (anyConfig == null)
               return anyConfigs;
           else if (anyConfigs.isEmpty())
               return List.of(anyConfig);
           else {
               List<DynamicConfiguration<InnerNode, ?>> res = new ArrayList<>(anyConfigs.size() + 1);
               
               res.addAll(anyConfigs);
               res.add(anyConfig);
               
               return res;
           }
   ```




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