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

Plywood and Druid zero-fill on timeseries queries #187

Open
viniciusbo opened this issue Oct 11, 2019 · 1 comment
Open

Plywood and Druid zero-fill on timeseries queries #187

viniciusbo opened this issue Oct 11, 2019 · 1 comment

Comments

@viniciusbo
Copy link

viniciusbo commented Oct 11, 2019

Hi! I'm new to Plywood framework. I'm using it to query a Druid database.

Suppose I want to count how many clicks certain link had from day 2019-10-1 until 2019-10-07 but some days don't have any data to show. How could I fill those missing days? I initially thought the operator.timeRange() would achieve that, but I guess I was wrong.

Any help is appreciated. Thanks in advance.

Edit: as I can see zero-filling is done by Druid, but I can't get those values returned from Plywood.

@viniciusbo
Copy link
Author

viniciusbo commented Oct 12, 2019

This is what I've been trying so far:

const { $, External } = require('plywood');
const { druidRequesterFactory } = require('plywood-druid-requester');

const druidRequester = druidRequesterFactory({
  host: '192.168.0.108:8082',
});

const dataset = External.fromJS({
  engine: 'druid',
  source: 'clicks',
  timeAttribute: '__time',
  query: {
    queryType: 'timeseries',
  },
  context: {
    skipEmptyBuckets: false,
  }
}, druidRequester);

const context = { clicks: dataset };

const ex = $('clicks')
  .filter($('__time').in({
    start: new Date('2019-10-01T00:00:00Z'),
    end: new Date('2019-11-01T00:00:00Z'),
  }))
  .split($('__time').timeBucket('P1D'), 'day')
  .apply('count', $('clicks').sum($('count')))

As plywood-druid-requester docs seems outdated I was wondering how to send timeseries queries to Druid. Is this right?

@viniciusbo viniciusbo changed the title How to fill missing dates in time range Plywood and Druid zero-fill on timeseries queries Oct 14, 2019
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