You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2020/02/24 16:35:34 UTC

[GitHub] [openwhisk] markusthoemmes opened a new pull request #4833: Force filterKeys and mapValues to return a Map.

markusthoemmes opened a new pull request #4833: Force filterKeys and mapValues to return a Map.
URL: https://github.com/apache/openwhisk/pull/4833
 
 
   <!--- Provide a concise summary of your changes in the Title -->
   
   ## Description
   Scala 2.13 makes both of these return views rather than strict maps. We don't need view semantics in any of these places, so we're safe to use the proposed alternative code as seen in https://docs.scala-lang.org/overviews/core/collections-migration-213.html#what-are-the-breaking-changes.
   
   ## Related issue and scope
   - [X] I opened an issue to propose and discuss this change (#4741)
   
   ## Checklist:
   <!--- Please review the points below which help you make sure you've covered all aspects of the change you're making. -->
   
   - [X] I signed an [Apache CLA](https://github.com/apache/openwhisk/blob/master/CONTRIBUTING.md).
   - [X] I reviewed the [style guides](https://github.com/apache/openwhisk/wiki/Contributing:-Git-guidelines#code-readiness) and followed the recommendations (Travis CI will check :).
   - [X] I added tests to cover my changes.
   
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [openwhisk] rabbah commented on a change in pull request #4833: Force filterKeys and mapValues to return a Map.

Posted by GitBox <gi...@apache.org>.
rabbah commented on a change in pull request #4833: Force filterKeys and mapValues to return a Map.
URL: https://github.com/apache/openwhisk/pull/4833#discussion_r383387263
 
 

 ##########
 File path: common/scala/src/main/scala/org/apache/openwhisk/core/entity/WhiskPackage.scala
 ##########
 @@ -122,14 +122,8 @@ case class WhiskPackage(namespace: EntityPath,
    * for this check.
    */
   def withPackageActions(actions: List[WhiskPackageAction] = List.empty): WhiskPackageWithActions = {
-    val actionGroups = actions map { a =>
-      //  group into "actions" and "feeds"
-      val feed = a.annotations.get(Parameters.Feed) map { _ =>
-        true
-      } getOrElse false
-      (feed, a)
-    } groupBy { _._1 } mapValues { _.map(_._2) }
-    WhiskPackageWithActions(this, actionGroups.getOrElse(false, List.empty), actionGroups.getOrElse(true, List.empty))
+    val (feedActions, nonFeedActions) = actions.partition(_.annotations.get(Parameters.Feed).isDefined)
 
 Review comment:
   there's a test for that i hope :D looks pretty/good to me

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [openwhisk] markusthoemmes merged pull request #4833: Force filterKeys and mapValues to return a Map.

Posted by GitBox <gi...@apache.org>.
markusthoemmes merged pull request #4833: Force filterKeys and mapValues to return a Map.
URL: https://github.com/apache/openwhisk/pull/4833
 
 
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [openwhisk] codecov-io commented on issue #4833: Force filterKeys and mapValues to return a Map.

Posted by GitBox <gi...@apache.org>.
codecov-io commented on issue #4833: Force filterKeys and mapValues to return a Map.
URL: https://github.com/apache/openwhisk/pull/4833#issuecomment-590504155
 
 
   # [Codecov](https://codecov.io/gh/apache/openwhisk/pull/4833?src=pr&el=h1) Report
   > Merging [#4833](https://codecov.io/gh/apache/openwhisk/pull/4833?src=pr&el=desc) into [master](https://codecov.io/gh/apache/openwhisk/commit/acf4cdacd1ea8ee4c10802178ee20a9c7ec97f66?src=pr&el=desc) will **decrease** coverage by `6.47%`.
   > The diff coverage is `87.5%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/openwhisk/pull/4833/graphs/tree.svg?width=650&token=l0YmsiSAso&height=150&src=pr)](https://codecov.io/gh/apache/openwhisk/pull/4833?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master    #4833      +/-   ##
   ==========================================
   - Coverage   82.35%   75.88%   -6.48%     
   ==========================================
     Files         197      197              
     Lines        9019     9016       -3     
     Branches      370      350      -20     
   ==========================================
   - Hits         7428     6842     -586     
   - Misses       1591     2174     +583
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/openwhisk/pull/4833?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [...rg/apache/openwhisk/core/entity/WhiskPackage.scala](https://codecov.io/gh/apache/openwhisk/pull/4833/diff?src=pr&el=tree#diff-Y29tbW9uL3NjYWxhL3NyYy9tYWluL3NjYWxhL29yZy9hcGFjaGUvb3BlbndoaXNrL2NvcmUvZW50aXR5L1doaXNrUGFja2FnZS5zY2FsYQ==) | `96.61% <100%> (-0.17%)` | :arrow_down: |
   | [...ache/openwhisk/core/database/DocumentHandler.scala](https://codecov.io/gh/apache/openwhisk/pull/4833/diff?src=pr&el=tree#diff-Y29tbW9uL3NjYWxhL3NyYy9tYWluL3NjYWxhL29yZy9hcGFjaGUvb3BlbndoaXNrL2NvcmUvZGF0YWJhc2UvRG9jdW1lbnRIYW5kbGVyLnNjYWxh) | `87.68% <83.33%> (ø)` | :arrow_up: |
   | [...core/database/cosmosdb/RxObservableImplicits.scala](https://codecov.io/gh/apache/openwhisk/pull/4833/diff?src=pr&el=tree#diff-Y29tbW9uL3NjYWxhL3NyYy9tYWluL3NjYWxhL29yZy9hcGFjaGUvb3BlbndoaXNrL2NvcmUvZGF0YWJhc2UvY29zbW9zZGIvUnhPYnNlcnZhYmxlSW1wbGljaXRzLnNjYWxh) | `0% <0%> (-100%)` | :arrow_down: |
   | [...enwhisk/connector/kafka/KamonMetricsReporter.scala](https://codecov.io/gh/apache/openwhisk/pull/4833/diff?src=pr&el=tree#diff-Y29tbW9uL3NjYWxhL3NyYy9tYWluL3NjYWxhL29yZy9hcGFjaGUvb3BlbndoaXNrL2Nvbm5lY3Rvci9rYWZrYS9LYW1vbk1ldHJpY3NSZXBvcnRlci5zY2FsYQ==) | `0% <0%> (-100%)` | :arrow_down: |
   | [...e/database/cosmosdb/cache/ChangeFeedConsumer.scala](https://codecov.io/gh/apache/openwhisk/pull/4833/diff?src=pr&el=tree#diff-Y29yZS9jb3Ntb3NkYi9jYWNoZS1pbnZhbGlkYXRvci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL29wZW53aGlzay9jb3JlL2RhdGFiYXNlL2Nvc21vc2RiL2NhY2hlL0NoYW5nZUZlZWRDb25zdW1lci5zY2FsYQ==) | `0% <0%> (-100%)` | :arrow_down: |
   | [...ore/database/cosmosdb/cache/CacheInvalidator.scala](https://codecov.io/gh/apache/openwhisk/pull/4833/diff?src=pr&el=tree#diff-Y29yZS9jb3Ntb3NkYi9jYWNoZS1pbnZhbGlkYXRvci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL29wZW53aGlzay9jb3JlL2RhdGFiYXNlL2Nvc21vc2RiL2NhY2hlL0NhY2hlSW52YWxpZGF0b3Iuc2NhbGE=) | `0% <0%> (-100%)` | :arrow_down: |
   | [...core/database/cosmosdb/CosmosDBArtifactStore.scala](https://codecov.io/gh/apache/openwhisk/pull/4833/diff?src=pr&el=tree#diff-Y29tbW9uL3NjYWxhL3NyYy9tYWluL3NjYWxhL29yZy9hcGFjaGUvb3BlbndoaXNrL2NvcmUvZGF0YWJhc2UvY29zbW9zZGIvQ29zbW9zREJBcnRpZmFjdFN0b3JlLnNjYWxh) | `0% <0%> (-96.23%)` | :arrow_down: |
   | [...sk/core/database/cosmosdb/CosmosDBViewMapper.scala](https://codecov.io/gh/apache/openwhisk/pull/4833/diff?src=pr&el=tree#diff-Y29tbW9uL3NjYWxhL3NyYy9tYWluL3NjYWxhL29yZy9hcGFjaGUvb3BlbndoaXNrL2NvcmUvZGF0YWJhc2UvY29zbW9zZGIvQ29zbW9zREJWaWV3TWFwcGVyLnNjYWxh) | `0% <0%> (-93.9%)` | :arrow_down: |
   | [...tabase/cosmosdb/cache/CacheInvalidatorConfig.scala](https://codecov.io/gh/apache/openwhisk/pull/4833/diff?src=pr&el=tree#diff-Y29yZS9jb3Ntb3NkYi9jYWNoZS1pbnZhbGlkYXRvci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL29wZW53aGlzay9jb3JlL2RhdGFiYXNlL2Nvc21vc2RiL2NhY2hlL0NhY2hlSW52YWxpZGF0b3JDb25maWcuc2NhbGE=) | `0% <0%> (-92.31%)` | :arrow_down: |
   | [...e/database/cosmosdb/cache/KafkaEventProducer.scala](https://codecov.io/gh/apache/openwhisk/pull/4833/diff?src=pr&el=tree#diff-Y29yZS9jb3Ntb3NkYi9jYWNoZS1pbnZhbGlkYXRvci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL29wZW53aGlzay9jb3JlL2RhdGFiYXNlL2Nvc21vc2RiL2NhY2hlL0thZmthRXZlbnRQcm9kdWNlci5zY2FsYQ==) | `0% <0%> (-77.78%)` | :arrow_down: |
   | ... and [9 more](https://codecov.io/gh/apache/openwhisk/pull/4833/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/openwhisk/pull/4833?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/openwhisk/pull/4833?src=pr&el=footer). Last update [acf4cda...44c2563](https://codecov.io/gh/apache/openwhisk/pull/4833?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [openwhisk] markusthoemmes commented on a change in pull request #4833: Force filterKeys and mapValues to return a Map.

Posted by GitBox <gi...@apache.org>.
markusthoemmes commented on a change in pull request #4833: Force filterKeys and mapValues to return a Map.
URL: https://github.com/apache/openwhisk/pull/4833#discussion_r383385850
 
 

 ##########
 File path: common/scala/src/main/scala/org/apache/openwhisk/core/entity/WhiskPackage.scala
 ##########
 @@ -122,14 +122,8 @@ case class WhiskPackage(namespace: EntityPath,
    * for this check.
    */
   def withPackageActions(actions: List[WhiskPackageAction] = List.empty): WhiskPackageWithActions = {
-    val actionGroups = actions map { a =>
-      //  group into "actions" and "feeds"
-      val feed = a.annotations.get(Parameters.Feed) map { _ =>
-        true
-      } getOrElse false
-      (feed, a)
-    } groupBy { _._1 } mapValues { _.map(_._2) }
-    WhiskPackageWithActions(this, actionGroups.getOrElse(false, List.empty), actionGroups.getOrElse(true, List.empty))
+    val (feedActions, nonFeedActions) = actions.partition(_.annotations.get(Parameters.Feed).isDefined)
 
 Review comment:
   This one was fun 😂. Hope I got it correct.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services