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

Yang Jie commented on SPARK-46461:
----------------------------------

cc [~srowen] [~dongjoon] [~gurwls223] 

I'm not certain if `sbt console` command needs to be fixed, but I've found 
configurations related to the `console` command in `SparkBuild.scala` that 
should have been unusable for quite some time.

 

[https://github.com/apache/spark/blob/c9cfaac90fd423c3a38e295234e24744b946cb02/project/SparkBuild.scala#L1126-L1148]

 
{code:java}
object SQL {
  lazy val settings = Seq(
    (console / initialCommands) :=
      """
        |import org.apache.spark.SparkContext
        |import org.apache.spark.sql.SQLContext
        |import org.apache.spark.sql.catalyst.analysis._
        |import org.apache.spark.sql.catalyst.dsl._
        |import org.apache.spark.sql.catalyst.errors._
        |import org.apache.spark.sql.catalyst.expressions._
        |import org.apache.spark.sql.catalyst.plans.logical._
        |import org.apache.spark.sql.catalyst.rules._
        |import org.apache.spark.sql.catalyst.util._
        |import org.apache.spark.sql.execution
        |import org.apache.spark.sql.functions._
        |import org.apache.spark.sql.types._
        |
        |val sc = new SparkContext("local[*]", "dev-shell")
        |val sqlContext = new SQLContext(sc)
        |import sqlContext.implicits._
        |import sqlContext._
      """.stripMargin,
    (console / cleanupCommands) := "sc.stop()"
  )
} {code}
 

[https://github.com/apache/spark/blob/c9cfaac90fd423c3a38e295234e24744b946cb02/project/SparkBuild.scala#L1164-L1180]

 
{code:java}
    (console / initialCommands) :=
      """
        |import org.apache.spark.SparkContext
        |import org.apache.spark.sql.catalyst.analysis._
        |import org.apache.spark.sql.catalyst.dsl._
        |import org.apache.spark.sql.catalyst.errors._
        |import org.apache.spark.sql.catalyst.expressions._
        |import org.apache.spark.sql.catalyst.plans.logical._
        |import org.apache.spark.sql.catalyst.rules._
        |import org.apache.spark.sql.catalyst.util._
        |import org.apache.spark.sql.execution
        |import org.apache.spark.sql.functions._
        |import org.apache.spark.sql.hive._
        |import org.apache.spark.sql.hive.test.TestHive._
        |import org.apache.spark.sql.hive.test.TestHive.implicits._
        |import org.apache.spark.sql.types._""".stripMargin,
    (console / cleanupCommands) := "sparkContext.stop()", {code}

> The `sbt console` command is not available
> ------------------------------------------
>
>                 Key: SPARK-46461
>                 URL: https://issues.apache.org/jira/browse/SPARK-46461
>             Project: Spark
>          Issue Type: Bug
>          Components: Build
>    Affects Versions: 4.0.0
>            Reporter: Yang Jie
>            Priority: Minor
>
> # Unable to define expressions after executing the `build/sbt console` command
> {code:java}
> scala> val i = 1 // show
> package $line3 {
>   sealed class $read extends _root_.scala.Serializable {
>     def <init>() = {
>       super.<init>;
>       ()
>     };
>     sealed class $iw extends _root_.java.io.Serializable {
>       def <init>() = {
>         super.<init>;
>         ()
>       };
>       val i = 1
>     };
>     val $iw = new $iw.<init>
>   };
>   object $read extends scala.AnyRef {
>     def <init>() = {
>       super.<init>;
>       ()
>     };
>     val INSTANCE = new $read.<init>
>   }
> }
> warning: -target is deprecated: Use -release instead to compile against the 
> correct platform API.
> Applicable -Wconf / @nowarn filters for this warning: msg=<part of the 
> message>, cat=deprecation
>        ^
>        error: expected class or object definition {code}
> 2.  Due to the default unused imports check, the error "unused imports" will 
> be reported after executing the `build/sbt sql/console` command
> {code:java}
> Welcome to Scala 2.13.12 (OpenJDK 64-Bit Server VM, Java 17.0.9).
> Type in expressions for evaluation. Or try :help.
> warning: -target is deprecated: Use -release instead to compile against the 
> correct platform API.
> Applicable -Wconf / @nowarn filters for this warning: msg=<part of the 
> message>, cat=deprecation
>        import org.apache.spark.sql.catalyst.errors._
>                                             ^
> On line 6: error: object errors is not a member of package 
> org.apache.spark.sql.catalyst
>        import org.apache.spark.sql.catalyst.analysis._
>                                                      ^
> On line 4: error: Unused import
>        Applicable -Wconf / @nowarn filters for this fatal warning: msg=<part 
> of the message>, cat=unused-imports, site=
>        import org.apache.spark.sql.catalyst.dsl._
>                                                 ^
> On line 5: error: Unused import
>        Applicable -Wconf / @nowarn filters for this fatal warning: msg=<part 
> of the message>, cat=unused-imports, site=
>        import org.apache.spark.sql.catalyst.errors._
>                                                    ^
> On line 6: error: Unused import
>        Applicable -Wconf / @nowarn filters for this fatal warning: msg=<part 
> of the message>, cat=unused-imports, site=
>        import org.apache.spark.sql.catalyst.expressions._
>                                                         ^
> On line 7: error: Unused import
>        Applicable -Wconf / @nowarn filters for this fatal warning: msg=<part 
> of the message>, cat=unused-imports, site=
>        import org.apache.spark.sql.catalyst.plans.logical._
>                                                           ^
> On line 8: error: Unused import
>        Applicable -Wconf / @nowarn filters for this fatal warning: msg=<part 
> of the message>, cat=unused-imports, site=
>        import org.apache.spark.sql.catalyst.rules._
>                                                   ^
> On line 9: error: Unused import
>        Applicable -Wconf / @nowarn filters for this fatal warning: msg=<part 
> of the message>, cat=unused-imports, site=
>        import org.apache.spark.sql.catalyst.util._
>                                                  ^
> On line 10: error: Unused import
>        Applicable -Wconf / @nowarn filters for this fatal warning: msg=<part 
> of the message>, cat=unused-imports, site=
>        import org.apache.spark.sql.execution
>                                    ^
> On line 11: error: Unused import
>        Applicable -Wconf / @nowarn filters for this fatal warning: msg=<part 
> of the message>, cat=unused-imports, site=
>        import org.apache.spark.sql.functions._
>                                              ^
> On line 12: error: Unused import
>        Applicable -Wconf / @nowarn filters for this fatal warning: msg=<part 
> of the message>, cat=unused-imports, site=
>        import org.apache.spark.sql.types._
>                                          ^
> On line 13: error: Unused import
>        Applicable -Wconf / @nowarn filters for this fatal warning: msg=<part 
> of the message>, cat=unused-imports, site=
>        import sqlContext.implicits._
>                                    ^
> On line 17: error: Unused import
>        Applicable -Wconf / @nowarn filters for this fatal warning: msg=<part 
> of the message>, cat=unused-imports, site=
>        import sqlContext._
>                          ^
> On line 18: error: Unused import
>        Applicable -Wconf / @nowarn filters for this fatal warning: msg=<part 
> of the message>, cat=unused-imports, site=
> scala>  {code}
> It is necessary to delete `-Wunused:imports` from both SparkBuild. sbt and 
> pom.xml in order to avoid this error



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to