axiom-optimizer 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.rspec +2 -1
- data/.rubocop.yml +6 -0
- data/.travis.yml +16 -20
- data/CONTRIBUTING.md +1 -2
- data/Gemfile +3 -1
- data/Gemfile.devtools +28 -18
- data/README.md +7 -13
- data/TODO +6 -5
- data/axiom-optimizer.gemspec +3 -3
- data/config/flay.yml +1 -1
- data/config/reek.yml +5 -29
- data/config/rubocop.yml +16 -10
- data/lib/axiom/optimizer.rb +3 -7
- data/lib/axiom/optimizer/algebra/difference.rb +2 -2
- data/lib/axiom/optimizer/algebra/extension.rb +6 -6
- data/lib/axiom/optimizer/algebra/intersection.rb +2 -2
- data/lib/axiom/optimizer/algebra/join.rb +4 -4
- data/lib/axiom/optimizer/algebra/product.rb +4 -4
- data/lib/axiom/optimizer/algebra/projection.rb +5 -5
- data/lib/axiom/optimizer/algebra/rename.rb +10 -10
- data/lib/axiom/optimizer/algebra/restriction.rb +8 -9
- data/lib/axiom/optimizer/algebra/summarization.rb +7 -7
- data/lib/axiom/optimizer/algebra/union.rb +2 -2
- data/lib/axiom/optimizer/function.rb +4 -6
- data/lib/axiom/optimizer/function/binary.rb +2 -2
- data/lib/axiom/optimizer/function/connective/binary.rb +1 -1
- data/lib/axiom/optimizer/function/connective/negation.rb +1 -1
- data/lib/axiom/optimizer/function/predicate.rb +1 -1
- data/lib/axiom/optimizer/function/predicate/comparable.rb +8 -6
- data/lib/axiom/optimizer/function/predicate/enumerable.rb +2 -2
- data/lib/axiom/optimizer/function/unary.rb +1 -1
- data/lib/axiom/optimizer/relation/operation/binary.rb +12 -12
- data/lib/axiom/optimizer/relation/operation/reverse.rb +9 -9
- data/lib/axiom/optimizer/relation/operation/{order.rb → sorted.rb} +15 -15
- data/lib/axiom/optimizer/relation/operation/unary.rb +7 -7
- data/lib/axiom/optimizer/support/predicate_partition.rb +11 -13
- data/lib/axiom/optimizer/version.rb +1 -1
- data/spec/integration/axiom/algebra/difference/optimize_spec.rb +12 -12
- data/spec/integration/axiom/algebra/intersection/optimize_spec.rb +12 -12
- data/spec/integration/axiom/algebra/join/optimize_spec.rb +6 -6
- data/spec/integration/axiom/algebra/product/optimize_spec.rb +10 -10
- data/spec/integration/axiom/algebra/projection/optimize_spec.rb +14 -14
- data/spec/integration/axiom/algebra/rename/optimize_spec.rb +38 -38
- data/spec/integration/axiom/algebra/restriction/optimize_spec.rb +12 -12
- data/spec/integration/axiom/algebra/summarization/optimize_spec.rb +2 -2
- data/spec/integration/axiom/algebra/union/optimize_spec.rb +16 -16
- data/spec/integration/axiom/function/optimize_spec.rb +1 -1
- data/spec/integration/axiom/relation/operation/limit/optimize_spec.rb +20 -20
- data/spec/integration/axiom/relation/operation/offset/optimize_spec.rb +14 -14
- data/spec/integration/axiom/relation/operation/reverse/optimize_spec.rb +15 -15
- data/spec/integration/axiom/relation/operation/{order → sorted}/optimize_spec.rb +6 -6
- data/spec/integration/axiom/relation/optimize_spec.rb +1 -1
- data/spec/shared/function_connective_binary_optimize_behavior.rb +8 -2
- data/spec/shared/optimize_method_behavior.rb +0 -11
- data/spec/spec_helper.rb +9 -9
- data/spec/support/config_alias.rb +2 -0
- data/spec/unit/axiom/optimizer/algebra/extension/{order_operand → sorted_operand}/optimizable_predicate_spec.rb +3 -3
- data/spec/unit/axiom/optimizer/algebra/extension/{order_operand → sorted_operand}/optimize_spec.rb +1 -1
- data/spec/unit/axiom/optimizer/algebra/rename/limit_operand/optimize_spec.rb +3 -3
- data/spec/unit/axiom/optimizer/algebra/rename/offset_operand/optimize_spec.rb +3 -3
- data/spec/unit/axiom/optimizer/algebra/rename/{order_operand → sorted_operand}/optimizable_predicate_spec.rb +3 -3
- data/spec/unit/axiom/optimizer/algebra/rename/{order_operand → sorted_operand}/optimize_spec.rb +2 -2
- data/spec/unit/axiom/optimizer/algebra/restriction/combination_operand/optimize_spec.rb +1 -1
- data/spec/unit/axiom/optimizer/algebra/restriction/predicate_spec.rb +5 -4
- data/spec/unit/axiom/optimizer/algebra/restriction/{order_operand → sorted_operand}/optimizable_predicate_spec.rb +3 -3
- data/spec/unit/axiom/optimizer/algebra/restriction/{order_operand → sorted_operand}/optimize_spec.rb +1 -1
- data/spec/unit/axiom/optimizer/algebra/summarization/empty_operand/class_methods/extension_default_spec.rb +1 -1
- data/spec/unit/axiom/optimizer/algebra/summarization/{order_operand → sorted_operand}/optimizable_predicate_spec.rb +3 -3
- data/spec/unit/axiom/optimizer/algebra/summarization/{order_operand → sorted_operand}/optimize_spec.rb +1 -1
- data/spec/unit/axiom/optimizer/algebra/summarization/summarize_per_spec.rb +1 -1
- data/spec/unit/axiom/optimizer/function/binary/constant_operands/optimizable_predicate_spec.rb +4 -4
- data/spec/unit/axiom/optimizer/function/connective/conjunction/contradiction/optimizable_predicate_spec.rb +2 -2
- data/spec/unit/axiom/optimizer/function/connective/disjunction/tautology/optimizable_predicate_spec.rb +2 -2
- data/spec/unit/axiom/optimizer/function/unary/constant_operand/optimizable_predicate_spec.rb +1 -1
- data/spec/unit/axiom/optimizer/function/util/class_methods/max_spec.rb +1 -1
- data/spec/unit/axiom/optimizer/function/util/class_methods/min_spec.rb +1 -1
- data/spec/unit/axiom/optimizer/optimizable/optimize_spec.rb +3 -3
- data/spec/unit/axiom/optimizer/optimizable_predicate_spec.rb +1 -5
- data/spec/unit/axiom/optimizer/optimize_spec.rb +1 -5
- data/spec/unit/axiom/optimizer/relation/operation/binary/{order_left → sorted_left}/optimizable_predicate_spec.rb +3 -3
- data/spec/unit/axiom/optimizer/relation/operation/binary/{order_left → sorted_left}/optimize_spec.rb +1 -1
- data/spec/unit/axiom/optimizer/relation/operation/binary/{order_right → sorted_right}/optimizable_predicate_spec.rb +3 -3
- data/spec/unit/axiom/optimizer/relation/operation/binary/{order_right → sorted_right}/optimize_spec.rb +1 -1
- data/spec/unit/axiom/optimizer/relation/operation/limit/equal_limit_operand/optimize_spec.rb +2 -2
- data/spec/unit/axiom/optimizer/relation/operation/limit/limit_operand/optimize_spec.rb +4 -4
- data/spec/unit/axiom/optimizer/relation/operation/limit/unoptimized_operand/optimize_spec.rb +3 -3
- data/spec/unit/axiom/optimizer/relation/operation/limit/zero_limit/optimize_spec.rb +2 -2
- data/spec/unit/axiom/optimizer/relation/operation/offset/offset_operand/optimize_spec.rb +3 -3
- data/spec/unit/axiom/optimizer/relation/operation/offset/unoptimized_operand/optimize_spec.rb +3 -3
- data/spec/unit/axiom/optimizer/relation/operation/offset/zero_offset/optimize_spec.rb +3 -3
- data/spec/unit/axiom/optimizer/relation/operation/reverse/{order_operand → sorted_operand}/optimizable_predicate_spec.rb +3 -3
- data/spec/unit/axiom/optimizer/relation/operation/reverse/{order_operand → sorted_operand}/optimize_spec.rb +2 -2
- data/spec/unit/axiom/optimizer/relation/operation/reverse/unoptimized_operand/optimize_spec.rb +4 -4
- data/spec/unit/axiom/optimizer/relation/operation/{order → sorted}/one_limit_operand/optimizable_predicate_spec.rb +2 -2
- data/spec/unit/axiom/optimizer/relation/operation/{order → sorted}/one_limit_operand/optimize_spec.rb +1 -1
- data/spec/unit/axiom/optimizer/relation/operation/{order/order_operand → sorted/sorted_operand}/optimizable_predicate_spec.rb +4 -4
- data/spec/unit/axiom/optimizer/relation/operation/{order/order_operand → sorted/sorted_operand}/optimize_spec.rb +5 -5
- data/spec/unit/axiom/optimizer/relation/operation/{order → sorted}/unoptimized_operand/optimizable_predicate_spec.rb +2 -2
- data/spec/unit/axiom/optimizer/relation/operation/{order → sorted}/unoptimized_operand/optimize_spec.rb +2 -2
- data/spec/unit/axiom/optimizer/relation/operation/unary/{order_operand → sorted_operand}/optimizable_predicate_spec.rb +4 -4
- data/spec/unit/axiom/optimizer/relation/operation/unary/{order_operand → sorted_operand}/optimize_spec.rb +2 -2
- metadata +291 -47
- data/spec/support/ice_nine_config.rb +0 -6
@@ -88,7 +88,7 @@ module Axiom
|
|
88
88
|
#
|
89
89
|
# @api private
|
90
90
|
def optimizable?
|
91
|
-
left.materialized? && !
|
91
|
+
left.materialized? && !right_matching_left?
|
92
92
|
end
|
93
93
|
|
94
94
|
# Return the join of the left and right with the right restricted
|
@@ -131,7 +131,7 @@ module Axiom
|
|
131
131
|
#
|
132
132
|
# @api private
|
133
133
|
def optimizable?
|
134
|
-
right.materialized? && !
|
134
|
+
right.materialized? && !left_matching_right?
|
135
135
|
end
|
136
136
|
|
137
137
|
# Return the join of the left and right with the left restricted
|
@@ -170,8 +170,8 @@ module Axiom
|
|
170
170
|
EmptyRight,
|
171
171
|
EqualHeaders,
|
172
172
|
DisjointHeaders,
|
173
|
-
|
174
|
-
|
173
|
+
SortedLeft,
|
174
|
+
SortedRight,
|
175
175
|
MaterializedOperands,
|
176
176
|
MaterializedLeft,
|
177
177
|
MaterializedRight,
|
@@ -16,7 +16,7 @@ module Axiom
|
|
16
16
|
#
|
17
17
|
# @api private
|
18
18
|
def optimizable?
|
19
|
-
left.header.empty? && !
|
19
|
+
left.header.empty? && !left.kind_of?(Axiom::Relation::Empty)
|
20
20
|
end
|
21
21
|
|
22
22
|
# A Product with a left TABLE DEE is equivalent to the right operand
|
@@ -39,7 +39,7 @@ module Axiom
|
|
39
39
|
#
|
40
40
|
# @api private
|
41
41
|
def optimizable?
|
42
|
-
right.header.empty? && !
|
42
|
+
right.header.empty? && !right.kind_of?(Axiom::Relation::Empty)
|
43
43
|
end
|
44
44
|
|
45
45
|
# A Product with a right TABLE DEE is equivalent to the left operand
|
@@ -58,8 +58,8 @@ module Axiom
|
|
58
58
|
TableDeeRight,
|
59
59
|
EmptyLeft,
|
60
60
|
EmptyRight,
|
61
|
-
|
62
|
-
|
61
|
+
SortedLeft,
|
62
|
+
SortedRight,
|
63
63
|
MaterializedOperands,
|
64
64
|
UnoptimizedOperands
|
65
65
|
)
|
@@ -152,10 +152,10 @@ module Axiom
|
|
152
152
|
|
153
153
|
end # class UnionOperand
|
154
154
|
|
155
|
-
# Optimize when the operand is an
|
156
|
-
class
|
157
|
-
include Relation::Operation::Unary::
|
158
|
-
end # class
|
155
|
+
# Optimize when the operand is an Sorted
|
156
|
+
class SortedOperand < self
|
157
|
+
include Relation::Operation::Unary::SortedOperand
|
158
|
+
end # class SortedOperand
|
159
159
|
|
160
160
|
# Optimize when the operand is Empty
|
161
161
|
class EmptyOperand < self
|
@@ -200,7 +200,7 @@ module Axiom
|
|
200
200
|
ProjectionOperand,
|
201
201
|
ExtensionOperand,
|
202
202
|
UnionOperand,
|
203
|
-
|
203
|
+
SortedOperand,
|
204
204
|
EmptyOperand,
|
205
205
|
MaterializedOperand,
|
206
206
|
UnoptimizedOperand
|
@@ -135,7 +135,7 @@ module Axiom
|
|
135
135
|
#
|
136
136
|
# @api private
|
137
137
|
def alias_names
|
138
|
-
aliases.to_hash.values.map
|
138
|
+
aliases.to_hash.values.map(&:name)
|
139
139
|
end
|
140
140
|
|
141
141
|
# Returns the attributes removed from the projection
|
@@ -249,31 +249,31 @@ module Axiom
|
|
249
249
|
|
250
250
|
end # class ReverseOperand
|
251
251
|
|
252
|
-
# Optimize when the operand is an
|
253
|
-
class
|
254
|
-
include Relation::Operation::Unary::
|
252
|
+
# Optimize when the operand is an Sorted
|
253
|
+
class SortedOperand < self
|
254
|
+
include Relation::Operation::Unary::SortedOperand
|
255
255
|
|
256
|
-
# Wrap the Rename in an
|
256
|
+
# Wrap the Rename in an Sorted
|
257
257
|
#
|
258
|
-
# @return [
|
258
|
+
# @return [Sorted]
|
259
259
|
#
|
260
260
|
# @api private
|
261
261
|
def optimize
|
262
|
-
wrap_operand.sort_by
|
262
|
+
wrap_operand.sort_by(directions)
|
263
263
|
end
|
264
264
|
|
265
265
|
private
|
266
266
|
|
267
267
|
# Return the renamed directions
|
268
268
|
#
|
269
|
-
# @return [Relation::Operation::
|
269
|
+
# @return [Relation::Operation::Sorted::DirectionSet]
|
270
270
|
#
|
271
271
|
# @api private
|
272
272
|
def directions
|
273
273
|
operand.directions.rename(aliases)
|
274
274
|
end
|
275
275
|
|
276
|
-
end # class
|
276
|
+
end # class SortedOperand
|
277
277
|
|
278
278
|
# Optimize when the operand is a Limit
|
279
279
|
class LimitOperand < self
|
@@ -367,7 +367,7 @@ module Axiom
|
|
367
367
|
RestrictionOperand,
|
368
368
|
SetOperand,
|
369
369
|
ReverseOperand,
|
370
|
-
|
370
|
+
SortedOperand,
|
371
371
|
LimitOperand,
|
372
372
|
OffsetOperand,
|
373
373
|
EmptyOperand,
|
@@ -6,6 +6,7 @@ module Axiom
|
|
6
6
|
|
7
7
|
# Abstract base class representing Restriction optimizations
|
8
8
|
class Restriction < Relation::Operation::Unary
|
9
|
+
include AbstractType
|
9
10
|
|
10
11
|
# The optimized predicate
|
11
12
|
#
|
@@ -206,9 +207,7 @@ module Axiom
|
|
206
207
|
# raised when the subclass does not implement the method
|
207
208
|
#
|
208
209
|
# @api private
|
209
|
-
|
210
|
-
raise NotImplementedError, "#{self.class}#relation_method must be implemented"
|
211
|
-
end
|
210
|
+
abstract_method :relation_method
|
212
211
|
|
213
212
|
# Restrict the left operand with the left predicate partition
|
214
213
|
#
|
@@ -325,10 +324,10 @@ module Axiom
|
|
325
324
|
|
326
325
|
end # class SetOperand
|
327
326
|
|
328
|
-
# Optimize when the operand is an
|
329
|
-
class
|
330
|
-
include Relation::Operation::Unary::
|
331
|
-
end # class
|
327
|
+
# Optimize when the operand is an Sorted
|
328
|
+
class SortedOperand < self
|
329
|
+
include Relation::Operation::Unary::SortedOperand
|
330
|
+
end # class SortedOperand
|
332
331
|
|
333
332
|
# Optimize when operand is optimizable
|
334
333
|
class UnoptimizedOperand < self
|
@@ -340,7 +339,7 @@ module Axiom
|
|
340
339
|
#
|
341
340
|
# @api private
|
342
341
|
def optimizable?
|
343
|
-
super || !
|
342
|
+
super || !predicate.equal?(operation.predicate)
|
344
343
|
end
|
345
344
|
|
346
345
|
# Return a Restriction with an optimized operand
|
@@ -361,7 +360,7 @@ module Axiom
|
|
361
360
|
JoinOperand,
|
362
361
|
ProductOperand,
|
363
362
|
SetOperand,
|
364
|
-
|
363
|
+
SortedOperand,
|
365
364
|
EmptyOperand,
|
366
365
|
MaterializedOperand,
|
367
366
|
UnoptimizedOperand
|
@@ -135,10 +135,10 @@ module Axiom
|
|
135
135
|
|
136
136
|
end # class EmptySummarizePer
|
137
137
|
|
138
|
-
# Optimize when the operand is an
|
139
|
-
class
|
140
|
-
include Relation::Operation::Unary::
|
141
|
-
end # class
|
138
|
+
# Optimize when the operand is an Sorted
|
139
|
+
class SortedOperand < self
|
140
|
+
include Relation::Operation::Unary::SortedOperand
|
141
|
+
end # class SortedOperand
|
142
142
|
|
143
143
|
# Optimize when operand is optimizable
|
144
144
|
class UnoptimizedOperand < self
|
@@ -172,7 +172,7 @@ module Axiom
|
|
172
172
|
#
|
173
173
|
# @api private
|
174
174
|
def summarize_per_optimizable?
|
175
|
-
!
|
175
|
+
!summarize_per.equal?(operation.summarize_per)
|
176
176
|
end
|
177
177
|
|
178
178
|
# Test if the summarizers are optimizable
|
@@ -181,7 +181,7 @@ module Axiom
|
|
181
181
|
#
|
182
182
|
# @api private
|
183
183
|
def summarizers_optimizable?
|
184
|
-
!
|
184
|
+
!summarizers.eql?(operation.summarizers)
|
185
185
|
end
|
186
186
|
|
187
187
|
end # class UnoptimizedOperand
|
@@ -189,7 +189,7 @@ module Axiom
|
|
189
189
|
Axiom::Algebra::Summarization.optimizer = chain(
|
190
190
|
EmptyOperand,
|
191
191
|
EmptySummarizePer,
|
192
|
-
|
192
|
+
SortedOperand,
|
193
193
|
MaterializedOperand,
|
194
194
|
UnoptimizedOperand
|
195
195
|
)
|
@@ -59,9 +59,8 @@ module Axiom
|
|
59
59
|
#
|
60
60
|
# @api private
|
61
61
|
def self.min(operand)
|
62
|
-
|
63
|
-
|
64
|
-
when Attribute::Numeric then operand.range.first
|
62
|
+
if operand.respond_to?(:range)
|
63
|
+
operand.range.first
|
65
64
|
else
|
66
65
|
operand
|
67
66
|
end
|
@@ -73,9 +72,8 @@ module Axiom
|
|
73
72
|
#
|
74
73
|
# @api private
|
75
74
|
def self.max(operand)
|
76
|
-
|
77
|
-
|
78
|
-
when Attribute::Numeric then operand.range.last
|
75
|
+
if operand.respond_to?(:range)
|
76
|
+
operand.range.last
|
79
77
|
else
|
80
78
|
operand
|
81
79
|
end
|
@@ -105,7 +105,7 @@ module Axiom
|
|
105
105
|
#
|
106
106
|
# @api private
|
107
107
|
def left_optimizable?
|
108
|
-
!
|
108
|
+
!left.equal?(operation.left)
|
109
109
|
end
|
110
110
|
|
111
111
|
# Test if the right operand is optimizable
|
@@ -114,7 +114,7 @@ module Axiom
|
|
114
114
|
#
|
115
115
|
# @api private
|
116
116
|
def right_optimizable?
|
117
|
-
!
|
117
|
+
!right.equal?(operation.right)
|
118
118
|
end
|
119
119
|
|
120
120
|
end # module UnoptimizedOperands
|
@@ -46,7 +46,7 @@ module Axiom
|
|
46
46
|
elsif util.constant?(left) then left_invalid_constant?
|
47
47
|
elsif util.constant?(right) then right_invalid_constant?
|
48
48
|
else
|
49
|
-
!
|
49
|
+
!joinable?
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
@@ -67,7 +67,7 @@ module Axiom
|
|
67
67
|
#
|
68
68
|
# @api private
|
69
69
|
def left_invalid_constant?
|
70
|
-
!
|
70
|
+
!right.include?(left)
|
71
71
|
end
|
72
72
|
|
73
73
|
# Test if the right operand is an invalid constant
|
@@ -76,7 +76,7 @@ module Axiom
|
|
76
76
|
#
|
77
77
|
# @api private
|
78
78
|
def right_invalid_constant?
|
79
|
-
!
|
79
|
+
!left.include?(right)
|
80
80
|
end
|
81
81
|
|
82
82
|
# Test if the left and right operand are joinable
|
@@ -103,7 +103,7 @@ module Axiom
|
|
103
103
|
if util.constant?(left) then left_invalid_constant?
|
104
104
|
elsif util.constant?(right) then right_invalid_constant?
|
105
105
|
else
|
106
|
-
!
|
106
|
+
!comparable?
|
107
107
|
end
|
108
108
|
end
|
109
109
|
|
@@ -115,7 +115,8 @@ module Axiom
|
|
115
115
|
#
|
116
116
|
# @api private
|
117
117
|
def left_invalid_constant?
|
118
|
-
|
118
|
+
type = right.type
|
119
|
+
!type.infer(left.class).equal?(type)
|
119
120
|
end
|
120
121
|
|
121
122
|
# Test if the right operand is an invalid constant
|
@@ -124,7 +125,8 @@ module Axiom
|
|
124
125
|
#
|
125
126
|
# @api private
|
126
127
|
def right_invalid_constant?
|
127
|
-
|
128
|
+
type = left.type
|
129
|
+
!type.infer(right.class).equal?(type)
|
128
130
|
end
|
129
131
|
|
130
132
|
# Test if the left and right operand are comparable
|
@@ -72,9 +72,9 @@ module Axiom
|
|
72
72
|
#
|
73
73
|
# @api private
|
74
74
|
def normalized_right_enumerable
|
75
|
-
enumerable = operation.right.select
|
75
|
+
enumerable = operation.right.select(&left.method(:include?))
|
76
76
|
enumerable.uniq!
|
77
|
-
enumerable.sort_by!
|
77
|
+
enumerable.sort_by!(&Enumerable.method(:sort_by_value))
|
78
78
|
end
|
79
79
|
|
80
80
|
# Optimize when the right operand is empty
|
@@ -53,19 +53,19 @@ module Axiom
|
|
53
53
|
|
54
54
|
end # module EmptyRight
|
55
55
|
|
56
|
-
# Optimize when the left operand is an
|
57
|
-
class
|
56
|
+
# Optimize when the left operand is an Sorted
|
57
|
+
class SortedLeft < self
|
58
58
|
|
59
|
-
# Test if the left operand is an
|
59
|
+
# Test if the left operand is an Sorted
|
60
60
|
#
|
61
61
|
# @return [Boolean]
|
62
62
|
#
|
63
63
|
# @api private
|
64
64
|
def optimizable?
|
65
|
-
left.kind_of?(Axiom::Relation::Operation::
|
65
|
+
left.kind_of?(Axiom::Relation::Operation::Sorted)
|
66
66
|
end
|
67
67
|
|
68
|
-
# Drop the
|
68
|
+
# Drop the Sorted and wrap the left operand
|
69
69
|
#
|
70
70
|
# @return [Binary]
|
71
71
|
#
|
@@ -74,21 +74,21 @@ module Axiom
|
|
74
74
|
operation.class.new(left.operand, right)
|
75
75
|
end
|
76
76
|
|
77
|
-
end # class
|
77
|
+
end # class SortedLeft
|
78
78
|
|
79
|
-
# Optimize when the right operand is an
|
80
|
-
class
|
79
|
+
# Optimize when the right operand is an Sorted
|
80
|
+
class SortedRight < self
|
81
81
|
|
82
|
-
# Test if the right operand is an
|
82
|
+
# Test if the right operand is an Sorted
|
83
83
|
#
|
84
84
|
# @return [Boolean]
|
85
85
|
#
|
86
86
|
# @api private
|
87
87
|
def optimizable?
|
88
|
-
right.kind_of?(Axiom::Relation::Operation::
|
88
|
+
right.kind_of?(Axiom::Relation::Operation::Sorted)
|
89
89
|
end
|
90
90
|
|
91
|
-
# Drop the
|
91
|
+
# Drop the Sorted and wrap the right operand
|
92
92
|
#
|
93
93
|
# @return [Binary]
|
94
94
|
#
|
@@ -97,7 +97,7 @@ module Axiom
|
|
97
97
|
operation.class.new(left, right.operand)
|
98
98
|
end
|
99
99
|
|
100
|
-
end # class
|
100
|
+
end # class SortedRight
|
101
101
|
|
102
102
|
# Optimize when the operands are Materialized
|
103
103
|
class MaterializedOperands < self
|