val sqlContext = new org.apache.spark.sql.hive.HiveContext(sc) sqlContext.sql("CREATE TABLE IF NOT EXISTS productid INT, productname STRING)" sqlContext.sql("LOAD DATA LOCAL INPATH Data/examples/product.txt INTO TABLE product") sqlContext.sql("SELECT productid, productname FROM product LIMIT 100").collect().foreach (println)
References: https://www.tutorialspoint.com/spark_sql/spark_sql_hive_tables.htm
