{"action":"created","comment":{"url":"https://api.github.com/repos/locationtech/geomesa/pulls/comments/83717099","pull_request_review_id":4542758,"id":83717099,"diff_hunk":"@@ -0,0 +1,113 @@\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.features.kryo.json\n+\n+import org.locationtech.geomesa.features.kryo.json.JsonPathParser.JsonPathFunction.JsonPathFunction\n+import org.locationtech.geomesa.features.kryo.json.JsonPathParser._\n+import org.parboiled.Context\n+import org.parboiled.errors.{ErrorUtils, ParsingException}\n+import org.parboiled.scala._\n+\n+/**\n+  * Parses a json path string into a sequence of selectors. See https://github.com/jayway/JsonPath for examples.\n+  *\n+  * Does not support filter predicates.\n+  */\n+object JsonPathParser {\n+\n+  private val Parser = new JsonPathParser()\n+\n+  @throws(classOf[ParsingException])\n+  def parse(path: String, report: Boolean = true): Seq[PathElement] = {\n+    val runner = if (report) { ReportingParseRunner(Parser.Path) } else { BasicParseRunner(Parser.Path) }\n+    val parsing = runner.run(path)\n+    parsing.result.getOrElse {\n+      throw new ParsingException(s\"Invalid json path: ${ErrorUtils.printParseErrors(parsing)}\")\n+    }\n+  }\n+\n+  sealed trait PathElement\n+\n+  // attribute: .foo\n+  case class PathAttribute(name: String) extends PathElement\n+\n+  // enumerated index: [1]\n+  case class PathIndex(index: Int) extends PathElement\n+\n+  // enumerated indices: [1,2,5]\n+  case class PathIndices(indices: Seq[Int]) extends PathElement\n+\n+  // any attribute: .*\n+  case object PathAttributeWildCard extends PathElement\n+\n+  // any index: [*]\n+  case object PathIndexWildCard extends PathElement\n+\n+  // deep scan: ..\n+  case object PathDeepScan extends PathElement\n+\n+  // path function: .min(), .max(), .avg(), .length()\n+  // not implemented: stddev\n+  case class PathFunction(function: JsonPathFunction) extends PathElement\n+\n+  object JsonPathFunction extends Enumeration {\n+    type JsonPathFunction = Value\n+    val min, max, avg, length = Value\n+  }\n+}\n+\n+private class JsonPathParser extends Parser {\n+\n+  // main parsing rule\n+  def Path: Rule1[Seq[PathElement]] =\n+  rule { \"$\" ~ zeroOrMore(Element) ~ optional(Function) ~~> ((e, f) => e ++ f.toSeq) ~ EOI }\n+\n+  def Element: Rule1[PathElement] = rule {\n+    Attribute | ArrayIndex | ArrayIndices | ArrayIndexRange | AttributeWildCard | IndexWildCard | DeepScan\n+  }\n+\n+  def IndexWildCard: Rule1[PathElement] = rule { \"[*]\" ~ push(PathIndexWildCard) }\n+\n+  def AttributeWildCard: Rule1[PathElement] = rule { \".*\" ~ push(PathAttributeWildCard) }\n+\n+  // we have to push the deep scan directly onto the stack as there is no forward matching and\n+  // it's ridiculous trying to combine Rule1's and Rule2's\n+  def DeepScan: Rule1[PathElement] = rule { \".\" ~ toRunAction(pushDeepScan) ~ (Attribute | AttributeWildCard) }\n+\n+  // note: this assumes that we are inside a zeroOrMore, which is currently the case\n+  // the zeroOrMore will have pushed a single list onto the value stack - we append our value to that\n+  private def pushDeepScan(context: Context[Any]): Unit =\n+    context.getValueStack.push(PathDeepScan :: context.getValueStack.pop.asInstanceOf[List[_]])\n+\n+  def ArrayIndex: Rule1[PathIndex] = rule { \"[\" ~ Number ~ \"]\" ~~> PathIndex }\n+\n+  def ArrayIndices: Rule1[PathIndices] =\n+    rule { \"[\" ~ Number ~ \",\" ~ oneOrMore(Number, \",\") ~ \"]\" ~~> ((n0, n) => PathIndices(n.+:(n0))) }\n+\n+  def ArrayIndexRange: Rule1[PathIndices] =\n+    rule { \"[\" ~ Number ~ \":\" ~ Number ~ \"]\" ~~> ((n0, n1) => PathIndices(n0 until n1)) }\n+\n+  def Attribute: Rule1[PathAttribute] = rule { \".\" ~ oneOrMore(Character) ~> PathAttribute ~ !\"()\" }\n+\n+  def Function: Rule1[PathFunction] = rule {\n+    \".\" ~ (\"min\" | \"max\" | \"avg\" | \"length\") ~> ((f) => PathFunction(JsonPathFunction.withName(f))) ~ \"()\"\n+  }\n+\n+  def Number: Rule1[Int] = rule { oneOrMore(\"0\" - \"9\") ~> (_.toInt) }\n+\n+  def Character: Rule0 = rule { EscapedChar | NormalChar }\n+\n+  def EscapedChar: Rule0 = rule { \"\\\\\" ~ (anyOf(\"\\\"\\\\/bfnrt\") | Unicode) }\n+\n+  def NormalChar: Rule0 = rule { \"a\" - \"z\" | \"A\" - \"Z\" | \"0\" - \"9\" }\n+\n+  def Unicode: Rule0 = rule { \"u\" ~ HexDigit ~ HexDigit ~ HexDigit ~ HexDigit }\n+\n+  def HexDigit: Rule0 = rule { \"0\" - \"9\" | \"a\" - \"f\" | \"A\" - \"Z\" }","path":"geomesa-features/geomesa-feature-kryo/src/main/scala/org/locationtech/geomesa/features/kryo/json/JsonPathParser.scala","position":112,"original_position":112,"commit_id":"4934f2c83438504e9a4b96bc63e77e657fff77d3","original_commit_id":"4934f2c83438504e9a4b96bc63e77e657fff77d3","user":{"login":"elahrvivaz","id":7715322,"avatar_url":"https://avatars.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":"yeah, good catch","created_at":"2016-10-17T19:36:41Z","updated_at":"2016-10-17T19:36:41Z","html_url":"https://github.com/locationtech/geomesa/pull/1102#discussion_r83717099","pull_request_url":"https://api.github.com/repos/locationtech/geomesa/pulls/1102","_links":{"self":{"href":"https://api.github.com/repos/locationtech/geomesa/pulls/comments/83717099"},"html":{"href":"https://github.com/locationtech/geomesa/pull/1102#discussion_r83717099"},"pull_request":{"href":"https://api.github.com/repos/locationtech/geomesa/pulls/1102"}}},"pull_request":{"url":"https://api.github.com/repos/locationtech/geomesa/pulls/1102","id":85850723,"html_url":"https://github.com/locationtech/geomesa/pull/1102","diff_url":"https://github.com/locationtech/geomesa/pull/1102.diff","patch_url":"https://github.com/locationtech/geomesa/pull/1102.patch","issue_url":"https://api.github.com/repos/locationtech/geomesa/issues/1102","number":1102,"state":"open","locked":false,"title":"GEOMESA-1438 Support for json attributes in SimpleFeatures","user":{"login":"elahrvivaz","id":7715322,"avatar_url":"https://avatars.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":"* Attributes can be marked as json in the simple feature type definition: 'json-field:String:json=true'\r\n* Json attributes will be serialized as bson\r\n* Nested json can be queried or projected using json-path (note json path must be double-quoted): \"$.json-field.foo\" = 'bar'\r\n* Removed old serialization code - dropping support for versions prior to 1.1.0-rc.1\r\n\r\nSigned-off-by: Emilio Lahr-Vivaz <elahrvivaz@ccri.com>","created_at":"2016-09-19T19:06:12Z","updated_at":"2016-10-17T19:36:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1fed051c8285beb0c117ada31a7121ab08588cb7","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/locationtech/geomesa/pulls/1102/commits","review_comments_url":"https://api.github.com/repos/locationtech/geomesa/pulls/1102/comments","review_comment_url":"https://api.github.com/repos/locationtech/geomesa/pulls/comments{/number}","comments_url":"https://api.github.com/repos/locationtech/geomesa/issues/1102/comments","statuses_url":"https://api.github.com/repos/locationtech/geomesa/statuses/4934f2c83438504e9a4b96bc63e77e657fff77d3","head":{"label":"elahrvivaz:fcr_geojson_attributes","ref":"fcr_geojson_attributes","sha":"4934f2c83438504e9a4b96bc63e77e657fff77d3","user":{"login":"elahrvivaz","id":7715322,"avatar_url":"https://avatars.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},"repo":{"id":20541167,"name":"geomesa","full_name":"elahrvivaz/geomesa","owner":{"login":"elahrvivaz","id":7715322,"avatar_url":"https://avatars.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},"private":false,"html_url":"https://github.com/elahrvivaz/geomesa","description":null,"fork":true,"url":"https://api.github.com/repos/elahrvivaz/geomesa","forks_url":"https://api.github.com/repos/elahrvivaz/geomesa/forks","keys_url":"https://api.github.com/repos/elahrvivaz/geomesa/keys{/key_id}","collaborators_url":"https://api.github.com/repos/elahrvivaz/geomesa/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/elahrvivaz/geomesa/teams","hooks_url":"https://api.github.com/repos/elahrvivaz/geomesa/hooks","issue_events_url":"https://api.github.com/repos/elahrvivaz/geomesa/issues/events{/number}","events_url":"https://api.github.com/repos/elahrvivaz/geomesa/events","assignees_url":"https://api.github.com/repos/elahrvivaz/geomesa/assignees{/user}","branches_url":"https://api.github.com/repos/elahrvivaz/geomesa/branches{/branch}","tags_url":"https://api.github.com/repos/elahrvivaz/geomesa/tags","blobs_url":"https://api.github.com/repos/elahrvivaz/geomesa/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/elahrvivaz/geomesa/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/elahrvivaz/geomesa/git/refs{/sha}","trees_url":"https://api.github.com/repos/elahrvivaz/geomesa/git/trees{/sha}","statuses_url":"https://api.github.com/repos/elahrvivaz/geomesa/statuses/{sha}","languages_url":"https://api.github.com/repos/elahrvivaz/geomesa/languages","stargazers_url":"https://api.github.com/repos/elahrvivaz/geomesa/stargazers","contributors_url":"https://api.github.com/repos/elahrvivaz/geomesa/contributors","subscribers_url":"https://api.github.com/repos/elahrvivaz/geomesa/subscribers","subscription_url":"https://api.github.com/repos/elahrvivaz/geomesa/subscription","commits_url":"https://api.github.com/repos/elahrvivaz/geomesa/commits{/sha}","git_commits_url":"https://api.github.com/repos/elahrvivaz/geomesa/git/commits{/sha}","comments_url":"https://api.github.com/repos/elahrvivaz/geomesa/comments{/number}","issue_comment_url":"https://api.github.com/repos/elahrvivaz/geomesa/issues/comments{/number}","contents_url":"https://api.github.com/repos/elahrvivaz/geomesa/contents/{+path}","compare_url":"https://api.github.com/repos/elahrvivaz/geomesa/compare/{base}...{head}","merges_url":"https://api.github.com/repos/elahrvivaz/geomesa/merges","archive_url":"https://api.github.com/repos/elahrvivaz/geomesa/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/elahrvivaz/geomesa/downloads","issues_url":"https://api.github.com/repos/elahrvivaz/geomesa/issues{/number}","pulls_url":"https://api.github.com/repos/elahrvivaz/geomesa/pulls{/number}","milestones_url":"https://api.github.com/repos/elahrvivaz/geomesa/milestones{/number}","notifications_url":"https://api.github.com/repos/elahrvivaz/geomesa/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/elahrvivaz/geomesa/labels{/name}","releases_url":"https://api.github.com/repos/elahrvivaz/geomesa/releases{/id}","deployments_url":"https://api.github.com/repos/elahrvivaz/geomesa/deployments","created_at":"2014-06-05T20:51:54Z","updated_at":"2016-02-15T21:22:52Z","pushed_at":"2016-10-17T17:21:37Z","git_url":"git://github.com/elahrvivaz/geomesa.git","ssh_url":"git@github.com:elahrvivaz/geomesa.git","clone_url":"https://github.com/elahrvivaz/geomesa.git","svn_url":"https://github.com/elahrvivaz/geomesa","homepage":null,"size":38808,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":false,"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":"0386e77a1bb5d708304a6e92fa81f93ef8e8e4b9","user":{"login":"locationtech","id":1991411,"avatar_url":"https://avatars.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://avatars.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":"2016-10-13T14:21:24Z","pushed_at":"2016-10-17T18:49:58Z","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":62095,"stargazers_count":211,"watchers_count":211,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":106,"mirror_url":null,"open_issues_count":21,"forks":106,"open_issues":21,"watchers":211,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/locationtech/geomesa/pulls/1102"},"html":{"href":"https://github.com/locationtech/geomesa/pull/1102"},"issue":{"href":"https://api.github.com/repos/locationtech/geomesa/issues/1102"},"comments":{"href":"https://api.github.com/repos/locationtech/geomesa/issues/1102/comments"},"review_comments":{"href":"https://api.github.com/repos/locationtech/geomesa/pulls/1102/comments"},"review_comment":{"href":"https://api.github.com/repos/locationtech/geomesa/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/locationtech/geomesa/pulls/1102/commits"},"statuses":{"href":"https://api.github.com/repos/locationtech/geomesa/statuses/4934f2c83438504e9a4b96bc63e77e657fff77d3"}}}}
{"actor":{"display_login":"elahrvivaz"}}