[ 
https://issues.apache.org/jira/browse/ARROW-1652?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16234360#comment-16234360
 ] 

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_r148311928
 
 

 ##########
 File path: js/src/types/table/table.ts
 ##########
 @@ -0,0 +1,63 @@
+// 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 { Row } from './row';
+import { toString } from './toString';
+import { VirtualVector } from '../vector/virtual';
+import { Vector, Column, Struct } from '../types';
+
+export interface TableVector {
+    toString(): string;
+    toString(index: boolean): string;
+    toString(options: { index: boolean }): string;
+}
+
+export class TableVector extends Vector<TableRow> implements Struct<string> {
+    readonly length: number;
+    readonly columns: Column[];
+    constructor(argv: { columns: Column[] }) {
+        super();
+        this.columns = argv.columns || [];
+        if (!this.length) {
+            this.length = Math.max(...this.columns.map((col) => col.length)) | 
0;
+        }
+    }
+    get(index: number): TableRow {
+        return new TableRow(this, index);
+    }
+    col(name: string) {
+        return this.columns.find((col) => col.name === name) || null;
+    }
 
 Review comment:
   d'oh nevermind just noticed that `columns` is exposed, so no one should be 
tempted to use `table.col(table.key(i))`, but its still true that the `Row` 
can't access table columns by index.

----------------------------------------------------------------
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)

Reply via email to