ImportError:无法从“ pyspark.sql”导入名称“ HiveContext”

时间:2019-12-01 00:04:55

标签: python-3.x pyspark pyspark-sql hivecontext

我正在PC(Windows 10)中运行pyspark,但无法导入HiveContext:

Nov 30, 2019 6:32:17 PM songbook.HomeController initialize
SEVERE: null
java.lang.NullPointerException
    at songbook.HomeController.loadGrid(HomeController.java:45)
    at songbook.HomeController.initialize(HomeController.java:36)
    at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2573)
    at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2466)
    at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3237)
    at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3194)
    at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3163)
    at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3136)
    at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3113)
    at javafx.fxml/javafx.fxml.FXMLLoader.load(FXMLLoader.java:3106)
    at songbook.SongBook.start(SongBook.java:23)
    at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:846)
    at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455)
    at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
    at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
    at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)

我应该如何解决呢?

1 个答案:

答案 0 :(得分:1)

您正在使用Spark 3.0的预览版。根据{{​​3}},您应该使用SparkSession.builder.enableHiveSupport()

  

在Spark 3.0中,已弃用的HiveContext类已被移除。改用SparkSession.builder.enableHiveSupport()。