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

Date equality works on Druid but not locally #204

Open
darabos opened this issue Feb 24, 2021 · 0 comments
Open

Date equality works on Druid but not locally #204

darabos opened this issue Feb 24, 2021 · 0 comments

Comments

@darabos
Copy link

darabos commented Feb 24, 2021

I noticed this while writing a unit test.

const someDataset = plywood.Dataset.fromJS([
  { cut: 'Good',  price: 400, time: new Date('2015-10-01T00:00:00Z') },
]);
const ex = $('data').filter($('time').is(new Date('2015-10-01T00:00:00Z'))).count();
const r = await ex.compute({ data: someDataset });
console.log(r); // --> 0

I tried sharing the date object between the query and the dataset but it's the same.

const d = new Date('2015-10-01T00:00:00Z');
const someDataset = plywood.Dataset.fromJS([
  { cut: 'Good',  price: 400, time: d },
]);
const ex = $('data').filter($('time').is(d)).count();
const r = await ex.compute({ data: someDataset });
console.log(r); // --> 0

I get the same with equals(new Date(...)) or in([new Date(...)]). But in() works if you share the Date object!

const d = new Date('2015-10-01T00:00:00Z');
const someDataset = plywood.Dataset.fromJS([
  { cut: 'Good',  price: 400, time: d },
]);
const ex = $('data').filter($('time').in([d])).count();
const r = await ex.compute({ data: someDataset });
console.log(r); // --> 1

I think these all work with a Druid backend. I'm not sure what's the right way to do this in unit tests. Thanks for any advice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant