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

JS API should return nulls rather than undefined when reading table data #5437

Merged
merged 2 commits into from
May 2, 2024

Conversation

niloc132
Copy link
Member

While Java arrays are initialized to nulls, GWT normalizes undefined and null to be equivalent, so we need to explicitly assign null values when building arrays.

Adds tests to ensure this doesn't break as part of #188.

Fixes #5400

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.

Looks fine, one question about the StringArray in the unit test table.
I tested in browser console with this snippet:

var dh = (await import('./dh-core.js')).default
var client = new dh.CoreClient(window.location.protocol + "//" + window.location.host);
await client.login({type: 'io.deephaven.authentication.psk.PskAuthenticationHandler', token: 'iris'});
var connection = await client.getAsIdeConnection();
var ide = await connection.startSession("python");
await ide.runCode(`
from deephaven import empty_table

x = empty_table(1).update("X=(String)null")
`)


var x = await connection.getObject({ type: 'Table', name: 'x' })
x.setViewport(0, 0)
var data = await x.getViewportData()
var value = data.get(0).get(x.columns[0])
console.log('Value is', value, ', isNull?=', value === null)

@niloc132 niloc132 merged commit c222524 into deephaven:main May 2, 2024
21 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators May 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

JSAPI returns undefined for a null value in table data
3 participants