[ https://issues.apache.org/jira/browse/FLINK-2001?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Stephan Ewen closed FLINK-2001. ------------------------------- > DistanceMetric cannot be serialized > ----------------------------------- > > Key: FLINK-2001 > URL: https://issues.apache.org/jira/browse/FLINK-2001 > Project: Flink > Issue Type: Bug > Components: Machine Learning Library > Reporter: Chiwan Park > Assignee: Chiwan Park > Priority: Critical > Labels: ML > Fix For: 0.9 > > > Because DistanceMeasure trait doesn't extend Serializable, The task using > DistanceMeasure raises a following exception. > {code} > Task not serializable > org.apache.flink.api.common.InvalidProgramException: Task not serializable > at > org.apache.flink.api.scala.ClosureCleaner$.ensureSerializable(ClosureCleaner.scala:179) > at > org.apache.flink.api.scala.ClosureCleaner$.clean(ClosureCleaner.scala:171) > at org.apache.flink.api.scala.DataSet.clean(DataSet.scala:123) > at org.apache.flink.api.scala.DataSet$$anon$10.<init>(DataSet.scala:691) > at org.apache.flink.api.scala.DataSet.combineGroup(DataSet.scala:690) > at org.apache.flink.ml.classification.KNNModel.transform(KNN.scala:78) > at > org.apache.flink.ml.classification.KNNITSuite$$anonfun$1.apply$mcV$sp(KNNSuite.scala:25) > at > org.apache.flink.ml.classification.KNNITSuite$$anonfun$1.apply(KNNSuite.scala:12) > at > org.apache.flink.ml.classification.KNNITSuite$$anonfun$1.apply(KNNSuite.scala:12) > at > org.scalatest.Transformer$$anonfun$apply$1.apply$mcV$sp(Transformer.scala:22) > at org.scalatest.OutcomeOf$class.outcomeOf(OutcomeOf.scala:85) > at org.scalatest.OutcomeOf$.outcomeOf(OutcomeOf.scala:104) > at org.scalatest.Transformer.apply(Transformer.scala:22) > at org.scalatest.Transformer.apply(Transformer.scala:20) > at org.scalatest.FlatSpecLike$$anon$1.apply(FlatSpecLike.scala:1647) > at org.scalatest.Suite$class.withFixture(Suite.scala:1122) > at org.scalatest.FlatSpec.withFixture(FlatSpec.scala:1683) > at > org.scalatest.FlatSpecLike$class.invokeWithFixture$1(FlatSpecLike.scala:1644) > at > org.scalatest.FlatSpecLike$$anonfun$runTest$1.apply(FlatSpecLike.scala:1656) > at > org.scalatest.FlatSpecLike$$anonfun$runTest$1.apply(FlatSpecLike.scala:1656) > at org.scalatest.SuperEngine.runTestImpl(Engine.scala:306) > at org.scalatest.FlatSpecLike$class.runTest(FlatSpecLike.scala:1656) > at > org.apache.flink.ml.classification.KNNITSuite.org$scalatest$BeforeAndAfter$$super$runTest(KNNSuite.scala:9) > at org.scalatest.BeforeAndAfter$class.runTest(BeforeAndAfter.scala:200) > at > org.apache.flink.ml.classification.KNNITSuite.runTest(KNNSuite.scala:9) > at > org.scalatest.FlatSpecLike$$anonfun$runTests$1.apply(FlatSpecLike.scala:1714) > at > org.scalatest.FlatSpecLike$$anonfun$runTests$1.apply(FlatSpecLike.scala:1714) > at > org.scalatest.SuperEngine$$anonfun$traverseSubNodes$1$1.apply(Engine.scala:413) > at > org.scalatest.SuperEngine$$anonfun$traverseSubNodes$1$1.apply(Engine.scala:401) > at scala.collection.immutable.List.foreach(List.scala:318) > at org.scalatest.SuperEngine.traverseSubNodes$1(Engine.scala:401) > at > org.scalatest.SuperEngine.org$scalatest$SuperEngine$$runTestsInBranch(Engine.scala:390) > at > org.scalatest.SuperEngine$$anonfun$traverseSubNodes$1$1.apply(Engine.scala:427) > at > org.scalatest.SuperEngine$$anonfun$traverseSubNodes$1$1.apply(Engine.scala:401) > at scala.collection.immutable.List.foreach(List.scala:318) > at org.scalatest.SuperEngine.traverseSubNodes$1(Engine.scala:401) > at > org.scalatest.SuperEngine.org$scalatest$SuperEngine$$runTestsInBranch(Engine.scala:396) > at org.scalatest.SuperEngine.runTestsImpl(Engine.scala:483) > at org.scalatest.FlatSpecLike$class.runTests(FlatSpecLike.scala:1714) > at org.scalatest.FlatSpec.runTests(FlatSpec.scala:1683) > at org.scalatest.Suite$class.run(Suite.scala:1424) > at > org.scalatest.FlatSpec.org$scalatest$FlatSpecLike$$super$run(FlatSpec.scala:1683) > at > org.scalatest.FlatSpecLike$$anonfun$run$1.apply(FlatSpecLike.scala:1760) > at > org.scalatest.FlatSpecLike$$anonfun$run$1.apply(FlatSpecLike.scala:1760) > at org.scalatest.SuperEngine.runImpl(Engine.scala:545) > at org.scalatest.FlatSpecLike$class.run(FlatSpecLike.scala:1760) > at > org.apache.flink.ml.classification.KNNITSuite.org$scalatest$BeforeAndAfter$$super$run(KNNSuite.scala:9) > at org.scalatest.BeforeAndAfter$class.run(BeforeAndAfter.scala:241) > at org.apache.flink.ml.classification.KNNITSuite.run(KNNSuite.scala:9) > at org.scalatest.tools.SuiteRunner.run(SuiteRunner.scala:55) > at > org.scalatest.tools.Runner$$anonfun$doRunRunRunDaDoRunRun$3.apply(Runner.scala:2563) > at > org.scalatest.tools.Runner$$anonfun$doRunRunRunDaDoRunRun$3.apply(Runner.scala:2557) > at scala.collection.immutable.List.foreach(List.scala:318) > at org.scalatest.tools.Runner$.doRunRunRunDaDoRunRun(Runner.scala:2557) > at > org.scalatest.tools.Runner$$anonfun$runOptionallyWithPassFailReporter$2.apply(Runner.scala:1044) > at > org.scalatest.tools.Runner$$anonfun$runOptionallyWithPassFailReporter$2.apply(Runner.scala:1043) > at > org.scalatest.tools.Runner$.withClassLoaderAndDispatchReporter(Runner.scala:2722) > at > org.scalatest.tools.Runner$.runOptionallyWithPassFailReporter(Runner.scala:1043) > at org.scalatest.tools.Runner$.run(Runner.scala:883) > at org.scalatest.tools.Runner.run(Runner.scala) > at > org.jetbrains.plugins.scala.testingSupport.scalaTest.ScalaTestRunner.runScalaTest2(ScalaTestRunner.java:138) > at > org.jetbrains.plugins.scala.testingSupport.scalaTest.ScalaTestRunner.main(ScalaTestRunner.java:28) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:497) > at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140) > Caused by: java.io.NotSerializableException: > org.apache.flink.ml.metrics.distances.EuclideanDistanceMetric > at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1184) > at > java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548) > at > java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509) > at > java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432) > at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178) > at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348) > at > org.apache.flink.util.InstantiationUtil.serializeObject(InstantiationUtil.java:314) > at > org.apache.flink.api.scala.ClosureCleaner$.ensureSerializable(ClosureCleaner.scala:177) > ... 66 more > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)