domoritz commented on PR #35780:
URL: https://github.com/apache/arrow/pull/35780#issuecomment-1837209620
Looks like it's pretty easy to exceed the buffer sizes, though.
```ts
import { constants } from 'node:buffer';
import { LargeUtf8, makeBuilder } from './src/Arrow.dom.ts';
// make the longest posstible string (longer will crash with `RangeError:
Invalid string length`)
const MAX_STRING_LENGTH = constants.MAX_STRING_LENGTH;
console.log(`MAX_STRING_LENGTH: ${MAX_STRING_LENGTH}`);
const longString = "a".repeat(MAX_STRING_LENGTH);
const builder = makeBuilder({ type: new LargeUtf8 });
// length of vector
const N = 5;
console.log(`Building vector with total string length (potential need for
offsets): ${MAX_STRING_LENGTH * N} or 2^${Math.ceil(Math.log2(MAX_STRING_LENGTH
* N))}`);
for (let i = 0; i < N; i++) {
builder.append(longString);
}
// add string to force another offset
builder.append("");
builder.finish();
const vector = builder.toVector();
console.log(vector);
```
--
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]