Skip to content

Instantly share code, notes, and snippets.

@mgurov
Created December 29, 2014 07:43
Show Gist options
  • Save mgurov/a58c010889124a0095b6 to your computer and use it in GitHub Desktop.
Save mgurov/a58c010889124a0095b6 to your computer and use it in GitHub Desktop.
dual table at apache spark
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
@pauldx
Copy link

pauldx commented May 2, 2020

command-3321821764560589:10: error: value hql is not a member of org.apache.spark.sql.hive.HiveContext

@pauldx
Copy link

pauldx commented May 2, 2020

also this is reqd : import org.apache.spark.sql.types._

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment