Created
December 29, 2014 07:43
-
-
Save mgurov/a58c010889124a0095b6 to your computer and use it in GitHub Desktop.
dual table at apache spark
This file contains hidden or 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
import org.apache.spark.sql._ | |
val hc = new org.apache.spark.sql.hive.HiveContext(sc) | |
val schema = StructType(Seq(StructField("dual", StringType, true))) | |
val rowRDD = sc.parallelize(Seq(Row("dual"))) | |
val schemaRDD = hc.applySchema(rowRDD, schema) | |
schemaRDD.registerTempTable("dual") | |
hc.hql("select 'hello world' from dual").collect |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
also this is reqd : import org.apache.spark.sql.types._