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

GH-40851: [JS] Fix nullcount and make vectors created from typed arrays not nullable #40852

Merged
merged 1 commit into from
Apr 3, 2024

Conversation

domoritz
Copy link
Member

@domoritz domoritz commented Mar 27, 2024

@@ -177,16 +180,16 @@ export class Data<T extends DataType = DataType> {
// if we have a nullBitmap, truncate + slice and set it over the pre-filled 1s
if (this.nullCount > 0) {
nullBitmap.set(truncateBitmap(offset, length, this.nullBitmap), 0);
Object.assign(this, { nullBitmap });
Copy link
Member Author

Choose a reason for hiding this comment

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

If we assign null count here, the update to the null count will be wrong. Also, we know that the null count has not yet changed so there is no need to set it here.

@github-actions github-actions bot added awaiting changes Awaiting changes and removed awaiting committer review Awaiting committer review labels Mar 27, 2024
@@ -177,16 +180,16 @@ export class Data<T extends DataType = DataType> {
// if we have a nullBitmap, truncate + slice and set it over the pre-filled 1s
if (this.nullCount > 0) {
nullBitmap.set(truncateBitmap(offset, length, this.nullBitmap), 0);
Object.assign(this, { nullBitmap });
} else {
Object.assign(this, { nullBitmap, _nullCount: 0 });
Copy link
Member Author

Choose a reason for hiding this comment

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

Here we can set the null count to 0 since we just created a new nullBitmap that is all valid values.

@@ -445,7 +445,7 @@ export function makeVector(init: any) {
if (init instanceof DataView) {
init = new Uint8Array(init.buffer);
}
const props = { offset: 0, length: init.length, nullCount: 0, data: init };
const props = { offset: 0, length: init.length, nullCount: -1, data: init };
Copy link
Member Author

Choose a reason for hiding this comment

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

_nullCount != 0 && (!nullBitmap || nullBitmap.byteLength == 0) is not nullable so we set -1 as the null count here to mark the data as not nullable. makeData will always create a null bitmap so I'm not sure why we need to check for no bitmap.

@domoritz domoritz added awaiting committer review Awaiting committer review and removed awaiting changes Awaiting changes labels Mar 29, 2024
@domoritz domoritz added this to the 16.0.0 milestone Apr 3, 2024
@domoritz domoritz merged commit 5b09059 into apache:main Apr 3, 2024
13 checks passed
@domoritz domoritz deleted the dom/nulls branch April 3, 2024 22:31
Copy link

After merging your PR, Conbench analyzed the 7 benchmarking runs that have been run so far on merge-commit 5b09059.

There were no benchmark performance regressions. 🎉

The full Conbench report has more details. It also includes information about 14 possible false positives for unstable benchmarks that are known to sometimes produce them.

tolleybot pushed a commit to tmct/arrow that referenced this pull request May 2, 2024
tolleybot pushed a commit to tmct/arrow that referenced this pull request May 4, 2024
rok pushed a commit to tmct/arrow that referenced this pull request May 8, 2024
rok pushed a commit to tmct/arrow that referenced this pull request May 8, 2024
vibhatha pushed a commit to vibhatha/arrow that referenced this pull request May 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants