hipster_sql_to_hbase 0.1.85 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2b82a138f6e35c5a4072920ba7a5f5b6c07538e1
4
- data.tar.gz: cab50297a9a0e006e2034bb99e803cbfb0239625
3
+ metadata.gz: 1e9b6ec47f4bf7ea5891b324f89503e45cf8c3eb
4
+ data.tar.gz: c5e995d9ff7c8cf4518a9721c799316ce991bcad
5
5
  SHA512:
6
- metadata.gz: 721c219f83f84770cc61b7e87ff3f345536168d2a7d2d962d42112ae96d1f1120e766a5fef5865c20db11a4a79ad7779d1bd1f1a4d54b14445d63f06dd70356c
7
- data.tar.gz: d58b5d6e8d55ac34abd20e9ce71bd33dd46b38da13818365dd2aa8cd9648962e6de6169201b3cec7b2e8773ad4004474542eca7473000981c92e65d877e14553
6
+ metadata.gz: 69e228786d1539ea179445b1b73160d109fe111348748cbd761790a3ec38f7a4199351023895aeb2322dd96ad5899dc4565167524de8464fc624ce9d0898742d
7
+ data.tar.gz: 01d0174443732c50f334f6d145f80a2d1d5e0b1f5eb3915311d6afeb39a1c05201da54a0591ef884d1bf6f547c387b4223cb5f645feeeb315f7a650a799bf16d
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.85
1
+ 0.2.0
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "hipster_sql_to_hbase"
5
- s.version = "0.1.85"
5
+ s.version = "0.2.0"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Jean Lescure"]
@@ -112,11 +112,16 @@ module HipsterSqlToHbase
112
112
  # }
113
113
  def parse_hash(string)
114
114
  syntax_tree = parse_syntax(string)
115
+
115
116
  return nil if syntax_tree.nil?
116
- {
117
+
118
+ result = {
117
119
  :query_type => syntax_tree.query_type,
118
120
  :query_hash => syntax_tree.tree
119
121
  }
122
+ result[:query_hash][:create_sentence] = string if syntax_tree.query_type == :create_table
123
+
124
+ result
120
125
  end
121
126
 
122
127
  # Generate a <b>HipsterSqlToHbase</b>::<b>ResultTree</b> from a valid, SQL string.
@@ -2,10 +2,11 @@ grammar SQL
2
2
  include SQLSelect
3
3
  include SQLDelete
4
4
  include SQLTruncate
5
- include DropTable #TODO: Fix my name
5
+ include SQLDropTable
6
6
  include SQLTransaction
7
7
  include SQLInsert
8
8
  include SQLShowTables
9
+ include SQLShowCreate
9
10
  include SQLCreateTable
10
11
  include SQLCreateIndex
11
12
 
@@ -17,6 +18,7 @@ grammar SQL
17
18
  transaction_statement /
18
19
  insert /
19
20
  show_tables /
21
+ show_create /
20
22
  create_table /
21
23
  create_index
22
24
  end
@@ -1,4 +1,4 @@
1
- grammar DropTable
1
+ grammar SQLDropTable
2
2
  include SQLPrimitives
3
3
  include SQLRowSupport
4
4
 
@@ -0,0 +1,34 @@
1
+ grammar SQLShowCreate
2
+ include SQLPrimitives
3
+ include SQLRowSupport
4
+
5
+ rule show_create
6
+ "SHOW" SPACES "CREATE" SPACES table_or_db SPACES table_name {
7
+ def query_type
8
+ :show
9
+ end
10
+
11
+ def tree
12
+ {
13
+ :show => "create",
14
+ :table_or_db => table_or_db.eval,
15
+ :name => table_name.eval
16
+ }
17
+ end
18
+ }
19
+ end
20
+
21
+ rule table_or_db
22
+ "TABLE" {
23
+ def eval
24
+ "table"
25
+ end
26
+ }
27
+ /
28
+ "DATABASE" {
29
+ def eval
30
+ "db"
31
+ end
32
+ }
33
+ end
34
+ end
@@ -14,6 +14,7 @@ Treetop.load "#{File.dirname(__FILE__)}/sql_parser/sql_select.treetop"
14
14
  Treetop.load "#{File.dirname(__FILE__)}/sql_parser/sql_truncate.treetop"
15
15
  Treetop.load "#{File.dirname(__FILE__)}/sql_parser/sql_delete.treetop"
16
16
  Treetop.load "#{File.dirname(__FILE__)}/sql_parser/sql_drop_table.treetop"
17
+ Treetop.load "#{File.dirname(__FILE__)}/sql_parser/sql_show_create.treetop"
17
18
  Treetop.load "#{File.dirname(__FILE__)}/sql_parser/sql_show_tables.treetop"
18
19
  Treetop.load "#{File.dirname(__FILE__)}/sql_parser/sql_transaction.treetop"
19
20
  Treetop.load "#{File.dirname(__FILE__)}/sql_parser/sql_insert.treetop"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hipster_sql_to_hbase
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.85
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jean Lescure
@@ -156,6 +156,7 @@ files:
156
156
  - lib/sql_parser/sql_row_support.treetop
157
157
  - lib/sql_parser/sql_select.treetop
158
158
  - lib/sql_parser/sql_select_clause.treetop
159
+ - lib/sql_parser/sql_show_create.treetop
159
160
  - lib/sql_parser/sql_show_tables.treetop
160
161
  - lib/sql_parser/sql_tokens.treetop
161
162
  - lib/sql_parser/sql_transaction.treetop