Skip to content

Commit

Permalink
Merge pull request #2 from trxcllnt/js-cpp-refactor
Browse files Browse the repository at this point in the history
fix perf tests + lint
  • Loading branch information
TheNeuralBit authored Jan 25, 2018
2 parents 016ba78 + f3cde1a commit 579ab1f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
16 changes: 8 additions & 8 deletions js/perf/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')) {
Expand Down Expand Up @@ -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
};
}
Expand All @@ -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);
}
Expand All @@ -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();
}
Expand Down
9 changes: 4 additions & 5 deletions js/test/unit/table-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
// specific language governing permissions and limitations
// under the License.

import Arrow, {
} from '../Arrow';
import Arrow from '../Arrow';

const {
col,
Expand All @@ -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`, () => {
Expand Down Expand Up @@ -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++]);
});
});
Expand Down Expand Up @@ -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++]);
});
});
Expand Down

0 comments on commit 579ab1f

Please sign in to comment.