sishen-hbase-ruby 0.4.6 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Rakefile
CHANGED
data/hbase-ruby.gemspec
CHANGED
data/lib/hbase/model/row.rb
CHANGED
@@ -13,10 +13,10 @@ module HBase
|
|
13
13
|
raise NotImplementedError, "Currently not supported in native hbase client"
|
14
14
|
end
|
15
15
|
|
16
|
-
def show_row(table_name, name, timestamp = nil, columns = nil,
|
16
|
+
def show_row(table_name, name, timestamp = nil, columns = nil, options = { })
|
17
17
|
begin
|
18
18
|
request = Request::RowRequest.new(table_name, name, timestamp)
|
19
|
-
row = Response::RowResponse.new(get(request.show(columns,
|
19
|
+
row = Response::RowResponse.new(get(request.show(columns, options))).parse
|
20
20
|
row.table_name = table_name
|
21
21
|
row.name = name
|
22
22
|
row.timestamp = timestamp
|
@@ -113,6 +113,8 @@ module HBase
|
|
113
113
|
arg.each do |k,v|
|
114
114
|
if Model::ColumnDescriptor::AVAILABLE_OPTS.include? k
|
115
115
|
xml_data << "<#{Model::ColumnDescriptor::AVAILABLE_OPTS[k]}>#{v}</#{Model::ColumnDescriptor::AVAILABLE_OPTS[k]}>"
|
116
|
+
else
|
117
|
+
xml_data << "<metadata><name>#{k}</name><value>#{v}</value></metadata>"
|
116
118
|
end
|
117
119
|
end
|
118
120
|
xml_data << "</columnfamily>"
|
@@ -12,10 +12,12 @@ module HBase
|
|
12
12
|
super(path)
|
13
13
|
end
|
14
14
|
|
15
|
-
def show(columns = nil,
|
15
|
+
def show(columns = nil, options = { })
|
16
16
|
if columns
|
17
17
|
@path << "?#{pack_params(columns)}"
|
18
|
-
@path << "&version=#{version}" if version
|
18
|
+
@path << "&version=#{options[:version]}" if options[:version]
|
19
|
+
@path << "&offset=#{options[:offset]}" if options[:offset]
|
20
|
+
@path << "&limit=#{options[:limit]}" if options[:limit]
|
19
21
|
end
|
20
22
|
@path
|
21
23
|
end
|
@@ -5,6 +5,7 @@ module HBase
|
|
5
5
|
doc = REXML::Document.new(raw_data)
|
6
6
|
row = doc.elements["row"]
|
7
7
|
columns = []
|
8
|
+
count = row.elements["count"].text.strip.to_i rescue 0
|
8
9
|
row.elements.each("column") do |col|
|
9
10
|
name = col.elements["name"].text.strip.unpack("m").first
|
10
11
|
value = col.elements["value"].text.strip.unpack("m").first rescue nil
|
@@ -13,7 +14,7 @@ module HBase
|
|
13
14
|
:value => value,
|
14
15
|
:timestamp => timestamp)
|
15
16
|
end
|
16
|
-
Model::Row.new(:columns => columns)
|
17
|
+
Model::Row.new(:total_count => count, :columns => columns)
|
17
18
|
end
|
18
19
|
end
|
19
20
|
end
|