[jira] [Commented] (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=16468094#comment-16468094 ] Shixiong Zhu commented on SPARK-14146: -- [~ashawley] Yeah, we can close this ticket when we upgrade Scala 2.11. > 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 >Priority: Major > > {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 (v7.6.3#76005) - To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org
[jira] [Commented] (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=16460239#comment-16460239 ] Aaron S. Hawley commented on SPARK-14146: - Should be resolved in Scala after this was merged: [https://github.com/scala/scala/pull/5084] That fix was released in Scala 2.11.11 [https://github.com/scala/scala/releases/tag/v2.11.11] > 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 >Priority: Major > > {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 (v7.6.3#76005) - To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org
[jira] [Commented] (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=15687597#comment-15687597 ] Shixiong Zhu commented on SPARK-14146: -- 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") } :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-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org
[jira] [Commented] (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=15320357#comment-15320357 ] Prashant Sharma commented on SPARK-14146: - So I tried that option, looks like it does not help either. here is the branch. https://github.com/ScrapCodes/spark/tree/SPARK-14146/import-fix Unexplored ideas that can may be fix this issue. -Yunused-imports is one unexplored territory. I am not sure, if replacing semicolon in the input with \n can work. Because sometimes input can be an XML(or even scala-xml) literal. And I will think of more options. Thanks, > 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-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org
[jira] [Commented] (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=15318162#comment-15318162 ] Prashant Sharma commented on SPARK-14146: - Yes. > 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-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org
[jira] [Commented] (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=15317383#comment-15317383 ] Shixiong Zhu commented on SPARK-14146: -- [~scrapco...@gmail.com] could you submit a PR to add it? > 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-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org
[jira] [Commented] (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=15316383#comment-15316383 ] Prashant Sharma commented on SPARK-14146: - I am having difficulty fixing it. Unless there is a way to know in advance what implicit imports are required by a particular statement, we need to import everything. Which leads to several issues, that were addressed by the change I made by importing exactly what was required for a particular repl expression to execute. Incase, we import everything for each executing expression the bugs like SPARK-1199 will again surface. I just felt that is much more difficult to deal with bug than this. Here we can somewhat reduce the impact of this bug by may be adding import spark.implicits._ in the wrappers. The same way we did for `addOuterScope`. > 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-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org
[jira] [Commented] (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=15313618#comment-15313618 ] Prashant Sharma commented on SPARK-14146: - Thanks for the reproducers, I am looking into it. > 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-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org
[jira] [Commented] (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=15311242#comment-15311242 ] Shixiong Zhu commented on SPARK-14146: -- [~cloud_fan] https://issues.scala-lang.org/browse/SI-9734 doesn't fix the issue in the JIRA description. I tested the latest 2.12.x branch and your test case still fails. > 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-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org
[jira] [Commented] (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=15311223#comment-15311223 ] Shixiong Zhu commented on SPARK-14146: -- Another failure case: {code} scala> val x = Seq("a").toDS() x: org.apache.spark.sql.Dataset[String] = [value: string] scala> :paste // Entering paste mode (ctrl-D to finish) class Bar(s: String) { val x = Seq("a").toDS() } // Exiting paste mode, now interpreting. :12: error: value toDS is not a member of Seq[String] val x = Seq("a").toDS() ^ {code} I created another Scala issue for this one: https://issues.scala-lang.org/browse/SI-9799 > 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-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org
[jira] [Commented] (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=15310980#comment-15310980 ] Shixiong Zhu commented on SPARK-14146: -- We still need a fix for Scala 2.10. FYI, for Scala 2.10, the fallback mode works: {code} scala> :fallback Switched on fallback mode without restarting. If you have defined classes in the repl, it would be good to redefine them incase you plan to use them. If you still run into issues it would be good to restart the repl and turn on `:fallback` mode as first command. scala> class A; Seq(1 -> "a").toDS() defined class A res0: org.apache.spark.sql.Dataset[(Int, String)] = [_1: int, _2: string] {code} /cc [~prashant_] let's continue to discuss here. > 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-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org
[jira] [Commented] (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=15267742#comment-15267742 ] Wenchen Fan commented on SPARK-14146: - this is actually a scala issue: https://issues.scala-lang.org/browse/SI-9734 , and it's already fixed. We should wait for the scala release with this bug fix. > 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-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org
[jira] [Commented] (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=15259079#comment-15259079 ] Jakob Odersky commented on SPARK-14146: --- the reason this fails is because spark-shell sets the `-Yrepl-class-based` of the scala REPL. I'm looking into this. > 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-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org