Skip to content

Instantly share code, notes, and snippets.

@treper
Created December 28, 2015 09:55
Show Gist options
  • Save treper/895f6cde128336ec1661 to your computer and use it in GitHub Desktop.
Save treper/895f6cde128336ec1661 to your computer and use it in GitHub Desktop.
TestHiveSQL-in-SparkShell
val sqlContext = new org.apache.spark.sql.hive.HiveContext(sc)
import sqlContext.implicits._
val pp = sc.makeRDD(1 to 5).map(i => (i, i * 2)).toDF("single", "double")
pp.registerTempTable("people")
sqlContext.sql("select concat('test_',single) from people").collect().foreach(println)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment