Time render Array instead an object
ayxos opened this issue · comments
Right now, if i want to compare two different timeframes for the same object id i have to use a hack to duplicate the query and send it twice with pivot. Is there any way to do it sending just an array of two (or more) timeranges and let plywood do its magic?
something like:
"action":"in",
"expression":{
"op":"literal",
"value":[{
"start":"2015-12-26T00:01:00.000Z",
"end":"2015-12-27T00:01:00.000Z"
},{
"start":"2015-12-26T00:01:00.000Z",
"end":"2015-12-27T00:01:00.000Z"
}],
"type":"TIME_RANGE"
}
I am confused, where are you running this query?
In Plywood you can use an OR or a set of TIME_RANGES like so:
{
"action": "in",
"expression": {
"op": "literal",
"type": "SET",
"value": {
"elements": [
{
"end": new Date('2015-10-10T00:00:00.000Z'),
"start": new Date('2015-03-03T00:00:00.000Z')
},
{
"end": new Date('2015-11-25T00:00:00.000Z'),
"start": new Date('2015-11-20T00:00:00.000Z')
}
],
"setType": "TIME_RANGE"
}
}
}
In Pivot there is no UI yet for issuing those kinds of time filters.
Are you working with Pivot or Plywood?
Oh, my fault, im trying to running this query on Postman directly to plywood.
Im trying to get to datasets for one single item using two time ranges but i dont know how to create the query.
{
"version":"0.7.24",
"dataSource":"full20151226v4",
"expression":{
"op":"chain",
"expression":{
"op":"literal",
"value":[
{
}
],
"type":"DATASET"
},
"actions":[
{
"action":"apply",
"expression":{
"op":"chain",
"expression":{
"op":"ref",
"name":"main"
},
"action":{
"action":"filter",
"expression":{
"op":"chain",
"expression":{
"op":"ref",
"name":"time"
},
"actions":[
{
"action":"in",
"expression":{
"op":"literal",
"type": "SET",
"value": {
"elements": [
{
"start":"2015-12-26T00:01:00.000Z",
"end":"2015-12-26T12:01:00.000Z"
},
{
"start":"2015-12-26T12:01:00.000Z",
"end":"2015-12-26T23:01:00.000Z"
}
],
"setType": "TIME_RANGE"
}
}
},
{
"action":"and",
"expression":{
"op":"chain",
"expression":{
"op":"ref",
"name":"adSpaceId"
},
"action":{
"action":"in",
"expression":{
"op":"literal",
"value":{
"setType":"STRING",
"elements":[
"130021373"
]
},
"type":"SET"
}
}
}
}
]
}
}
},
"name":"main"
},
{
"action":"apply",
"expression":{
"op":"chain",
"expression":{
"op":"ref",
"name":"main"
},
"action":{
"action":"sum",
"expression":{
"op":"ref",
"name":"count"
}
}
},
"name":"count"
},
{
"action":"apply",
"expression":{
"op":"chain",
"expression":{
"op":"ref",
"name":"main"
},
"actions":[
{
"action":"split",
"name":"SEGMENT",
"expression":{
"op":"ref",
"name":"adSpaceId"
},
"dataName":"main"
},
{
"action":"apply",
"expression":{
"op":"chain",
"expression":{
"op":"ref",
"name":"main"
},
"action":{
"action":"sum",
"expression":{
"op":"ref",
"name":"count"
}
}
},
"name":"count"
},
{
"action":"apply",
"expression":{
"op":"chain",
"expression":{
"op":"ref",
"name":"main"
},
"action":{
"action":"sum",
"expression":{
"op":"ref",
"name":"count"
}
}
},
"name":"count"
},
{
"action":"sort",
"expression":{
"op":"ref",
"name":"count"
},
"direction":"descending"
},
{
"action":"limit",
"limit":5
},
{
"action":"apply",
"expression":{
"op":"chain",
"expression":{
"op":"ref",
"name":"main"
},
"actions":[
{
"action":"split",
"name":"TIME",
"expression":{
"op":"chain",
"expression":{
"op":"ref",
"name":"time"
},
"action":{
"action":"timeBucket",
"duration":"PT1M",
"timezone":"Etc/UTC"
}
},
"dataName":"main"
},
{
"action":"apply",
"expression":{
"op":"chain",
"expression":{
"op":"ref",
"name":"main"
},
"action":{
"action":"sum",
"expression":{
"op":"ref",
"name":"count"
}
}
},
"name":"count"
},
{
"action":"sort",
"expression":{
"op":"ref",
"name":"TIME"
},
"direction":"ascending"
}
]
},
"name":"SPLIT"
}
]
},
"name":"SPLIT"
}
]
}
}
Thats return a single dataset, not two different datasets splitted, so, i want to split by TIME_RANGE