You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Shixiong Zhu (JIRA)" <ji...@apache.org> on 2016/11/22 19:10:58 UTC

[jira] [Comment Edited] (SPARK-14146) Imported implicits can't be found in Spark REPL in some cases

    [ https://issues.apache.org/jira/browse/SPARK-14146?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15687597#comment-15687597 ] 

Shixiong Zhu edited comment on SPARK-14146 at 11/22/16 7:10 PM:
----------------------------------------------------------------

Hm..., this issue seems worse than I thought. It will ignore all wildcard imports. E.g.,

{code}
scala> import java.text._
import java.text._

scala> class Foo() { val f = new SimpleDateFormat("hh") }
r: false h: import java.text._ wanted: Set(scala, SimpleDateFormat)
r: false h: import org.apache.spark.sql.functions._ wanted: Set(scala, SimpleDateFormat)
r: false h: import spark.sql wanted: Set(scala, SimpleDateFormat)
r: false h: import spark.implicits._ wanted: Set(scala, SimpleDateFormat)
r: false h: import org.apache.spark.SparkContext._ wanted: Set(scala, SimpleDateFormat)
<console>:13: error: not found: type SimpleDateFormat
         class Foo() { val f = new SimpleDateFormat("hh") }
{code}


was (Author: zsxwing):
Hm..., this issue seems worse than I thought. It will ignore all wildcard imports. E.g.,

{code}
bin/scala -Yrepl-class-based
Welcome to Scala 2.11.8 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_45).
Type in expressions for evaluation. Or try :help.

scala> import java.text._
import java.text._

scala> class Foo() { val f = new SimpleDateFormat("hh") }
<console>:11: error: not found: type SimpleDateFormat
       class Foo() { val f = new SimpleDateFormat("hh") }
{code}

> Imported implicits can't be found in Spark REPL in some cases
> -------------------------------------------------------------
>
>                 Key: SPARK-14146
>                 URL: https://issues.apache.org/jira/browse/SPARK-14146
>             Project: Spark
>          Issue Type: Bug
>          Components: Spark Core, SQL
>    Affects Versions: 2.0.0
>            Reporter: Wenchen Fan
>
> {code}
> class I(i: Int) {
>   def double: Int = i * 2
> }
> class Context {
>   implicit def toI(i: Int): I = new I(i)
> }
> val c = new Context
> import c._
> // OK
> 1.double
> // Fail
> class A; 1.double
> {code}
> The above code snippets can work in Scala REPL however.
> This will affect our Dataset functionality, for example:
> {code}
> class A; Seq(1 -> "a").toDS() // fail
> {code}
> or in paste mode:
> {code}
> :paste
> class A
> Seq(1 -> "a").toDS() // fail
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org