Skip to content

Would like the ability to use the __time column in filters (not intervals) #2816

@vogievetsky

Description

@vogievetsky

I would like to issue filters on the __time column just like any other dimension column.

This is to support the usecase described here: https://groups.google.com/forum/#!topic/imply-user-group/EQ_9oi29kgg

Essentially I want to be able to compute (in PlyQL):

SUM(`revenue_in_dollars` WHERE __time < '2016-04-04T00:00:00Z') +
SUM(`revenue_in_cents` WHERE '2016-04-04T00:00:00Z' <= __time) / 100

by expressing it as two filtered aggs that I add in a postAgg.

I would like, for example, the following query to work:

{
  "queryType": "timeseries",
  "dataSource": "wikipedia",
  "intervals": "2015-09-12/2015-09-13",
  "granularity": "all",
  "context": {
    "timeout": 10000
  },
  "aggregations": [
    {
      "type": "filtered",
      "name": "!T_0",
      "filter": {
        "type": "bound",
        "dimension": "__time",
        "alphaNumeric": true,
        "upper": 1442080800000,
        "upperStrict": true
      },
      "aggregator": {
        "name": "!T_0",
        "type": "doubleSum",
        "fieldName": "rev1"
      }
    },
    {
      "type": "filtered",
      "name": "!T_1",
      "filter": {
        "type": "bound",
        "dimension": "__time",
        "alphaNumeric": true,
        "lower": 1442080800000
      },
      "aggregator": {
        "name": "!T_1",
        "type": "doubleSum",
        "fieldName": "rev2"
      }
    }
  ],
  "postAggregations": [
    {
      "type": "arithmetic",
      "fn": "+",
      "fields": [
        {
          "type": "fieldAccess",
          "fieldName": "!T_0"
        },
        {
          "type": "fieldAccess",
          "fieldName": "!T_1"
        }
      ],
      "name": "Revenue"
    }
  ]
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions