Skip to content

Commit 93ec924

Browse files
author
Andrew Pope
committed
fixes dynamodb batch dropping missing entities
Signed-off-by: Andrew Pope <apope@nursefly.com>
1 parent 1bd0930 commit 93ec924

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

sdk/python/feast/infra/online_stores/dynamodb.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,9 @@ def online_read(
221221
entity_ids_iter = iter(entity_ids)
222222
while True:
223223
batch = list(itertools.islice(entity_ids_iter, batch_size))
224+
batch_result: List[
225+
Tuple[Optional[datetime], Optional[Dict[str, ValueProto]]]
226+
] = []
224227
# No more items to insert
225228
if len(batch) == 0:
226229
break
@@ -243,20 +246,23 @@ def online_read(
243246
for tbl_res in table_responses:
244247
entity_id = tbl_res["entity_id"]
245248
while entity_id != batch[entity_idx]:
246-
result.append((None, None))
249+
batch_result.append((None, None))
247250
entity_idx += 1
248251
res = {}
249252
for feature_name, value_bin in tbl_res["values"].items():
250253
val = ValueProto()
251254
val.ParseFromString(value_bin.value)
252255
res[feature_name] = val
253-
result.append((datetime.fromisoformat(tbl_res["event_ts"]), res))
256+
batch_result.append(
257+
(datetime.fromisoformat(tbl_res["event_ts"]), res)
258+
)
254259
entity_idx += 1
255260

256261
# Not all entities in a batch may have responses
257262
# Pad with remaining values in batch that were not found
258-
batch_size_nones = ((None, None),) * (len(batch) - len(result))
259-
result.extend(batch_size_nones)
263+
batch_size_nones = ((None, None),) * (len(batch) - len(batch_result))
264+
batch_result.extend(batch_size_nones)
265+
result.extend(batch_result)
260266
return result
261267

262268
def _get_dynamodb_client(self, region: str, endpoint_url: Optional[str] = None):

0 commit comments

Comments
 (0)