mirror of
https://github.com/asadbek064/hyparquet.git
synced 2025-12-06 06:51:54 +00:00
Fix metadata timestamp conversion (#45)
* Fix metadata timestamp conversion * Remove redundant check Co-authored-by: Kenny Daniel <platypii@gmail.com> --------- Co-authored-by: Kenny Daniel <platypii@gmail.com>
This commit is contained in:
parent
36cb2c29bf
commit
9aacd15349
@ -281,6 +281,8 @@ export function convertMetadata(value, schema) {
|
||||
if (type === 'INT32' && converted_type === 'DATE') return new Date(view.getInt32(0, true) * 86400000)
|
||||
if (type === 'INT64' && converted_type === 'TIMESTAMP_MICROS') return new Date(Number(view.getBigInt64(0, true) / 1000n))
|
||||
if (type === 'INT64' && converted_type === 'TIMESTAMP_MILLIS') return new Date(Number(view.getBigInt64(0, true)))
|
||||
if (type === 'INT64' && logical_type?.type === 'TIMESTAMP' && logical_type?.unit === 'NANOS') return new Date(Number(view.getBigInt64(0, true) / 1000000n))
|
||||
if (type === 'INT64' && logical_type?.type === 'TIMESTAMP' && logical_type?.unit === 'MICROS') return new Date(Number(view.getBigInt64(0, true) / 1000n))
|
||||
if (type === 'INT64' && logical_type?.type === 'TIMESTAMP') return new Date(Number(view.getBigInt64(0, true)))
|
||||
if (type === 'INT32' && view.byteLength === 4) return view.getInt32(0, true)
|
||||
if (type === 'INT64' && view.byteLength === 8) return view.getBigInt64(0, true)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user