osdir.com

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fwd: Comparison of druid dimensions as dates


Hello,

I want to compare two dates which are in mill seconds while querying to
druid.
But it seems druid is doing the comparison  by considering them as strings.

{
  "queryType": "select",
  "dataSource": "source",
  "intervals": "2015-09-12/2020-09-13",
  "dimensions": [
    "eventTime",
    {
      "type": "extraction",
      "dimension": "__time",
      "outputName": "millisTransactionTime",
      "extractionFn": {
        "type": "javascript",
        "function": "function(hello) { return hello+1296000000; }",
        "asMillis": "true"
      }
    },
    {
      "type": "extraction",
      "dimension": "eventTime",
      "outputName": "millisEventTime",
      "extractionFn": {
        "type": "timeFormat",
        "asMillis": "true"
      }
    },
    {
      "type": "extraction",
      "outputName": "isProper",
      "dimension": "eventTime",
      "args": [
        "millisTransactionTime",
        "millisEventTime"
      ],
      "extractionFn": {
        "type": "javascript",
        *"function": "function(a,b) { return (Date(b) < Date(a)) ; }"*
      }
    }
  ],
  "aggregations": [
    {
      "name": "count",
      "type": "count"
    }
  ],
  "pagingSpec": {
    "pagingIdentifiers": {},
    "threshold": 100
  }
}
Regards,
Spandana.