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

Test for various arrow timestamp resolutions, and proper psp column types #45

Merged
merged 1 commit into from
Feb 14, 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
Binary file modified packages/perspective/test/arrow/test-null.arrow
Binary file not shown.
40 changes: 35 additions & 5 deletions packages/perspective/test/js/constructors.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,20 @@ var meta_3 = {
import arrow from "../arrow/test-null.arrow";

var arrow_result = [
{"f32": 1.5, "f64": 1.5, "i64": 1, "i32": 1, "i16": 1, "i8": 1, "bool": true, "char": "a", "dict": "a", "datetime": +(new Date("2018-01-25"))},
{"f32": 2.5, "f64": 2.5, "i64": 2, "i32": 2, "i16": 2, "i8": 2, "bool": false, "char": "b", "dict": "b", "datetime": +(new Date("2018-01-26"))},
{"f32": 3.5, "f64": 3.5, "i64": 3, "i32": 3, "i16": 3, "i8": 3, "bool": true, "char": "c", "dict": "c", "datetime": +(new Date("2018-01-27"))},
{"f32": 4.5, "f64": 4.5, "i64": 4, "i32": 4, "i16": 4, "i8": 4, "bool": false, "char": "d", "dict": "d", "datetime": +(new Date("2018-01-28"))},
{"f32": null, "f64": null, "i64": null, "i32": null, "i16": null, "i8": null, "bool": null, "char": null, "dict": null, "datetime": null}
{"f32": 1.5, "f64": 1.5, "i64": 1, "i32": 1, "i16": 1, "i8": 1, "bool": true, "char": "a", "dict": "a",
"datetime(ms)": +(new Date("2018-01-25")), "datetime(us)": +(new Date("2018-01-25")), "datetime(ns)": +(new Date("2018-01-25"))},
{"f32": 2.5, "f64": 2.5, "i64": 2, "i32": 2, "i16": 2, "i8": 2, "bool": false, "char": "b", "dict": "b",
"datetime(ms)": +(new Date("2018-01-26")), "datetime(us)": +(new Date("2018-01-26")), "datetime(ns)": +(new Date("2018-01-26"))},
{"f32": 3.5, "f64": 3.5, "i64": 3, "i32": 3, "i16": 3, "i8": 3, "bool": true, "char": "c", "dict": "c",
"datetime(ms)": +(new Date("2018-01-27")), "datetime(us)": +(new Date("2018-01-27")), "datetime(ns)": +(new Date("2018-01-27"))},
{"f32": 4.5, "f64": 4.5, "i64": 4, "i32": 4, "i16": 4, "i8": 4, "bool": false, "char": "d", "dict": "d",
"datetime(ms)": +(new Date("2018-01-28")), "datetime(us)": +(new Date("2018-01-28")), "datetime(ns)": +(new Date("2018-01-28"))},
{"f32": null, "f64": null, "i64": null, "i32": null, "i16": null, "i8": null, "bool": null, "char": null, "dict": null,
"datetime(ms)": null, "datetime(us)": null, "datetime(ns)": null}
];

var arrow_psp_internal_schema = [9, 10, 1, 2, 3, 4, 11, 19, 19, 12, 12, 12, 2];

var dt = new Date();
var data_4 = [
{'v': dt}
Expand Down Expand Up @@ -117,6 +124,29 @@ module.exports = (perspective) => {
expect(arrow_result).toEqual(result);
});

it("Arrow schema", async function () {
// This only works for non parallel
var table = perspective.table(arrow);
let schema, stypes;
let types = [];
try{
schema = table.gnode.get_tblschema();
stypes = schema.types();

for (let i = 0; i < stypes.size(); i ++) {
types.push(stypes.get(i).value);
}
expect(arrow_psp_internal_schema).toEqual(types);
} finally {
if (schema) {
schema.delete();
}
if (stypes) {
stypes.delete();
}
}
});

it("CSV constructor", async function () {
var table = perspective.table(csv);
var view = table.view();
Expand Down