@@ -143,30 +143,6 @@ def test_populate_antijoin_with_secondary_attrs(clean_autopopulate, subject, exp
143143 assert len (pending_after ) == 0 , f"Antijoin returned { len (pending_after )} pending keys after full populate, expected 0."
144144
145145
146- def test_populate_distributed_antijoin (clean_autopopulate , subject , experiment ):
147- """Test that reserve_jobs=True correctly identifies pending keys.
148-
149- When using distributed mode, jobs.refresh() must only insert truly pending
150- keys into the jobs table, not already-completed ones.
151- """
152- assert subject , "root tables are empty"
153- assert not experiment , "table already filled?"
154-
155- total_keys = len (experiment .key_source )
156-
157- # Partially populate
158- experiment .populate (max_calls = 2 )
159- assert len (experiment ) == 2 * experiment .fake_experiments_per_subject
160-
161- # Refresh jobs — should only create entries for unpopulated keys
162- experiment .jobs .refresh (delay = - 1 )
163- pending_jobs = len (experiment .jobs .pending )
164- assert pending_jobs == total_keys - 2 , f"jobs.refresh() created { pending_jobs } pending jobs, expected { total_keys - 2 } ."
165-
166- # Clean up
167- experiment .jobs .delete_quick ()
168-
169-
170146def test_populate_antijoin_overlapping_attrs (prefix , connection_test ):
171147 """Regression test: antijoin with overlapping secondary attribute names.
172148
@@ -193,7 +169,7 @@ class Sensor(dj.Lookup):
193169 sensor_id : int32
194170 ---
195171 num_samples : int32
196- quality : float
172+ quality : decimal(4,2)
197173 """
198174 contents = [
199175 (1 , 100 , 0.95 ),
@@ -208,24 +184,26 @@ class ProcessedSensor(dj.Computed):
208184 -> Sensor
209185 ---
210186 num_samples : int32 # same name as Sensor's secondary attr
211- quality : float # same name as Sensor's secondary attr
212- result : float
187+ quality : decimal(4,2) # same name as Sensor's secondary attr
188+ result : decimal(8,2)
213189 """
214190
215191 @property
216192 def key_source (self ):
217193 return Sensor () # returns sensor_id + num_samples + quality
218194
219195 def make (self , key ):
196+ # Fetch source data (key only contains PK after projection)
197+ source = (Sensor () & key ).fetch1 ()
220198 # Values intentionally differ from source — this is what triggers
221199 # the bug: the antijoin tries to match on num_samples and quality
222200 # too, and since values differ, no match is found.
223201 self .insert1 (
224202 dict (
225203 sensor_id = key ["sensor_id" ],
226- num_samples = key ["num_samples" ] * 2 ,
227- quality = round ( key ["quality" ] + 0.05 , 2 ) ,
228- result = key ["num_samples" ] * key ["quality" ],
204+ num_samples = source ["num_samples" ] * 2 ,
205+ quality = float ( source ["quality" ]) + 0.05 ,
206+ result = float ( source ["num_samples" ]) * float ( source ["quality" ]) ,
229207 )
230208 )
231209
@@ -255,7 +233,7 @@ def make(self, key):
255233 pending = ProcessedSensor ().key_source - ProcessedSensor ().proj ()
256234 assert len (pending ) == 0
257235 finally :
258- test_schema .drop (force = True )
236+ test_schema .drop (prompt = False )
259237
260238
261239def test_load_dependencies (prefix , connection_test ):
0 commit comments