-
Notifications
You must be signed in to change notification settings - Fork 4k
GH-40959: [JS] Store Timestamps in 64 bits #40960
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
Changes from 11 commits
a902b46
66fb984
45a8a87
55ef9ff
9c4eefd
432e1eb
0ffb3c1
ee5ce9d
2268410
5e0aa8f
2c72601
1802bc5
3907324
aca95f0
8c86cf9
8ab2d0a
e9788f0
a03a227
e3e6d03
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -402,10 +402,7 @@ function generateDate<T extends Date_>(this: TestDataVectorGenerator, type: T, l | |
| const data = type.unit === DateUnit.DAY | ||
| ? createDate32(length, nullBitmap, values) | ||
| : createDate64(length, nullBitmap, values); | ||
| return { | ||
| values: () => values.map((x) => x == null ? null : new Date(x)), | ||
| vector: new Vector([makeData({ type, length, nullCount, nullBitmap, data })]) | ||
| }; | ||
| return { values: () => values, vector: new Vector([makeData({ type, length, nullCount, nullBitmap, data })]) }; | ||
| } | ||
|
|
||
| function generateTimestamp<T extends Timestamp>(this: TestDataVectorGenerator, type: T, length = 100, nullCount = Math.trunc(length * 0.2)): GeneratedVector<T> { | ||
|
|
@@ -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); | ||
|
||
| iterateBitmap(length, nullBitmap, (i, valid) => { | ||
| if (valid) { | ||
| const value = data32[i] * mult; | ||
| const hi = Math.trunc(value / 4294967296); | ||
| const lo = Math.trunc(value - 4294967296 * hi); | ||
| data[i * 2 + 0] = lo; | ||
| data[i * 2 + 1] = hi; | ||
| data[i] = BigInt(data32[i] * mult); | ||
| } | ||
| }); | ||
| return data; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.