Commit d74fa3aabe9f1506186c4a20ab985105d8e3298c

Authored by Joanne ago
1 parent 6c8d856de1
Exists in master

add hbase inserter in gghScore

Showing 1 changed file with 5 additions and 0 deletions Side-by-side Diff

app/com/piki_ds/ver2ggh/gghScore.scala View file @ d74fa3a
... ... @@ -4,6 +4,7 @@
4 4  
5 5 package com.piki_ds.ver2ggh
6 6  
  7 +import com.piki_ds.utils.hbase.HbaseInserter
7 8 import com.piki_ds.ver2ggh
8 9 import com.piki_ds.data.contents.report.Util
9 10 import java.util.Date
... ... @@ -159,6 +160,10 @@
159 160 s"${x(0)},${x.getAs[Double]("scaledGgh").toInt}"
160 161 }.saveAsTextFile(s"hdfs://pikinn/preprocess/timelineScore/content/ggh/$saveDay")
161 162  
  163 + val finalScore = gghScaled.map(x=>(x(0),x.getAs[Double]("scaledGgh").toInt))
  164 + val insertArray = finalScore.map(x=>(x._1.toString, x._2.toString)).collect()
  165 + val test = new HbaseInserter("cid_ggh2")
  166 + test.insert(insertArray)
162 167 /*//////// CTR and CTR Time 계산
163 168 val ctr = expConsume.groupBy("cid").
164 169 agg(expr("sum(expTime1) as expTime1"), expr("sum(expSize1) as expSize1"), expr("sum(expTime2) as expTime2"),