aboutsummaryrefslogtreecommitdiffstats
path: root/scalding/src/main/scala/sandcrawler/HBaseRowCountJob.scala
blob: 7f5c84a000ced93cab7d1dd3fa33d86fe0585493 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package sandcrawler

import cascading.property.AppProps
import cascading.tuple.Fields
import com.twitter.scalding._
import java.util.Properties
import parallelai.spyglass.base.JobBase
import parallelai.spyglass.hbase.{HBaseSource, HBasePipeConversions}
import parallelai.spyglass.hbase.HBaseConstants.SourceMode

class HBaseRowCountJob(args: Args) extends JobBase(args) with HBasePipeConversions {

  val output = args("output")

  HBaseRowCountJob.getHBaseSource(args("hbase-table"),
                                  args("zookeeper-hosts"))
    .read
    .debug
    .groupAll { _.size('count) }
    .write(Tsv(output))
}

object HBaseRowCountJob {

  // eg, "wbgrp-journal-extract-0-qa", "mtrcs-zk1.us.archive.org:2181"
  def getHBaseSource(hbase_table: String, zookeeper_hosts: String) : HBaseSource = {
    return HBaseBuilder.build(
      hbase_table,
      zookeeper_hosts,
      List("file:size"),
      SourceMode.SCAN_ALL)
  }

}