bmg 0.18.1 → 0.18.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bmg/operator/allbut.rb +8 -4
- data/lib/bmg/operator/autosummarize.rb +6 -0
- data/lib/bmg/operator/autowrap.rb +18 -0
- data/lib/bmg/operator/constants.rb +6 -0
- data/lib/bmg/operator/extend.rb +6 -0
- data/lib/bmg/operator/image.rb +14 -0
- data/lib/bmg/operator/project.rb +2 -2
- data/lib/bmg/operator/rename.rb +6 -0
- data/lib/bmg/relation.rb +12 -0
- data/lib/bmg/relation/empty.rb +4 -0
- data/lib/bmg/relation/in_memory.rb +10 -0
- data/lib/bmg/relation/materialized.rb +6 -0
- data/lib/bmg/relation/spied.rb +5 -0
- data/lib/bmg/sequel/relation.rb +4 -0
- data/lib/bmg/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c9b490328160c9816102f7dd34b3ee46207ab4362cd2af6d8623c9fc5d4b87a
|
4
|
+
data.tar.gz: d113dc14ae1811f2b5565af9e84a0ffbc82b7842c46284af7fcad3bc9f3b7470
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd42b8787cc093c6452386760744d7480c64c8be186ab73b87a548a1b853643b46a6ad48cf019da9d77fddbb38c824eb0e0bef3ef5fa2f333f1d1240f5a0bd84
|
7
|
+
data.tar.gz: 7bd0cd32a28963123b03b59152fa03d6470bbdf1a3c6cfe0b17a6667a80d97e65d5309def4e31ec9cbb47353d409ad9ad2a6d1fbc9c2ec10797460852836ce35
|
data/lib/bmg/operator/allbut.rb
CHANGED
@@ -74,15 +74,19 @@ module Bmg
|
|
74
74
|
operand.matching(right, on).allbut(butlist)
|
75
75
|
end
|
76
76
|
|
77
|
-
def _restrict(type, predicate)
|
78
|
-
operand.restrict(predicate).allbut(butlist)
|
79
|
-
end
|
80
|
-
|
81
77
|
def _page(type, ordering, page_index, options)
|
82
78
|
return super unless self.preserving_key?
|
83
79
|
operand.page(ordering, page_index, options).allbut(butlist)
|
84
80
|
end
|
85
81
|
|
82
|
+
def _project(type, attrlist)
|
83
|
+
operand.project(attrlist)
|
84
|
+
end
|
85
|
+
|
86
|
+
def _restrict(type, predicate)
|
87
|
+
operand.restrict(predicate).allbut(butlist)
|
88
|
+
end
|
89
|
+
|
86
90
|
protected ### inspect
|
87
91
|
|
88
92
|
def preserving_key?
|
@@ -52,6 +52,12 @@ module Bmg
|
|
52
52
|
[ :autowrap, operand.to_ast, @original_options.dup ]
|
53
53
|
end
|
54
54
|
|
55
|
+
public ### for internal reasons
|
56
|
+
|
57
|
+
def _count
|
58
|
+
operand._count
|
59
|
+
end
|
60
|
+
|
55
61
|
protected ### optimization
|
56
62
|
|
57
63
|
def _autowrap(type, opts)
|
@@ -92,6 +98,8 @@ module Bmg
|
|
92
98
|
else
|
93
99
|
super
|
94
100
|
end
|
101
|
+
rescue UnknownAttributesError
|
102
|
+
super
|
95
103
|
end
|
96
104
|
|
97
105
|
def _page(type, ordering, page_index, opts)
|
@@ -105,6 +113,16 @@ module Bmg
|
|
105
113
|
super
|
106
114
|
end
|
107
115
|
|
116
|
+
def _project(type, attrlist)
|
117
|
+
if (wrapped_roots! & attrlist).empty?
|
118
|
+
operand.project(attrlist).autowrap(options)
|
119
|
+
else
|
120
|
+
super
|
121
|
+
end
|
122
|
+
rescue UnknownAttributesError
|
123
|
+
super
|
124
|
+
end
|
125
|
+
|
108
126
|
def _rename(type, renaming)
|
109
127
|
# 1. Can't optimize if renaming applies to a wrapped one
|
110
128
|
return super unless (wrapped_roots! & renaming.keys).empty?
|
data/lib/bmg/operator/extend.rb
CHANGED
data/lib/bmg/operator/image.rb
CHANGED
@@ -155,6 +155,12 @@ module Bmg
|
|
155
155
|
end
|
156
156
|
end
|
157
157
|
|
158
|
+
public ### for internal reasons
|
159
|
+
|
160
|
+
def _count
|
161
|
+
left._count
|
162
|
+
end
|
163
|
+
|
158
164
|
protected ### optimization
|
159
165
|
|
160
166
|
def _allbut(type, butlist)
|
@@ -185,6 +191,14 @@ module Bmg
|
|
185
191
|
end
|
186
192
|
end
|
187
193
|
|
194
|
+
def _project(type, attrlist)
|
195
|
+
if attrlist.include?(as)
|
196
|
+
super
|
197
|
+
else
|
198
|
+
left.project(attrlist)
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
188
202
|
def _restrict(type, predicate)
|
189
203
|
on_as, rest = predicate.and_split([as])
|
190
204
|
if rest.tautology?
|
data/lib/bmg/operator/project.rb
CHANGED
@@ -31,7 +31,7 @@ module Bmg
|
|
31
31
|
def each
|
32
32
|
seen = {}
|
33
33
|
@operand.each do |tuple|
|
34
|
-
projected =
|
34
|
+
projected = tuple_project(tuple)
|
35
35
|
unless seen.has_key?(projected)
|
36
36
|
yield(projected)
|
37
37
|
seen[projected] = true
|
@@ -74,7 +74,7 @@ module Bmg
|
|
74
74
|
|
75
75
|
private
|
76
76
|
|
77
|
-
def
|
77
|
+
def tuple_project(tuple)
|
78
78
|
tuple.dup.delete_if{|k,_| !@attrlist.include?(k) }
|
79
79
|
end
|
80
80
|
|
data/lib/bmg/operator/rename.rb
CHANGED
data/lib/bmg/relation.rb
CHANGED
@@ -110,6 +110,18 @@ module Bmg
|
|
110
110
|
end
|
111
111
|
end
|
112
112
|
|
113
|
+
def count
|
114
|
+
if type.knows_keys?
|
115
|
+
project(type.keys.first)._count
|
116
|
+
else
|
117
|
+
self._count
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
def _count
|
122
|
+
to_a.size
|
123
|
+
end
|
124
|
+
|
113
125
|
# Returns a json representation
|
114
126
|
def to_json(*args, &bl)
|
115
127
|
to_a.to_json(*args, &bl)
|
data/lib/bmg/relation/empty.rb
CHANGED
data/lib/bmg/relation/spied.rb
CHANGED
data/lib/bmg/sequel/relation.rb
CHANGED
data/lib/bmg/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bmg
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.18.
|
4
|
+
version: 0.18.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bernard Lambeau
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-04-
|
11
|
+
date: 2021-04-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: predicate
|