From 20a18b4388f0cd06bec0b43d083150f6e1bb2c5e Mon Sep 17 00:00:00 2001 From: Gracia Fernandez Date: Thu, 4 Jul 2013 16:49:09 +0100 Subject: Changed HBaseSource and JDBCSource to allow testing with JobTest. Samples of tests included. --- src/main/java/parallelai/spyglass/hbase/HBaseScheme.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/parallelai/spyglass/hbase/HBaseScheme.java b/src/main/java/parallelai/spyglass/hbase/HBaseScheme.java index a7d36fd..3c64e52 100644 --- a/src/main/java/parallelai/spyglass/hbase/HBaseScheme.java +++ b/src/main/java/parallelai/spyglass/hbase/HBaseScheme.java @@ -238,12 +238,17 @@ public class HBaseScheme OutputCollector outputCollector = sinkCall.getOutput(); Tuple key = tupleEntry.selectTuple(keyField); ImmutableBytesWritable keyBytes = (ImmutableBytesWritable) key.getObject(0); - - if( useSalt ) { - keyBytes = HBaseSalter.addSaltPrefix(keyBytes); + + if (useSalt) { + keyBytes = HBaseSalter.addSaltPrefix(keyBytes); + } + + Put put; + if (this.timeStamp == 0L) { + put = new Put(keyBytes.get()); + } else { + put = new Put(keyBytes.get(), this.timeStamp); } - - Put put = new Put(keyBytes.get(), this.timeStamp); for (int i = 0; i < valueFields.length; i++) { Fields fieldSelector = valueFields[i]; -- cgit v1.2.3