Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: DH-16865: Fix spinner on empty partitions list #1953

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

vbabich
Copy link
Collaborator

@vbabich vbabich commented Apr 22, 2024

Closes #1904

@vbabich vbabich self-assigned this Apr 22, 2024
@vbabich vbabich requested a review from mofojed April 22, 2024 13:51
@vbabich vbabich enabled auto-merge (squash) April 22, 2024 13:51
@vbabich vbabich changed the title DH-16595: Fix null partition filter fix: Fix spinner on empty partitions list Apr 22, 2024
@vbabich
Copy link
Collaborator Author

vbabich commented Apr 23, 2024

This PR should fix the issue with partitioned tables with no partitions in DHE. But I think I found an edge case with widgets of type VariableType.PARTITIONEDTABLE without partitions in DHC, where a null returned from this.partitionedTable.getTable(partitions) sends IrisGrid into an infinite initState loop.

Copy link
Member

@mofojed mofojed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why my comments didn't post before

}
);
});
const { rows } = await keyTable.getViewportData();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't be returning the initial partition until it's available. Right now this is getting stuck in a loop, as it's trying to apply a partition and one doesn't exist:

from deephaven import empty_table, time_table
t = empty_table(0).update("X=ii").partition_by("X")
t2 = time_table("PT20S").update("X=ii").where("X>0").partition_by("X")

image

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, I only tested with DHE partitioned tables, didn't realize PARTITIONEDTABLE in DHC triggers a different code path. Will fix and make sure to test both DHE and DHC.

Copy link
Collaborator Author

@vbabich vbabich Apr 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't be returning the initial partition until it's available.

What should we return in that case? Ok to show the Spinner on DHC partitioned tables? In Enterprise we want to show an empty table when there's no available partitions.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be showing the empty table in the DHC case as well if we already know there's no partitions.

@vbabich vbabich changed the title fix: Fix spinner on empty partitions list fix: DH-16865: Fix spinner on empty partitions list Apr 24, 2024
@vbabich vbabich force-pushed the fix_null_partition_filter branch from b8f31c9 to add2766 Compare May 10, 2024 14:59

get rowCount(): number {
return 0;
super(dh, []);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to pass the formatter through.

Suggested change
super(dh, []);
super(dh, [], formatter);

That being said, it's not like this really needs a formatter since it's an empty grid, but 🤷

Comment on lines 877 to +878
this.startListening(model);
this.startListeningForPartitionChanges(model);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd probably break down the current startListening/stopListening methods, e.g.

startListening(model: IrisGridModel): void {
  this.startListeningForEvents(model);
  this.startListeningForPartitionChanges(model);
}

As you're calling both startListening methods everywhere, may as well combine it into just one top level one.

model: IrisGridModel,
resetState = false
): void {
const { keyTable } = this.state;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a race condition here - in startListeningForPartitionChanges, we fetch the keyTable asynchronously, so in theory it's possible that stopListening is called before startListening completes/can set the key table.

May need to keep that promise around explicitly such that it can be cancelled/unset if stopListening is called.

Comment on lines +71 to +72
// TODO: find out how partitionTables can be null after this

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can they be? Remove TODO

Comment on lines +237 to +239
// TODO: cleanup, partitionTables can be null now
// assertNotNull(partitionTables);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO cleanup

Comment on lines +264 to +266
// throw new Error(
// `Invalid partition config set. Expected ${partitionTables.length} partitions, but got ${partitions.length}`
// );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not throw here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DH-16865: Partitioned table with no data displays a spinner indefinitely
2 participants