axiom-optimizer 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +2 -1
  3. data/.rubocop.yml +6 -0
  4. data/.travis.yml +16 -20
  5. data/CONTRIBUTING.md +1 -2
  6. data/Gemfile +3 -1
  7. data/Gemfile.devtools +28 -18
  8. data/README.md +7 -13
  9. data/TODO +6 -5
  10. data/axiom-optimizer.gemspec +3 -3
  11. data/config/flay.yml +1 -1
  12. data/config/reek.yml +5 -29
  13. data/config/rubocop.yml +16 -10
  14. data/lib/axiom/optimizer.rb +3 -7
  15. data/lib/axiom/optimizer/algebra/difference.rb +2 -2
  16. data/lib/axiom/optimizer/algebra/extension.rb +6 -6
  17. data/lib/axiom/optimizer/algebra/intersection.rb +2 -2
  18. data/lib/axiom/optimizer/algebra/join.rb +4 -4
  19. data/lib/axiom/optimizer/algebra/product.rb +4 -4
  20. data/lib/axiom/optimizer/algebra/projection.rb +5 -5
  21. data/lib/axiom/optimizer/algebra/rename.rb +10 -10
  22. data/lib/axiom/optimizer/algebra/restriction.rb +8 -9
  23. data/lib/axiom/optimizer/algebra/summarization.rb +7 -7
  24. data/lib/axiom/optimizer/algebra/union.rb +2 -2
  25. data/lib/axiom/optimizer/function.rb +4 -6
  26. data/lib/axiom/optimizer/function/binary.rb +2 -2
  27. data/lib/axiom/optimizer/function/connective/binary.rb +1 -1
  28. data/lib/axiom/optimizer/function/connective/negation.rb +1 -1
  29. data/lib/axiom/optimizer/function/predicate.rb +1 -1
  30. data/lib/axiom/optimizer/function/predicate/comparable.rb +8 -6
  31. data/lib/axiom/optimizer/function/predicate/enumerable.rb +2 -2
  32. data/lib/axiom/optimizer/function/unary.rb +1 -1
  33. data/lib/axiom/optimizer/relation/operation/binary.rb +12 -12
  34. data/lib/axiom/optimizer/relation/operation/reverse.rb +9 -9
  35. data/lib/axiom/optimizer/relation/operation/{order.rb → sorted.rb} +15 -15
  36. data/lib/axiom/optimizer/relation/operation/unary.rb +7 -7
  37. data/lib/axiom/optimizer/support/predicate_partition.rb +11 -13
  38. data/lib/axiom/optimizer/version.rb +1 -1
  39. data/spec/integration/axiom/algebra/difference/optimize_spec.rb +12 -12
  40. data/spec/integration/axiom/algebra/intersection/optimize_spec.rb +12 -12
  41. data/spec/integration/axiom/algebra/join/optimize_spec.rb +6 -6
  42. data/spec/integration/axiom/algebra/product/optimize_spec.rb +10 -10
  43. data/spec/integration/axiom/algebra/projection/optimize_spec.rb +14 -14
  44. data/spec/integration/axiom/algebra/rename/optimize_spec.rb +38 -38
  45. data/spec/integration/axiom/algebra/restriction/optimize_spec.rb +12 -12
  46. data/spec/integration/axiom/algebra/summarization/optimize_spec.rb +2 -2
  47. data/spec/integration/axiom/algebra/union/optimize_spec.rb +16 -16
  48. data/spec/integration/axiom/function/optimize_spec.rb +1 -1
  49. data/spec/integration/axiom/relation/operation/limit/optimize_spec.rb +20 -20
  50. data/spec/integration/axiom/relation/operation/offset/optimize_spec.rb +14 -14
  51. data/spec/integration/axiom/relation/operation/reverse/optimize_spec.rb +15 -15
  52. data/spec/integration/axiom/relation/operation/{order → sorted}/optimize_spec.rb +6 -6
  53. data/spec/integration/axiom/relation/optimize_spec.rb +1 -1
  54. data/spec/shared/function_connective_binary_optimize_behavior.rb +8 -2
  55. data/spec/shared/optimize_method_behavior.rb +0 -11
  56. data/spec/spec_helper.rb +9 -9
  57. data/spec/support/config_alias.rb +2 -0
  58. data/spec/unit/axiom/optimizer/algebra/extension/{order_operand → sorted_operand}/optimizable_predicate_spec.rb +3 -3
  59. data/spec/unit/axiom/optimizer/algebra/extension/{order_operand → sorted_operand}/optimize_spec.rb +1 -1
  60. data/spec/unit/axiom/optimizer/algebra/rename/limit_operand/optimize_spec.rb +3 -3
  61. data/spec/unit/axiom/optimizer/algebra/rename/offset_operand/optimize_spec.rb +3 -3
  62. data/spec/unit/axiom/optimizer/algebra/rename/{order_operand → sorted_operand}/optimizable_predicate_spec.rb +3 -3
  63. data/spec/unit/axiom/optimizer/algebra/rename/{order_operand → sorted_operand}/optimize_spec.rb +2 -2
  64. data/spec/unit/axiom/optimizer/algebra/restriction/combination_operand/optimize_spec.rb +1 -1
  65. data/spec/unit/axiom/optimizer/algebra/restriction/predicate_spec.rb +5 -4
  66. data/spec/unit/axiom/optimizer/algebra/restriction/{order_operand → sorted_operand}/optimizable_predicate_spec.rb +3 -3
  67. data/spec/unit/axiom/optimizer/algebra/restriction/{order_operand → sorted_operand}/optimize_spec.rb +1 -1
  68. data/spec/unit/axiom/optimizer/algebra/summarization/empty_operand/class_methods/extension_default_spec.rb +1 -1
  69. data/spec/unit/axiom/optimizer/algebra/summarization/{order_operand → sorted_operand}/optimizable_predicate_spec.rb +3 -3
  70. data/spec/unit/axiom/optimizer/algebra/summarization/{order_operand → sorted_operand}/optimize_spec.rb +1 -1
  71. data/spec/unit/axiom/optimizer/algebra/summarization/summarize_per_spec.rb +1 -1
  72. data/spec/unit/axiom/optimizer/function/binary/constant_operands/optimizable_predicate_spec.rb +4 -4
  73. data/spec/unit/axiom/optimizer/function/connective/conjunction/contradiction/optimizable_predicate_spec.rb +2 -2
  74. data/spec/unit/axiom/optimizer/function/connective/disjunction/tautology/optimizable_predicate_spec.rb +2 -2
  75. data/spec/unit/axiom/optimizer/function/unary/constant_operand/optimizable_predicate_spec.rb +1 -1
  76. data/spec/unit/axiom/optimizer/function/util/class_methods/max_spec.rb +1 -1
  77. data/spec/unit/axiom/optimizer/function/util/class_methods/min_spec.rb +1 -1
  78. data/spec/unit/axiom/optimizer/optimizable/optimize_spec.rb +3 -3
  79. data/spec/unit/axiom/optimizer/optimizable_predicate_spec.rb +1 -5
  80. data/spec/unit/axiom/optimizer/optimize_spec.rb +1 -5
  81. data/spec/unit/axiom/optimizer/relation/operation/binary/{order_left → sorted_left}/optimizable_predicate_spec.rb +3 -3
  82. data/spec/unit/axiom/optimizer/relation/operation/binary/{order_left → sorted_left}/optimize_spec.rb +1 -1
  83. data/spec/unit/axiom/optimizer/relation/operation/binary/{order_right → sorted_right}/optimizable_predicate_spec.rb +3 -3
  84. data/spec/unit/axiom/optimizer/relation/operation/binary/{order_right → sorted_right}/optimize_spec.rb +1 -1
  85. data/spec/unit/axiom/optimizer/relation/operation/limit/equal_limit_operand/optimize_spec.rb +2 -2
  86. data/spec/unit/axiom/optimizer/relation/operation/limit/limit_operand/optimize_spec.rb +4 -4
  87. data/spec/unit/axiom/optimizer/relation/operation/limit/unoptimized_operand/optimize_spec.rb +3 -3
  88. data/spec/unit/axiom/optimizer/relation/operation/limit/zero_limit/optimize_spec.rb +2 -2
  89. data/spec/unit/axiom/optimizer/relation/operation/offset/offset_operand/optimize_spec.rb +3 -3
  90. data/spec/unit/axiom/optimizer/relation/operation/offset/unoptimized_operand/optimize_spec.rb +3 -3
  91. data/spec/unit/axiom/optimizer/relation/operation/offset/zero_offset/optimize_spec.rb +3 -3
  92. data/spec/unit/axiom/optimizer/relation/operation/reverse/{order_operand → sorted_operand}/optimizable_predicate_spec.rb +3 -3
  93. data/spec/unit/axiom/optimizer/relation/operation/reverse/{order_operand → sorted_operand}/optimize_spec.rb +2 -2
  94. data/spec/unit/axiom/optimizer/relation/operation/reverse/unoptimized_operand/optimize_spec.rb +4 -4
  95. data/spec/unit/axiom/optimizer/relation/operation/{order → sorted}/one_limit_operand/optimizable_predicate_spec.rb +2 -2
  96. data/spec/unit/axiom/optimizer/relation/operation/{order → sorted}/one_limit_operand/optimize_spec.rb +1 -1
  97. data/spec/unit/axiom/optimizer/relation/operation/{order/order_operand → sorted/sorted_operand}/optimizable_predicate_spec.rb +4 -4
  98. data/spec/unit/axiom/optimizer/relation/operation/{order/order_operand → sorted/sorted_operand}/optimize_spec.rb +5 -5
  99. data/spec/unit/axiom/optimizer/relation/operation/{order → sorted}/unoptimized_operand/optimizable_predicate_spec.rb +2 -2
  100. data/spec/unit/axiom/optimizer/relation/operation/{order → sorted}/unoptimized_operand/optimize_spec.rb +2 -2
  101. data/spec/unit/axiom/optimizer/relation/operation/unary/{order_operand → sorted_operand}/optimizable_predicate_spec.rb +4 -4
  102. data/spec/unit/axiom/optimizer/relation/operation/unary/{order_operand → sorted_operand}/optimize_spec.rb +2 -2
  103. metadata +291 -47
  104. data/spec/support/ice_nine_config.rb +0 -6
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: bccd5f05e6c6803b863b3e5fa27e73d8a0d107dc
4
+ data.tar.gz: 14112805ecdd1e826d28e96e1696a32fb61afa6a
5
+ SHA512:
6
+ metadata.gz: c30e128184f50585d4c00b145a56edf1c57d78aada4307a0af950b378456dc30aaed39d42b1efb004d69a07c553bb6f6b55016860fcfed61b5eccc7120bd7ba5
7
+ data.tar.gz: 1e577f725496d72bd354815d0f80681e3125993c82691c212c0192ebd879cfaa212a361ed9f5c94d2cb9c600bd53342322264d81c2475234bf7d6a333322bbe5
data/.rspec CHANGED
@@ -1,5 +1,6 @@
1
+ --backtrace
1
2
  --color
2
3
  --format progress
4
+ --order random
3
5
  --profile
4
6
  --warnings
5
- --order random
@@ -0,0 +1,6 @@
1
+ AllCops:
2
+ Includes:
3
+ - 'Gemfile'
4
+ Excludes:
5
+ - 'Gemfile.devtools'
6
+ - 'vendor/**'
@@ -1,33 +1,29 @@
1
1
  language: ruby
2
2
  before_install: gem install bundler
3
3
  bundler_args: --without yard guard benchmarks
4
- script: "bundle exec rake ci"
4
+ script: "bundle exec rake ci:metrics"
5
5
  rvm:
6
6
  - 1.9.3
7
7
  - 2.0.0
8
+ - 2.1.0
8
9
  - ruby-head
9
- - rbx-19mode
10
+ - rbx
11
+ matrix:
12
+ include:
13
+ - rvm: jruby-19mode
14
+ env: JRUBY_OPTS="$JRUBY_OPTS --debug" # for simplecov
15
+ - rvm: jruby-20mode
16
+ env: JRUBY_OPTS="$JRUBY_OPTS --debug" # for simplecov
17
+ - rvm: jruby-21mode
18
+ env: JRUBY_OPTS="$JRUBY_OPTS --debug" # for simplecov
19
+ - rvm: jruby-head
20
+ env: JRUBY_OPTS="$JRUBY_OPTS --debug" # for simplecov
21
+ allow_failures:
22
+ - rvm: 2.1.0 # buggy runtime
23
+ fast_finish: true
10
24
  notifications:
