Skip to content

Commit ddde211

Browse files
committed
support base64 decoding fields of type long
1 parent e72a831 commit ddde211

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

lib/scanner.js

Lines changed: 14 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/scanner.coffee.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ rows and columns from HBase. Internally, it implements the native
2424
# @id = id or null
2525
@options = table: @options if typeof @options is 'string'
2626
@options.batch ?= 1000
27+
@options.types ?= {}
2728
throw Error 'Missing required option "table"' unless @options.table
2829
@options.id = null
2930
@callback = null
@@ -82,7 +83,10 @@ Internal method to retrieve a batch of records.
8283
data.key = key
8384
data.column = utils.base64.decode cell.column, @client.options.encoding
8485
data.timestamp = cell.timestamp
85-
data.$ = utils.base64.decode cell.$, @client.options.encoding
86+
type = @options.types[data.column]
87+
type = switch
88+
when "long" then data.$ = parseInt(utils.base64.decode(cell.$, "hex"), 16);
89+
else data.$ = utils.base64.decode cell.$, @client.options.encoding
8690
cells.push data
8791
callback null, cells
8892

0 commit comments

Comments
 (0)