Created
May 25, 2015 10:06
-
-
Save aseigneurin/ac8ad103b5bc7dda6e75 to your computer and use it in GitHub Desktop.
Zeppelin + Cassandra
This file contains 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
%dep | |
z.load("com.datastax.spark:spark-cassandra-connector_2.10:1.2.1") |
This file contains 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
%spark | |
import org.apache.spark.{SparkConf, SparkContext} | |
import org.apache.spark.sql.cassandra.CassandraSQLContext | |
sc.stop | |
val sparkConf = new SparkConf().setMaster("local[8]").setAppName("dope-data-loader").set("spark.cassandra.connection.host", "127.0.0.1") | |
val sc = new SparkContext(sparkConf) | |
val cc = new CassandraSQLContext(sc) |
This file contains 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
%spark | |
import org.joda.time.DateTime | |
import com.datastax.spark.connector._ | |
class MonthData(val prtt_no: Int, | |
val si_aa: Int, | |
val mm: Int, | |
val no_cd: String, | |
val no_part_mi: String, | |
val no_mis: String, | |
val no_int: String, | |
val ca_acoss: Double, | |
val ca_hors_acoss: Double, | |
val mt_mb_com: Double, | |
val nb_j_mis: Double, | |
val nb_hr_100t: Double, | |
val nb_hr_125t: Double, | |
val nb_hr_126t: Double, | |
val nb_hr_201t: Double, | |
val nb_hr_202t: Double, | |
val nb_hr_203t: Double, | |
val nb_hr_norm: Double, | |
val nb_hr_supl: Double, | |
val nb_hr_jfr: Double, | |
val nb_hr_paya: Double, | |
val der_tx_pay_100t: Double, | |
val der_tx_fc_100t: Double, | |
val nb_hr_norm_fc: Double, | |
val nb_hr_norm_fc_1: Double, | |
val nb_hr_supl_fc: Double, | |
val nb_hr_supl_fc_1: Double, | |
val nb_j_hr_norm_fc: Int, | |
val nb_j_hr_norm_fc_1: Int, | |
val nb_j_hr_supl_fc: Int, | |
val nb_j_hr_supl_fc_1: Int, | |
val nb_j_hr_norm_pa: Int, | |
val nb_j_hr_norm_pa_1: Int, | |
val nb_hr_trav: Double, | |
val mt_tot_fc: Double, | |
val mt_hr_norm_fc: Double, | |
val mt_201t_fc: Double, | |
val mt_202t_fc: Double, | |
val mt_203t_fc: Double, | |
val mt_hs_fc: Double, | |
val mt_hr_norm_hs: Double, | |
val mt_tot_pai: Double, | |
val mt_prm_sms: Double, | |
val mt_j_fr_fc: Double, | |
val mt_trs_fc: Double, | |
val dts_maj: DateTime, | |
val nb_hr_mis_ins: Double, | |
val si_aa_mm: Int, | |
val nm_gc: String // Client.nm_gc | |
) extends Serializable {} | |
// -- GET MONTH DATA | |
val monthData = sc.cassandraTable[MonthData]("dope", "itgrme") | |
monthData.collect() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment