{"action":"created","comment":{"url":"https://api.github.com/repos/apache/vxquery/pulls/comments/69382013","id":69382013,"diff_hunk":"@@ -0,0 +1,188 @@\n+/*\n+ * Licensed to the Apache Software Foundation (ASF) under one or more\n+ * contributor license agreements. See the NOTICE file distributed with\n+ * this work for additional information regarding copyright ownership.\n+ * The ASF licenses this file to You under the Apache License, Version 2.0\n+ * (the \"License\"); you may not use this file except in compliance with\n+ * the License. You may obtain a copy of the License at\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+package org.apache.vxquery.jsonparser;\n+\n+import java.io.DataOutput;\n+import java.io.File;\n+import java.io.IOException;\n+import java.util.ArrayList;\n+import java.util.List;\n+\n+import org.apache.htrace.fasterxml.jackson.core.JsonFactory;\n+import org.apache.htrace.fasterxml.jackson.core.JsonParseException;\n+import org.apache.htrace.fasterxml.jackson.core.JsonParser;\n+import org.apache.htrace.fasterxml.jackson.core.JsonToken;\n+import org.apache.hyracks.data.std.primitive.UTF8StringPointable;\n+import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;\n+import org.apache.vxquery.datamodel.builders.atomic.StringValueBuilder;\n+import org.apache.vxquery.datamodel.builders.jsonitem.ArrayBuilder;\n+import org.apache.vxquery.datamodel.builders.jsonitem.ObjectBuilder;\n+import org.apache.vxquery.datamodel.values.ValueTag;\n+\n+public class JSONParser {\n+\n+    final JsonFactory factory;\n+    protected final ArrayBackedValueStorage atomic;\n+    protected final List<ArrayBuilder> abStack;\n+    protected final List<ObjectBuilder> obStack;\n+    protected final List<ArrayBackedValueStorage> abvsStack;\n+    protected final List<UTF8StringPointable> spStack;\n+    protected final List<String> itemStack;\n+\n+    public JSONParser() throws JsonParseException, IOException {\n+        factory = new JsonFactory();\n+        atomic = new ArrayBackedValueStorage();\n+        abStack = new ArrayList<ArrayBuilder>();\n+        obStack = new ArrayList<ObjectBuilder>();\n+        abvsStack = new ArrayList<ArrayBackedValueStorage>();\n+        spStack = new ArrayList<UTF8StringPointable>();\n+        itemStack = new ArrayList<String>();\n+    }\n+\n+    public void parseDocument(File file, ArrayBackedValueStorage result)\n+            throws NumberFormatException, JsonParseException, IOException {\n+        DataOutput outResult = result.getDataOutput();\n+        DataOutput out = atomic.getDataOutput();\n+        StringValueBuilder svb = new StringValueBuilder();\n+        String lastItem = null;\n+        String startItem = null;\n+        boolean nested = false;\n+        JsonParser parser = factory.createParser(file);\n+        while (!parser.isClosed()) {\n+            JsonToken token = parser.nextToken();\n+            if (token == JsonToken.START_ARRAY) {\n+                if (!nested) {\n+                    abvsStack.add(new ArrayBackedValueStorage());\n+                    abStack.add(new ArrayBuilder());\n+                }\n+                itemStack.add(\"array\");","path":"vxquery-core/src/main/java/org/apache/vxquery/jsonparser/JSONParser.java","position":70,"original_position":70,"commit_id":"f463dda78a619d6fe7503c91563b9e529e429b4e","original_commit_id":"f463dda78a619d6fe7503c91563b9e529e429b4e","user":{"login":"westmann","id":1339954,"avatar_url":"https://avatars.githubusercontent.com/u/1339954?v=3","gravatar_id":"","url":"https://api.github.com/users/westmann","html_url":"https://github.com/westmann","followers_url":"https://api.github.com/users/westmann/followers","following_url":"https://api.github.com/users/westmann/following{/other_user}","gists_url":"https://api.github.com/users/westmann/gists{/gist_id}","starred_url":"https://api.github.com/users/westmann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/westmann/subscriptions","organizations_url":"https://api.github.com/users/westmann/orgs","repos_url":"https://api.github.com/users/westmann/repos","events_url":"https://api.github.com/users/westmann/events{/privacy}","received_events_url":"https://api.github.com/users/westmann/received_events","type":"User","site_admin":false},"body":"These values (\"array\", \"object\"), should be enums (or ints).","created_at":"2016-07-02T19:51:05Z","updated_at":"2016-07-02T19:51:05Z","html_url":"https://github.com/apache/vxquery/pull/81#discussion_r69382013","pull_request_url":"https://api.github.com/repos/apache/vxquery/pulls/81","_links":{"self":{"href":"https://api.github.com/repos/apache/vxquery/pulls/comments/69382013"},"html":{"href":"https://github.com/apache/vxquery/pull/81#discussion_r69382013"},"pull_request":{"href":"https://api.github.com/repos/apache/vxquery/pulls/81"}}},"pull_request":{"url":"https://api.github.com/repos/apache/vxquery/pulls/81","id":76070151,"html_url":"https://github.com/apache/vxquery/pull/81","diff_url":"https://github.com/apache/vxquery/pull/81.diff","patch_url":"https://github.com/apache/vxquery/pull/81.patch","issue_url":"https://api.github.com/repos/apache/vxquery/issues/81","number":81,"state":"open","locked":false,"title":"Implementation of json Parser and test cases","user":{"login":"pavlopoul","id":17622699,"avatar_url":"https://avatars.githubusercontent.com/u/17622699?v=3","gravatar_id":"","url":"https://api.github.com/users/pavlopoul","html_url":"https://github.com/pavlopoul","followers_url":"https://api.github.com/users/pavlopoul/followers","following_url":"https://api.github.com/users/pavlopoul/following{/other_user}","gists_url":"https://api.github.com/users/pavlopoul/gists{/gist_id}","starred_url":"https://api.github.com/users/pavlopoul/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pavlopoul/subscriptions","organizations_url":"https://api.github.com/users/pavlopoul/orgs","repos_url":"https://api.github.com/users/pavlopoul/repos","events_url":"https://api.github.com/users/pavlopoul/events{/privacy}","received_events_url":"https://api.github.com/users/pavlopoul/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-07-02T17:09:40Z","updated_at":"2016-07-02T19:51:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/apache/vxquery/pulls/81/commits","review_comments_url":"https://api.github.com/repos/apache/vxquery/pulls/81/comments","review_comment_url":"https://api.github.com/repos/apache/vxquery/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/vxquery/issues/81/comments","statuses_url":"https://api.github.com/repos/apache/vxquery/statuses/f463dda78a619d6fe7503c91563b9e529e429b4e","head":{"label":"pavlopoul:christina/jsonparser","ref":"christina/jsonparser","sha":"f463dda78a619d6fe7503c91563b9e529e429b4e","user":{"login":"pavlopoul","id":17622699,"avatar_url":"https://avatars.githubusercontent.com/u/17622699?v=3","gravatar_id":"","url":"https://api.github.com/users/pavlopoul","html_url":"https://github.com/pavlopoul","followers_url":"https://api.github.com/users/pavlopoul/followers","following_url":"https://api.github.com/users/pavlopoul/following{/other_user}","gists_url":"https://api.github.com/users/pavlopoul/gists{/gist_id}","starred_url":"https://api.github.com/users/pavlopoul/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pavlopoul/subscriptions","organizations_url":"https://api.github.com/users/pavlopoul/orgs","repos_url":"https://api.github.com/users/pavlopoul/repos","events_url":"https://api.github.com/users/pavlopoul/events{/privacy}","received_events_url":"https://api.github.com/users/pavlopoul/received_events","type":"User","site_admin":false},"repo":{"id":53075665,"name":"vxquery","full_name":"pavlopoul/vxquery","owner":{"login":"pavlopoul","id":17622699,"avatar_url":"https://avatars.githubusercontent.com/u/17622699?v=3","gravatar_id":"","url":"https://api.github.com/users/pavlopoul","html_url":"https://github.com/pavlopoul","followers_url":"https://api.github.com/users/pavlopoul/followers","following_url":"https://api.github.com/users/pavlopoul/following{/other_user}","gists_url":"https://api.github.com/users/pavlopoul/gists{/gist_id}","starred_url":"https://api.github.com/users/pavlopoul/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pavlopoul/subscriptions","organizations_url":"https://api.github.com/users/pavlopoul/orgs","repos_url":"https://api.github.com/users/pavlopoul/repos","events_url":"https://api.github.com/users/pavlopoul/events{/privacy}","received_events_url":"https://api.github.com/users/pavlopoul/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/pavlopoul/vxquery","description":"Mirror of Apache VXQuery","fork":true,"url":"https://api.github.com/repos/pavlopoul/vxquery","forks_url":"https://api.github.com/repos/pavlopoul/vxquery/forks","keys_url":"https://api.github.com/repos/pavlopoul/vxquery/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pavlopoul/vxquery/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pavlopoul/vxquery/teams","hooks_url":"https://api.github.com/repos/pavlopoul/vxquery/hooks","issue_events_url":"https://api.github.com/repos/pavlopoul/vxquery/issues/events{/number}","events_url":"https://api.github.com/repos/pavlopoul/vxquery/events","assignees_url":"https://api.github.com/repos/pavlopoul/vxquery/assignees{/user}","branches_url":"https://api.github.com/repos/pavlopoul/vxquery/branches{/branch}","tags_url":"https://api.github.com/repos/pavlopoul/vxquery/tags","blobs_url":"https://api.github.com/repos/pavlopoul/vxquery/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pavlopoul/vxquery/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pavlopoul/vxquery/git/refs{/sha}","trees_url":"https://api.github.com/repos/pavlopoul/vxquery/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pavlopoul/vxquery/statuses/{sha}","languages_url":"https://api.github.com/repos/pavlopoul/vxquery/languages","stargazers_url":"https://api.github.com/repos/pavlopoul/vxquery/stargazers","contributors_url":"https://api.github.com/repos/pavlopoul/vxquery/contributors","subscribers_url":"https://api.github.com/repos/pavlopoul/vxquery/subscribers","subscription_url":"https://api.github.com/repos/pavlopoul/vxquery/subscription","commits_url":"https://api.github.com/repos/pavlopoul/vxquery/commits{/sha}","git_commits_url":"https://api.github.com/repos/pavlopoul/vxquery/git/commits{/sha}","comments_url":"https://api.github.com/repos/pavlopoul/vxquery/comments{/number}","issue_comment_url":"https://api.github.com/repos/pavlopoul/vxquery/issues/comments{/number}","contents_url":"https://api.github.com/repos/pavlopoul/vxquery/contents/{+path}","compare_url":"https://api.github.com/repos/pavlopoul/vxquery/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pavlopoul/vxquery/merges","archive_url":"https://api.github.com/repos/pavlopoul/vxquery/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pavlopoul/vxquery/downloads","issues_url":"https://api.github.com/repos/pavlopoul/vxquery/issues{/number}","pulls_url":"https://api.github.com/repos/pavlopoul/vxquery/pulls{/number}","milestones_url":"https://api.github.com/repos/pavlopoul/vxquery/milestones{/number}","notifications_url":"https://api.github.com/repos/pavlopoul/vxquery/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pavlopoul/vxquery/labels{/name}","releases_url":"https://api.github.com/repos/pavlopoul/vxquery/releases{/id}","deployments_url":"https://api.github.com/repos/pavlopoul/vxquery/deployments","created_at":"2016-03-03T19:05:51Z","updated_at":"2016-03-03T19:05:54Z","pushed_at":"2016-07-02T17:08:18Z","git_url":"git://github.com/pavlopoul/vxquery.git","ssh_url":"git@github.com:pavlopoul/vxquery.git","clone_url":"https://github.com/pavlopoul/vxquery.git","svn_url":"https://github.com/pavlopoul/vxquery","homepage":null,"size":12436,"stargazers_count":0,"watchers_count":0,"language":"Java","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":"apache:master","ref":"master","sha":"4a6f2aa67a8d20eee3d230078dd751e6d17481db","user":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":32376873,"name":"vxquery","full_name":"apache/vxquery","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apache/vxquery","description":"Mirror of Apache VXQuery","fork":false,"url":"https://api.github.com/repos/apache/vxquery","forks_url":"https://api.github.com/repos/apache/vxquery/forks","keys_url":"https://api.github.com/repos/apache/vxquery/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/vxquery/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/vxquery/teams","hooks_url":"https://api.github.com/repos/apache/vxquery/hooks","issue_events_url":"https://api.github.com/repos/apache/vxquery/issues/events{/number}","events_url":"https://api.github.com/repos/apache/vxquery/events","assignees_url":"https://api.github.com/repos/apache/vxquery/assignees{/user}","branches_url":"https://api.github.com/repos/apache/vxquery/branches{/branch}","tags_url":"https://api.github.com/repos/apache/vxquery/tags","blobs_url":"https://api.github.com/repos/apache/vxquery/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/vxquery/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/vxquery/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/vxquery/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/vxquery/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/vxquery/languages","stargazers_url":"https://api.github.com/repos/apache/vxquery/stargazers","contributors_url":"https://api.github.com/repos/apache/vxquery/contributors","subscribers_url":"https://api.github.com/repos/apache/vxquery/subscribers","subscription_url":"https://api.github.com/repos/apache/vxquery/subscription","commits_url":"https://api.github.com/repos/apache/vxquery/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/vxquery/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/vxquery/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/vxquery/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/vxquery/contents/{+path}","compare_url":"https://api.github.com/repos/apache/vxquery/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/vxquery/merges","archive_url":"https://api.github.com/repos/apache/vxquery/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/vxquery/downloads","issues_url":"https://api.github.com/repos/apache/vxquery/issues{/number}","pulls_url":"https://api.github.com/repos/apache/vxquery/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/vxquery/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/vxquery/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/vxquery/labels{/name}","releases_url":"https://api.github.com/repos/apache/vxquery/releases{/id}","deployments_url":"https://api.github.com/repos/apache/vxquery/deployments","created_at":"2015-03-17T07:00:06Z","updated_at":"2016-06-09T16:29:34Z","pushed_at":"2016-07-02T17:09:40Z","git_url":"git://github.com/apache/vxquery.git","ssh_url":"git@github.com:apache/vxquery.git","clone_url":"https://github.com/apache/vxquery.git","svn_url":"https://github.com/apache/vxquery","homepage":null,"size":104102,"stargazers_count":9,"watchers_count":9,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":25,"mirror_url":"git://git.apache.org/vxquery.git","open_issues_count":8,"forks":25,"open_issues":8,"watchers":9,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/vxquery/pulls/81"},"html":{"href":"https://github.com/apache/vxquery/pull/81"},"issue":{"href":"https://api.github.com/repos/apache/vxquery/issues/81"},"comments":{"href":"https://api.github.com/repos/apache/vxquery/issues/81/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/vxquery/pulls/81/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/vxquery/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/vxquery/pulls/81/commits"},"statuses":{"href":"https://api.github.com/repos/apache/vxquery/statuses/f463dda78a619d6fe7503c91563b9e529e429b4e"}}}}
{"actor":{"display_login":"westmann"}}