Skip to content

Commit

Permalink
Wrap remove_blink in pyserver
Browse files Browse the repository at this point in the history
  • Loading branch information
alexpeters1208 committed Aug 19, 2024
1 parent 2f6530b commit 2ea15cd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
10 changes: 10 additions & 0 deletions py/server/deephaven/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -816,6 +816,16 @@ def flatten(self) -> Table:
"""Returns a new version of this table with a flat row set, i.e. from 0 to number of rows - 1."""
return Table(j_table=self.j_table.flatten())

def remove_blink(self) -> Table:
"""Returns a new version of this table without specialized blink table aggregation semantics."""
if self.is_blink:
try:
return Table(j_table=self.j_table.removeBlink())
except Exception as e:
raise DHError(e, "failed to remove blink table semantics.") from e
else:
raise RuntimeError("Table is not a blink table, so blink table semantics cannot be removed.")

def snapshot(self) -> Table:
"""Returns a static snapshot table.
Expand Down
6 changes: 6 additions & 0 deletions py/server/tests/test_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -930,6 +930,12 @@ def test_attributes(self):
self.assertEqual(len(attrs), len(rt_attrs) + 1)
self.assertIn("BlinkTable", set(attrs.keys()) - set(rt_attrs.keys()))

def test_remove_blink(self):
t_blink = time_table("PT1s", blink_table=True).update("X = ii")
t_no_blink = t_blink.remove_blink()
self.assertEqual(t_blink.is_blink, True)
self.assertEqual(t_no_blink.is_blink, False)

def test_grouped_column_as_arg(self):
t1 = empty_table(100).update(
["id = i % 10", "Person = random() > 0.5 ? true : random() > 0.5 ? false : true"]).sort(
Expand Down

0 comments on commit 2ea15cd

Please sign in to comment.