swallez commented on PR #44247: URL: https://github.com/apache/arrow/pull/44247#issuecomment-2380722833
> Why not use make the vector/table behave like an array view? Mimicking an array is a bit tricky: it has a lot of methods that are implemented by iterating it (like `join`, `map`, `find`, etc) and we would have to reimplement all of them. Also, `Array.isArray()` would return `false` even if we reimplemented all array methods. This is why `toArrayView()` creates a proxy to an empty array and passes the table to the proxy handler: ```js return new Proxy([] as Array<Struct<T>['TValue']>, new TableArrayProxyHandler(this)); ``` That way the proxy handler only has to implement iteration and direct access, and benefits from all other array methods by delegating to the wrapped array. -- 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]
