I am running scala on my local machine, version 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)))
^
i loaded import org.apache.spark.sql._ but still getting this error. am i missing any packages?
The StructType and StructFields are used to define a schema or its part for the Dataframe. This defines the name, datatype, and nullable flag for each column. StructType object is the collection of StructFields objects. It is a Built-in datatype that contains the list of StructField.
Struct type, consisting of a list of StructField . This is the data type representing a Row . Iterating a StructType will iterate over its StructField s. A contained StructField can be accessed by its name or position.
import org.apache.spark.sql.types.{StructType, StructField, StringType, IntegerType};
try importing
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With