Created
March 25, 2018 13:50
-
-
Save gordinmitya/0058ea5b644a428192812e34091b861b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val spark = org.apache.spark.sql.SparkSession.builder | |
.master("local") | |
.appName("Spark CSV Reader") | |
.getOrCreate | |
val df = spark.read | |
.format("csv") | |
.option("header", "false") //reading the headers | |
.option("mode", "DROPMALFORMED") | |
.schema(StructType(List( | |
StructField("polarity", IntegerType, nullable = false), | |
StructField("id", IntegerType, nullable = false), | |
StructField("date", StringType, nullable = false), | |
StructField("query", StringType, nullable = false), | |
StructField("user", StringType, nullable = false), | |
StructField("text", StringType, nullable = false) | |
))) | |
.load("/Users/mitya/Downloads/trainingandtestdata/testdata.manual.2009.06.14.csv") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment