bmg 0.21.0 → 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: ef6b320621feeff681bb76b804da274ae055573c
4
- data.tar.gz: 2a119b1aa5838fbb2b657332de25fd22cc10dbb6
3
+ metadata.gz: c0ca5faec7c7529e032eca725661a0e480b0e527
4
+ data.tar.gz: b2891c92b61211b40048d8545988bc1de5fd5bfc
5
5
  SHA512:
6
- metadata.gz: e33cda560cb1c3f119940745c63f45884a406d7b0bce113d08a43d2f374a9a658ab47667c63919d16d5863f6867f2d29808d23a049efe9e34487a282e29c9c82
7
- data.tar.gz: ec437125ffbf4e41633b33c6ddc5eedeccef915dd2201f7d0f2a54e8ba348f272e67195ebc57cd8a8e839b07a0fa1aacb957eacf6723d34a42b03dac1d4783ec
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
@@ -2,7 +2,7 @@ module Bmg
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 21
5
- TINY = 0
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.21.0
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: 2023-05-18 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