Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-1927

Implicits declared in companion objects not found in Spark shell

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Duplicate
    • 0.9.0
    • None
    • Spark Shell
    • None
    • Ubuntu Linux 14.04, Oracle Java 7u55

    Description

      scala> :paste
      // Entering paste mode (ctrl-D to finish)
      
      trait Mapper[T]
      class Foo
      object Foo { implicit object FooMapper extends Mapper[Foo] }
      
      // Exiting paste mode, now interpreting.
      
      defined trait Mapper
      defined class Foo
      defined module Foo
      
      scala> implicitly[Mapper[Foo]]
      <console>:28: error: could not find implicit value for parameter e: Mapper[Foo]
                    implicitly[Mapper[Foo]]
                              ^
      

      Exactly same example in the official Scala REPL (2.10.4):

      scala> :paste
      // Entering paste mode (ctrl-D to finish)
      
      trait Mapper[T]
      class Foo
      object Foo { implicit object FooMapper extends Mapper[Foo] }
      
      // Exiting paste mode, now interpreting.
      
      defined trait Mapper
      defined class Foo
      defined module Foo
      
      scala> implicitly[Mapper[Foo]]
      res0: Mapper[Foo] = Foo$FooMapper$@4a20e9c6
      

      I guess it might be another manifestation of the problem of everything being an inner object in Spark Repl.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              pkolaczk Piotr Kolaczkowski
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: