{"action":"created","comment":{"url":"https://api.github.com/repos/locationtech/geomesa/pulls/comments/111802685","pull_request_review_id":33059148,"id":111802685,"diff_hunk":"@@ -0,0 +1,149 @@\n+/***********************************************************************\n+* Copyright (c) 2013-2016 Commonwealth Computer Research, Inc.\n+* All rights reserved. This program and the accompanying materials\n+* are made available under the terms of the Apache License, Version 2.0\n+* which accompanies this distribution and is available at\n+* http://www.opensource.org/licenses/apache2.0.php.\n+*************************************************************************/\n+\n+package org.locationtech.geomesa.hbase.data\n+\n+import java.nio.charset.StandardCharsets\n+\n+import com.typesafe.scalalogging.LazyLogging\n+import com.vividsolutions.jts.geom.Envelope\n+import org.apache.hadoop.conf.Configuration\n+import org.apache.hadoop.hbase.{HBaseTestingUtility, TableName}\n+import org.apache.hadoop.hbase.client._\n+import org.apache.hadoop.hbase.coprocessor.CoprocessorHost\n+import org.geotools.data._\n+import org.geotools.data.collection.ListFeatureCollection\n+import org.geotools.data.simple.SimpleFeatureStore\n+import org.geotools.data.Query\n+import org.geotools.factory.Hints\n+import org.geotools.filter.text.ecql.ECQL\n+import org.geotools.geometry.jts.ReferencedEnvelope\n+import org.geotools.referencing.crs.DefaultGeographicCRS\n+import org.joda.time.{DateTime, DateTimeZone}\n+import org.junit.runner.RunWith\n+import org.locationtech.geomesa.features.ScalaSimpleFeature\n+import org.locationtech.geomesa.features.SerializationOption.SerializationOptions\n+import org.locationtech.geomesa.features.kryo.KryoFeatureSerializer\n+import org.locationtech.geomesa.hbase.data.HBaseDataStoreParams._\n+import org.locationtech.geomesa.hbase.utils.HBaseBatchScan\n+import org.locationtech.geomesa.index.conf.QueryHints\n+import org.locationtech.geomesa.index.index.ClientSideFiltering.RowAndValue\n+import org.locationtech.geomesa.process.utils.KryoLazyDensityUtils\n+import org.locationtech.geomesa.utils.geotools.SimpleFeatureTypes\n+import org.opengis.feature.simple.{SimpleFeature, SimpleFeatureType}\n+import org.specs2.mutable.Specification\n+import org.specs2.runner.JUnitRunner\n+\n+import scala.collection.JavaConversions._\n+\n+@RunWith(classOf[JUnitRunner])\n+class HBaseDensityFilterTest extends Specification with LazyLogging {\n+\n+  sequential\n+\n+  val cluster: HBaseTestingUtility = new HBaseTestingUtility()\n+  var connection: Connection = null\n+  var conf: Configuration = cluster.getConfiguration();\n+  val TEST_FAMILY = \"an_id:java.lang.Integer,attr:java.lang.Double,dtg:Date,geom:Point:srid=4326\"\n+  val TEST_HINT = new Hints()\n+  val typeName = \"testpoints\"\n+\n+  step {\n+    logger.info(\"Starting embedded hbase\")\n+    conf.set(CoprocessorHost.REGION_COPROCESSOR_CONF_KEY,\n+      \"org.locationtech.geomesa.hbase.coprocessor.KryoLazyDensityCoprocessor\");\n+    cluster.startMiniCluster(1)\n+    connection = cluster.getConnection\n+    logger.info(\"Started\")\n+  }\n+\n+  \"HBaseDataStore\" should {\n+    \"work with points\" in {\n+\n+      val params = Map(ConnectionParam.getName -> connection, BigTableNameParam.getName -> \"test_sft\")\n+      val ds = DataStoreFinder.getDataStore(params).asInstanceOf[HBaseDataStore]\n+\n+      ds.getSchema(typeName) must beNull\n+\n+      ds.createSchema(SimpleFeatureTypes.createType(typeName, TEST_FAMILY))\n+\n+      val sft = ds.getSchema(typeName)\n+\n+      sft must not(beNull)\n+\n+      val fs = ds.getFeatureSource(typeName).asInstanceOf[SimpleFeatureStore]\n+\n+      val toAdd = (0 until 150).map { i =>\n+        val sf = new ScalaSimpleFeature(i.toString, sft)\n+        sf.setAttribute(0, i.toString)\n+        sf.setAttribute(1, \"1.0\")\n+        sf.setAttribute(2, new DateTime(\"2012-01-01T19:00:00\", DateTimeZone.UTC).toDate)\n+        sf.setAttribute(3, \"POINT(-77 38)\")\n+        sf\n+      }\n+\n+      val ids = fs.addFeatures(new ListFeatureCollection(sft, toAdd))\n+\n+      val table: TableName = connection.getAdmin.listTableNames(\"test_sft_testpoints_z3\")(0)\n+\n+      val scanRange: Scan = new Scan()\n+\n+      def rowAndValue(result: Result): RowAndValue = {\n+        val cell = result.rawCells()(0)\n+        RowAndValue(cell.getRowArray, cell.getRowOffset, cell.getRowLength,\n+          cell.getValueArray, cell.getValueOffset, cell.getValueLength)\n+      }\n+\n+      val deserializer = new KryoFeatureSerializer(sft, SerializationOptions.withoutId)\n+\n+      import org.locationtech.geomesa.utils.geotools.RichSimpleFeatureType._\n+      def getIdFromRow(sft: SimpleFeatureType): (Array[Byte], Int, Int) => String = {\n+        val start = if (sft.isTableSharing) {\n+          12\n+        } else {\n+          11\n+        } // table sharing + shard + 2 byte short + 8 byte long\n+        (row, offset, length) => new String(row, offset + start, length - start, StandardCharsets.UTF_8)\n+      }\n+\n+      val getId = getIdFromRow(sft)\n+\n+      // 1. Goal scan one of the tables with data\n+      val scan = new HBaseBatchScan(connection, table, Seq(scanRange), 2, 100000)\n+      val results = scan.map { result =>\n+        val RowAndValue(row, rowOffset, rowLength, value, valueOffset, valueLength) = rowAndValue(result)\n+        val sf: SimpleFeature = deserializer.deserialize(value, valueOffset, valueLength)\n+        sf\n+      }\n+\n+      getDensity(\"INCLUDE\", fs).foreach { i =>\n+        logger.info(s\"Got $i\")\n+      }\n+\n+      true mustEqual (true)","path":"geomesa-hbase/geomesa-hbase-datastore/src/test/scala/org/locationtech/geomesa/hbase/data/HBaseDensityFilterTest.scala","position":128,"original_position":128,"commit_id":"642afe248ae70cbe4460859ab38008010720f317","original_commit_id":"642afe248ae70cbe4460859ab38008010720f317","user":{"login":"elahrvivaz","id":7715322,"avatar_url":"https://avatars3.githubusercontent.com/u/7715322?v=3","gravatar_id":"","url":"https://api.github.com/users/elahrvivaz","html_url":"https://github.com/elahrvivaz","followers_url":"https://api.github.com/users/elahrvivaz/followers","following_url":"https://api.github.com/users/elahrvivaz/following{/other_user}","gists_url":"https://api.github.com/users/elahrvivaz/gists{/gist_id}","starred_url":"https://api.github.com/users/elahrvivaz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elahrvivaz/subscriptions","organizations_url":"https://api.github.com/users/elahrvivaz/orgs","repos_url":"https://api.github.com/users/elahrvivaz/repos","events_url":"https://api.github.com/users/elahrvivaz/events{/privacy}","received_events_url":"https://api.github.com/users/elahrvivaz/received_events","type":"User","site_admin":false},"body":"need some real tests that call this through the regular data store query method, like this: https://github.com/locationtech/geomesa/blob/master/geomesa-accumulo/geomesa-accumulo-datastore/src/test/scala/org/locationtech/geomesa/accumulo/iterators/DensityIteratorTest.scala#L48-L60","created_at":"2017-04-17T19:28:07Z","updated_at":"2017-04-17T19:29:06Z","html_url":"https://github.com/locationtech/geomesa/pull/1478#discussion_r111802685","pull_request_url":"https://api.github.com/repos/locationtech/geomesa/pulls/1478","_links":{"self":{"href":"https://api.github.com/repos/locationtech/geomesa/pulls/comments/111802685"},"html":{"href":"https://github.com/locationtech/geomesa/pull/1478#discussion_r111802685"},"pull_request":{"href":"https://api.github.com/repos/locationtech/geomesa/pulls/1478"}}},"pull_request":{"url":"https://api.github.com/repos/locationtech/geomesa/pulls/1478","id":116090718,"html_url":"https://github.com/locationtech/geomesa/pull/1478","diff_url":"https://github.com/locationtech/geomesa/pull/1478.diff","patch_url":"https://github.com/locationtech/geomesa/pull/1478.patch","issue_url":"https://api.github.com/repos/locationtech/geomesa/issues/1478","number":1478,"state":"open","locked":false,"title":"Hbase Density Filter","user":{"login":"mahakgrg","id":21136027,"avatar_url":"https://avatars3.githubusercontent.com/u/21136027?v=3","gravatar_id":"","url":"https://api.github.com/users/mahakgrg","html_url":"https://github.com/mahakgrg","followers_url":"https://api.github.com/users/mahakgrg/followers","following_url":"https://api.github.com/users/mahakgrg/following{/other_user}","gists_url":"https://api.github.com/users/mahakgrg/gists{/gist_id}","starred_url":"https://api.github.com/users/mahakgrg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mahakgrg/subscriptions","organizations_url":"https://api.github.com/users/mahakgrg/orgs","repos_url":"https://api.github.com/users/mahakgrg/repos","events_url":"https://api.github.com/users/mahakgrg/events{/privacy}","received_events_url":"https://api.github.com/users/mahakgrg/received_events","type":"User","site_admin":false},"body":"PR for hbase density filter implementation\r\n\r\nSigned-off-by: Mutahir <kazmi.mutahir@gmail.com>\r\nSigned-off-by: Mahak <mahakgrg@gmail.com>","created_at":"2017-04-17T04:44:33Z","updated_at":"2017-04-17T19:29:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8ccd88625be3727636619e9539ad957b53c70d20","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/locationtech/geomesa/pulls/1478/commits","review_comments_url":"https://api.github.com/repos/locationtech/geomesa/pulls/1478/comments","review_comment_url":"https://api.github.com/repos/locationtech/geomesa/pulls/comments{/number}","comments_url":"https://api.github.com/repos/locationtech/geomesa/issues/1478/comments","statuses_url":"https://api.github.com/repos/locationtech/geomesa/statuses/642afe248ae70cbe4460859ab38008010720f317","head":{"label":"MutahirKazmi:fcr_hbase_density_filter","ref":"fcr_hbase_density_filter","sha":"642afe248ae70cbe4460859ab38008010720f317","user":{"login":"MutahirKazmi","id":4002943,"avatar_url":"https://avatars2.githubusercontent.com/u/4002943?v=3","gravatar_id":"","url":"https://api.github.com/users/MutahirKazmi","html_url":"https://github.com/MutahirKazmi","followers_url":"https://api.github.com/users/MutahirKazmi/followers","following_url":"https://api.github.com/users/MutahirKazmi/following{/other_user}","gists_url":"https://api.github.com/users/MutahirKazmi/gists{/gist_id}","starred_url":"https://api.github.com/users/MutahirKazmi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MutahirKazmi/subscriptions","organizations_url":"https://api.github.com/users/MutahirKazmi/orgs","repos_url":"https://api.github.com/users/MutahirKazmi/repos","events_url":"https://api.github.com/users/MutahirKazmi/events{/privacy}","received_events_url":"https://api.github.com/users/MutahirKazmi/received_events","type":"User","site_admin":false},"repo":{"id":80958525,"name":"geomesa","full_name":"MutahirKazmi/geomesa","owner":{"login":"MutahirKazmi","id":4002943,"avatar_url":"https://avatars2.githubusercontent.com/u/4002943?v=3","gravatar_id":"","url":"https://api.github.com/users/MutahirKazmi","html_url":"https://github.com/MutahirKazmi","followers_url":"https://api.github.com/users/MutahirKazmi/followers","following_url":"https://api.github.com/users/MutahirKazmi/following{/other_user}","gists_url":"https://api.github.com/users/MutahirKazmi/gists{/gist_id}","starred_url":"https://api.github.com/users/MutahirKazmi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MutahirKazmi/subscriptions","organizations_url":"https://api.github.com/users/MutahirKazmi/orgs","repos_url":"https://api.github.com/users/MutahirKazmi/repos","events_url":"https://api.github.com/users/MutahirKazmi/events{/privacy}","received_events_url":"https://api.github.com/users/MutahirKazmi/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/MutahirKazmi/geomesa","description":"GeoMesa is a suite of tools for working with big geo-spatial data in a distributed fashion.","fork":true,"url":"https://api.github.com/repos/MutahirKazmi/geomesa","forks_url":"https://api.github.com/repos/MutahirKazmi/geomesa/forks","keys_url":"https://api.github.com/repos/MutahirKazmi/geomesa/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MutahirKazmi/geomesa/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MutahirKazmi/geomesa/teams","hooks_url":"https://api.github.com/repos/MutahirKazmi/geomesa/hooks","issue_events_url":"https://api.github.com/repos/MutahirKazmi/geomesa/issues/events{/number}","events_url":"https://api.github.com/repos/MutahirKazmi/geomesa/events","assignees_url":"https://api.github.com/repos/MutahirKazmi/geomesa/assignees{/user}","branches_url":"https://api.github.com/repos/MutahirKazmi/geomesa/branches{/branch}","tags_url":"https://api.github.com/repos/MutahirKazmi/geomesa/tags","blobs_url":"https://api.github.com/repos/MutahirKazmi/geomesa/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MutahirKazmi/geomesa/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MutahirKazmi/geomesa/git/refs{/sha}","trees_url":"https://api.github.com/repos/MutahirKazmi/geomesa/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MutahirKazmi/geomesa/statuses/{sha}","languages_url":"https://api.github.com/repos/MutahirKazmi/geomesa/languages","stargazers_url":"https://api.github.com/repos/MutahirKazmi/geomesa/stargazers","contributors_url":"https://api.github.com/repos/MutahirKazmi/geomesa/contributors","subscribers_url":"https://api.github.com/repos/MutahirKazmi/geomesa/subscribers","subscription_url":"https://api.github.com/repos/MutahirKazmi/geomesa/subscription","commits_url":"https://api.github.com/repos/MutahirKazmi/geomesa/commits{/sha}","git_commits_url":"https://api.github.com/repos/MutahirKazmi/geomesa/git/commits{/sha}","comments_url":"https://api.github.com/repos/MutahirKazmi/geomesa/comments{/number}","issue_comment_url":"https://api.github.com/repos/MutahirKazmi/geomesa/issues/comments{/number}","contents_url":"https://api.github.com/repos/MutahirKazmi/geomesa/contents/{+path}","compare_url":"https://api.github.com/repos/MutahirKazmi/geomesa/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MutahirKazmi/geomesa/merges","archive_url":"https://api.github.com/repos/MutahirKazmi/geomesa/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MutahirKazmi/geomesa/downloads","issues_url":"https://api.github.com/repos/MutahirKazmi/geomesa/issues{/number}","pulls_url":"https://api.github.com/repos/MutahirKazmi/geomesa/pulls{/number}","milestones_url":"https://api.github.com/repos/MutahirKazmi/geomesa/milestones{/number}","notifications_url":"https://api.github.com/repos/MutahirKazmi/geomesa/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MutahirKazmi/geomesa/labels{/name}","releases_url":"https://api.github.com/repos/MutahirKazmi/geomesa/releases{/id}","deployments_url":"https://api.github.com/repos/MutahirKazmi/geomesa/deployments","created_at":"2017-02-05T00:33:37Z","updated_at":"2017-02-05T00:33:42Z","pushed_at":"2017-04-17T16:17:01Z","git_url":"git://github.com/MutahirKazmi/geomesa.git","ssh_url":"git@github.com:MutahirKazmi/geomesa.git","clone_url":"https://github.com/MutahirKazmi/geomesa.git","svn_url":"https://github.com/MutahirKazmi/geomesa","homepage":"https://www.locationtech.org/projects/technology.geomesa","size":40343,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"locationtech:master","ref":"master","sha":"b238a3a07ca1e26ccf6ac7f962b64955a75ab202","user":{"login":"locationtech","id":1991411,"avatar_url":"https://avatars1.githubusercontent.com/u/1991411?v=3","gravatar_id":"","url":"https://api.github.com/users/locationtech","html_url":"https://github.com/locationtech","followers_url":"https://api.github.com/users/locationtech/followers","following_url":"https://api.github.com/users/locationtech/following{/other_user}","gists_url":"https://api.github.com/users/locationtech/gists{/gist_id}","starred_url":"https://api.github.com/users/locationtech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/locationtech/subscriptions","organizations_url":"https://api.github.com/users/locationtech/orgs","repos_url":"https://api.github.com/users/locationtech/repos","events_url":"https://api.github.com/users/locationtech/events{/privacy}","received_events_url":"https://api.github.com/users/locationtech/received_events","type":"Organization","site_admin":false},"repo":{"id":13226069,"name":"geomesa","full_name":"locationtech/geomesa","owner":{"login":"locationtech","id":1991411,"avatar_url":"https://avatars1.githubusercontent.com/u/1991411?v=3","gravatar_id":"","url":"https://api.github.com/users/locationtech","html_url":"https://github.com/locationtech","followers_url":"https://api.github.com/users/locationtech/followers","following_url":"https://api.github.com/users/locationtech/following{/other_user}","gists_url":"https://api.github.com/users/locationtech/gists{/gist_id}","starred_url":"https://api.github.com/users/locationtech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/locationtech/subscriptions","organizations_url":"https://api.github.com/users/locationtech/orgs","repos_url":"https://api.github.com/users/locationtech/repos","events_url":"https://api.github.com/users/locationtech/events{/privacy}","received_events_url":"https://api.github.com/users/locationtech/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/locationtech/geomesa","description":"GeoMesa is a suite of tools for working with big geo-spatial data in a distributed fashion.","fork":false,"url":"https://api.github.com/repos/locationtech/geomesa","forks_url":"https://api.github.com/repos/locationtech/geomesa/forks","keys_url":"https://api.github.com/repos/locationtech/geomesa/keys{/key_id}","collaborators_url":"https://api.github.com/repos/locationtech/geomesa/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/locationtech/geomesa/teams","hooks_url":"https://api.github.com/repos/locationtech/geomesa/hooks","issue_events_url":"https://api.github.com/repos/locationtech/geomesa/issues/events{/number}","events_url":"https://api.github.com/repos/locationtech/geomesa/events","assignees_url":"https://api.github.com/repos/locationtech/geomesa/assignees{/user}","branches_url":"https://api.github.com/repos/locationtech/geomesa/branches{/branch}","tags_url":"https://api.github.com/repos/locationtech/geomesa/tags","blobs_url":"https://api.github.com/repos/locationtech/geomesa/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/locationtech/geomesa/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/locationtech/geomesa/git/refs{/sha}","trees_url":"https://api.github.com/repos/locationtech/geomesa/git/trees{/sha}","statuses_url":"https://api.github.com/repos/locationtech/geomesa/statuses/{sha}","languages_url":"https://api.github.com/repos/locationtech/geomesa/languages","stargazers_url":"https://api.github.com/repos/locationtech/geomesa/stargazers","contributors_url":"https://api.github.com/repos/locationtech/geomesa/contributors","subscribers_url":"https://api.github.com/repos/locationtech/geomesa/subscribers","subscription_url":"https://api.github.com/repos/locationtech/geomesa/subscription","commits_url":"https://api.github.com/repos/locationtech/geomesa/commits{/sha}","git_commits_url":"https://api.github.com/repos/locationtech/geomesa/git/commits{/sha}","comments_url":"https://api.github.com/repos/locationtech/geomesa/comments{/number}","issue_comment_url":"https://api.github.com/repos/locationtech/geomesa/issues/comments{/number}","contents_url":"https://api.github.com/repos/locationtech/geomesa/contents/{+path}","compare_url":"https://api.github.com/repos/locationtech/geomesa/compare/{base}...{head}","merges_url":"https://api.github.com/repos/locationtech/geomesa/merges","archive_url":"https://api.github.com/repos/locationtech/geomesa/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/locationtech/geomesa/downloads","issues_url":"https://api.github.com/repos/locationtech/geomesa/issues{/number}","pulls_url":"https://api.github.com/repos/locationtech/geomesa/pulls{/number}","milestones_url":"https://api.github.com/repos/locationtech/geomesa/milestones{/number}","notifications_url":"https://api.github.com/repos/locationtech/geomesa/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/locationtech/geomesa/labels{/name}","releases_url":"https://api.github.com/repos/locationtech/geomesa/releases{/id}","deployments_url":"https://api.github.com/repos/locationtech/geomesa/deployments","created_at":"2013-09-30T20:13:46Z","updated_at":"2017-04-14T14:46:50Z","pushed_at":"2017-04-17T16:17:02Z","git_url":"git://github.com/locationtech/geomesa.git","ssh_url":"git@github.com:locationtech/geomesa.git","clone_url":"https://github.com/locationtech/geomesa.git","svn_url":"https://github.com/locationtech/geomesa","homepage":"https://www.locationtech.org/projects/technology.geomesa","size":40590,"stargazers_count":283,"watchers_count":283,"language":"Scala","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":137,"mirror_url":null,"open_issues_count":13,"forks":137,"open_issues":13,"watchers":283,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/locationtech/geomesa/pulls/1478"},"html":{"href":"https://github.com/locationtech/geomesa/pull/1478"},"issue":{"href":"https://api.github.com/repos/locationtech/geomesa/issues/1478"},"comments":{"href":"https://api.github.com/repos/locationtech/geomesa/issues/1478/comments"},"review_comments":{"href":"https://api.github.com/repos/locationtech/geomesa/pulls/1478/comments"},"review_comment":{"href":"https://api.github.com/repos/locationtech/geomesa/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/locationtech/geomesa/pulls/1478/commits"},"statuses":{"href":"https://api.github.com/repos/locationtech/geomesa/statuses/642afe248ae70cbe4460859ab38008010720f317"}}}}
{"actor":{"display_login":"elahrvivaz"}}