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

Null fix #233

Merged
merged 5 commits into from
Sep 12, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Additional tests for appending rows with null/partial values
  • Loading branch information
neilslinger committed Sep 11, 2018
commit e67b2292dcf25f39aa0ebe3b929ffa19cfa03853
5 changes: 2 additions & 3 deletions packages/perspective/src/cpp/gnode_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,11 +294,12 @@ t_gstate::update_history(const t_table* tbl)
++idx)
{
t_bool is_valid = fcolumn->is_valid(idx);
t_uindex stableidx = stableidx_vec[idx];

if (!is_valid) {
t_bool is_cleared = fcolumn->is_cleared(idx);
if (is_cleared) {
scolumn->clear(idx);
scolumn->clear(stableidx);
}
continue;
}
Expand All @@ -309,8 +310,6 @@ t_gstate::update_history(const t_table* tbl)
if (op == OP_DELETE)
continue;

t_uindex stableidx = stableidx_vec[idx];

switch (fcolumn->get_dtype())
{
case DTYPE_NONE:
Expand Down
25 changes: 21 additions & 4 deletions packages/perspective/test/js/updates.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
*/

import _ from "underscore";

import arrow from "../arrow/test.arrow";

var data = [
Expand Down Expand Up @@ -398,9 +397,6 @@ module.exports = (perspective) => {
var partial = [
{'x': null, 'y': 'a', 'z': false},
];

// make err on call partial update w/o index

var expected = [
{'x': null, 'y': 'a', 'z': false},
{'x': 2, 'y':'b', 'z': false},
Expand All @@ -417,6 +413,27 @@ module.exports = (perspective) => {
});
});

it("update by adding rows (new pkeys) with partials/nulls", function (done) {
var update = [
{'x': null, 'y':'e', 'z': null}
];
var expected = [
{'x': 1, 'y':'a', 'z': true},
{'x': 2, 'y':'b', 'z': false},
{'x': 3, 'y':'c', 'z': true},
{'x': 4, 'y':'d', 'z': false},
{'x': null, 'y':'e', 'z': null}
];
var table = perspective.table(meta, {index: 'y'});
var view = table.view();
table.update(data);
table.update(update);
view.to_json().then(json => {
expect(json).toEqual(expected);
done();
});
});


it("partial column oriented update with null unsets value", function (done) {
var partial = {
Expand Down