aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2018-08-20 18:45:21 -0700
committerBryan Newbold <bnewbold@archive.org>2018-08-21 21:25:56 -0700
commit9514b6a3620a98e4fc069ca31b77eac6f9c98bec (patch)
tree8eba706270946f2af78a956c3a6168a710b8e147
parent29eb22bc60193e6f919d98ec14a39ecd53477331 (diff)
downloadsandcrawler-9514b6a3620a98e4fc069ca31b77eac6f9c98bec.tar.gz
sandcrawler-9514b6a3620a98e4fc069ca31b77eac6f9c98bec.zip
add dedicated job for counting GrobidMetadata column
-rw-r--r--scalding/src/main/scala/sandcrawler/GrobidMetadataCountJob.scala36
1 files changed, 36 insertions, 0 deletions
diff --git a/scalding/src/main/scala/sandcrawler/GrobidMetadataCountJob.scala b/scalding/src/main/scala/sandcrawler/GrobidMetadataCountJob.scala
new file mode 100644
index 0000000..08f3340
--- /dev/null
+++ b/scalding/src/main/scala/sandcrawler/GrobidMetadataCountJob.scala
@@ -0,0 +1,36 @@
+package sandcrawler
+
+import java.util.Properties
+
+import cascading.property.AppProps
+import cascading.tuple.Fields
+import com.twitter.scalding._
+import parallelai.spyglass.base.JobBase
+import parallelai.spyglass.hbase.HBaseConstants.SourceMode
+import parallelai.spyglass.hbase.HBasePipeConversions
+import parallelai.spyglass.hbase.HBaseSource
+
+class GrobidMetadataCountJob(args: Args) extends JobBase(args) with HBasePipeConversions {
+
+ val output = args("output")
+
+ GrobidMetadataCountJob.getHBaseSource(
+ args("hbase-table"),
+ args("zookeeper-hosts"))
+ .read
+ .debug
+ .groupAll { _.size('count) }
+ .write(Tsv(output))
+}
+
+object GrobidMetadataCountJob {
+
+ // eg, "wbgrp-journal-extract-0-qa",7 "mtrcs-zk1.us.archive.org:2181"
+ def getHBaseSource(hbaseTable: String, zookeeperHosts: String) : HBaseSource = {
+ HBaseBuilder.build(
+ hbaseTable,
+ zookeeperHosts,
+ List("grobid0:metadata"),
+ SourceMode.SCAN_ALL)
+ }
+}