Details

    • Hide
      When using Scala 2.12 you might have to add explicit type annotations in places where they were not required when using Scala 2.11. This is an excerpt from the TransitiveClosureNaive.scala example in the Flink code base that shows the changes that could be required.

      Previous code:
      {code}
      val terminate = prevPaths
       .coGroup(nextPaths)
       .where(0).equalTo(0) {
         (prev, next, out: Collector[(Long, Long)]) => {
           val prevPaths = prev.toSet
           for (n <- next)
             if (!prevPaths.contains(n)) out.collect(n)
         }
      }
      {code}

      With Scala 2.12 you have to change it to:
      {code}
      val terminate = prevPaths
       .coGroup(nextPaths)
       .where(0).equalTo(0) {
         (prev: Iterator[(Long, Long)], next: Iterator[(Long, Long)], out: Collector[(Long, Long)]) => {
             val prevPaths = prev.toSet
             for (n <- next)
               if (!prevPaths.contains(n)) out.collect(n)
           }
      }
      {code}

      The reason for this is that Scala 2.12 changes how lambdas are implemented. They now use the lambda support using SAM interfaces introduced in Java 8. This makes some method calls ambiguous because now both Scala-style lambdas and SAMs are candidates for methods were it was previously clear which method would be invoked.
      Show
      When using Scala 2.12 you might have to add explicit type annotations in places where they were not required when using Scala 2.11. This is an excerpt from the TransitiveClosureNaive.scala example in the Flink code base that shows the changes that could be required. Previous code: {code} val terminate = prevPaths  .coGroup(nextPaths)  .where(0).equalTo(0) {    (prev, next, out: Collector[(Long, Long)]) => {      val prevPaths = prev.toSet      for (n <- next)        if (!prevPaths.contains(n)) out.collect(n)    } } {code} With Scala 2.12 you have to change it to: {code} val terminate = prevPaths  .coGroup(nextPaths)  .where(0).equalTo(0) {    (prev: Iterator[(Long, Long)], next: Iterator[(Long, Long)], out: Collector[(Long, Long)]) => {        val prevPaths = prev.toSet        for (n <- next)          if (!prevPaths.contains(n)) out.collect(n)      } } {code} The reason for this is that Scala 2.12 changes how lambdas are implemented. They now use the lambda support using SAM interfaces introduced in Java 8. This makes some method calls ambiguous because now both Scala-style lambdas and SAMs are candidates for methods were it was previously clear which method would be invoked.

    Attachments

      Issue Links

        Activity

          People

            aljoscha Aljoscha Krettek
            aljoscha Aljoscha Krettek
            Votes:
            5 Vote for this issue
            Watchers:
            11 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: