Skip to content

Instantly share code, notes, and snippets.

@ishassan
ishassan / SparkToHiveTable.scala
Created April 6, 2016 17:03
Creates some dummy data from Spark and insert it into a Hive table
package testpackage
import org.apache.spark.sql.Row
import org.apache.spark.sql.types.{StringType, StructField, StructType}
import org.apache.spark.{SparkConf, SparkContext }
import org.apache.spark.sql.hive.HiveContext
object TestJob {
def main(args: Array[String]): Unit ={
/*
For more examples, please refer to https://github.com/cloudera-labs/SparkOnHBase/tree/cdh5-0.0.2/java/com/cloudera/spark/hbase/example
*/
package testpackage
import com.cloudera.spark.hbase.HBaseContext
import com.typesafe.config.Config
import org.apache.hadoop.conf.Configuration
import org.apache.hadoop.hbase.{CellUtil, HBaseConfiguration}
@ishassan
ishassan / ScalaHBaseExample.scala
Last active June 8, 2023 09:08
A hello world example about connecting Scala to HBase
//CHECK ishassan/build.sbt as well
import org.apache.hadoop.hbase.client._
import org.apache.hadoop.hbase.util.Bytes
import org.apache.hadoop.hbase.{CellUtil, HBaseConfiguration, TableName}
import org.apache.hadoop.conf.Configuration
import scala.collection.JavaConverters._
object ScalaHBaseExample extends App{
def printRow(result : Result) = {