PySyft icon indicating copy to clipboard operation
PySyft copied to clipboard

Fix `dataset.getall()` shows `DictTuple()` when there are no datasets

Open khoaguin opened this issue 1 year ago • 2 comments

Issue: https://github.com/OpenMined/Heartbeat/issues/1685

Before: image

khoaguin avatar Aug 13 '24 08:08 khoaguin

Hi @kiendang, I tried to make an empty table with no rows when there are no datasets as we discussed, however, this is challenging since we need an object in the DictTuple iterable so we can grab that object and find its _coll_repr_ (in the _create_table_rows() function. However, when the DictTuple is empty, we don't have any objects. For now, I make the DictTuple's repr to be an empty list when there are no items inside, like in the picture image

This will make the repr consistent with other APIs when the results are empty: image

khoaguin avatar Aug 16 '24 08:08 khoaguin

I see. We do need a refactoring of _coll_repr_ to be able to display an empty table. I still think it is the desirable behavior, but let me check with product. For now I think let's display 0 records instead of []. A DictTuple is not a list and showing [] is misleading.

kiendang avatar Aug 19 '24 02:08 kiendang