11
25
  irc:
12
26
  channels:
13
27
  - irc.freenode.org#rom-rb
14
28
  on_success: never
15
29
  on_failure: change
16
- email:
17
- recipients:
18
- - dan.kubb@gmail.com
19
- on_success: never
20
- on_failure: change
21
- matrix:
22
- include:
23
- - rvm: jruby-19mode
24
- env: JRUBY_OPTS="$JRUBY_OPTS --debug"
25
- - rvm: jruby-head
26
- env: JRUBY_OPTS="$JRUBY_OPTS --debug"
27
- allow_failures:
28
- # mutant fails
29
- - rvm: 1.9.3
30
- - rvm: 2.0.0
31
- - rvm: rbx-19mode
32
- # broken on travis
33
- - rvm: ruby-head
@@ -1,5 +1,4 @@
1
- Contributing
2
- ------------
1
+ # Contributing
3
2
 
4
3
  * If you want your code merged into the mainline, please discuss the proposed changes with me before doing any work on it. This library is still in early development, and the direction it is going may not always be clear. Some features may not be appropriate yet, may need to be deferred until later when the foundation for them is laid, or may be more applicable in a plugin.
5
4
  * Fork the project.
data/Gemfile CHANGED
@@ -4,7 +4,9 @@ source 'https://rubygems.org'
4
4
 
5
5
  gemspec
6
6
 
7
- gem 'axiom', '~> 0.1.1', git: 'https://github.com/dkubb/axiom.git'
7
+ platform :rbx do
8
+ gem 'rubysl-bigdecimal', '~> 2.0.2'
9
+ end
8
10
 
9
11
  group :development, :test do
10
12
  gem 'devtools', git: 'https://github.com/rom-rb/devtools.git'
@@ -3,22 +3,25 @@
3
3
  group :development do
4
4
  gem 'rake', '~> 10.1.0'
5
5
  gem 'rspec', '~> 2.14.1'
6
- gem 'yard', '~> 0.8.6.2'
6
+ gem 'yard', '~> 0.8.7'
7
+
8
+ platform :rbx do
9
+ gem 'rubysl-singleton', '~> 2.0.0'
10
+ end
7
11
  end
8
12
 
9
13
  group :yard do
10
- gem 'kramdown', '~> 1.1.0'
14
+ gem 'kramdown', '~> 1.3.0'
11
15
  end
12
16
 
13
17
  group :guard do
14
- gem 'guard', '~> 1.8.1'
15
- gem 'guard-bundler', '~> 1.0.0'
16
- gem 'guard-rspec', '~> 3.0.2'
17
- gem 'guard-rubocop', '~> 0.2.0'
18
- gem 'guard-mutant', '~> 0.0.1'
18
+ gem 'guard', '~> 2.3.0'
19
+ gem 'guard-bundler', '~> 2.0.0'
20
+ gem 'guard-rspec', '~> 4.2.0'
21
+ gem 'guard-rubocop', '~> 1.0.0'
19
22
 
20
23
  # file system change event handling
21
- gem 'listen', '~> 1.2.2'
24
+ gem 'listen', '~> 2.4.0'
22
25
  gem 'rb-fchange', '~> 0.0.6', require: false
23
26
  gem 'rb-fsevent', '~> 0.9.3', require: false
24
27
  gem 'rb-inotify', '~> 0.9.0', require: false
@@ -30,21 +33,28 @@ group :guard do
30
33
  end
31
34
 
32
35
  group :metrics do
33
- gem 'coveralls', '~> 0.6.7'
34
- gem 'flay', '~> 2.3.1'
35
- gem 'flog', '~> 4.1.1'
36
- gem 'reek', '~> 1.3.1', git: 'https://github.com/troessner/reek.git'
37
- gem 'rubocop', '~> 0.10.0', git: 'https://github.com/bbatsov/rubocop.git'
38
- gem 'simplecov', '~> 0.7.1'
39
- gem 'yardstick', '~> 0.9.6'
36
+ gem 'coveralls', '~> 0.7.0'
37
+ gem 'flay', '~> 2.4.0'
38
+ gem 'flog', '~> 4.2.0'
39
+ gem 'reek', '~> 1.3.2'
40
+ gem 'rubocop', '~> 0.16.0'
41
+ gem 'simplecov', '~> 0.8.2'
42
+ gem 'yardstick', '~> 0.9.9'
43
+
44
+ platforms :mri do
45
+ gem 'mutant', '~> 0.3.4'
46
+ end
40
47
 
41
48
  platforms :ruby_19, :ruby_20 do
42
- gem 'mutant', git: 'https://github.com/mbj/mutant.git'
43
49
  gem 'yard-spellcheck', '~> 0.1.5'
44
50
  end
45
51
 
46
- platforms :rbx do
47
- gem 'pelusa', '~> 0.2.2'
52
+ platform :rbx do
53
+ gem 'json', '~> 1.8.1'
54
+ gem 'racc', '~> 1.4'
55
+ gem 'rubysl-logger', '~> 2.0.0'
56
+ gem 'rubysl-open-uri', '~> 2.0.0'
57
+ gem 'rubysl-prettyprint', '~> 2.0.2'
48
58
  end
49
59
  end
50
60
 
data/README.md CHANGED
@@ -1,5 +1,4 @@
1
- axiom-optimizer
2
- ===============
1
+ # axiom-optimizer
3
2
 
4
3
  Relational algebra optimizer
5
4
 
@@ -15,8 +14,7 @@ Relational algebra optimizer
15
14
  [codeclimate]: https://codeclimate.com/github/dkubb/axiom-optimizer
16
15
  [coveralls]: https://coveralls.io/r/dkubb/axiom-optimizer
17
16
 
18
- Examples
19
- --------
17
+ ## Examples
20
18
 
21
19
  ```ruby
22
20
  # optimize a relation
@@ -32,8 +30,7 @@ new_aggregate = function.aggregate
32
30
  new_aggregate = function.aggregate(optimizer)
33
31
  ```
34
32
 
35
- Description
36
- -----------
33
+ ## Description
37
34
 
