DRAG DROP
You have a text file named Data/examples/product.txt that contains product information.
You need to create a new Apache Hive table, import the product information to the table, and then read the top
100 rows of the table.
Which four code segments should you use in sequence? To answer, move the appropriate code segments
from the list of code segments to the answer area and arrange them in the correct order.
Select and Place:
Explanation:
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)
https://www.tutorialspoint.com/spark_sql/spark_sql_hive_tables.htm