Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error: not found: value StructType/StructField/StringType

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?

like image 260
toofrellik Avatar asked Sep 07 '16 08:09

toofrellik


People also ask

What is StructType and StructField in spark?

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.

What is struct type in Python?

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.


1 Answers

import org.apache.spark.sql.types.{StructType, StructField, StringType, IntegerType};

try importing

like image 133
Vijay Krishna Avatar answered Sep 24 '22 04:09

Vijay Krishna