-
Notifications
You must be signed in to change notification settings - Fork 13.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FLINK-7811] Add support for Scala 2.12 #6784
Conversation
I'm currently preparing an asm6 version for |
Note that the GitHub link for the version you're using results in a 404. |
For |
API compatibility failed:
|
@zentol that was resolved by one of the last commits. The problem was that our exclusion pattern for |
@zentol Also, the only ASM-related imports are
which seem to be exactly the same as for our earlier asm5 dependency. |
5da50f2
to
ba043d0
Compare
5c6bc57
to
a4ab90d
Compare
@zentol The last 5 commits (minus the |
Also, we won't merge it like this but have to think about how to integrate the Scala 2.12 build. This PR only builds Scala 2.12, for testing, without building Scala 2.11. |
8af1873
to
e8d5110
Compare
Can we split this PR so we don't change 30 different things at once? It's impossible to gauge how/whether these changes affect the current build with 2.11.
|
1 similar comment
Can we split this PR so we don't change 30 different things at once? It's impossible to gauge how/whether these changes affect the current build with 2.11.
|
*/ | ||
def where[K: TypeInformation](fun: KeySelector[L, K]) = { | ||
val keyType = implicitly[TypeInformation[K]] | ||
val keyExtractor = new KeySelector[L, K] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like redundant wrapping of KeySelector
into KeySelector
. I would suggest to remove that.
*/ | ||
def where[K: TypeInformation](fun: KeySelector[L, K]) = { | ||
val keyType = implicitly[TypeInformation[K]] | ||
val keyExtractor = new KeySelector[L, K] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like redundant wrapping of KeySelector
into KeySelector
. I would suggest to remove that.
*/ | ||
def where[K: TypeInformation](fun: KeySelector[L, K]) = { | ||
val keyType = implicitly[TypeInformation[K]] | ||
val keyExtractor = new KeySelector[L, K] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like redundant wrapping of KeySelector
into KeySelector
. I would suggest to remove that.
*/ | ||
def equalTo[K: TypeInformation](fun: KeySelector[R, K]): O = { | ||
val keyType = implicitly[TypeInformation[K]] | ||
val keyExtractor = new KeySelector[R, K] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant wrapping, see above.
val cleanFun = clean(fun) | ||
val keyType: TypeInformation[K] = implicitly[TypeInformation[K]] | ||
|
||
val keyExtractor = new KeySelector[T, K] with ResultTypeQueryable[K] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to wrap this in a ResultTypeQueryable
if we explicitly pass the key type info below?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so, I'm changing it.
@@ -227,32 +227,35 @@ object KNN { | |||
|
|||
// join input and training set | |||
val crossed = crossTuned.mapPartition { | |||
(iter, out: Collector[(FlinkVector, FlinkVector, Long, Double)]) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor: Can this be fixed without changing the indentation level of the function body?
@@ -227,32 +227,35 @@ object KNN { | |||
|
|||
// join input and training set | |||
val crossed = crossTuned.mapPartition { | |||
(iter, out: Collector[(FlinkVector, FlinkVector, Long, Double)]) => { | |||
for ((training, testing) <- iter) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor: Can this be changed without changing the indentation of the function body?
@@ -227,32 +227,35 @@ object KNN { | |||
|
|||
// join input and training set | |||
val crossed = crossTuned.mapPartition { | |||
(iter, out: Collector[(FlinkVector, FlinkVector, Long, Double)]) => { | |||
for ((training, testing) <- iter) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor: Can this be changed without changing the indentation of the function body?
@@ -227,32 +227,35 @@ object KNN { | |||
|
|||
// join input and training set | |||
val crossed = crossTuned.mapPartition { | |||
(iter, out: Collector[(FlinkVector, FlinkVector, Long, Double)]) => { | |||
for ((training, testing) <- iter) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor: Can this be changed without changing the indentation of the function body?
val rightKey = new Keys.SelectorFunctionKeys[R, K]( | ||
keyExtractor, | ||
unfinished.leftInput.clean(fun), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be unfinished.rightInput.clean(fun)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't matter, I just need to somehow clean the function.
flink-formats/flink-avro/pom.xml
Outdated
@@ -64,8 +64,7 @@ under the License. | |||
|
|||
<dependency> | |||
<groupId>org.apache.flink</groupId> | |||
<!-- use a dedicated Scala version to not depend on it --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is dangerous, because it means that the artifact we release have an undefined Scala version - effectively whatever version we uploaded first (or last?).
That means flink-avro
1.7 depends on Scala 2.11, flink-avro
1.8 might depend on Scala 2.12, flink-avro
1.9 might depend again on Scala 2.11.
flink-formats/flink-json/pom.xml
Outdated
@@ -53,8 +53,7 @@ under the License. | |||
|
|||
<dependency> | |||
<groupId>org.apache.flink</groupId> | |||
<!-- use a dedicated Scala version to not depend on it --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, see above.
…eCleaner This updates the ClosureCleaner with recent changes from SPARK-14540.
Some places in the code didn't have override, this wasn't a problem for Scala 2.11 but Scala 2.12 seems to be more strict.
This wasn't a problem for Scala 2.11 but Scala 2.12 seems to be more strict.
…pport Scala 2.12 doesn't have ForkJoinPool there anymore.
It seems this wasn't a problem with Scala 2.11 but with 2.12 we go into infinite recursion. The fix should still be good for 2.11.
Our previous grizzled dependency is too old for Scala 2.12
Our previous dependency was too old.
The new Scala 2.12 typechecker didn't like this.
These changes are required for 2.12 support and also work on Scala 2.11.
It seems \$ doesn't work but $$ does. I noticed this when changing DataStream.scala.
Previously we only allowed a lambda here, which was an omission. This also adds support for KeySelector on other operations that need a key.
This is needed for Scala 2.12 compatibility
… 0.7.6 We have to do this in order to be able to update our Chill dependency without changing the the Kryo serializers that are registered by default. The problem is that snapshots of our Kryo serializer only contain the user-registered serializers, not the serializers that are registered by default by Chill. If we had that, we could probably get by without this change. The reason we have to update is that there is no Chill 0.7.4 dependency for Scala 2.12.
…rk on Scala 2.12 They didn't have a SerialVersionUID before and it seems Scala 2.12 assigns different UIDs from Scala 2.11 so we have to fix them to those that Scala 2.11 assigned automatically.
…sionUID It seems that the SerialVersionUID of this changed between 2.11 and 2.12. We need to ignore it so that we can restore savepoints taken on a 2.11 build with a 2.12 build.
…hinBound() With Scala 2.12, the ClosureCleaner will complain that the filter function that uses withinBound() is not serializable. The reason is that when "Bound" is not final it will serialize it with the closure, wich includes IterateExample.
This changes some modules that had a _2.11 dependency but didn't expose it in their module name to instead depend on the ${scala.binary.version} dependency. The main reason for this is to make the build self contained, before, with the hard-dependency on 2.11, when buildig for 2.12 it would not be clear where the dependency would come from because it is not created as part of the build. This could lead to inconsistencies. For example, when adding a new class in flink-runtime but not recompiling on 2.11 but only on 2.12, the 2.12 tests would fail when using that new class because they would use 2.11 dependencies that weren't rebuilt with the new class. We also don't build flink-scala-shell and flink-connector-kafka-0.8 because they don't work with Scala 2.12. This also includes $PROFILE in dependency convergence check script. This is in preparation for building with "-Dscala-212", where we hace to exclude certain things. We also exclude Kafka 0.8 from stages when building for Scala 2.12 And add Scala 2.12 to the release scripts
Merged |
This is the first batch of changes on the way to Scala 2.12 support. All these changes are necessary to make the Scala 2.12 compiler happy and I also updated the
ClosureCleaner
to be able to work with Scala 2.12.This does not yet change the Scala version to 2.12 but I have a work-in-progress branch that does that and these changes are the first batch of changes that are valid both for Scala 2.11 and necessary for Scala 2.12.
This adds a dependency:
It's required to make the ClosureCleaner work with Scala 2.12 lambdas. It's convenient because it's already there but we can also make our own
flink-shaded
release of ASM 6.