deephaven / deephaven-plugins

Deephaven Plugins
11 stars 15 forks source link

Some tables such as tables created with `group_by` not loading when embedded in `ui.flex` #701

Open jnumainville opened 2 months ago

jnumainville commented 2 months ago

Description

Some tables such as tables created with group_by are not loading when embedded in a ui.flex component

Steps to reproduce

import deephaven.ui as ui
from deephaven import time_table

t = time_table("PT2s").update([
    "X = randomInt(0, 100)",
    "Y = randomDouble(0, 10)",
    "Group = i % 5",
    "Letter = (i % 2 == 0) ? `A` : `B`"
])
t_grouped_by_group = t.group_by("Group")
t_grouped_by_multiple = t.group_by(["Group", "Letter"])

flex_t = ui.flex(t_grouped_by_group, t_grouped_by_multiple)
display(DeephavenWidget(flex_t))

Note that t_grouped_by_group, t_grouped_by_multiple, and flex_t=ui.flex(t, t) render fine, so something about those group_by calls is causing it in that case

In this second case, converted_date_times does not render within the flex but the other three do.

from deephaven import empty_table
import deephaven.ui as ui

string_date_times = empty_table(10).update(
    [
        "DateTime = `2022-04-03T19:34:22.000 UTC`",
        "Date = `2013-07-07`",
        "Time = `14:04:39.123`",
        "Duration = `PT6m`",
        "Period = `P10d`",
        "TimeZone = `America/Chicago`",
    ]
)

converted_date_times = string_date_times.update(
    [
        "DateTime = parseInstant(DateTime)",
        "Date = parseLocalDate(Date)",
        "Time = parseLocalTime(Time)",
        "Duration = parseDuration(Duration)",
        "Period = parsePeriod(Period)",
        "TimeZone = parseTimeZone(TimeZone)",
    ]
)

string_meta = string_date_times.meta_table
converted_meta = converted_date_times.meta_table

flex_t = ui.flex(string_date_times, string_meta, converted_date_times, converted_meta)=

Expected results

The tables load with all data.

Actual results

Often you get the message "Waiting for viewport..." but the data never loads for the problematic tables, although sometimes I didn't even see the message and the tables just didn't load.

Screenshot 2024-08-05 at 2 55 23 PM

Versions Engine Version: 0.35.2 Web UI Version: 0.85.3 Java Version: 19.0.1 Barrage Version: 0.6.0 Browser Name: Chrome 127 OS Name: macOS 10.15.7 @deephaven/js-plugin-plotly-express: 0.11.1 @deephaven/js-plugin-ui: 0.18.0 @deephaven/js-plugin-matplotlib: 0.4.1

mattrunyon commented 2 months ago

I don't think this has anything to do with flex specifically. I see this log spam for these tables, so something doesn't like viewing vectors of any sort in dh.ui

Uncaught Error: java.lang.IllegalStateException: Can't decode column of type io.deephaven.vector.ObjectVector
    at IllegalStateException_0.createError (dh-core.js:1383:10)
    at IllegalStateException_0.initializeBackingError (dh-core.js:1409:46)
    at IllegalStateException_0.Throwable_0 (dh-core.js:1348:8)
    at IllegalStateException_0.Exception_1 (dh-core.js:1433:18)
    at IllegalStateException_0.RuntimeException_1 (dh-core.js:1446:18)
    at new IllegalStateException_0 (dh-core.js:35487:25)
    at Object.readArrowBuffer (dh-core.js:15334:32)
    at Object.$handleModBatch (dh-core.js:15575:25)
    at Object.$appendRecordBatch (dh-core.js:15542:148)
    at Object.$appendAndMaybeFlush (dh-core.js:13230:24)
    at Object.$startAndMaybeFlush (dh-core.js:13292:11)
    at Object.$apply_1 (dh-core.js:13276:11)
    at Function.apply_47 (dh-core.js:13305:9)
    at lambda (dh-core.js:174:22)
    at dh-internal.js:1:397506
    at Array.forEach (<anonymous>)
    at dh-internal.js:1:397485
    at dh-internal.js:1:43529
    at Array.forEach (<anonymous>)
    at e.rawOnMessage (dh-internal.js:1:43491)
    at dh-internal.js:1:41304
    at Array.forEach (<anonymous>)
    at e.onTransportChunk (dh-internal.js:1:41179)
    at Object.$onMessage (dh-core.js:18392:35)
    at MultiplexedWebsocketTransport$3methodref$onMessage$Type.handleEvent_2 [as handleEvent] (dh-core.js:18536:10)
mattrunyon commented 2 months ago

Likely related to https://github.com/deephaven/deephaven-core/issues/5708

mofojed commented 2 weeks ago

@chipkent watch this issue, #944 was a duplicate of it.