Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix perf tests + lint #2

Merged
merged 2 commits into from
Jan 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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