Skip to content

Commit

Permalink
[FLINK-11329] [scala] Delegate compatibility check on old OptionSeria…
Browse files Browse the repository at this point in the history
…lizerConfigSnapshot to ScalaOptionSerializerSnapshot

This closes apache#7590.
  • Loading branch information
tzulitai committed Jan 30, 2019
1 parent a34d463 commit 198ceb2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
* <p>This configuration snapshot class is implemented in Java because Scala does not
* allow calling different base class constructors from subclasses, while we need that
* for the default empty constructor.
*
* @deprecated this snapshot class is no longer in use, and is maintained only for backwards compatibility.
* It is fully replaced by {@link ScalaOptionSerializerSnapshot}.
*/
@Deprecated
public final class ScalaOptionSerializerConfigSnapshot<E> extends CompositeTypeSerializerConfigSnapshot<Option<E>> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@

import org.apache.flink.api.common.typeutils.CompositeTypeSerializerSnapshot;
import org.apache.flink.api.common.typeutils.TypeSerializer;
import org.apache.flink.api.common.typeutils.TypeSerializerSnapshot;

import scala.Option;

/**
* A {@link org.apache.flink.api.common.typeutils.TypeSerializerSnapshot} for the Scala {@link OptionSerializer}.
* A {@link TypeSerializerSnapshot} for the Scala {@link OptionSerializer}.
*/
public final class ScalaOptionSerializerSnapshot<E> extends CompositeTypeSerializerSnapshot<Option<E>, OptionSerializer<E>> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,16 @@ object OptionSerializer {
extends CompositeTypeSerializerConfigSnapshot[Option[A]] {

override def getVersion: Int = OptionSerializerConfigSnapshot.VERSION

override def resolveSchemaCompatibility(
newSerializer: TypeSerializer[Option[A]]
): TypeSerializerSchemaCompatibility[Option[A]] = {
CompositeTypeSerializerUtil.delegateCompatibilityCheckToNewSnapshot(
newSerializer,
new ScalaOptionSerializerSnapshot[A](),
getSingleNestedSerializerAndConfig.f1
)
}
}

object OptionSerializerConfigSnapshot {
Expand Down

0 comments on commit 198ceb2

Please sign in to comment.