From 9769773e59d50c12e4c7b9005e0343358bdb7771 Mon Sep 17 00:00:00 2001
From: Paul Taylor <paul.e.taylor@me.com>
Date: Thu, 25 Jan 2018 14:12:45 -0800
Subject: [PATCH 1/2] fix vector perf tests

---
 js/perf/index.js | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/js/perf/index.js b/js/perf/index.js
index 98f6dfb4000d..7cce871a4c1c 100644
--- a/js/perf/index.js
+++ b/js/perf/index.js
@@ -33,11 +33,11 @@ for (let { name, buffers } of require('./table_config')) {
     const sliceToArraySuiteName = `Slice toArray "${name}" vectors`;
     suites.push(createTestSuite(parseSuiteName, createFromTableTest(name, buffers)));
     suites.push(createTestSuite(parseSuiteName, createReadBatchesTest(name, buffers)));
-    const table = Table.from(buffers);
-    suites.push(...table.columns.map((vector, i) => createTestSuite(getByIndexSuiteName, createGetByIndexTest(vector, table.schema.fields[i].name))));
-    suites.push(...table.columns.map((vector, i) => createTestSuite(iterateSuiteName, createIterateTest(vector, table.schema.fields[i].name))));
-    suites.push(...table.columns.map((vector, i) => createTestSuite(sliceToArraySuiteName, createSliceToArrayTest(vector, table.schema.fields[i].name))));
-    suites.push(...table.columns.map((vector, i) => createTestSuite(sliceSuiteName, createSliceTest(vector, table.schema.fields[i].name))));
+    const table = Table.from(buffers), schema = table.schema;
+    suites.push(...schema.fields.map((f, i) => createTestSuite(getByIndexSuiteName, createGetByIndexTest(table.getColumnAt(i), f.name))));
+    suites.push(...schema.fields.map((f, i) => createTestSuite(iterateSuiteName, createIterateTest(table.getColumnAt(i), f.name))));
+    suites.push(...schema.fields.map((f, i) => createTestSuite(sliceToArraySuiteName, createSliceToArrayTest(table.getColumnAt(i), f.name))));
+    suites.push(...schema.fields.map((f, i) => createTestSuite(sliceSuiteName, createSliceTest(table.getColumnAt(i), f.name))));
 }
 
 for (let {name, buffers, countBys, counts} of require('./table_config')) {
@@ -173,7 +173,7 @@ function createDataFrameDirectCountTest(table, column, test, value) {
 
     return {
         async: true,
-        name: `name: '${column}', length: ${table.numRows}, type: ${table.getColumnAt(colidx).type}, test: ${test}, value: ${value}\n`,
+        name: `name: '${column}', length: ${table.length}, type: ${table.getColumnAt(colidx).type}, test: ${test}, value: ${value}\n`,
         fn: op
     };
 }
@@ -183,7 +183,7 @@ function createDataFrameCountByTest(table, column) {
 
     return {
         async: true,
-        name: `name: '${column}', length: ${table.numRows}, type: ${table.getColumnAt(colidx).type}\n`,
+        name: `name: '${column}', length: ${table.length}, type: ${table.getColumnAt(colidx).type}\n`,
         fn() {
             table.countBy(column);
         }
@@ -204,7 +204,7 @@ function createDataFrameFilterCountTest(table, column, test, value) {
 
     return {
         async: true,
-        name: `name: '${column}', length: ${table.numRows}, type: ${table.getColumnAt(colidx).type}, test: ${test}, value: ${value}\n`,
+        name: `name: '${column}', length: ${table.length}, type: ${table.getColumnAt(colidx).type}, test: ${test}, value: ${value}\n`,
         fn() {
             df.count();
         }

From f3cde1aa48f8251fe9f63c9891c374d3819ff9a2 Mon Sep 17 00:00:00 2001
From: Paul Taylor <paul.e.taylor@me.com>
Date: Thu, 25 Jan 2018 14:40:09 -0800
Subject: [PATCH 2/2] fix lint

---
 js/test/unit/table-tests.ts | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/js/test/unit/table-tests.ts b/js/test/unit/table-tests.ts
index 9b71c79f265d..d1e441c54045 100644
--- a/js/test/unit/table-tests.ts
+++ b/js/test/unit/table-tests.ts
@@ -15,8 +15,7 @@
 // specific language governing permissions and limitations
 // under the License.
 
-import Arrow, {
-} from '../Arrow';
+import Arrow from '../Arrow';
 
 const {
     col,
@@ -25,7 +24,7 @@ const {
 
 describe(`Table`, () => {
     test(`can create an empty table`, () => {
-        expect(Table.empty().length).toEqual(0)
+        expect(Table.empty().length).toEqual(0);
     });
 
     describe(`single record batch`, () => {
@@ -147,7 +146,7 @@ describe(`Table`, () => {
         test(`scans expected values`, () => {
             let expected_idx = 0;
             table.scan((idx, batch) => {
-              const columns = batch.schema.fields.map((_, i) => batch.getChildAt(i));
+              const columns = batch.schema.fields.map((_, i) => batch.getChildAt(i)!);
               expect(columns.map((c) => c.get(idx))).toEqual(values[expected_idx++]);
             });
         });
@@ -353,7 +352,7 @@ describe(`Table`, () => {
         test(`scans expected values`, () => {
             let expected_idx = 0;
             table.scan((idx, batch) => {
-                const columns = batch.schema.fields.map((_, i) => batch.getChildAt(i));
+                const columns = batch.schema.fields.map((_, i) => batch.getChildAt(i)!);
                 expect(columns.map((c) => c.get(idx))).toEqual(values[expected_idx++]);
             });
         });
