[
https://issues.apache.org/jira/browse/ARROW-1652?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16235792#comment-16235792
]
ASF GitHub Bot commented on ARROW-1652:
---------------------------------------
TheNeuralBit commented on a change in pull request #1273: ARROW-1652: [JS]
housekeeping, vector cleanup
URL: https://github.com/apache/arrow/pull/1273#discussion_r148543271
##########
File path: js/src/types/table/row.ts
##########
@@ -0,0 +1,56 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+import { Vector, Struct } from '../types';
+import { VirtualVector } from '../vector/virtual';
+
+export class Row<TKey extends string | number> extends Vector {
+ readonly row: number;
+ readonly table: Struct<TKey>;
+ [Symbol.toStringTag]() { return 'Row'; }
+ constructor(table: Struct<TKey>, row: number) {
+ super();
+ this.row = row;
+ this.table = table;
+ }
+ get length() { return this.table.length; }
+ get<T = any>(key: TKey) {
+ const col = this.table.col(key as TKey);
+ return col ? col.get(this.row) as T : null;
+ }
Review comment:
I think your suggestion to change `get()` and `key()` to take column indexes
does apply to my other comment on the `TableVector` though. I'll respond there.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> [JS] Separate Vector into BatchVector and CompositeVector
> ---------------------------------------------------------
>
> Key: ARROW-1652
> URL: https://issues.apache.org/jira/browse/ARROW-1652
> Project: Apache Arrow
> Issue Type: Improvement
> Components: JavaScript
> Reporter: Brian Hulette
> Assignee: Paul Taylor
> Priority: Major
> Labels: Performance, pull-request-available
>
> CompositeVector should have a {{batch(..)}} function that returns a
> BatchVector
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)