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 +4 -4
- data/VERSION +1 -1
- data/hipster_sql_to_hbase.gemspec +1 -1
- data/lib/hipster_sql_to_hbase.rb +6 -1
- data/lib/sql_parser/sql.treetop +3 -1
- data/lib/sql_parser/sql_drop_table.treetop +1 -1
- data/lib/sql_parser/sql_show_create.treetop +34 -0
- data/lib/sql_treetop_load.rb +1 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e9b6ec47f4bf7ea5891b324f89503e45cf8c3eb
|
4
|
+
data.tar.gz: c5e995d9ff7c8cf4518a9721c799316ce991bcad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 69e228786d1539ea179445b1b73160d109fe111348748cbd761790a3ec38f7a4199351023895aeb2322dd96ad5899dc4565167524de8464fc624ce9d0898742d
|
7
|
+
data.tar.gz: 01d0174443732c50f334f6d145f80a2d1d5e0b1f5eb3915311d6afeb39a1c05201da54a0591ef884d1bf6f547c387b4223cb5f645feeeb315f7a650a799bf16d
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
data/lib/hipster_sql_to_hbase.rb
CHANGED
@@ -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.
|
data/lib/sql_parser/sql.treetop
CHANGED
@@ -2,10 +2,11 @@ grammar SQL
|
|
2
2
|
include SQLSelect
|
3
3
|
include SQLDelete
|
4
4
|
include SQLTruncate
|
5
|
-
include
|
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
|
@@ -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
|
data/lib/sql_treetop_load.rb
CHANGED
@@ -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.
|
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
|