pitrou commented on code in PR #40960:
URL: https://github.com/apache/arrow/pull/40960#discussion_r1551343433
##########
js/test/generate-test-data.ts:
##########
@@ -750,32 +747,23 @@ function createDate32(length: number, nullBitmap:
Uint8Array, values: (number |
}
function createDate64(length: number, nullBitmap: Uint8Array, values: (number
| null)[] = []) {
- const data = new Int32Array(length * 2).fill(0);
+ const data = new BigInt64Array(length).fill(0n);
const data32 = createDate32(length, nullBitmap, values);
iterateBitmap(length, nullBitmap, (i, valid) => {
if (valid) {
- const value = data32[i] * 86400000;
- const hi = Math.trunc(value / 4294967296);
- const lo = Math.trunc(value - 4294967296 * hi);
- values[i] = value;
- data[i * 2 + 0] = lo;
- data[i * 2 + 1] = hi;
+ data[i] = BigInt(data32[i] * 86400000);
}
});
return data;
}
function createTimestamp(length: number, nullBitmap: Uint8Array, multiple:
number, values: (number | null)[] = []) {
const mult = 86400 * multiple;
- const data = new Int32Array(length * 2).fill(0);
+ const data = new BigInt64Array(length).fill(0n);
const data32 = createDate32(length, nullBitmap, values);
Review Comment:
This is a bit weird, don't you want to create timestamp data that does not
represent whole days?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]