Skip to content

Commit

Permalink
Merge pull request #12 from findify/fix/triple-nesting
Browse files Browse the repository at this point in the history
migrate to softwaremill magnolia fork
  • Loading branch information
shuttie authored Sep 23, 2021
2 parents d2a11cc + 1172666 commit b0f2b6b
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 16 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ versions

`flink-adt` is released to Maven-central. For SBT, add this snippet to `build.sbt`:
```scala
libraryDependencies += "io.findify" %% "flink-adt" % "0.4.3"
libraryDependencies += "io.findify" %% "flink-adt" % "0.4.4"
```

To use this library, swap `import org.apache.flink.api.scala._` with `import io.findify.flinkadt.api._` and enjoy.
Expand Down
18 changes: 9 additions & 9 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name := "flink-adt"

version := "0.4.3"
version := "0.4.4"

scalaVersion := "2.12.14"
scalaVersion := "2.12.15"

organization := "io.findify"
licenses := Seq("MIT" -> url("https://opensource.org/licenses/MIT"))
Expand All @@ -12,15 +12,15 @@ publishMavenStyle := true

publishTo := sonatypePublishToBundle.value

lazy val flinkVersion = "1.13.1"
lazy val flinkVersion = "1.13.2"

libraryDependencies ++= Seq(
"com.propensive" %% "magnolia" % "0.17.0",
"org.apache.flink" %% "flink-scala" % flinkVersion % "provided",
"org.apache.flink" %% "flink-streaming-scala" % flinkVersion % "provided",
"org.apache.flink" %% "flink-test-utils" % flinkVersion % "test",
"org.scalatest" %% "scalatest" % "3.2.9" % "test",
"org.typelevel" %% "cats-core" % "2.3.0" % "test"
"com.softwaremill.magnolia1_2" % "magnolia_2.12" % "1.0.0-M5",
"org.apache.flink" %% "flink-scala" % flinkVersion % "provided",
"org.apache.flink" %% "flink-streaming-scala" % flinkVersion % "provided",
"org.apache.flink" %% "flink-test-utils" % flinkVersion % "test",
"org.scalatest" %% "scalatest" % "3.2.10" % "test",
"org.typelevel" %% "cats-core" % "2.6.1" % "test"
)

scmInfo := Some(
Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version = 1.5.2
sbt.version = 1.5.5
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.findify.flinkadt.api

import magnolia.Magnolia
import magnolia1.Magnolia
import org.apache.flink.api.common.typeinfo.TypeInformation
import scala.language.experimental.macros

Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/io/findify/flinkadt/api/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package io.findify.flinkadt

import io.findify.flinkadt.api.serializer._
import io.findify.flinkadt.api.typeinfo.{CollectionTypeInformation, CoproductTypeInformation, ProductTypeInformation}
import magnolia.{CaseClass, Magnolia, SealedTrait}
import magnolia1.{CaseClass, Magnolia, SealedTrait}
import org.apache.flink.api.common.ExecutionConfig
import org.apache.flink.api.common.typeinfo.{BasicTypeInfo, TypeInformation}
import org.apache.flink.api.common.typeutils.TypeSerializer
Expand Down Expand Up @@ -89,7 +89,7 @@ package object api extends LowPrioImplicits {
}
}

private def typeName(tn: magnolia.TypeName): String = {
private def typeName(tn: magnolia1.TypeName): String = {
s"${tn.full}[${tn.typeArguments.map(typeName).mkString(",")}]"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import java.io.{ByteArrayInputStream, ByteArrayOutputStream, ObjectInputStream,
import java.util

import io.findify.flinkadt.api.serializer.CoproductSerializer.CoproductSerializerSnapshot
import magnolia.{SealedTrait, Subtype, TypeName}
import magnolia1.{SealedTrait, Subtype, TypeName}
import org.apache.flink.api.common.typeutils.base.TypeSerializerSingleton
import org.apache.flink.api.common.typeutils.{
GenericTypeSerializerSnapshot,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.findify.flinkadt.api.typeinfo

import magnolia.{CaseClass, Param}
import magnolia1.{CaseClass, Param}
import org.apache.flink.api.common.ExecutionConfig
import org.apache.flink.api.common.typeinfo.TypeInformation
import org.apache.flink.api.common.typeutils.TypeSerializer
Expand Down
18 changes: 18 additions & 0 deletions src/test/scala/io/findify/flinkadt/SerializerTest.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package io.findify.flinkadt

import cats.data.NonEmptyList
import io.findify.flinkadt.SerializerTest.DeeplyNested.ModeNested.SuperNested.{Egg, Food}
import io.findify.flinkadt.SerializerTest.NestedRoot.NestedMiddle.NestedBottom

import java.io.{ByteArrayInputStream, ByteArrayOutputStream, ObjectOutputStream}
import io.findify.flinkadt.SerializerTest.{
Expand Down Expand Up @@ -162,6 +164,16 @@ class SerializerTest extends AnyFlatSpec with Matchers with Inspectors with Test
all(ser2, Generic(Simple(0, "asd"), Bar(0)))
}

it should "serialize nil" in {
val ser = implicitly[TypeInformation[NonEmptyList[String]]].createSerializer(null)
roundtrip(ser, NonEmptyList.one("a"))
}

it should "serialize triple-nested case clases" in {
val ser = implicitly[TypeInformation[Seq[NestedBottom]]].createSerializer(null)
roundtrip(ser, List(NestedBottom(Some("a"), None)))
}

}

object SerializerTest {
Expand Down Expand Up @@ -218,4 +230,10 @@ object SerializerTest {
case class Generic[T](a: T, b: ADT)

case class ListADT(a: List[ADT])

object NestedRoot {
object NestedMiddle {
case class NestedBottom(a: Option[String], b: Option[String])
}
}
}

0 comments on commit b0f2b6b

Please sign in to comment.