Unverified Commit 8c8c5b1d authored by Andrew's avatar Andrew Committed by GitHub
Browse files

[Bug fix] Stop erasing schemas of frames with no data rows (#2529)



* added option for batching empty data, fixes #2526

* added option for batching empty data, fixes #2526

* decreased line lengths

* removed trailing whitespace

* fixed wrong feature name

* [Bugfix] stop erasing schema of frames w/ no cols (fixes #2528)

* removed arg doc
Co-authored-by: default avatarQuan (Andy) Gan <coin2028@hotmail.com>
Co-authored-by: default avatarMinjie Wang <wmjlyjemaine@gmail.com>
parent 673cc64c
......@@ -505,12 +505,6 @@ class Frame(MutableMapping):
def _append(self, other):
"""Append ``other`` frame to ``self`` frame."""
# NOTE: `other` can be empty.
if self.num_rows == 0:
# if no rows in current frame; append is equivalent to
# directly updating columns.
self._columns = {key: Column.create(data) for key, data in other.items()}
else:
# pad columns that are not provided in the other frame with initial values
for key, col in self._columns.items():
if key in other:
......
......@@ -338,6 +338,14 @@ def test_hypersparse_query():
assert g.out_degree(0) == 1
assert g.out_degree(1) == 0
def test_empty_data_initialized():
g = dgl.DGLGraph()
g = g.to(F.ctx())
g.ndata["ha"] = F.tensor([])
g.add_nodes(1, {"hb": F.tensor([1])})
assert "ha" in g.ndata
assert len(g.ndata["ha"]) == 1
if __name__ == '__main__':
test_query()
test_mutation()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment