bmg 0.20.4 → 0.21.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bb2c9a67394ec85b7898ecf5c3d0b0dcf9532666
4
- data.tar.gz: 6a8c8ed5c60392299225c7187e2d05ac95b59798
3
+ metadata.gz: c0ca5faec7c7529e032eca725661a0e480b0e527
4
+ data.tar.gz: b2891c92b61211b40048d8545988bc1de5fd5bfc
5
5
  SHA512:
6
- metadata.gz: 633a62f541c6f2fe87d20de2809fd2dc3166d1118320623ea3c16edd54435a164ef45d11d8a8475f927203abb0e247083525d280393dc30c0ffc06ff485c70ba
7
- data.tar.gz: c8b357936dc6511d3e955b80da8b48dee258adef5d2ad1cd1024fd45c3bd895ed31a382fcf27141c32afa9d0e7728c38866bd1f720830b29fdb941f98dec1411
6
+ metadata.gz: 399c045c70776108049673574a0f7631dc6b3b70e879b180de00feab49bd4ec4553b991a04549c4a336741cbadd3195204d918d1de5b060ee3195748d7bd2446
7
+ data.tar.gz: 97304f0d053a2755bfc0a15504610e917686e86f5b8fa7871ff09f66446a6b7cef9aa7043f68637ee5d72ac394838f773522dcfb4a175b2cc7443bb723cb279c
@@ -70,6 +70,29 @@ module Bmg
70
70
  end
71
71
  end
72
72
 
73
+ def _restrict(type, predicate)
74
+ return super if left_join?
75
+
76
+ # right_p makes no reference to attributes in left => full on right
77
+ # left_p makes no reference to attributes in right => full on left
78
+ up1, right_p = predicate.and_split(left.type.attrlist! - on)
79
+ up2, left_p = predicate.and_split(right.type.attrlist! - on)
80
+ if right_p.tautology? && left_p.tautology?
81
+ # no optimization can be done
82
+ super
83
+ else
84
+ # remains the full reduction, that up2 is not, since we got it
85
+ # from predicate, not from up1
86
+ remains, _ = up1.and_split(right.type.attrlist! - on)
87
+ left
88
+ .restrict(left_p)
89
+ .join(right.restrict(right_p), on)
90
+ .restrict(remains)
91
+ end
92
+ rescue UnknownAttributesError
93
+ super
94
+ end
95
+
73
96
  def _unautowrap(operand, options)
74
97
  return [operand, false] unless operand.is_a?(Operator::Autowrap)
75
98
  return [operand, false] unless operand.same_options?(options)
@@ -51,7 +51,7 @@ module Bmg
51
51
  protected
52
52
 
53
53
  def _restrict(type, predicate)
54
- Restrict.new(type, @operand, @predicate & predicate)
54
+ @operand.restrict(@predicate & predicate)
55
55
  end
56
56
 
57
57
  protected ### inspect
data/lib/bmg/version.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  module Bmg
2
2
  module Version
3
3
  MAJOR = 0
4
- MINOR = 20
5
- TINY = 4
4
+ MINOR = 21
5
+ TINY = 2
6
6
  end
7
7
  VERSION = "#{Version::MAJOR}.#{Version::MINOR}.#{Version::TINY}"
8
8
  end
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.20.4
4
+ version: 0.21.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: 2022-12-15 00:00:00.000000000 Z
11
+ date: 2023-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: predicate