38
35
  The purpose of this gem is to provide a simple API that can be used to optimize a [axiom](https://github.com/dkubb/axiom) relation, scalar or aggregate function. An optional optimizer can be passed in to the #optimize method and return an equivalent but simplified version of the object.
39
36
 
@@ -43,8 +40,7 @@ The goal is not to replace the advanced optimizers that are inside most database
43
40
 
44
41
  With the ability to provide custom optimizers we can even target output to a structure optimized for specific datastores. All operations in relational algebra can be transformed into other equivalent operations, ones that are more efficient for the target datastore to execute. The built-in optimizers included in this gem are only a starting point; the intention is to expand them as well as help others create custom optimizers that are optimized for each datastore.
45
42
 
46
- Design
47
- ------
43
+ ## Design
48
44
 
49
45
  The contract for an optimizer instance is simple:
50
46
 
@@ -64,7 +60,7 @@ Axiom::Algebra::Restriction.optimizer = chain(
64
60
  Contradiction, # does the predicate match nothing?
65
61
  RestrictionOperand, # does the restriction contain another restriction?
66
62
  SetOperand, # does the restriction contain a set operation?
67
- OrderOperand, # does the restriction contain an order?
63
+ SortedOperand, # does the restriction contain a sorted relation?
68
64
  EmptyOperand, # does the restriction contain an empty relation?
69
65
  MaterializedOperand, # does the restriction contain a materialized relation?
70
66
  UnoptimizedOperand # does the restriction contain an unoptimized relation?
@@ -77,12 +73,10 @@ We always perform at least two optimization passes on each object, because once
77
73
 
78
74
  Once the optimization passes are finished, and no further optimization is possible, the result of an #optimize call is memoized. Further calls to #optimize will always return the same object.
79
75
 
80
- Contributing
81
- ------------
76
+ ## Contributing
82
77
 
83
78
  See [CONTRIBUTING.md](CONTRIBUTING.md) for details.
84
79
 
85
- Copyright
86
- ---------
80
+ ## Copyright
87
81
 
88
82
  Copyright © 2011-2013 Dan Kubb. See LICENSE for details.
data/TODO CHANGED
@@ -54,11 +54,12 @@
54
54
  try to combine into a single relation with the restrictions using NOT.
55
55
 
56
56
  * Summarization
57
- * Add OrderSummarizePer for factoring out Order objects inside a Summarization
57
+ * Add SortedSummarizePer for factoring out Sorted objects inside a
58
+ Summarization
58
59
  * When there are no aggregate functions, drop the Summarization and
59
60
  return the summarize_per (?)
60
61
  * Use the UnchangedHeader optimizer as a base class
61
- * When summarize_per is an Order, the Order can be dropped.
62
+ * When summarize_per is an Sorted, the Sorted can be dropped.
62
63
 
63
64
  * Projection
64
65
  * When it contains a Restriction, if the removed attributes are *not*
@@ -110,10 +111,10 @@
110
111
  equality/conjunction between attributes from the left and right
111
112
  operands, then transform into a Join.
112
113
 
113
- * Order
114
- * When the operation is an instance of Order, and the operand is sorted in
114
+ * Sorted
115
+ * When the operation is an instance of Sorted, and the operand is sorted in
115
116
  reversed order, change to a Reverse operation. This should occur after the
116
- Order optimization that collapses two Order objects into one; it would be
117
+ Sorted optimization that collapses two Sorted objects into one; it would be
117
118
  expected that the operand is a Limit or Offset, but it probably isn't
118
119
  necessary to test that.
119
120
 
@@ -10,14 +10,14 @@ Gem::Specification.new do |gem|
10
10
  gem.description = 'Optimizes axiom relations'
11
11
  gem.summary = gem.description
12
12
  gem.homepage = 'https://github.com/dkubb/axiom-optimizer'
13
- gem.licenses = %w[MIT]
13
+ gem.license = 'MIT'
14
14
 
15
15
  gem.require_paths = %w[lib]
16
16
  gem.files = `git ls-files`.split($/)
17
17
  gem.test_files = `git ls-files -- spec/{unit,integration}`.split($/)
18
18
  gem.extra_rdoc_files = %w[LICENSE README.md CONTRIBUTING.md TODO]
19
19
 
20
- gem.add_runtime_dependency('axiom', '~> 0.1.0')
20
+ gem.add_runtime_dependency('axiom', '~> 0.2.0')
21
21
 
22
- gem.add_development_dependency('bundler', '~> 1.3', '>= 1.3.5')
22
+ gem.add_development_dependency('bundler', '~> 1.5', '>= 1.5.2')
23
23
  end
@@ -1,3 +1,3 @@
1
1
  ---
2
2
  threshold: 66
3
- total_score: 910
3
+ total_score: 885
@@ -1,17 +1,7 @@
1
1
  ---
2
2
  Attribute:
3
- enabled: true
4
- exclude:
5
- - Axiom::Optimizer
6
- - Axiom::Optimizer::Algebra::Extension
7
- - Axiom::Optimizer::Algebra::Rename
8
- - Axiom::Optimizer::Algebra::Restriction
9
- - Axiom::Optimizer::Algebra::Summarization
10
- - Axiom::Optimizer::Function::Binary
11
- - Axiom::Optimizer::Function::Unary
12
- - Axiom::Optimizer::Optimizable::ClassMethods
13
- - Axiom::Optimizer::PredicatePartition
14
- - Axiom::Optimizer::Relation::Operation::Unary
3
+ enabled: false
4
+ exclude: []
15
5
  BooleanParameter:
16
6
  enabled: true
17
7
  exclude: []
@@ -54,7 +44,7 @@ DuplicateMethodCall:
54
44
  - Axiom::Optimizer::Relation::Materialized::EmptyOperand#optimize
55
45
  - Axiom::Optimizer::Relation::Operation::Combination#optimize
56
46
  - Axiom::Optimizer::Relation::Operation::Limit::ZeroLimit#optimize
57
- - Axiom::Optimizer::Relation::Operation::Order::OneLimitOperand#optimizable?
47
+ - Axiom::Optimizer::Relation::Operation::Sorted::OneLimitOperand#optimizable?
58
48
  max_calls: 1
59
49
  allow_calls: []
60
50
  FeatureEnvy:
@@ -102,22 +92,8 @@ TooManyMethods:
102
92
  TooManyStatements:
103
93
  enabled: true
104
94
  exclude:
105
- - Axiom::Optimizer#self.link_optimizers
106
- - Axiom::Optimizer::Algebra::Projection::ExtensionOperand#new_extensions
107
- - Axiom::Optimizer::Algebra::Summarization::EmptyOperand#extensions
108
- - Axiom::Optimizer::Function#self.optimize_functions
109
- - Axiom::Optimizer::Function::Predicate::Comparable::NeverComparable#optimizable?
110
- - Axiom::Optimizer::Function::Predicate::Comparable::NeverEquivalent#optimizable?
111
- - Axiom::Optimizer::Function::Predicate::Enumerable#normalized_right_enumerable
112
- - Axiom::Optimizer::Function::Predicate::Enumerable#optimize_right
113
- - Axiom::Optimizer::Function::Predicate::Enumerable#optimize_right_enumerable
114
- - Axiom::Optimizer::Function::Predicate::Enumerable#optimize_right_range
115
- - Axiom::Optimizer::Optimizable#optimize
116
- - Axiom::Optimizer::PredicatePartition#partition!
117
- - Axiom::Optimizer::PredicatePartition#partition_binary!
118
- - Axiom::Optimizer::PredicatePartition#partition_proposition!
119
- - Axiom::Optimizer::PredicatePartition#partition_unary!
120
- max_statements: 2
95
+ - Axiom::Optimizer::PredicatePartition#partition_binary
96
+ max_statements: 5
121
97
  UncommunicativeMethodName:
122
98
  enabled: true
123
99
  exclude: []
@@ -1,10 +1,4 @@
1
- AllCops:
2
- Includes:
3
- - '**/*.rake'
4
- - 'Gemfile'
5
- - 'Gemfile.devtools'
6
- Excludes:
7
- - '**/vendor/**'
1
+ inherit_from: ../.rubocop.yml
8
2
 
9
3
  # Avoid parameter lists longer than five parameters.
10
4
  ParameterLists:
@@ -29,7 +23,7 @@ CollectionMethods:
29
23
  # sections of code and visually separate them. When the keyword is at the same
30
24
  # level I think it sort of blends in with the def keywords and makes it harder
31
25
  # to scan the code and see where the sections are.
32
- AccessControl:
26
+ AccessModifierIndentation:
33
27
  Enabled: false
34
28
 
35
29
  # Limit line length
@@ -40,14 +34,26 @@ LineLength:
40
34
  Documentation:
41
35
  Enabled: false
42
36
 
37
+ # Do not always use &&/|| instead of and/or.
38
+ AndOr:
39
+ Enabled: false
40
+
43
41
  # Do not favor modifier if/unless usage when you have a single-line body
44
42
  IfUnlessModifier:
45
43
  Enabled: false
46
44
 
45
+ # Allow case equality operator (in limited use within the specs)
46
+ CaseEquality:
47
+ Enabled: false
48
+
47
49
  # Constants do not always have to use SCREAMING_SNAKE_CASE
48
50
  ConstantName:
49
51
  Enabled: false
50
52
 
51
- # Do not check formatting of special comments like "TODO" or "OPTIMIZE"
52
- CommentAnnotation:
53
+ # Not all trivial readers/writers can be defined with attr_* methods
54
+ TrivialAccessors:
55
+ Enabled: false
56
+
57
+ # Allow empty lines around body
58
+ EmptyLinesAroundBody:
53
59
  Enabled: false
@@ -38,9 +38,7 @@ module Axiom
38
38
  # @return [Boolean]
39
39
  #
40
40
  # @api public
41
- def optimizable?
42
- raise NotImplementedError, "#{self.class}#optimizable? must be implemented"
43
- end
41
+ abstract_method :optimizable?
44
42
 
45
43
  # Abstract method that executes the optimization for the operation
46
44
  #
@@ -50,9 +48,7 @@ module Axiom
50
48
  # @return [Optimizable]
51
49
  #
52
50
  # @api public
53
- def optimize
54
- raise NotImplementedError, "#{self.class}#optimize must be implemented"
55
- end
51
+ abstract_method :optimize
56
52
 
57
53
  # Chain together a list of optimizer classes into a callable object
58
54
  #
@@ -110,7 +106,7 @@ require 'axiom/optimizer/relation/operation/unary'
110
106
  require 'axiom/optimizer/relation/operation/combination'
111
107
  require 'axiom/optimizer/relation/operation/limit'
112
108
  require 'axiom/optimizer/relation/operation/offset'
113
- require 'axiom/optimizer/relation/operation/order'
109
+ require 'axiom/optimizer/relation/operation/sorted'
114
110
  require 'axiom/optimizer/relation/operation/reverse'
115
111
 
116
112
  require 'axiom/optimizer/algebra/difference'
@@ -56,8 +56,8 @@ module Axiom
56
56
  EqualOperands,
57
57
  EmptyLeft,
58
58
  EmptyRight,
59
- OrderLeft,
60
- OrderRight,
59
+ SortedLeft,
60
+ SortedRight,
61
61
  MaterializedOperands,
62
62
  UnoptimizedOperands
63
63
  )
@@ -44,10 +44,10 @@ module Axiom
44
44
  operand.extend(extensions)
45
45
  end
46
46
 
47
- # Optimize when the operand is an Order
48
- class OrderOperand < self
49
- include Relation::Operation::Unary::OrderOperand
50
- end # class OrderOperand
47
+ # Optimize when the operand is an Sorted
48
+ class SortedOperand < self
49
+ include Relation::Operation::Unary::SortedOperand
50
+ end # class SortedOperand
51
51
 
52
52
  # Optimize when operands are optimizable
53
53
  class UnoptimizedOperand < self
@@ -79,7 +79,7 @@ module Axiom
79
79
  #
80
80
  # @api private
81
81
  def extensions_optimizable?
82
- ! extensions.eql?(operation.extensions)
82
+ !extensions.eql?(operation.extensions)
83
83
  end
84
84
 
85
85
  end # class UnoptimizedOperand
@@ -87,7 +87,7 @@ module Axiom
87
87
  Axiom::Algebra::Extension.optimizer = chain(
88
88
  UnchangedHeader,
89
89
  MaterializedOperand,
90
- OrderOperand,
90
+ SortedOperand,
91
91
  UnoptimizedOperand
92
92
  )
93
93