hipster_sql_to_hbase 0.1.7 → 0.1.8
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 +1 -3
- data/lib/sql_parser/sql.treetop +3 -1
- data/lib/sql_parser/sql_create_index.treetop +34 -0
- data/lib/sql_parser/sql_create_table.treetop +38 -2
- data/lib/sql_parser/sql_datatypes.treetop +6 -1
- data/lib/sql_parser/sql_drop_table.treetop +11 -6
- data/lib/sql_parser/sql_from_clause.treetop +1 -1
- data/lib/sql_parser/sql_helpers.treetop +48 -1
- data/lib/sql_parser/sql_insert.treetop +9 -9
- data/lib/sql_parser/sql_limit.treetop +1 -1
- data/lib/sql_parser/sql_row_support.treetop +4 -0
- data/lib/sql_parser/sql_select.treetop +5 -42
- data/lib/sql_parser/sql_select_clause.treetop +1 -1
- data/lib/sql_parser/sql_show_tables.treetop +94 -8
- data/lib/sql_parser/sql_tokens.treetop +52 -4
- data/lib/sql_parser/sql_transaction.treetop +36 -8
- data/lib/sql_parser/sql_where_condition.treetop +3 -3
- data/lib/sql_treetop_load.rb +1 -0
- metadata +30 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1583e88aaf6c60a66733fe927e0b23cbc1212131
|
4
|
+
data.tar.gz: b12dc40939b1f1ba3946f6f34fd6b81298510907
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a7f6babe8a3b23b6d732a61a349dc2c4e63cae89d836b122e2d58a2a9bcc744e0b1f381dbd5c3e425710183691038adf46b4dacba220e311dbd0abf1eed4875
|
7
|
+
data.tar.gz: 3f24fa78d1124120133e8524fe038750933553120b181f2dd7b4c97fe7e223c7ea02b020042c9155500b3e26e171749618f51233db3a8910282613d949699c46
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.8
|
data/lib/hipster_sql_to_hbase.rb
CHANGED
@@ -47,9 +47,7 @@ module HipsterSqlToHbase
|
|
47
47
|
# as to be executed as a Thrift method.
|
48
48
|
class ResultTree < Hash
|
49
49
|
def initialize(hash)
|
50
|
-
hash.each
|
51
|
-
self[k] = v
|
52
|
-
end
|
50
|
+
hash.each { |k,v| self[k] = v }
|
53
51
|
end
|
54
52
|
|
55
53
|
# Transforms itself into an HBase (Thrift) method.
|
data/lib/sql_parser/sql.treetop
CHANGED
@@ -7,6 +7,7 @@ grammar SQL
|
|
7
7
|
include SQLInsert
|
8
8
|
include SQLShowTables
|
9
9
|
include SQLCreateTable
|
10
|
+
include SQLCreateIndex
|
10
11
|
|
11
12
|
rule sql_statement
|
12
13
|
select_expression /
|
@@ -16,6 +17,7 @@ grammar SQL
|
|
16
17
|
transaction_statement /
|
17
18
|
insert /
|
18
19
|
show_tables /
|
19
|
-
create_table
|
20
|
+
create_table /
|
21
|
+
create_index
|
20
22
|
end
|
21
23
|
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
grammar SQLCreateIndex
|
2
|
+
include SQLRowSupport
|
3
|
+
|
4
|
+
rule create_index
|
5
|
+
"CREATE" optional_unique SPACES "INDEX" SPACES
|
6
|
+
index_name SPACES "ON" SPACES
|
7
|
+
table_name optional_spaces OPEN_PARENS optional_spaces column_name optional_spaces CLOSE_PARENS {
|
8
|
+
def query_type
|
9
|
+
:create_index
|
10
|
+
end
|
11
|
+
def tree
|
12
|
+
{
|
13
|
+
:index => index_name.eval,
|
14
|
+
:table => table_name.eval,
|
15
|
+
:column => column_name.eval
|
16
|
+
}
|
17
|
+
end
|
18
|
+
}
|
19
|
+
end
|
20
|
+
|
21
|
+
rule optional_unique
|
22
|
+
SPACES "UNIQUE" {
|
23
|
+
def eval
|
24
|
+
true
|
25
|
+
end
|
26
|
+
}
|
27
|
+
/
|
28
|
+
EMPTY_STRING {
|
29
|
+
def eval
|
30
|
+
false
|
31
|
+
end
|
32
|
+
}
|
33
|
+
end
|
34
|
+
end
|
@@ -3,7 +3,9 @@ grammar SQLCreateTable
|
|
3
3
|
include SQLDataTypes
|
4
4
|
|
5
5
|
rule create_table
|
6
|
-
"CREATE"
|
6
|
+
"CREATE" SPACES "TABLE" SPACES
|
7
|
+
table_name SPACES OPEN_PARENS columns_and_datatypes CLOSE_PARENS
|
8
|
+
optional_engine {
|
7
9
|
def eval
|
8
10
|
options = {
|
9
11
|
:columns => columns_and_datatypes.eval,
|
@@ -38,10 +40,44 @@ grammar SQLCreateTable
|
|
38
40
|
end
|
39
41
|
|
40
42
|
rule column_with_datatype
|
41
|
-
|
43
|
+
optional_spaces column_name SPACES datatype optional_column_features? optional_spaces {
|
42
44
|
def eval
|
43
45
|
[column_name.eval]
|
44
46
|
end
|
45
47
|
}
|
46
48
|
end
|
49
|
+
|
50
|
+
rule optional_column_features
|
51
|
+
optional_column_feature optional_column_feature
|
52
|
+
/
|
53
|
+
optional_column_feature
|
54
|
+
end
|
55
|
+
|
56
|
+
rule optional_column_feature
|
57
|
+
optional_primary_key /
|
58
|
+
optional_auto_increment /
|
59
|
+
optional_not_null
|
60
|
+
end
|
61
|
+
|
62
|
+
rule optional_primary_key
|
63
|
+
SPACES "PRIMARY" SPACES "KEY"
|
64
|
+
/
|
65
|
+
SPACES "primary" SPACES "key"
|
66
|
+
end
|
67
|
+
|
68
|
+
rule optional_auto_increment
|
69
|
+
SPACES "AUTO_INCREMENT"
|
70
|
+
/
|
71
|
+
SPACES "auto_increment"
|
72
|
+
end
|
73
|
+
|
74
|
+
rule optional_not_null
|
75
|
+
SPACES (NOT_KEYWORD SPACES)? NULL_KEYWORD
|
76
|
+
end
|
77
|
+
|
78
|
+
rule optional_engine
|
79
|
+
SPACES "ENGINE=InnoDB"
|
80
|
+
/
|
81
|
+
EMPTY_STRING
|
82
|
+
end
|
47
83
|
end
|
@@ -3,24 +3,29 @@ grammar DropTable
|
|
3
3
|
include SQLRowSupport
|
4
4
|
|
5
5
|
rule drop_table
|
6
|
-
"DROP" (temporary)?
|
6
|
+
"DROP" (temporary)? SPACES "TABLE" SPACES
|
7
7
|
table_name
|
8
8
|
(restrict / cascade)? {
|
9
|
-
def
|
10
|
-
|
9
|
+
def query_type
|
10
|
+
:drop_table
|
11
|
+
end
|
12
|
+
def tree
|
13
|
+
{
|
14
|
+
:table => table_name.eval
|
15
|
+
}
|
11
16
|
end
|
12
17
|
}
|
13
18
|
end
|
14
19
|
|
15
20
|
rule temporary
|
16
|
-
|
21
|
+
SPACES "TEMPORARY"
|
17
22
|
end
|
18
23
|
|
19
24
|
rule restrict
|
20
|
-
|
25
|
+
SPACES "RESTRICT"
|
21
26
|
end
|
22
27
|
|
23
28
|
rule cascade
|
24
|
-
|
29
|
+
SPACES "CASCADE"
|
25
30
|
end
|
26
31
|
end
|
@@ -1,6 +1,53 @@
|
|
1
1
|
grammar SQLHelpers
|
2
|
+
|
3
|
+
rule where_tree
|
4
|
+
where_condition_or_empty {
|
5
|
+
def eval
|
6
|
+
init_clause = where_condition.where_clause rescue false
|
7
|
+
|
8
|
+
(init_clause) ? build_where_tree(init_clause) : nil
|
9
|
+
end
|
10
|
+
def build_where_tree(init_clause)
|
11
|
+
clauses = []
|
12
|
+
clause = init_clause
|
13
|
+
while clause
|
14
|
+
parens = clause.OPEN_PARENS rescue false
|
15
|
+
if parens
|
16
|
+
clauses << build_where_tree(clause.where_clause)
|
17
|
+
break
|
18
|
+
end
|
19
|
+
|
20
|
+
clause_obj = false
|
21
|
+
begin
|
22
|
+
clause_obj = clause.clause1
|
23
|
+
rescue
|
24
|
+
clause_obj = clause if clause.one_column_name rescue false
|
25
|
+
end
|
26
|
+
if clause_obj
|
27
|
+
clauses << {
|
28
|
+
:column => clause_obj.one_column_name.eval,
|
29
|
+
:condition => clause_obj.joiner_or_null.condition_joiner.eval,
|
30
|
+
:value => clause_obj.joiner_or_null.primitive.eval
|
31
|
+
}
|
32
|
+
|
33
|
+
dc_joiner = clause.disjunction_or_conjunction_joiner.text_value rescue dc_joiner = false
|
34
|
+
clauses << dc_joiner if dc_joiner
|
35
|
+
|
36
|
+
clause = clause.clause2 rescue false
|
37
|
+
if !clause
|
38
|
+
clause = clause.where_clause rescue false
|
39
|
+
end
|
40
|
+
else
|
41
|
+
clause = clause.where_clause rescue false
|
42
|
+
end
|
43
|
+
end
|
44
|
+
clauses
|
45
|
+
end
|
46
|
+
}
|
47
|
+
end
|
48
|
+
|
2
49
|
rule where_condition_or_empty
|
3
|
-
|
50
|
+
SPACES where_condition {
|
4
51
|
def eval
|
5
52
|
where_condition.eval
|
6
53
|
end
|
@@ -4,9 +4,9 @@ grammar SQLInsert
|
|
4
4
|
include SQLHelpers
|
5
5
|
|
6
6
|
rule insert
|
7
|
-
"INSERT"
|
8
|
-
("INTO"
|
9
|
-
("VALUES" / "VALUE")
|
7
|
+
"INSERT" SPACES ((low_priority / delayed / high_priority) SPACES)? (ignore SPACES)?
|
8
|
+
("INTO" SPACES)? table_name SPACES optional_list_of_columns
|
9
|
+
("VALUES" / "VALUE") optional_spaces groups_of_values {
|
10
10
|
def query_type
|
11
11
|
:insert
|
12
12
|
end
|
@@ -41,7 +41,7 @@ grammar SQLInsert
|
|
41
41
|
end
|
42
42
|
|
43
43
|
rule optional_list_of_columns
|
44
|
-
list_of_columns
|
44
|
+
list_of_columns SPACES {
|
45
45
|
def eval; list_of_columns.eval; end
|
46
46
|
}
|
47
47
|
/
|
@@ -67,19 +67,19 @@ grammar SQLInsert
|
|
67
67
|
end
|
68
68
|
|
69
69
|
rule list_of_columns
|
70
|
-
"("
|
70
|
+
"(" optional_spaces one_or_more_column_names optional_spaces ")" {
|
71
71
|
def eval; one_or_more_column_names.eval; end
|
72
72
|
}
|
73
73
|
end
|
74
74
|
|
75
75
|
rule groups_of_values
|
76
|
-
OPEN_PARENS
|
76
|
+
OPEN_PARENS optional_spaces list_of_values optional_spaces CLOSE_PARENS optional_spaces "," optional_spaces groups_of_values {
|
77
77
|
def eval
|
78
78
|
[list_of_values.eval] + groups_of_values.eval
|
79
79
|
end
|
80
80
|
}
|
81
81
|
/
|
82
|
-
OPEN_PARENS
|
82
|
+
OPEN_PARENS optional_spaces list_of_values optional_spaces CLOSE_PARENS {
|
83
83
|
def eval
|
84
84
|
[list_of_values.eval]
|
85
85
|
end
|
@@ -93,7 +93,7 @@ grammar SQLInsert
|
|
93
93
|
end
|
94
94
|
|
95
95
|
rule one_or_more_values
|
96
|
-
insert_value
|
96
|
+
insert_value optional_spaces "," optional_spaces one_or_more_values {
|
97
97
|
def eval
|
98
98
|
[insert_value.eval, one_or_more_values.eval].flatten
|
99
99
|
end
|
@@ -111,7 +111,7 @@ grammar SQLInsert
|
|
111
111
|
end
|
112
112
|
|
113
113
|
rule default_value
|
114
|
-
"DEFAULT"
|
114
|
+
"DEFAULT" optional_spaces OPEN_PARENS optional_spaces column_name optional_spaces CLOSE_PARENS {
|
115
115
|
def eval; "DEFAULT"; end
|
116
116
|
}
|
117
117
|
end
|
@@ -11,7 +11,7 @@ grammar SQLSelect
|
|
11
11
|
rule select_expression
|
12
12
|
select
|
13
13
|
from
|
14
|
-
|
14
|
+
where_tree
|
15
15
|
limit_condition_or_empty
|
16
16
|
order_by_condition_or_empty
|
17
17
|
{
|
@@ -21,58 +21,21 @@ grammar SQLSelect
|
|
21
21
|
|
22
22
|
:select => select.eval,
|
23
23
|
:from => from.eval,
|
24
|
-
:where => where_condition_or_empty.eval,
|
24
|
+
:where => where_tree.where_condition_or_empty.eval,
|
25
25
|
:limit => limit_condition_or_empty.eval,
|
26
26
|
:order_by => order_by_condition_or_empty.eval
|
27
27
|
})
|
28
28
|
end
|
29
|
+
|
29
30
|
def query_type
|
30
31
|
:select
|
31
32
|
end
|
32
|
-
|
33
|
-
clauses = []
|
34
|
-
clause = init_clause
|
35
|
-
while clause
|
36
|
-
parens = clause.OPEN_PARENS rescue false
|
37
|
-
if parens
|
38
|
-
clauses << build_tree(clause.where_clause)
|
39
|
-
break
|
40
|
-
end
|
41
|
-
|
42
|
-
clause_obj = false
|
43
|
-
begin
|
44
|
-
clause_obj = clause.clause1
|
45
|
-
rescue
|
46
|
-
clause_obj = clause if clause.one_column_name rescue false
|
47
|
-
end
|
48
|
-
if clause_obj
|
49
|
-
clauses << {
|
50
|
-
:column => clause_obj.one_column_name.eval,
|
51
|
-
:condition => clause_obj.joiner_or_null.condition_joiner.eval,
|
52
|
-
:value => clause_obj.joiner_or_null.primitive.eval
|
53
|
-
}
|
54
|
-
|
55
|
-
dc_joiner = clause.disjunction_or_conjunction_joiner.text_value rescue dc_joiner = false
|
56
|
-
clauses << dc_joiner if dc_joiner
|
57
|
-
|
58
|
-
clause = clause.clause2 rescue false
|
59
|
-
if !clause
|
60
|
-
clause = clause.where_clause rescue false
|
61
|
-
end
|
62
|
-
else
|
63
|
-
clause = clause.where_clause rescue false
|
64
|
-
end
|
65
|
-
end
|
66
|
-
clauses
|
67
|
-
end
|
33
|
+
|
68
34
|
def tree
|
69
|
-
init_clause = self.where_condition_or_empty.where_condition.where_clause rescue false
|
70
|
-
|
71
|
-
where_result = (init_clause) ? build_tree(init_clause) : nil
|
72
35
|
{
|
73
36
|
:select => select.columns,
|
74
37
|
:from => from.tables,
|
75
|
-
:where =>
|
38
|
+
:where => where_tree.eval,
|
76
39
|
:limit => limit_condition_or_empty.eval,
|
77
40
|
:order_by => order_by_condition_or_empty.eval
|
78
41
|
}
|
@@ -4,23 +4,109 @@ grammar SQLShowTables
|
|
4
4
|
include SQLWhereCondition
|
5
5
|
|
6
6
|
rule show_tables
|
7
|
-
"SHOW"
|
8
|
-
|
7
|
+
"SHOW" SPACES optional_full
|
8
|
+
tables_or_fields
|
9
|
+
optional_from_table
|
10
|
+
optional_like_or_where {
|
11
|
+
def query_type
|
12
|
+
:show
|
13
|
+
end
|
14
|
+
|
15
|
+
def tree
|
16
|
+
like_where = optional_like_or_where.eval
|
17
|
+
{
|
18
|
+
:show => tables_or_fields.eval,
|
19
|
+
:full => optional_full.eval,
|
20
|
+
:from => optional_from_table.eval,
|
21
|
+
:like => like_where[:like],
|
22
|
+
:where => like_where[:where]
|
23
|
+
}
|
24
|
+
end
|
25
|
+
}
|
26
|
+
end
|
27
|
+
|
28
|
+
rule tables_or_fields
|
29
|
+
"TABLES" {
|
30
|
+
def eval
|
31
|
+
"tables"
|
32
|
+
end
|
33
|
+
}
|
34
|
+
/
|
35
|
+
"FIELDS" {
|
36
|
+
def eval
|
37
|
+
"fields"
|
38
|
+
end
|
39
|
+
}
|
40
|
+
/
|
41
|
+
"KEYS" {
|
9
42
|
def eval
|
10
|
-
|
43
|
+
"keys"
|
44
|
+
end
|
45
|
+
}
|
46
|
+
end
|
47
|
+
|
48
|
+
rule optional_like_or_where
|
49
|
+
EMPTY_STRING like_pattern {
|
50
|
+
def eval
|
51
|
+
{
|
52
|
+
:like => like_pattern.eval,
|
53
|
+
:where => nil
|
54
|
+
}
|
55
|
+
end
|
56
|
+
}
|
57
|
+
/
|
58
|
+
EMPTY_STRING where_tree {
|
59
|
+
def eval
|
60
|
+
{
|
61
|
+
:like => nil,
|
62
|
+
:where => where_tree.eval
|
63
|
+
}
|
64
|
+
end
|
65
|
+
}
|
66
|
+
/
|
67
|
+
EMPTY_STRING {
|
68
|
+
def eval
|
69
|
+
{
|
70
|
+
:like => nil,
|
71
|
+
:where => nil
|
72
|
+
}
|
11
73
|
end
|
12
74
|
}
|
13
75
|
end
|
14
76
|
|
15
|
-
rule
|
16
|
-
"FULL"
|
77
|
+
rule optional_full
|
78
|
+
"FULL" SPACES {
|
79
|
+
def eval
|
80
|
+
true
|
81
|
+
end
|
82
|
+
}
|
83
|
+
/
|
84
|
+
EMPTY_STRING {
|
85
|
+
def eval
|
86
|
+
false
|
87
|
+
end
|
88
|
+
}
|
17
89
|
end
|
18
90
|
|
19
|
-
rule
|
20
|
-
|
91
|
+
rule optional_from_table
|
92
|
+
SPACES "FROM" SPACES table_name {
|
93
|
+
def eval
|
94
|
+
table_name.eval
|
95
|
+
end
|
96
|
+
}
|
97
|
+
/
|
98
|
+
EMPTY_STRING {
|
99
|
+
def eval
|
100
|
+
nil
|
101
|
+
end
|
102
|
+
}
|
21
103
|
end
|
22
104
|
|
23
105
|
rule like_pattern
|
24
|
-
|
106
|
+
SPACES "LIKE" SPACES single_quoted_string {
|
107
|
+
def eval
|
108
|
+
single_quoted_string.eval
|
109
|
+
end
|
110
|
+
}
|
25
111
|
end
|
26
112
|
end
|
@@ -2,6 +2,10 @@ grammar SQLTokens
|
|
2
2
|
rule SPACE
|
3
3
|
" "
|
4
4
|
end
|
5
|
+
|
6
|
+
rule SPACES
|
7
|
+
SPACE+
|
8
|
+
end
|
5
9
|
|
6
10
|
rule OPEN_PARENS
|
7
11
|
'('
|
@@ -55,10 +59,6 @@ grammar SQLTokens
|
|
55
59
|
[a-zA-Z]
|
56
60
|
end
|
57
61
|
|
58
|
-
rule NON_QUOTE_CHARS
|
59
|
-
[^'"]
|
60
|
-
end
|
61
|
-
|
62
62
|
rule DIGIT
|
63
63
|
[0-9]
|
64
64
|
end
|
@@ -73,53 +73,101 @@ grammar SQLTokens
|
|
73
73
|
|
74
74
|
rule REAL_KEYWORD
|
75
75
|
"REAL"
|
76
|
+
/
|
77
|
+
"real"
|
76
78
|
end
|
77
79
|
|
78
80
|
rule DOUBLE_KEYWORD
|
79
81
|
"DOUBLE"
|
82
|
+
/
|
83
|
+
"double"
|
80
84
|
end
|
81
85
|
|
82
86
|
rule FLOAT_KEYWORD
|
83
87
|
"FLOAT"
|
88
|
+
/
|
89
|
+
"float"
|
84
90
|
end
|
85
91
|
|
86
92
|
rule DECIMAL_KEYWORD
|
87
93
|
"DECIMAL"
|
94
|
+
/
|
95
|
+
"decimal"
|
88
96
|
end
|
89
97
|
|
90
98
|
rule NUMERIC_KEYWORD
|
91
99
|
"NUMERIC"
|
100
|
+
/
|
101
|
+
"numeric"
|
92
102
|
end
|
93
103
|
|
94
104
|
rule SMALL_INT_KEYWORD
|
95
105
|
"SMALLINT"
|
106
|
+
/
|
107
|
+
"smallint"
|
96
108
|
end
|
97
109
|
|
98
110
|
rule TINY_INT_KEYWORD
|
99
111
|
"TINYINT"
|
112
|
+
/
|
113
|
+
"tinyint"
|
100
114
|
end
|
101
115
|
|
102
116
|
rule INT_KEYWORD
|
103
117
|
"INT"
|
118
|
+
/
|
119
|
+
"int"
|
104
120
|
end
|
105
121
|
|
106
122
|
rule INTEGER_KEYWORD
|
107
123
|
"INTEGER"
|
124
|
+
/
|
125
|
+
"integer"
|
108
126
|
end
|
109
127
|
|
110
128
|
rule ZEROFILL_KEYWORD
|
111
129
|
"ZEROFILL"
|
130
|
+
/
|
131
|
+
"zerofill"
|
112
132
|
end
|
113
133
|
|
114
134
|
rule UNSIGNED_KEYWORD
|
115
135
|
"UNSIGNED"
|
136
|
+
/
|
137
|
+
"unsigned"
|
116
138
|
end
|
117
139
|
|
118
140
|
rule BIG_INT_KEYWORD
|
119
141
|
"BIGINT"
|
142
|
+
/
|
143
|
+
"bigint"
|
120
144
|
end
|
121
145
|
|
122
146
|
rule VARCHAR_KEYWORD
|
123
147
|
"VARCHAR"
|
148
|
+
/
|
149
|
+
"varchar"
|
150
|
+
end
|
151
|
+
|
152
|
+
rule DATETIME_KEYWORD
|
153
|
+
"DATETIME"
|
154
|
+
/
|
155
|
+
"datetime"
|
156
|
+
end
|
157
|
+
|
158
|
+
rule NOT_KEYWORD
|
159
|
+
"NOT"
|
160
|
+
/
|
161
|
+
"not"
|
162
|
+
end
|
163
|
+
|
164
|
+
rule NULL_KEYWORD
|
165
|
+
"NULL"
|
166
|
+
/
|
167
|
+
"null"
|
168
|
+
end
|
169
|
+
|
170
|
+
rule NON_QUOTE_CHARS
|
171
|
+
[^'"]
|
124
172
|
end
|
125
173
|
end
|
@@ -6,23 +6,44 @@ grammar SQLTransaction
|
|
6
6
|
end
|
7
7
|
|
8
8
|
rule start_transaction
|
9
|
-
"START"
|
9
|
+
"START" SPACES "TRANSACTION" with_consistent_snapshot? {
|
10
|
+
def query_type
|
11
|
+
:start
|
12
|
+
end
|
13
|
+
def tree
|
14
|
+
{ :start => nil }
|
15
|
+
end
|
16
|
+
}
|
10
17
|
end
|
11
18
|
|
12
19
|
rule with_consistent_snapshot
|
13
|
-
|
20
|
+
SPACES "WITH" SPACES "CONSISTENT" SPACES "SNAPSHOT"
|
14
21
|
end
|
15
22
|
|
16
23
|
rule begin
|
17
|
-
"BEGIN" work?
|
24
|
+
"BEGIN" work? {
|
25
|
+
def query_type
|
26
|
+
:begin
|
27
|
+
end
|
28
|
+
def tree
|
29
|
+
{ :begin => nil }
|
30
|
+
end
|
31
|
+
}
|
18
32
|
end
|
19
33
|
|
20
34
|
rule work
|
21
|
-
|
35
|
+
SPACES "WORK"
|
22
36
|
end
|
23
37
|
|
24
38
|
rule commit
|
25
|
-
"COMMIT" optional_transactional_clauses
|
39
|
+
"COMMIT" optional_transactional_clauses {
|
40
|
+
def query_type
|
41
|
+
:commit
|
42
|
+
end
|
43
|
+
def tree
|
44
|
+
{ :commit => nil }
|
45
|
+
end
|
46
|
+
}
|
26
47
|
end
|
27
48
|
|
28
49
|
rule optional_transactional_clauses
|
@@ -30,14 +51,21 @@ grammar SQLTransaction
|
|
30
51
|
end
|
31
52
|
|
32
53
|
rule chain
|
33
|
-
|
54
|
+
SPACES "AND" SPACES ("NO" SPACES)? "CHAIN"
|
34
55
|
end
|
35
56
|
|
36
57
|
rule release
|
37
|
-
|
58
|
+
SPACES ("NO" SPACES)? "RELEASE"
|
38
59
|
end
|
39
60
|
|
40
61
|
rule rollback
|
41
|
-
"ROLLBACK" optional_transactional_clauses
|
62
|
+
"ROLLBACK" optional_transactional_clauses {
|
63
|
+
def query_type
|
64
|
+
:rollback
|
65
|
+
end
|
66
|
+
def tree
|
67
|
+
{ :rollback => nil }
|
68
|
+
end
|
69
|
+
}
|
42
70
|
end
|
43
71
|
end
|
@@ -2,7 +2,7 @@ grammar SQLWhereCondition
|
|
2
2
|
include SQLKeyValuePair
|
3
3
|
|
4
4
|
rule where_condition
|
5
|
-
"WHERE"
|
5
|
+
"WHERE" SPACES where_clause {
|
6
6
|
def eval
|
7
7
|
where_clause.eval
|
8
8
|
end
|
@@ -16,8 +16,8 @@ grammar SQLWhereCondition
|
|
16
16
|
end
|
17
17
|
}
|
18
18
|
/
|
19
|
-
clause1:single_expression_where_clause
|
20
|
-
disjunction_or_conjunction_joiner
|
19
|
+
clause1:single_expression_where_clause SPACES
|
20
|
+
disjunction_or_conjunction_joiner SPACES
|
21
21
|
clause2:where_clause {
|
22
22
|
def eval
|
23
23
|
klass = Expressions.find_class_for(disjunction_or_conjunction_joiner.eval)
|
data/lib/sql_treetop_load.rb
CHANGED
@@ -20,4 +20,5 @@ Treetop.load "#{File.dirname(__FILE__)}/sql_parser/sql_insert.treetop"
|
|
20
20
|
Treetop.load "#{File.dirname(__FILE__)}/sql_parser/sql_update.treetop"
|
21
21
|
Treetop.load "#{File.dirname(__FILE__)}/sql_parser/sql_datatypes.treetop"
|
22
22
|
Treetop.load "#{File.dirname(__FILE__)}/sql_parser/sql_create_table.treetop"
|
23
|
+
Treetop.load "#{File.dirname(__FILE__)}/sql_parser/sql_create_index.treetop"
|
23
24
|
Treetop.load "#{File.dirname(__FILE__)}/sql_parser/sql.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.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jean Lescure
|
@@ -14,98 +14,98 @@ dependencies:
|
|
14
14
|
name: treetop
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: jml_thrift
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: json
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: bundler
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rdoc
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - ~>
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: 4.0.0
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - ~>
|
94
|
+
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: 4.0.0
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: jfish
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: 0.1.1
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: 0.1.1
|
111
111
|
description: SQL to HBase parser using Treetop (output based on Thrift). Doing all
|
@@ -119,11 +119,20 @@ extra_rdoc_files:
|
|
119
119
|
- README.md
|
120
120
|
- README.rdoc
|
121
121
|
files:
|
122
|
+
- ".document"
|
123
|
+
- Gemfile
|
124
|
+
- LICENSE
|
125
|
+
- LICENSE.txt
|
126
|
+
- README.md
|
127
|
+
- README.rdoc
|
128
|
+
- Rakefile
|
129
|
+
- VERSION
|
130
|
+
- hipster_sql_to_hbase.gemspec
|
131
|
+
- lib/adapter/Hbase.thrift
|
132
|
+
- lib/adapter/hbase.rb
|
122
133
|
- lib/adapter/hbase/hbase.rb
|
123
134
|
- lib/adapter/hbase/hbase_constants.rb
|
124
135
|
- lib/adapter/hbase/hbase_types.rb
|
125
|
-
- lib/adapter/hbase.rb
|
126
|
-
- lib/adapter/Hbase.thrift
|
127
136
|
- lib/datatype_extras.rb
|
128
137
|
- lib/executor.rb
|
129
138
|
- lib/hipster_sql_to_hbase.rb
|
@@ -131,6 +140,7 @@ files:
|
|
131
140
|
- lib/result_tree_to_json_converter.rb
|
132
141
|
- lib/sql_parser/sql.treetop
|
133
142
|
- lib/sql_parser/sql_chars.treetop
|
143
|
+
- lib/sql_parser/sql_create_index.treetop
|
134
144
|
- lib/sql_parser/sql_create_table.treetop
|
135
145
|
- lib/sql_parser/sql_datatypes.treetop
|
136
146
|
- lib/sql_parser/sql_delete.treetop
|
@@ -155,15 +165,6 @@ files:
|
|
155
165
|
- lib/sql_treetop_load.rb
|
156
166
|
- spec/hipster_sql_to_hbase_spec.rb
|
157
167
|
- spec/spec_helper.rb
|
158
|
-
- .document
|
159
|
-
- Gemfile
|
160
|
-
- LICENSE
|
161
|
-
- LICENSE.txt
|
162
|
-
- README.md
|
163
|
-
- README.rdoc
|
164
|
-
- Rakefile
|
165
|
-
- VERSION
|
166
|
-
- hipster_sql_to_hbase.gemspec
|
167
168
|
homepage: http://github.com/jeanlescure/hipster_sql_to_hbase
|
168
169
|
licenses:
|
169
170
|
- MIT
|
@@ -174,19 +175,18 @@ require_paths:
|
|
174
175
|
- lib
|
175
176
|
required_ruby_version: !ruby/object:Gem::Requirement
|
176
177
|
requirements:
|
177
|
-
- -
|
178
|
+
- - ">="
|
178
179
|
- !ruby/object:Gem::Version
|
179
180
|
version: '0'
|
180
181
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
181
182
|
requirements:
|
182
|
-
- -
|
183
|
+
- - ">="
|
183
184
|
- !ruby/object:Gem::Version
|
184
185
|
version: '0'
|
185
186
|
requirements: []
|
186
187
|
rubyforge_project:
|
187
|
-
rubygems_version: 2.
|
188
|
+
rubygems_version: 2.2.2
|
188
189
|
signing_key:
|
189
190
|
specification_version: 4
|
190
191
|
summary: SQL to HBase parser using Treetop (output based on Thrift).
|
191
192
|
test_files: []
|
192
|
-
has_rdoc:
|