3 ms·
Infinitely. Yes. The addition of Dataframes in 1.3 and numerous enhancements to SparkSQL have made it as easy as: val myDF = sqlContext.read.format("com.data
by mydpy 11y ago
Infinitely. Yes. The addition of Dataframes in 1.3 and numerous enhancements to SparkSQL have made it as easy as:
val myDF = sqlContext.read.format("com.databricks.spark.csv") //allows you to read a csv file (for simplicity)
.option("header", "true")
.option("delimiter", "\\t")
.option("mode", "PERMISSIVE")
.option("inferSchema", "true")
.load(filename)
.where(filter_query)
.cache()
myDF.registerTempTable("myDF")
sqlContext.sql("SELECT COUNT(*) FROM myDF").show()
sqlContext.sql("SELECT COUNT(*) FROM myDF where filter_query").show()