You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Based on the MappedTypeInfoTest.scala unit test. I created my own version
objectCirceMappedTypeInfoTest {
classWrappedMapperextendsTypeMapper[Json, String] {
overridedefmap(json: Json):String= json.noSpaces
overridedefcontramap(jsonString: String):Json= {
valres= parse(jsonString)
res match {
caseLeft(value) =>Json.NullcaseRight(value) => value
}
}
}
implicitvalmapper:TypeMapper[Json, String] =newWrappedMapper()
}
classCirceMappedTypeInfoTestextendsAnyFlatSpecwithMatcherswithTestUtils {
importCirceMappedTypeInfoTest._
it should "derive TI for non-serializeable classes" in {
drop(implicitly[TypeInformation[Json]])
valti= implicitly[TypeInformation[Json]]
valser= ti.createSerializer(null)
assert(ser !=null)
}
And it failed with this error message:
[info] - should derive TI for non-serializeable classes *** FAILED ***
[info] java.lang.NullPointerException:
[info] at org.apache.flink.api.common.typeutils.base.TypeSerializerSingleton.equals(TypeSerializerSingleton.java:43)
[info] at io.findify.flinkadt.api.serializer.MappedSerializer.equals(MappedSerializer.scala:17)
[info] at io.findify.flinkadt.CirceMappedTypeInfoTest.$anonfun$new$1(CirceMappedTypeInfoTest.scala:23)
[info] at org.scalatest.OutcomeOf.outcomeOf(OutcomeOf.scala:85)
[info] at org.scalatest.OutcomeOf.outcomeOf$(OutcomeOf.scala:83)
[info] at org.scalatest.OutcomeOf$.outcomeOf(OutcomeOf.scala:104)
[info] at org.scalatest.Transformer.apply(Transformer.scala:22)
[info] at org.scalatest.Transformer.apply(Transformer.scala:20)
[info] at org.scalatest.flatspec.AnyFlatSpecLike$$anon$5.apply(AnyFlatSpecLike.scala:1812)
[info] at org.scalatest.TestSuite.withFixture(TestSuite.scala:196)
Question
I would think that circe.Json format is very common among flink-adt users.
Am I just using flink-adt badly with circe.Json, or is this a hard class to serialize?
The text was updated successfully, but these errors were encountered:
This should be easily fixable by updating the above method to use ==, which inherently checks for null before checking value equality. I'll cut a PR to address this issue & ensure circe JSON is supported @sami-badawi.
I have problems using Flink-ADT to serialize json in circe.Json format.
Approach 1
Here is the error message:
Approach 2
It compiles but crashes when I run unit test.
Approach 3
Based on the
MappedTypeInfoTest.scala
unit test. I created my own versionAnd it failed with this error message:
Question
I would think that circe.Json format is very common among flink-adt users.
Am I just using flink-adt badly with circe.Json, or is this a hard class to serialize?
The text was updated successfully, but these errors were encountered: