diff --git a/src/metadata.js b/src/metadata.js index ce2dc9e..e49803d 100644 --- a/src/metadata.js +++ b/src/metadata.js @@ -281,6 +281,9 @@ 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' && logical_type?.unit === 'MILLIS') return new Date(Number(view.getBigInt64(0, true))) 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)