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

allow typeLength to come from opts.column when decoding FIXED_LEN_BYTE_ARRAY #108

Merged
merged 4 commits into from
Jan 19, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions lib/codec/plain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,16 +264,17 @@ function decodeValues_FIXED_LEN_BYTE_ARRAY(
opts: Options
) {
let values = [];

if (!opts.typeLength) {
const typeLength =
opts.typeLength ?? (opts.column ? opts.column.typeLength : undefined);
if (!typeLength) {
throw "missing option: typeLength (required for FIXED_LEN_BYTE_ARRAY)";
}

for (let i = 0; i < count; ++i) {
values.push(
cursor.buffer.slice(cursor.offset, cursor.offset + opts.typeLength)
cursor.buffer.slice(cursor.offset, cursor.offset + typeLength)
);
cursor.offset += opts.typeLength;
cursor.offset += typeLength;
}

return values;
Expand Down
Loading