GeorgeLeePatterson commented on code in PR #320:
URL: https://github.com/apache/arrow-js/pull/320#discussion_r2484818119
##########
src/vector.ts:
##########
@@ -362,17 +362,21 @@ export class Vector<T extends DataType = any> {
.filter((T: any) => typeof T === 'number' && T !== Type.NONE);
for (const typeId of typeIds) {
- const get = getVisitor.getVisitFnByTypeId(typeId);
- const set = setVisitor.getVisitFnByTypeId(typeId);
- const indexOf = indexOfVisitor.getVisitFnByTypeId(typeId);
-
- visitorsByTypeId[typeId] = { get, set, indexOf };
- vectorPrototypesByTypeId[typeId] = Object.create(proto, {
- ['isValid']: { value: wrapChunkedCall1(isChunkedValid) },
- ['get']: { value:
wrapChunkedCall1(getVisitor.getVisitFnByTypeId(typeId)) },
- ['set']: { value:
wrapChunkedCall2(setVisitor.getVisitFnByTypeId(typeId)) },
- ['indexOf']: { value:
wrapChunkedIndexOf(indexOfVisitor.getVisitFnByTypeId(typeId)) },
- });
+ try {
+ const get = getVisitor.getVisitFnByTypeId(typeId);
+ const set = setVisitor.getVisitFnByTypeId(typeId);
+ const indexOf = indexOfVisitor.getVisitFnByTypeId(typeId);
+
+ visitorsByTypeId[typeId] = { get, set, indexOf };
+ vectorPrototypesByTypeId[typeId] = Object.create(proto, {
+ ['isValid']: { value: wrapChunkedCall1(isChunkedValid) },
+ ['get']: { value:
wrapChunkedCall1(getVisitor.getVisitFnByTypeId(typeId)) },
+ ['set']: { value:
wrapChunkedCall2(setVisitor.getVisitFnByTypeId(typeId)) },
+ ['indexOf']: { value:
wrapChunkedIndexOf(indexOfVisitor.getVisitFnByTypeId(typeId)) },
+ });
+ } catch {
+ continue;
Review Comment:
I ran into some testing issues and after a couple days sleeping on it, it
100% needs to be removed.
Edit: I recall now the issue. The issue is that the new type generation
introduces unsupported types (supported in subsequent PRs), which puts me in a
bit of a chicken and egg situation. But I'll work at this today and see if I
can come up with a more elegant solution that is low surface area, and ensure
the final PR that would eliminate this issue removes anything specific added.
Edit 2: Ok, I'm a dummy. I misinterpreted the error path. I added these
types and introduced the try...catch to allow for an accurate accounting of the
data types without blowing up the vector.rs code, but now realize that the
enum.ts can serve as the canonical list of SUPPORTED data types. This is
extremely simple to fix. Will have this corrected.
--
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]