24

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?

2
  • 10
    try importing org.apache.spark.sql.types._, that's where these classes are... Commented Sep 7, 2016 at 8:28
  • Thanks it worked :) Commented Sep 7, 2016 at 9:28

1 Answer 1

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

try importing

Sign up to request clarification or add additional context in comments.

1 Comment

Is StructField can be FloatType or DoubleType?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.