Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Switched type hints from HTable to HTableInterface, needed to work wi…

…th HBase 92.1 (Cloudera's CDH4)
  • Loading branch information...
commit 3843d53dd6e445d4037294ea02c590bf6a1b4e92 1 parent d6a6a0f
Ryan Senior authored November 26, 2012

Showing 1 changed file with 14 additions and 15 deletions. Show diff stats Hide diff stats

  1. 29  src/clojure_hbase/core.clj
29  src/clojure_hbase/core.clj
@@ -2,8 +2,7 @@
2 2
   (:refer-clojure :rename {get map-get})
3 3
   (:use clojure-hbase.internal)
4 4
   (:import [org.apache.hadoop.hbase HBaseConfiguration HConstants KeyValue]
5  
-           [org.apache.hadoop.hbase.client HTable
6  
-            HTablePool Get Put Delete Scan Result RowLock]
  5
+           [org.apache.hadoop.hbase.client HTablePool Get Put Delete Scan Result RowLock HTableInterface]
7 6
            [org.apache.hadoop.hbase.util Bytes]))
8 7
 
9 8
 (def ^{:private true} put-class
@@ -181,7 +180,7 @@
181 180
 
182 181
 (defn scanner
183 182
   "Creates a Scanner on the given table using the given Scan."
184  
-  [#^HTable table #^Scan scan]
  183
+  [#^HTableInterface table #^Scan scan]
185 184
   (io!
186 185
    (.getScanner table scan)))
187 186
 
@@ -193,7 +192,7 @@
193 192
 
194 193
 (defn release-table
195 194
   "Puts an HTable back into the open HTablePool."
196  
-  [#^HTable table]
  195
+  [#^HTableInterface table]
197 196
   (io!
198 197
    (.putTable (htable-pool) table)))
199 198
 
@@ -234,13 +233,13 @@
234 233
 
235 234
 (defn row-lock
236 235
   "Returns a RowLock on the given row of the given table."
237  
-  [#^HTable table row]
  236
+  [#^HTableInterface table row]
238 237
   (io!
239 238
    (.lockRow table (to-bytes row))))
240 239
 
241 240
 (defn row-unlock
242 241
   "Unlocks the row locked by the given RowLock."
243  
-  [#^HTable table row-lock]
  242
+  [#^HTableInterface table row-lock]
244 243
   (io!
245 244
    (.unlockRow table row-lock)))
246 245
 
@@ -248,7 +247,7 @@
248 247
   "Performs the given query actions (Get/Scan) on the given HTable. The return
249 248
    value will be a sequence of equal length, with each slot containing the
250 249
    results of the query in the corresponding position."
251  
-  [#^HTable table & ops]
  250
+  [#^HTableInterface table & ops]
252 251
   (io!
253 252
    (map (fn [op]
254 253
           (condp instance? op
@@ -260,7 +259,7 @@
260 259
 
261 260
 (defn modify
262 261
   "Performs the given modifying actions (Put/Delete) on the given HTable."
263  
-  [#^HTable table & ops]
  262
+  [#^HTableInterface table & ops]
264 263
   (io!
265 264
    (map (fn [op]
266 265
           (condp instance? op
@@ -344,7 +343,7 @@
344 343
 (defn get
345 344
   "Creates and executes a Get object against the given table. Options are
346 345
    the same as for get."
347  
-  [#^HTable table row & args]
  346
+  [#^HTableInterface table row & args]
348 347
   (let [g #^Get (apply get* row args)]
349 348
     (io!
350 349
      (.get table g))))
@@ -406,7 +405,7 @@
406 405
 (defn put
407 406
   "Creates and executes a Put object against the given table. Options are
408 407
    the same as for put."
409  
-  [#^HTable table row & args]
  408
+  [#^HTableInterface table row & args]
410 409
   (let [p #^Put (apply put* row args)]
411 410
     (io!
412 411
      (.put table p))))
@@ -414,17 +413,17 @@
414 413
 (defn check-and-put
415 414
   "Atomically checks that the row-family-qualifier-value match the values we
416 415
    give, and if so, executes the Put."
417  
-  ([#^HTable table row family qualifier value #^Put put]
  416
+  ([#^HTableInterface table row family qualifier value #^Put put]
418 417
      (.checkAndPut table (to-bytes row) (to-bytes family) (to-bytes qualifier)
419 418
                    (to-bytes value) put))
420  
-  ([#^HTable table [row family qualifier value] #^Put put]
  419
+  ([#^HTableInterface table [row family qualifier value] #^Put put]
421 420
      (check-and-put table row family qualifier value put)))
422 421
 
423 422
 (defn insert
424 423
   "If the family and qualifier are non-existent, the Put will be committed.
425 424
    The row is taken from the Put object, but the family and qualifier cannot
426 425
    be determined from a Put object, so they must be specified."
427  
-  [#^HTable table family qualifier ^Put put]
  426
+  [#^HTableInterface table family qualifier ^Put put]
428 427
   (check-and-put table (.getRow put) family qualifier
429 428
                  (byte-array 0) put))
430 429
 
@@ -530,7 +529,7 @@
530 529
 (defn delete
531 530
   "Creates and executes a Delete object against the given table. Options are
532 531
    the same as for delete."
533  
-  [#^HTable table row & args]
  532
+  [#^HTableInterface table row & args]
534 533
   (let [d #^Delete (apply delete* row args)]
535 534
     (io!
536 535
      (.delete table d))))
@@ -596,7 +595,7 @@
596 595
   "Creates and runs a Scan object. All arguments are the same as scan.
597 596
    ResultScanner implements Iterable, so you should be able to just use it
598 597
    directly, but don't forget to .close it! Better yet, use with-scanner."
599  
-  [#^HTable table & args]
  598
+  [#^HTableInterface table & args]
600 599
   (let [s (apply scan* args)]
601 600
     (io!
602 601
      (scanner table s))))

0 notes on commit 3843d53

Please sign in to comment.
Something went wrong with that request. Please try again.