{"action":"closed","issue":{"url":"https://api.github.com/repos/druid-io/druid/issues/1086","labels_url":"https://api.github.com/repos/druid-io/druid/issues/1086/labels{/name}","comments_url":"https://api.github.com/repos/druid-io/druid/issues/1086/comments","events_url":"https://api.github.com/repos/druid-io/druid/issues/1086/events","html_url":"https://github.com/druid-io/druid/issues/1086","id":56501370,"number":1086,"title":"__time not working with Javascript aggregator (0.6.171)","user":{"login":"schapirama","id":57937,"avatar_url":"https://avatars.githubusercontent.com/u/57937?v=3","gravatar_id":"","url":"https://api.github.com/users/schapirama","html_url":"https://github.com/schapirama","followers_url":"https://api.github.com/users/schapirama/followers","following_url":"https://api.github.com/users/schapirama/following{/other_user}","gists_url":"https://api.github.com/users/schapirama/gists{/gist_id}","starred_url":"https://api.github.com/users/schapirama/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/schapirama/subscriptions","organizations_url":"https://api.github.com/users/schapirama/orgs","repos_url":"https://api.github.com/users/schapirama/repos","events_url":"https://api.github.com/users/schapirama/events{/privacy}","received_events_url":"https://api.github.com/users/schapirama/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-02-04T09:26:59Z","updated_at":"2015-02-04T19:18:18Z","closed_at":"2015-02-04T19:18:18Z","body":"As discussed in the Google Group (https://groups.google.com/forum/#!topic/druid-development/RL79zFn56Pw) I am not able to get a valid value out of __time in my Javascript aggregator --the value that gets passed in to the JS function is null. \r\n\r\nHere is a sample query:\r\n\r\n```\r\n{\r\n    \"intervals\": [\r\n        \"2015-02-03T18:00:00.000+00:00/2015-02-03T19:00:00.000+00:00\"\r\n    ],\r\n    \"aggregations\": [\r\n        {\r\n            \"type\": \"count\",\r\n            \"name\": \"cnt\"\r\n        },\r\n        {\r\n            \"type\": \"javascript\",\r\n            \"fieldNames\": [\r\n                \"__time\"\r\n            ],\r\n            \"name\": \"aggtime\",\r\n            \"fnReset\": \"function reset() { return 0 }\",\r\n            \"fnCombine\": \"function combine(a,b) { return a + b }\",\r\n            \"fnAggregate\": \"function aggregate(current, time) {if(time > 1) {return(current + 1);} else {return(current);}}\"\r\n        }\r\n    ],\r\n    \"dataSource\": \"operational_events\",\r\n    \"granularity\": \"all\",\r\n    \"queryType\": \"timeseries\"\r\n}\r\n```\r\nNotice that I'm comparing time > 1 ... should always be true. Alas, the result I get is\r\n\r\n```\r\n[ {\r\n  \"timestamp\" : \"2015-02-03T18:22:00.000Z\",\r\n  \"result\" : {\r\n    \"aggtime\" : 0.0,\r\n    \"cnt\" : 22\r\n  }\r\n} ]\r\n```\r\n\r\nThis is against 0.6.171.\r\n\r\nFor completeness, in case I've done something wrong, here's the ingest spec (created for this test)\r\n\r\n```\r\n  {\r\n    \"type\" : \"index_realtime\",\r\n    \"schema\": {\r\n      \"dataSource\": \"operational_events_temp\",\r\n      \"aggregators\": [\r\n        {\r\n          \"type\": \"count\",\r\n          \"name\": \"rowCount\"\r\n        }\r\n      ],\r\n      \"indexGranularity\": \"minute\",\r\n      \"shardSpec\": {\r\n        \"type\": \"none\"\r\n      }\r\n    },\r\n    \"config\": {\r\n      \"maxRowsInMemory\": 500000,\r\n      \"intermediatePersistPeriod\": \"PT10m\"\r\n    },\r\n    \"firehose\": {\r\n      \"type\": \"kafka-0.8\",\r\n      \"consumerProps\": {\r\n        \"group.id\": \"xxx\",\r\n        \"zookeeper.connect\": \"xxxx\",\r\n        \"zookeeper.connection.timeout.ms\": \"15000\",\r\n        \"zookeeper.session.timeout.ms\": \"15000\",\r\n        \"zookeeper.sync.time.ms\": \"5000\",\r\n        \"fetch.message.max.bytes\": \"1048586\",\r\n        \"auto.offset.reset\": \"largest\",\r\n        \"auto.commit.enable\": \"true\"\r\n      },\r\n      \"feed\": \"operational_events\",\r\n      \"parser\": {\r\n        \"timestampSpec\": {\r\n          \"column\": \"timestamp\",\r\n          \"format\": \"millis\"\r\n        },\r\n        \"data\": {\r\n          \"format\": \"json\"\r\n        },\r\n        \"dimensionExclusions\": [\r\n          \"timestamp\"\r\n        ]\r\n      }\r\n    },\r\n    \"plumber\": {\r\n      \"type\": \"realtime\",\r\n      \"windowPeriod\": \"PT10m\",\r\n      \"segmentGranularity\": \"hour\"\r\n    }\r\n  }\r\n```\r\n\r\nand here's a segment query for the segment I am trying to query (to make sure it's a historical segment)\r\n\r\n```\r\n{\r\n\"queryType\":\"segmentMetadata\",\r\n\"dataSource\":\"operational_events_temp\",\r\n\"intervals\":[\"2015-02-03T18:00:00.000+00:00/2015-02-03T19:00:00.000+00:00\"],\r\n\"toInclude\":{ \"type\": \"list\", \"columns\":[\"__time\"]}\r\n}\r\n```\r\n\r\n==> \r\n```\r\n[ {\r\n  \"id\" : \"operational_events_temp_2015-02-03T00:00:00.000Z_2015-02-04T00:00:00.000Z_2015-02-03T18:22:46.586Z\",\r\n  \"intervals\" : [ \"2015-02-03T00:00:00.000Z/2015-02-03T23:59:00.000Z\" ],\r\n  \"columns\" : {\r\n    \"__time\" : {\r\n      \"type\" : \"LONG\",\r\n      \"size\" : 2880,\r\n      \"cardinality\" : null,\r\n      \"errorMessage\" : null\r\n    }\r\n  },\r\n  \"size\" : 36971\r\n} ]\r\n```\r\n\r\nThanks."}}