hipster_sql_to_hbase 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +7 -0
  2. data/.document +4 -0
  3. data/Gemfile +5 -0
  4. data/LICENSE +20 -0
  5. data/LICENSE.txt +20 -0
  6. data/README.md +39 -0
  7. data/README.rdoc +19 -0
  8. data/Rakefile +31 -0
  9. data/VERSION +1 -0
  10. data/hipster_sql_to_hbase.gemspec +55 -0
  11. data/lib/adapter/Hbase.thrift +914 -0
  12. data/lib/adapter/hbase.rb +59 -0
  13. data/lib/adapter/hbase/hbase.rb +2966 -0
  14. data/lib/adapter/hbase/hbase_constants.rb +14 -0
  15. data/lib/adapter/hbase/hbase_types.rb +282 -0
  16. data/lib/datatype_extras.rb +18 -0
  17. data/lib/executor.rb +91 -0
  18. data/lib/hipster_sql_to_hbase.rb +167 -0
  19. data/lib/result_tree_to_hbase_converter.rb +119 -0
  20. data/lib/result_tree_to_json_converter.rb +40 -0
  21. data/lib/sql_parser/sql.treetop +21 -0
  22. data/lib/sql_parser/sql_chars.treetop +5 -0
  23. data/lib/sql_parser/sql_create_table.treetop +47 -0
  24. data/lib/sql_parser/sql_datatypes.treetop +71 -0
  25. data/lib/sql_parser/sql_delete.treetop +64 -0
  26. data/lib/sql_parser/sql_drop_table.treetop +26 -0
  27. data/lib/sql_parser/sql_from_clause.treetop +12 -0
  28. data/lib/sql_parser/sql_group_by_clause.treetop +15 -0
  29. data/lib/sql_parser/sql_helpers.treetop +19 -0
  30. data/lib/sql_parser/sql_insert.treetop +118 -0
  31. data/lib/sql_parser/sql_key_value_pair.treetop +91 -0
  32. data/lib/sql_parser/sql_limit.treetop +7 -0
  33. data/lib/sql_parser/sql_order_by_clause.treetop +53 -0
  34. data/lib/sql_parser/sql_primitives.treetop +118 -0
  35. data/lib/sql_parser/sql_row_support.treetop +72 -0
  36. data/lib/sql_parser/sql_select.treetop +82 -0
  37. data/lib/sql_parser/sql_select_clause.treetop +17 -0
  38. data/lib/sql_parser/sql_show_tables.treetop +26 -0
  39. data/lib/sql_parser/sql_tokens.treetop +125 -0
  40. data/lib/sql_parser/sql_transaction.treetop +43 -0
  41. data/lib/sql_parser/sql_truncate.treetop +11 -0
  42. data/lib/sql_parser/sql_update.treetop +82 -0
  43. data/lib/sql_parser/sql_where_condition.treetop +46 -0
  44. data/lib/sql_treetop_load.rb +23 -0
  45. data/spec/hipster_sql_to_hbase_spec.rb +171 -0
  46. data/spec/spec_helper.rb +3 -0
  47. metadata +192 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f99379cf71c2477b6b81a54b37dd57a9cfa44978
4
+ data.tar.gz: 64e531e9caec692e602b43b561586d750a33ed55
5
+ SHA512:
6
+ metadata.gz: d93918b9c8e68148b15d2ab61eca75bb1db1cd146e05c66660acb395d8b07ded943655362a761bfcfc578a2f5c70ddcdef1f9b71c87f28ea7b163cdd2ce6dea1
7
+ data.tar.gz: 6dec99aed3e0313aff9bff0dc1bdcd7f1d38f46b3d341130f5d7c3c1b882dca5fe25241ecd4bddaa2269ff808536a8364a3acc38c7b961e89b5c032a62de7447
data/.document ADDED
@@ -0,0 +1,4 @@
1
+ lib/**/*.rb
2
+ spec/*
3
+ -
4
+ LICENSE.txt
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source "http://rubygems.org"
2
+
3
+ gemspec
4
+
5
+ gem 'rake'
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 jeanlescure
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2014 Jean Lescure
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,39 @@
1
+ ![hipster_sql_to_hbase logo](https://github.com/jeanlescure/hipster_sql_to_hbase/raw/master/misc/hipster_sql_to_hbase_logo.png)
2
+
3
+ # Hipster SQL To HBase [![Code Climate](https://codeclimate.com/github/jeanlescure/hipster_sql_to_hbase.png)](https://codeclimate.com/github/jeanlescure/hipster_sql_to_hbase) [![Code Climate](https://travis-ci.org/jeanlescure/hipster_sql_to_hbase.png)](https://travis-ci.org/jeanlescure/hipster_sql_to_hbase)
4
+ ### parsing sql to hbase (thrift) before it was cool
5
+
6
+ This project was born out of the need to migrate rapidly and efficiently a MySQL based application over to Hadoop's own HBase.
7
+
8
+ The HipsterSqlToHbase module provides the ability to produce Thrift compatible queries for HBase from SQL valid statements and execute them; and as if that wasn't cool enough I've also incorporated methods which give you access to each step of the transformation process, as in, the Treetop syntax tree, and the hashed parsing output relevant to each of the following query types:
9
+
10
+ * CREATE type queries
11
+ * SHOW type queries
12
+ * INSERT type queries
13
+ * SELECT type queries
14
+ * UPDATE type queries
15
+ * DROP/DELETE type queries
16
+
17
+ ## Getting Started
18
+
19
+ You can install it via RubyGems:
20
+
21
+ `$ gem install hipster_sql_to_hbase`
22
+
23
+ ## Usage
24
+
25
+ This is a no bullshit, straight as an arrow, to the point gem.
26
+
27
+ Simply require the gem and execute your SQL query. It's that simple:
28
+
29
+ `require 'hipster_sql_to_hbase'`
30
+
31
+ `HipsterSqlToHbase.execute("INSERT INTO users (user,pass) VALUES ('andy','w00dy'),('zaphod','b33bl3br0x')",'www.my-hbase-server.com',9090)`
32
+
33
+ And boom! You've got your result; which varies depending on the SQL query type you executed (i.e. SELECT, INSERT, etc).
34
+
35
+ ## Complexity
36
+
37
+ This gem provides a wide array of functionalities besides just parsing SQL to HBase (Thrift).
38
+
39
+ I'll eventually get around to listing some of the awesomeness withheld within these humble lines of code (especially as I play around with the gem and come up with some test cases), but in the meantime if you're curious about the added functionality of HipsterSqlToHbase, you'll surely want to checkout the RDoc I've generated and uploaded [here.](http://www.jlescure.com/hipster)
data/README.rdoc ADDED
@@ -0,0 +1,19 @@
1
+ = hipster_sql_to_hbase
2
+
3
+ Description goes here.
4
+
5
+ == Contributing to hipster_sql_to_hbase
6
+
7
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
8
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
9
+ * Fork the project.
10
+ * Start a feature/bugfix branch.
11
+ * Commit and push until you are happy with your contribution.
12
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
13
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
14
+
15
+ == Copyright
16
+
17
+ Copyright (c) 2014 Jean Lescure. See LICENSE.txt for
18
+ further details.
19
+
data/Rakefile ADDED
@@ -0,0 +1,31 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+
4
+ begin
5
+ Bundler.setup(:default, :development)
6
+ rescue Bundler::BundlerError => e
7
+ $stderr.puts e.message
8
+ $stderr.puts "Run `bundle install` to install missing gems"
9
+ exit e.status_code
10
+ end
11
+
12
+ require 'rake'
13
+ require 'rspec/core/rake_task'
14
+
15
+ task :default => [:spec]
16
+ desc "Run the specs."
17
+ RSpec::Core::RakeTask.new do |t|
18
+ t.pattern = "spec/**/*_spec.rb"
19
+ end
20
+
21
+ require 'rdoc/task'
22
+ Rake::RDocTask.new do |rdoc|
23
+ require 'jfish'
24
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
25
+
26
+ rdoc.rdoc_dir = 'rdoc'
27
+ rdoc.generator = 'jfish'
28
+ rdoc.title = "hipster_sql_to_hbase #{version}"
29
+ rdoc.rdoc_files.include('README.rdoc')
30
+ rdoc.rdoc_files.include('lib/**/*.rb').exclude(/lib\/adapter/,/lib\/datatype_extras.rb/)
31
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.2
@@ -0,0 +1,55 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = "hipster_sql_to_hbase"
5
+ s.version = "0.1.2"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Jean Lescure"]
9
+ s.date = "2014-02-21"
10
+ s.description = "SQL to HBase parser using Treetop (output based on Thrift). Doing all this before it was cool."
11
+ s.email = "jeanmlescure@gmail.com"
12
+ s.extra_rdoc_files = [
13
+ "LICENSE",
14
+ "LICENSE.txt",
15
+ "README.md",
16
+ "README.rdoc"
17
+ ]
18
+ s.files = Dir.glob("{lib,spec}/**/*") + %w(.document Gemfile LICENSE LICENSE.txt README.md README.rdoc Rakefile VERSION hipster_sql_to_hbase.gemspec)
19
+ s.homepage = "http://github.com/jeanlescure/hipster_sql_to_hbase"
20
+ s.licenses = ["MIT"]
21
+ s.require_paths = ["lib"]
22
+ s.rubygems_version = "2.0.3"
23
+ s.summary = "SQL to HBase parser using Treetop (output based on Thrift)."
24
+
25
+ if s.respond_to? :specification_version then
26
+ s.specification_version = 4
27
+
28
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
29
+ s.add_runtime_dependency(%q<treetop>, [">= 0"])
30
+ s.add_runtime_dependency(%q<jml_thrift>, [">= 0"])
31
+ s.add_runtime_dependency(%q<json>, [">= 0"])
32
+ s.add_development_dependency(%q<bundler>, [">= 0"])
33
+ s.add_development_dependency(%q<rspec>, [">= 0"])
34
+ s.add_development_dependency(%q<rdoc>, ["~> 4.0.0"])
35
+ s.add_development_dependency(%q<jfish>, [">= 0.1.1"])
36
+ else
37
+ s.add_dependency(%q<treetop>, [">= 0"])
38
+ s.add_dependency(%q<jml_thrift>, [">= 0"])
39
+ s.add_dependency(%q<json>, [">= 0"])
40
+ s.add_dependency(%q<bundler>, [">= 0"])
41
+ s.add_dependency(%q<rspec>, [">= 0"])
42
+ s.add_dependency(%q<rdoc>, ["~> 4.0.0"])
43
+ s.add_dependency(%q<jfish>, [">= 0.1.1"])
44
+ end
45
+ else
46
+ s.add_dependency(%q<treetop>, [">= 0"])
47
+ s.add_dependency(%q<jml_thrift>, [">= 0"])
48
+ s.add_dependency(%q<json>, [">= 0"])
49
+ s.add_dependency(%q<bundler>, [">= 0"])
50
+ s.add_dependency(%q<rspec>, [">= 0"])
51
+ s.add_dependency(%q<rdoc>, ["~> 4.0.0"])
52
+ s.add_dependency(%q<jfish>, [">= 0.1.1"])
53
+ end
54
+ end
55
+
@@ -0,0 +1,914 @@
1
+ /*
2
+ * Licensed to the Apache Software Foundation (ASF) under one
3
+ * or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information
5
+ * regarding copyright ownership. The ASF licenses this file
6
+ * to you under the Apache License, Version 2.0 (the
7
+ * "License"); you may not use this file except in compliance
8
+ * with the License. You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+
19
+ // ----------------------------------------------------------------
20
+ // Hbase.thrift
21
+ //
22
+ // This is a Thrift interface definition file for the Hbase service.
23
+ // Target language libraries for C++, Java, Ruby, PHP, (and more) are
24
+ // generated by running this file through the Thrift compiler with the
25
+ // appropriate flags. The Thrift compiler binary and runtime
26
+ // libraries for various languages are available
27
+ // from the Apache Incubator (http://incubator.apache.org/thrift/)
28
+ //
29
+ // See the package.html file for information on the version of Thrift
30
+ // used to generate the *.java files checked into the Hbase project.
31
+ // ----------------------------------------------------------------
32
+
33
+ namespace java org.apache.hadoop.hbase.thrift.generated
34
+ namespace cpp apache.hadoop.hbase.thrift
35
+ namespace rb Apache.Hadoop.Hbase.Thrift
36
+ namespace py hbase
37
+ namespace perl Hbase
38
+
39
+ //
40
+ // Types
41
+ //
42
+
43
+ // NOTE: all variables with the Text type are assumed to be correctly
44
+ // formatted UTF-8 strings. This is a programming language and locale
45
+ // dependent property that the client application is repsonsible for
46
+ // maintaining. If strings with an invalid encoding are sent, an
47
+ // IOError will be thrown.
48
+
49
+ typedef binary Text
50
+ typedef binary Bytes
51
+ typedef i32 ScannerID
52
+
53
+ /**
54
+ * TCell - Used to transport a cell value (byte[]) and the timestamp it was
55
+ * stored with together as a result for get and getRow methods. This promotes
56
+ * the timestamp of a cell to a first-class value, making it easy to take
57
+ * note of temporal data. Cell is used all the way from HStore up to HTable.
58
+ */
59
+ struct TCell{
60
+ 1:Bytes value,
61
+ 2:i64 timestamp
62
+ }
63
+
64
+ /**
65
+ * An HColumnDescriptor contains information about a column family
66
+ * such as the number of versions, compression settings, etc. It is
67
+ * used as input when creating a table or adding a column.
68
+ */
69
+ struct ColumnDescriptor {
70
+ 1:Text name,
71
+ 2:i32 maxVersions = 3,
72
+ 3:string compression = "NONE",
73
+ 4:bool inMemory = 0,
74
+ 5:string bloomFilterType = "NONE",
75
+ 6:i32 bloomFilterVectorSize = 0,
76
+ 7:i32 bloomFilterNbHashes = 0,
77
+ 8:bool blockCacheEnabled = 0,
78
+ 9:i32 timeToLive = -1
79
+ }
80
+
81
+ /**
82
+ * A TRegionInfo contains information about an HTable region.
83
+ */
84
+ struct TRegionInfo {
85
+ 1:Text startKey,
86
+ 2:Text endKey,
87
+ 3:i64 id,
88
+ 4:Text name,
89
+ 5:byte version,
90
+ 6:Text serverName,
91
+ 7:i32 port
92
+ }
93
+
94
+ /**
95
+ * A Mutation object is used to either update or delete a column-value.
96
+ */
97
+ struct Mutation {
98
+ 1:bool isDelete = 0,
99
+ 2:Text column,
100
+ 3:Text value,
101
+ 4:bool writeToWAL = 1
102
+ }
103
+
104
+
105
+ /**
106
+ * A BatchMutation object is used to apply a number of Mutations to a single row.
107
+ */
108
+ struct BatchMutation {
109
+ 1:Text row,
110
+ 2:list<Mutation> mutations
111
+ }
112
+
113
+ /**
114
+ * For increments that are not incrementColumnValue
115
+ * equivalents.
116
+ */
117
+ struct TIncrement {
118
+ 1:Text table,
119
+ 2:Text row,
120
+ 3:Text column,
121
+ 4:i64 ammount
122
+ }
123
+
124
+ /**
125
+ * Holds row name and then a map of columns to cells.
126
+ */
127
+ struct TRowResult {
128
+ 1:Text row,
129
+ 2:map<Text, TCell> columns
130
+ }
131
+
132
+ /**
133
+ * A Scan object is used to specify scanner parameters when opening a scanner.
134
+ */
135
+ struct TScan {
136
+ 1:optional Text startRow,
137
+ 2:optional Text stopRow,
138
+ 3:optional i64 timestamp,
139
+ 4:optional list<Text> columns,
140
+ 5:optional i32 caching,
141
+ 6:optional Text filterString
142
+ }
143
+
144
+ //
145
+ // Exceptions
146
+ //
147
+ /**
148
+ * An IOError exception signals that an error occurred communicating
149
+ * to the Hbase master or an Hbase region server. Also used to return
150
+ * more general Hbase error conditions.
151
+ */
152
+ exception IOError {
153
+ 1:string message
154
+ }
155
+
156
+ /**
157
+ * An IllegalArgument exception indicates an illegal or invalid
158
+ * argument was passed into a procedure.
159
+ */
160
+ exception IllegalArgument {
161
+ 1:string message
162
+ }
163
+
164
+ /**
165
+ * An AlreadyExists exceptions signals that a table with the specified
166
+ * name already exists
167
+ */
168
+ exception AlreadyExists {
169
+ 1:string message
170
+ }
171
+
172
+ //
173
+ // Service
174
+ //
175
+
176
+ service Hbase {
177
+ /**
178
+ * Brings a table on-line (enables it)
179
+ */
180
+ void enableTable(
181
+ /** name of the table */
182
+ 1:Bytes tableName
183
+ ) throws (1:IOError io)
184
+
185
+ /**
186
+ * Disables a table (takes it off-line) If it is being served, the master
187
+ * will tell the servers to stop serving it.
188
+ */
189
+ void disableTable(
190
+ /** name of the table */
191
+ 1:Bytes tableName
192
+ ) throws (1:IOError io)
193
+
194
+ /**
195
+ * @return true if table is on-line
196
+ */
197
+ bool isTableEnabled(
198
+ /** name of the table to check */
199
+ 1:Bytes tableName
200
+ ) throws (1:IOError io)
201
+
202
+ void compact(1:Bytes tableNameOrRegionName)
203
+ throws (1:IOError io)
204
+
205
+ void majorCompact(1:Bytes tableNameOrRegionName)
206
+ throws (1:IOError io)
207
+
208
+ /**
209
+ * List all the userspace tables.
210
+ *
211
+ * @return returns a list of names
212
+ */
213
+ list<Text> getTableNames()
214
+ throws (1:IOError io)
215
+
216
+ /**
217
+ * List all the column families assoicated with a table.
218
+ *
219
+ * @return list of column family descriptors
220
+ */
221
+ map<Text,ColumnDescriptor> getColumnDescriptors (
222
+ /** table name */
223
+ 1:Text tableName
224
+ ) throws (1:IOError io)
225
+
226
+ /**
227
+ * List the regions associated with a table.
228
+ *
229
+ * @return list of region descriptors
230
+ */
231
+ list<TRegionInfo> getTableRegions(
232
+ /** table name */
233
+ 1:Text tableName)
234
+ throws (1:IOError io)
235
+
236
+ /**
237
+ * Create a table with the specified column families. The name
238
+ * field for each ColumnDescriptor must be set and must end in a
239
+ * colon (:). All other fields are optional and will get default
240
+ * values if not explicitly specified.
241
+ *
242
+ * @throws IllegalArgument if an input parameter is invalid
243
+ *
244
+ * @throws AlreadyExists if the table name already exists
245
+ */
246
+ void createTable(
247
+ /** name of table to create */
248
+ 1:Text tableName,
249
+
250
+ /** list of column family descriptors */
251
+ 2:list<ColumnDescriptor> columnFamilies
252
+ ) throws (1:IOError io, 2:IllegalArgument ia, 3:AlreadyExists exist)
253
+
254
+ /**
255
+ * Deletes a table
256
+ *
257
+ * @throws IOError if table doesn't exist on server or there was some other
258
+ * problem
259
+ */
260
+ void deleteTable(
261
+ /** name of table to delete */
262
+ 1:Text tableName
263
+ ) throws (1:IOError io)
264
+
265
+ /**
266
+ * Get a single TCell for the specified table, row, and column at the
267
+ * latest timestamp. Returns an empty list if no such value exists.
268
+ *
269
+ * @return value for specified row/column
270
+ */
271
+ list<TCell> get(
272
+ /** name of table */
273
+ 1:Text tableName,
274
+
275
+ /** row key */
276
+ 2:Text row,
277
+
278
+ /** column name */
279
+ 3:Text column,
280
+
281
+ /** Get attributes */
282
+ 4:map<Text, Text> attributes
283
+ ) throws (1:IOError io)
284
+
285
+ /**
286
+ * Get the specified number of versions for the specified table,
287
+ * row, and column.
288
+ *
289
+ * @return list of cells for specified row/column
290
+ */
291
+ list<TCell> getVer(
292
+ /** name of table */
293
+ 1:Text tableName,
294
+
295
+ /** row key */
296
+ 2:Text row,
297
+
298
+ /** column name */
299
+ 3:Text column,
300
+
301
+ /** number of versions to retrieve */
302
+ 4:i32 numVersions,
303
+
304
+ /** Get attributes */
305
+ 5:map<Text, Text> attributes
306
+ ) throws (1:IOError io)
307
+
308
+ /**
309
+ * Get the specified number of versions for the specified table,
310
+ * row, and column. Only versions less than or equal to the specified
311
+ * timestamp will be returned.
312
+ *
313
+ * @return list of cells for specified row/column
314
+ */
315
+ list<TCell> getVerTs(
316
+ /** name of table */
317
+ 1:Text tableName,
318
+
319
+ /** row key */
320
+ 2:Text row,
321
+
322
+ /** column name */
323
+ 3:Text column,
324
+
325
+ /** timestamp */
326
+ 4:i64 timestamp,
327
+
328
+ /** number of versions to retrieve */
329
+ 5:i32 numVersions,
330
+
331
+ /** Get attributes */
332
+ 6:map<Text, Text> attributes
333
+ ) throws (1:IOError io)
334
+
335
+ /**
336
+ * Get all the data for the specified table and row at the latest
337
+ * timestamp. Returns an empty list if the row does not exist.
338
+ *
339
+ * @return TRowResult containing the row and map of columns to TCells
340
+ */
341
+ list<TRowResult> getRow(
342
+ /** name of table */
343
+ 1:Text tableName,
344
+
345
+ /** row key */
346
+ 2:Text row,
347
+
348
+ /** Get attributes */
349
+ 3:map<Text, Text> attributes
350
+ ) throws (1:IOError io)
351
+
352
+ /**
353
+ * Get the specified columns for the specified table and row at the latest
354
+ * timestamp. Returns an empty list if the row does not exist.
355
+ *
356
+ * @return TRowResult containing the row and map of columns to TCells
357
+ */
358
+ list<TRowResult> getRowWithColumns(
359
+ /** name of table */
360
+ 1:Text tableName,
361
+
362
+ /** row key */
363
+ 2:Text row,
364
+
365
+ /** List of columns to return, null for all columns */
366
+ 3:list<Text> columns,
367
+
368
+ /** Get attributes */
369
+ 4:map<Text, Text> attributes
370
+ ) throws (1:IOError io)
371
+
372
+ /**
373
+ * Get all the data for the specified table and row at the specified
374
+ * timestamp. Returns an empty list if the row does not exist.
375
+ *
376
+ * @return TRowResult containing the row and map of columns to TCells
377
+ */
378
+ list<TRowResult> getRowTs(
379
+ /** name of the table */
380
+ 1:Text tableName,
381
+
382
+ /** row key */
383
+ 2:Text row,
384
+
385
+ /** timestamp */
386
+ 3:i64 timestamp,
387
+
388
+ /** Get attributes */
389
+ 4:map<Text, Text> attributes
390
+ ) throws (1:IOError io)
391
+
392
+ /**
393
+ * Get the specified columns for the specified table and row at the specified
394
+ * timestamp. Returns an empty list if the row does not exist.
395
+ *
396
+ * @return TRowResult containing the row and map of columns to TCells
397
+ */
398
+ list<TRowResult> getRowWithColumnsTs(
399
+ /** name of table */
400
+ 1:Text tableName,
401
+
402
+ /** row key */
403
+ 2:Text row,
404
+
405
+ /** List of columns to return, null for all columns */
406
+ 3:list<Text> columns,
407
+ 4:i64 timestamp,
408
+
409
+ /** Get attributes */
410
+ 5:map<Text, Text> attributes
411
+ ) throws (1:IOError io)
412
+
413
+ /**
414
+ * Get all the data for the specified table and rows at the latest
415
+ * timestamp. Returns an empty list if no rows exist.
416
+ *
417
+ * @return TRowResult containing the rows and map of columns to TCells
418
+ */
419
+ list<TRowResult> getRows(
420
+ /** name of table */
421
+ 1:Text tableName,
422
+
423
+ /** row keys */
424
+ 2:list<Text> rows
425
+
426
+ /** Get attributes */
427
+ 3:map<Text, Text> attributes
428
+ ) throws (1:IOError io)
429
+
430
+ /**
431
+ * Get the specified columns for the specified table and rows at the latest
432
+ * timestamp. Returns an empty list if no rows exist.
433
+ *
434
+ * @return TRowResult containing the rows and map of columns to TCells
435
+ */
436
+ list<TRowResult> getRowsWithColumns(
437
+ /** name of table */
438
+ 1:Text tableName,
439
+
440
+ /** row keys */
441
+ 2:list<Text> rows,
442
+
443
+ /** List of columns to return, null for all columns */
444
+ 3:list<Text> columns,
445
+
446
+ /** Get attributes */
447
+ 4:map<Text, Text> attributes
448
+ ) throws (1:IOError io)
449
+
450
+ /**
451
+ * Get all the data for the specified table and rows at the specified
452
+ * timestamp. Returns an empty list if no rows exist.
453
+ *
454
+ * @return TRowResult containing the rows and map of columns to TCells
455
+ */
456
+ list<TRowResult> getRowsTs(
457
+ /** name of the table */
458
+ 1:Text tableName,
459
+
460
+ /** row keys */
461
+ 2:list<Text> rows
462
+
463
+ /** timestamp */
464
+ 3:i64 timestamp,
465
+
466
+ /** Get attributes */
467
+ 4:map<Text, Text> attributes
468
+ ) throws (1:IOError io)
469
+
470
+ /**
471
+ * Get the specified columns for the specified table and rows at the specified
472
+ * timestamp. Returns an empty list if no rows exist.
473
+ *
474
+ * @return TRowResult containing the rows and map of columns to TCells
475
+ */
476
+ list<TRowResult> getRowsWithColumnsTs(
477
+ /** name of table */
478
+ 1:Text tableName,
479
+
480
+ /** row keys */
481
+ 2:list<Text> rows
482
+
483
+ /** List of columns to return, null for all columns */
484
+ 3:list<Text> columns,
485
+ 4:i64 timestamp,
486
+
487
+ /** Get attributes */
488
+ 5:map<Text, Text> attributes
489
+ ) throws (1:IOError io)
490
+
491
+ /**
492
+ * Apply a series of mutations (updates/deletes) to a row in a
493
+ * single transaction. If an exception is thrown, then the
494
+ * transaction is aborted. Default current timestamp is used, and
495
+ * all entries will have an identical timestamp.
496
+ */
497
+ void mutateRow(
498
+ /** name of table */
499
+ 1:Text tableName,
500
+
501
+ /** row key */
502
+ 2:Text row,
503
+
504
+ /** list of mutation commands */
505
+ 3:list<Mutation> mutations,
506
+
507
+ /** Mutation attributes */
508
+ 4:map<Text, Text> attributes
509
+ ) throws (1:IOError io, 2:IllegalArgument ia)
510
+
511
+ /**
512
+ * Apply a series of mutations (updates/deletes) to a row in a
513
+ * single transaction. If an exception is thrown, then the
514
+ * transaction is aborted. The specified timestamp is used, and
515
+ * all entries will have an identical timestamp.
516
+ */
517
+ void mutateRowTs(
518
+ /** name of table */
519
+ 1:Text tableName,
520
+
521
+ /** row key */
522
+ 2:Text row,
523
+
524
+ /** list of mutation commands */
525
+ 3:list<Mutation> mutations,
526
+
527
+ /** timestamp */
528
+ 4:i64 timestamp,
529
+
530
+ /** Mutation attributes */
531
+ 5:map<Text, Text> attributes
532
+ ) throws (1:IOError io, 2:IllegalArgument ia)
533
+
534
+ /**
535
+ * Apply a series of batches (each a series of mutations on a single row)
536
+ * in a single transaction. If an exception is thrown, then the
537
+ * transaction is aborted. Default current timestamp is used, and
538
+ * all entries will have an identical timestamp.
539
+ */
540
+ void mutateRows(
541
+ /** name of table */
542
+ 1:Text tableName,
543
+
544
+ /** list of row batches */
545
+ 2:list<BatchMutation> rowBatches,
546
+
547
+ /** Mutation attributes */
548
+ 3:map<Text, Text> attributes
549
+ ) throws (1:IOError io, 2:IllegalArgument ia)
550
+
551
+ /**
552
+ * Apply a series of batches (each a series of mutations on a single row)
553
+ * in a single transaction. If an exception is thrown, then the
554
+ * transaction is aborted. The specified timestamp is used, and
555
+ * all entries will have an identical timestamp.
556
+ */
557
+ void mutateRowsTs(
558
+ /** name of table */
559
+ 1:Text tableName,
560
+
561
+ /** list of row batches */
562
+ 2:list<BatchMutation> rowBatches,
563
+
564
+ /** timestamp */
565
+ 3:i64 timestamp,
566
+
567
+ /** Mutation attributes */
568
+ 4:map<Text, Text> attributes
569
+ ) throws (1:IOError io, 2:IllegalArgument ia)
570
+
571
+ /**
572
+ * Atomically increment the column value specified. Returns the next value post increment.
573
+ */
574
+ i64 atomicIncrement(
575
+ /** name of table */
576
+ 1:Text tableName,
577
+
578
+ /** row to increment */
579
+ 2:Text row,
580
+
581
+ /** name of column */
582
+ 3:Text column,
583
+
584
+ /** amount to increment by */
585
+ 4:i64 value
586
+ ) throws (1:IOError io, 2:IllegalArgument ia)
587
+
588
+ /**
589
+ * Delete all cells that match the passed row and column.
590
+ */
591
+ void deleteAll(
592
+ /** name of table */
593
+ 1:Text tableName,
594
+
595
+ /** Row to update */
596
+ 2:Text row,
597
+
598
+ /** name of column whose value is to be deleted */
599
+ 3:Text column,
600
+
601
+ /** Delete attributes */
602
+ 4:map<Text, Text> attributes
603
+ ) throws (1:IOError io)
604
+
605
+ /**
606
+ * Delete all cells that match the passed row and column and whose
607
+ * timestamp is equal-to or older than the passed timestamp.
608
+ */
609
+ void deleteAllTs(
610
+ /** name of table */
611
+ 1:Text tableName,
612
+
613
+ /** Row to update */
614
+ 2:Text row,
615
+
616
+ /** name of column whose value is to be deleted */
617
+ 3:Text column,
618
+
619
+ /** timestamp */
620
+ 4:i64 timestamp,
621
+
622
+ /** Delete attributes */
623
+ 5:map<Text, Text> attributes
624
+ ) throws (1:IOError io)
625
+
626
+ /**
627
+ * Completely delete the row's cells.
628
+ */
629
+ void deleteAllRow(
630
+ /** name of table */
631
+ 1:Text tableName,
632
+
633
+ /** key of the row to be completely deleted. */
634
+ 2:Text row,
635
+
636
+ /** Delete attributes */
637
+ 3:map<Text, Text> attributes
638
+ ) throws (1:IOError io)
639
+
640
+ /**
641
+ * Increment a cell by the ammount.
642
+ * Increments can be applied async if hbase.regionserver.thrift.coalesceIncrement is set to true.
643
+ * False is the default. Turn to true if you need the extra performance and can accept some
644
+ * data loss if a thrift server dies with increments still in the queue.
645
+ */
646
+ void increment(
647
+ /** The single increment to apply */
648
+ 1:TIncrement increment
649
+ ) throws (1:IOError io)
650
+
651
+
652
+ void incrementRows(
653
+ /** The list of increments */
654
+ 1:list<TIncrement> increments
655
+ ) throws (1:IOError io)
656
+
657
+ /**
658
+ * Completely delete the row's cells marked with a timestamp
659
+ * equal-to or older than the passed timestamp.
660
+ */
661
+ void deleteAllRowTs(
662
+ /** name of table */
663
+ 1:Text tableName,
664
+
665
+ /** key of the row to be completely deleted. */
666
+ 2:Text row,
667
+
668
+ /** timestamp */
669
+ 3:i64 timestamp,
670
+
671
+ /** Delete attributes */
672
+ 4:map<Text, Text> attributes
673
+ ) throws (1:IOError io)
674
+
675
+ /**
676
+ * Get a scanner on the current table, using the Scan instance
677
+ * for the scan parameters.
678
+ */
679
+ ScannerID scannerOpenWithScan(
680
+ /** name of table */
681
+ 1:Text tableName,
682
+
683
+ /** Scan instance */
684
+ 2:TScan scan,
685
+
686
+ /** Scan attributes */
687
+ 3:map<Text, Text> attributes
688
+ ) throws (1:IOError io)
689
+
690
+ /**
691
+ * Get a scanner on the current table starting at the specified row and
692
+ * ending at the last row in the table. Return the specified columns.
693
+ *
694
+ * @return scanner id to be used with other scanner procedures
695
+ */
696
+ ScannerID scannerOpen(
697
+ /** name of table */
698
+ 1:Text tableName,
699
+
700
+ /**
701
+ * Starting row in table to scan.
702
+ * Send "" (empty string) to start at the first row.
703
+ */
704
+ 2:Text startRow,
705
+
706
+ /**
707
+ * columns to scan. If column name is a column family, all
708
+ * columns of the specified column family are returned. It's also possible
709
+ * to pass a regex in the column qualifier.
710
+ */
711
+ 3:list<Text> columns,
712
+
713
+ /** Scan attributes */
714
+ 4:map<Text, Text> attributes
715
+ ) throws (1:IOError io)
716
+
717
+ /**
718
+ * Get a scanner on the current table starting and stopping at the
719
+ * specified rows. ending at the last row in the table. Return the
720
+ * specified columns.
721
+ *
722
+ * @return scanner id to be used with other scanner procedures
723
+ */
724
+ ScannerID scannerOpenWithStop(
725
+ /** name of table */
726
+ 1:Text tableName,
727
+
728
+ /**
729
+ * Starting row in table to scan.
730
+ * Send "" (empty string) to start at the first row.
731
+ */
732
+ 2:Text startRow,
733
+
734
+ /**
735
+ * row to stop scanning on. This row is *not* included in the
736
+ * scanner's results
737
+ */
738
+ 3:Text stopRow,
739
+
740
+ /**
741
+ * columns to scan. If column name is a column family, all
742
+ * columns of the specified column family are returned. It's also possible
743
+ * to pass a regex in the column qualifier.
744
+ */
745
+ 4:list<Text> columns,
746
+
747
+ /** Scan attributes */
748
+ 5:map<Text, Text> attributes
749
+ ) throws (1:IOError io)
750
+
751
+ /**
752
+ * Open a scanner for a given prefix. That is all rows will have the specified
753
+ * prefix. No other rows will be returned.
754
+ *
755
+ * @return scanner id to use with other scanner calls
756
+ */
757
+ ScannerID scannerOpenWithPrefix(
758
+ /** name of table */
759
+ 1:Text tableName,
760
+
761
+ /** the prefix (and thus start row) of the keys you want */
762
+ 2:Text startAndPrefix,
763
+
764
+ /** the columns you want returned */
765
+ 3:list<Text> columns,
766
+
767
+ /** Scan attributes */
768
+ 4:map<Text, Text> attributes
769
+ ) throws (1:IOError io)
770
+
771
+ /**
772
+ * Get a scanner on the current table starting at the specified row and
773
+ * ending at the last row in the table. Return the specified columns.
774
+ * Only values with the specified timestamp are returned.
775
+ *
776
+ * @return scanner id to be used with other scanner procedures
777
+ */
778
+ ScannerID scannerOpenTs(
779
+ /** name of table */
780
+ 1:Text tableName,
781
+
782
+ /**
783
+ * Starting row in table to scan.
784
+ * Send "" (empty string) to start at the first row.
785
+ */
786
+ 2:Text startRow,
787
+
788
+ /**
789
+ * columns to scan. If column name is a column family, all
790
+ * columns of the specified column family are returned. It's also possible
791
+ * to pass a regex in the column qualifier.
792
+ */
793
+ 3:list<Text> columns,
794
+
795
+ /** timestamp */
796
+ 4:i64 timestamp,
797
+
798
+ /** Scan attributes */
799
+ 5:map<Text, Text> attributes
800
+ ) throws (1:IOError io)
801
+
802
+ /**
803
+ * Get a scanner on the current table starting and stopping at the
804
+ * specified rows. ending at the last row in the table. Return the
805
+ * specified columns. Only values with the specified timestamp are
806
+ * returned.
807
+ *
808
+ * @return scanner id to be used with other scanner procedures
809
+ */
810
+ ScannerID scannerOpenWithStopTs(
811
+ /** name of table */
812
+ 1:Text tableName,
813
+
814
+ /**
815
+ * Starting row in table to scan.
816
+ * Send "" (empty string) to start at the first row.
817
+ */
818
+ 2:Text startRow,
819
+
820
+ /**
821
+ * row to stop scanning on. This row is *not* included in the
822
+ * scanner's results
823
+ */
824
+ 3:Text stopRow,
825
+
826
+ /**
827
+ * columns to scan. If column name is a column family, all
828
+ * columns of the specified column family are returned. It's also possible
829
+ * to pass a regex in the column qualifier.
830
+ */
831
+ 4:list<Text> columns,
832
+
833
+ /** timestamp */
834
+ 5:i64 timestamp,
835
+
836
+ /** Scan attributes */
837
+ 6:map<Text, Text> attributes
838
+ ) throws (1:IOError io)
839
+
840
+ /**
841
+ * Returns the scanner's current row value and advances to the next
842
+ * row in the table. When there are no more rows in the table, or a key
843
+ * greater-than-or-equal-to the scanner's specified stopRow is reached,
844
+ * an empty list is returned.
845
+ *
846
+ * @return a TRowResult containing the current row and a map of the columns to TCells.
847
+ *
848
+ * @throws IllegalArgument if ScannerID is invalid
849
+ *
850
+ * @throws NotFound when the scanner reaches the end
851
+ */
852
+ list<TRowResult> scannerGet(
853
+ /** id of a scanner returned by scannerOpen */
854
+ 1:ScannerID id
855
+ ) throws (1:IOError io, 2:IllegalArgument ia)
856
+
857
+ /**
858
+ * Returns, starting at the scanner's current row value nbRows worth of
859
+ * rows and advances to the next row in the table. When there are no more
860
+ * rows in the table, or a key greater-than-or-equal-to the scanner's
861
+ * specified stopRow is reached, an empty list is returned.
862
+ *
863
+ * @return a TRowResult containing the current row and a map of the columns to TCells.
864
+ *
865
+ * @throws IllegalArgument if ScannerID is invalid
866
+ *
867
+ * @throws NotFound when the scanner reaches the end
868
+ */
869
+ list<TRowResult> scannerGetList(
870
+ /** id of a scanner returned by scannerOpen */
871
+ 1:ScannerID id,
872
+
873
+ /** number of results to return */
874
+ 2:i32 nbRows
875
+ ) throws (1:IOError io, 2:IllegalArgument ia)
876
+
877
+ /**
878
+ * Closes the server-state associated with an open scanner.
879
+ *
880
+ * @throws IllegalArgument if ScannerID is invalid
881
+ */
882
+ void scannerClose(
883
+ /** id of a scanner returned by scannerOpen */
884
+ 1:ScannerID id
885
+ ) throws (1:IOError io, 2:IllegalArgument ia)
886
+
887
+ /**
888
+ * Get the row just before the specified one.
889
+ *
890
+ * @return value for specified row/column
891
+ */
892
+ list<TCell> getRowOrBefore(
893
+ /** name of table */
894
+ 1:Text tableName,
895
+
896
+ /** row key */
897
+ 2:Text row,
898
+
899
+ /** column name */
900
+ 3:Text family
901
+ ) throws (1:IOError io)
902
+
903
+ /**
904
+ * Get the regininfo for the specified row. It scans
905
+ * the metatable to find region's start and end keys.
906
+ *
907
+ * @return value for specified row/column
908
+ */
909
+ TRegionInfo getRegionInfo(
910
+ /** row key */
911
+ 1:Text row,
912
+
913
+ ) throws (1:IOError io)
914
+ }