Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-16969

Unable to use case class in flink scala shell

    XMLWordPrintableJSON

Details

    Description

      case class WC(word: String, count: Int)
      val wordCounts = benv.fromElements(WC("hello", 1),WC("world", 2), WC("world", 8))
      wordCounts.collect()

      Get the following exception

      java.lang.IllegalArgumentException: requirement failed:
      The class WC is an instance class, meaning it is not a member of a
      toplevel object, or of an object contained in a toplevel object,
      therefore it requires an outer instance to be instantiated, but we don't have a
      reference to the outer instance. Please consider changing the outer class to an object.
      
        at scala.Predef$.require(Predef.scala:224)
        at org.apache.flink.api.scala.typeutils.ScalaCaseClassSerializer$.lookupConstructor(ScalaCaseClassSerializer.scala:90)
        at org.apache.flink.api.scala.typeutils.ScalaCaseClassSerializer.<init>(ScalaCaseClassSerializer.scala:46)
        ... 66 elided
      
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              zjffdu Jeff Zhang
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: