【发布时间】:2016-11-02 07:07:14
【问题描述】:
我在本地机器上运行 scala,版本 2.0。
val schema = StructType(schemaString.split("|^").map(fieldName =>StructField(fieldName, StringType, true)))
<console>:45: error: not found: value StructType
val schema = StructType(schemaString.split("|^").map(fieldName =>StructField(fieldName, StringType, true)))
^
<console>:45: error: not found: value StructField
val schema = StructType(schemaString.split("|^").map(fieldName => StructField(fieldName, StringType, true)))
^
<console>:45: error: not found: value StringType
val schema = StructType(schemaString.split("|^").map(fieldName => StructField(fieldName, StringType, true)))
^
我加载了 import org.apache.spark.sql._ 但仍然收到此错误。我缺少任何包裹吗?
【问题讨论】:
-
尝试导入
org.apache.spark.sql.types._,这就是这些类的所在... -
谢谢它的工作:)
标签: scala apache-spark