{"action":"created","comment":{"url":"https://api.github.com/repos/apache/incubator-carbondata/pulls/comments/84240216","pull_request_review_id":5026974,"id":84240216,"diff_hunk":"@@ -0,0 +1,132 @@\n+/*\n+ * Licensed to the Apache Software Foundation (ASF) under one\n+ * or more contributor license agreements.  See the NOTICE file\n+ * distributed with this work for additional information\n+ * regarding copyright ownership.  The ASF licenses this file\n+ * to you under the Apache License, Version 2.0 (the\n+ * \"License\"); you may not use this file except in compliance\n+ * with the License.  You may obtain a copy of the License at\n+ *\n+ *    http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing,\n+ * software distributed under the License is distributed on an\n+ * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n+ * KIND, either express or implied.  See the License for the\n+ * specific language governing permissions and limitations\n+ * under the License.\n+ */\n+package org.apache.carbondata.processing.newflow.encoding.impl;\n+\n+import java.nio.ByteBuffer;\n+import java.util.ArrayList;\n+import java.util.List;\n+\n+import org.apache.carbondata.core.cache.Cache;\n+import org.apache.carbondata.core.cache.CacheProvider;\n+import org.apache.carbondata.core.cache.CacheType;\n+import org.apache.carbondata.core.cache.dictionary.Dictionary;\n+import org.apache.carbondata.core.cache.dictionary.DictionaryColumnUniqueIdentifier;\n+import org.apache.carbondata.core.constants.IgnoreDictionary;\n+import org.apache.carbondata.core.util.CarbonTimeStatisticsFactory;\n+import org.apache.carbondata.processing.newflow.CarbonDataLoadConfiguration;\n+import org.apache.carbondata.processing.newflow.DataField;\n+import org.apache.carbondata.processing.newflow.constants.DataLoadProcessorConstants;\n+import org.apache.carbondata.processing.newflow.encoding.FieldEncoder;\n+import org.apache.carbondata.processing.newflow.encoding.RowEncoder;\n+import org.apache.carbondata.processing.newflow.exception.CarbonDataLoadingException;\n+import org.apache.carbondata.processing.newflow.row.CarbonRow;\n+import org.apache.carbondata.processing.util.RemoveDictionaryUtil;\n+\n+/**\n+ *\n+ */\n+public class RowEncoderImpl implements RowEncoder {\n+\n+  private CarbonDataLoadConfiguration configuration;\n+\n+  private AbstractDictionaryFieldEncoderImpl[] dictionaryFieldEncoders;\n+\n+  private NonDictionaryFieldEncoderImpl[] nonDictionaryFieldEncoders;\n+\n+  private MeasureFieldEncoderImpl[] measureFieldEncoders;\n+\n+  public RowEncoderImpl(DataField[] fields, CarbonDataLoadConfiguration configuration) {\n+    this.configuration = configuration;\n+    CacheProvider cacheProvider = CacheProvider.getInstance();\n+    Cache<DictionaryColumnUniqueIdentifier, Dictionary> cache = cacheProvider\n+        .createCache(CacheType.REVERSE_DICTIONARY,\n+            configuration.getTableIdentifier().getStorePath());\n+    List<AbstractDictionaryFieldEncoderImpl> dictFieldEncoders = new ArrayList<>();\n+    List<NonDictionaryFieldEncoderImpl> nonDictFieldEncoders = new ArrayList<>();\n+    List<MeasureFieldEncoderImpl> measureFieldEncoderList = new ArrayList<>();\n+\n+    long lruCacheStartTime = System.currentTimeMillis();\n+\n+    for (int i = 0; i < fields.length; i++) {\n+      FieldEncoder fieldEncoder = FieldEncoderFactory.getInstance()\n+          .createFieldEncoder(fields[i], cache,\n+              configuration.getTableIdentifier().getCarbonTableIdentifier(), i);\n+      if (fieldEncoder instanceof AbstractDictionaryFieldEncoderImpl) {\n+        dictFieldEncoders.add((AbstractDictionaryFieldEncoderImpl) fieldEncoder);\n+      } else if (fieldEncoder instanceof NonDictionaryFieldEncoderImpl) {\n+        nonDictFieldEncoders.add((NonDictionaryFieldEncoderImpl) fieldEncoder);\n+      } else if (fieldEncoder instanceof MeasureFieldEncoderImpl) {\n+        measureFieldEncoderList.add((MeasureFieldEncoderImpl)fieldEncoder);\n+      }\n+    }\n+    CarbonTimeStatisticsFactory.getLoadStatisticsInstance()\n+        .recordLruCacheLoadTime((System.currentTimeMillis() - lruCacheStartTime) / 1000.0);\n+    dictionaryFieldEncoders =\n+        dictFieldEncoders.toArray(new AbstractDictionaryFieldEncoderImpl[dictFieldEncoders.size()]);\n+    nonDictionaryFieldEncoders = nonDictFieldEncoders\n+        .toArray(new NonDictionaryFieldEncoderImpl[nonDictFieldEncoders.size()]);\n+    measureFieldEncoders = measureFieldEncoderList\n+        .toArray(new MeasureFieldEncoderImpl[measureFieldEncoderList.size()]);\n+\n+  }\n+\n+  @Override public CarbonRow encode(CarbonRow row) throws CarbonDataLoadingException {","path":"processing/src/main/java/org/apache/carbondata/processing/newflow/encoding/impl/RowEncoderImpl.java","position":89,"original_position":89,"commit_id":"e6eb5d1137bd82beed642e7206ebb566dcb81fa3","original_commit_id":"e6eb5d1137bd82beed642e7206ebb566dcb81fa3","user":{"login":"jackylk","id":6500698,"avatar_url":"https://avatars.githubusercontent.com/u/6500698?v=3","gravatar_id":"","url":"https://api.github.com/users/jackylk","html_url":"https://github.com/jackylk","followers_url":"https://api.github.com/users/jackylk/followers","following_url":"https://api.github.com/users/jackylk/following{/other_user}","gists_url":"https://api.github.com/users/jackylk/gists{/gist_id}","starred_url":"https://api.github.com/users/jackylk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jackylk/subscriptions","organizations_url":"https://api.github.com/users/jackylk/orgs","repos_url":"https://api.github.com/users/jackylk/repos","events_url":"https://api.github.com/users/jackylk/events{/privacy}","received_events_url":"https://api.github.com/users/jackylk/received_events","type":"User","site_admin":false},"body":"This logic is complex and strange to new comers, can you add more comment description in this function explaining what it is doing. \r\nAnd maybe refactory the function body to make it more readable like `fillDictionaryDimension`, `fillNonDictionaryDimension`, `fillMeasure`\r\n\r\nOther approach is to make CarbonRow an interface, and have another CarbonRow implementation (say KeyedRow because it is a preparation step for sorting) used in this step. And add getKey or compareTo function in KeyedRow so it can be used in sort step. Then all the complexity of how that 3 elements are ordered and constructed is encapsulated inside KeyedRow only","created_at":"2016-10-20T09:06:36Z","updated_at":"2016-10-20T09:27:07Z","html_url":"https://github.com/apache/incubator-carbondata/pull/244#discussion_r84240216","pull_request_url":"https://api.github.com/repos/apache/incubator-carbondata/pulls/244","_links":{"self":{"href":"https://api.github.com/repos/apache/incubator-carbondata/pulls/comments/84240216"},"html":{"href":"https://github.com/apache/incubator-carbondata/pull/244#discussion_r84240216"},"pull_request":{"href":"https://api.github.com/repos/apache/incubator-carbondata/pulls/244"}}},"pull_request":{"url":"https://api.github.com/repos/apache/incubator-carbondata/pulls/244","id":89561309,"html_url":"https://github.com/apache/incubator-carbondata/pull/244","diff_url":"https://github.com/apache/incubator-carbondata/pull/244.diff","patch_url":"https://github.com/apache/incubator-carbondata/pull/244.patch","issue_url":"https://api.github.com/repos/apache/incubator-carbondata/issues/244","number":244,"state":"open","locked":false,"title":"[CARBONDATA-300] Added Encoder processor for dataloading.","user":{"login":"ravipesala","id":8134086,"avatar_url":"https://avatars.githubusercontent.com/u/8134086?v=3","gravatar_id":"","url":"https://api.github.com/users/ravipesala","html_url":"https://github.com/ravipesala","followers_url":"https://api.github.com/users/ravipesala/followers","following_url":"https://api.github.com/users/ravipesala/following{/other_user}","gists_url":"https://api.github.com/users/ravipesala/gists{/gist_id}","starred_url":"https://api.github.com/users/ravipesala/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ravipesala/subscriptions","organizations_url":"https://api.github.com/users/ravipesala/orgs","repos_url":"https://api.github.com/users/ravipesala/repos","events_url":"https://api.github.com/users/ravipesala/events{/privacy}","received_events_url":"https://api.github.com/users/ravipesala/received_events","type":"User","site_admin":false},"body":"Added interface implementation for encode data load processor. \r\n\r\n","created_at":"2016-10-17T05:07:14Z","updated_at":"2016-10-20T09:27:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f2bdf27f768d234d98b3cab6ffdc4e4127c0bf20","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/apache/incubator-carbondata/pulls/244/commits","review_comments_url":"https://api.github.com/repos/apache/incubator-carbondata/pulls/244/comments","review_comment_url":"https://api.github.com/repos/apache/incubator-carbondata/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/incubator-carbondata/issues/244/comments","statuses_url":"https://api.github.com/repos/apache/incubator-carbondata/statuses/e6eb5d1137bd82beed642e7206ebb566dcb81fa3","head":{"label":"ravipesala:encode-step","ref":"encode-step","sha":"e6eb5d1137bd82beed642e7206ebb566dcb81fa3","user":{"login":"ravipesala","id":8134086,"avatar_url":"https://avatars.githubusercontent.com/u/8134086?v=3","gravatar_id":"","url":"https://api.github.com/users/ravipesala","html_url":"https://github.com/ravipesala","followers_url":"https://api.github.com/users/ravipesala/followers","following_url":"https://api.github.com/users/ravipesala/following{/other_user}","gists_url":"https://api.github.com/users/ravipesala/gists{/gist_id}","starred_url":"https://api.github.com/users/ravipesala/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ravipesala/subscriptions","organizations_url":"https://api.github.com/users/ravipesala/orgs","repos_url":"https://api.github.com/users/ravipesala/repos","events_url":"https://api.github.com/users/ravipesala/events{/privacy}","received_events_url":"https://api.github.com/users/ravipesala/received_events","type":"User","site_admin":false},"repo":{"id":62142167,"name":"incubator-carbondata","full_name":"ravipesala/incubator-carbondata","owner":{"login":"ravipesala","id":8134086,"avatar_url":"https://avatars.githubusercontent.com/u/8134086?v=3","gravatar_id":"","url":"https://api.github.com/users/ravipesala","html_url":"https://github.com/ravipesala","followers_url":"https://api.github.com/users/ravipesala/followers","following_url":"https://api.github.com/users/ravipesala/following{/other_user}","gists_url":"https://api.github.com/users/ravipesala/gists{/gist_id}","starred_url":"https://api.github.com/users/ravipesala/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ravipesala/subscriptions","organizations_url":"https://api.github.com/users/ravipesala/orgs","repos_url":"https://api.github.com/users/ravipesala/repos","events_url":"https://api.github.com/users/ravipesala/events{/privacy}","received_events_url":"https://api.github.com/users/ravipesala/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ravipesala/incubator-carbondata","description":"Mirror of Apache CarbonData (Incubating)","fork":true,"url":"https://api.github.com/repos/ravipesala/incubator-carbondata","forks_url":"https://api.github.com/repos/ravipesala/incubator-carbondata/forks","keys_url":"https://api.github.com/repos/ravipesala/incubator-carbondata/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ravipesala/incubator-carbondata/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ravipesala/incubator-carbondata/teams","hooks_url":"https://api.github.com/repos/ravipesala/incubator-carbondata/hooks","issue_events_url":"https://api.github.com/repos/ravipesala/incubator-carbondata/issues/events{/number}","events_url":"https://api.github.com/repos/ravipesala/incubator-carbondata/events","assignees_url":"https://api.github.com/repos/ravipesala/incubator-carbondata/assignees{/user}","branches_url":"https://api.github.com/repos/ravipesala/incubator-carbondata/branches{/branch}","tags_url":"https://api.github.com/repos/ravipesala/incubator-carbondata/tags","blobs_url":"https://api.github.com/repos/ravipesala/incubator-carbondata/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ravipesala/incubator-carbondata/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ravipesala/incubator-carbondata/git/refs{/sha}","trees_url":"https://api.github.com/repos/ravipesala/incubator-carbondata/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ravipesala/incubator-carbondata/statuses/{sha}","languages_url":"https://api.github.com/repos/ravipesala/incubator-carbondata/languages","stargazers_url":"https://api.github.com/repos/ravipesala/incubator-carbondata/stargazers","contributors_url":"https://api.github.com/repos/ravipesala/incubator-carbondata/contributors","subscribers_url":"https://api.github.com/repos/ravipesala/incubator-carbondata/subscribers","subscription_url":"https://api.github.com/repos/ravipesala/incubator-carbondata/subscription","commits_url":"https://api.github.com/repos/ravipesala/incubator-carbondata/commits{/sha}","git_commits_url":"https://api.github.com/repos/ravipesala/incubator-carbondata/git/commits{/sha}","comments_url":"https://api.github.com/repos/ravipesala/incubator-carbondata/comments{/number}","issue_comment_url":"https://api.github.com/repos/ravipesala/incubator-carbondata/issues/comments{/number}","contents_url":"https://api.github.com/repos/ravipesala/incubator-carbondata/contents/{+path}","compare_url":"https://api.github.com/repos/ravipesala/incubator-carbondata/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ravipesala/incubator-carbondata/merges","archive_url":"https://api.github.com/repos/ravipesala/incubator-carbondata/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ravipesala/incubator-carbondata/downloads","issues_url":"https://api.github.com/repos/ravipesala/incubator-carbondata/issues{/number}","pulls_url":"https://api.github.com/repos/ravipesala/incubator-carbondata/pulls{/number}","milestones_url":"https://api.github.com/repos/ravipesala/incubator-carbondata/milestones{/number}","notifications_url":"https://api.github.com/repos/ravipesala/incubator-carbondata/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ravipesala/incubator-carbondata/labels{/name}","releases_url":"https://api.github.com/repos/ravipesala/incubator-carbondata/releases{/id}","deployments_url":"https://api.github.com/repos/ravipesala/incubator-carbondata/deployments","created_at":"2016-06-28T13:16:56Z","updated_at":"2016-06-29T11:42:51Z","pushed_at":"2016-10-20T02:42:44Z","git_url":"git://github.com/ravipesala/incubator-carbondata.git","ssh_url":"git@github.com:ravipesala/incubator-carbondata.git","clone_url":"https://github.com/ravipesala/incubator-carbondata.git","svn_url":"https://github.com/ravipesala/incubator-carbondata","homepage":null,"size":38245,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"4d564ad4eed08d2a999ab16331693a5f1ec15ed3","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":62117818,"name":"incubator-carbondata","full_name":"apache/incubator-carbondata","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/incubator-carbondata","description":"Mirror of Apache CarbonData (Incubating)","fork":false,"url":"https://api.github.com/repos/apache/incubator-carbondata","forks_url":"https://api.github.com/repos/apache/incubator-carbondata/forks","keys_url":"https://api.github.com/repos/apache/incubator-carbondata/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/incubator-carbondata/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/incubator-carbondata/teams","hooks_url":"https://api.github.com/repos/apache/incubator-carbondata/hooks","issue_events_url":"https://api.github.com/repos/apache/incubator-carbondata/issues/events{/number}","events_url":"https://api.github.com/repos/apache/incubator-carbondata/events","assignees_url":"https://api.github.com/repos/apache/incubator-carbondata/assignees{/user}","branches_url":"https://api.github.com/repos/apache/incubator-carbondata/branches{/branch}","tags_url":"https://api.github.com/repos/apache/incubator-carbondata/tags","blobs_url":"https://api.github.com/repos/apache/incubator-carbondata/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/incubator-carbondata/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/incubator-carbondata/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/incubator-carbondata/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/incubator-carbondata/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/incubator-carbondata/languages","stargazers_url":"https://api.github.com/repos/apache/incubator-carbondata/stargazers","contributors_url":"https://api.github.com/repos/apache/incubator-carbondata/contributors","subscribers_url":"https://api.github.com/repos/apache/incubator-carbondata/subscribers","subscription_url":"https://api.github.com/repos/apache/incubator-carbondata/subscription","commits_url":"https://api.github.com/repos/apache/incubator-carbondata/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/incubator-carbondata/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/incubator-carbondata/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/incubator-carbondata/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/incubator-carbondata/contents/{+path}","compare_url":"https://api.github.com/repos/apache/incubator-carbondata/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/incubator-carbondata/merges","archive_url":"https://api.github.com/repos/apache/incubator-carbondata/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/incubator-carbondata/downloads","issues_url":"https://api.github.com/repos/apache/incubator-carbondata/issues{/number}","pulls_url":"https://api.github.com/repos/apache/incubator-carbondata/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/incubator-carbondata/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/incubator-carbondata/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/incubator-carbondata/labels{/name}","releases_url":"https://api.github.com/repos/apache/incubator-carbondata/releases{/id}","deployments_url":"https://api.github.com/repos/apache/incubator-carbondata/deployments","created_at":"2016-06-28T07:00:06Z","updated_at":"2016-10-19T07:13:15Z","pushed_at":"2016-10-20T07:33:00Z","git_url":"git://github.com/apache/incubator-carbondata.git","ssh_url":"git@github.com:apache/incubator-carbondata.git","clone_url":"https://github.com/apache/incubator-carbondata.git","svn_url":"https://github.com/apache/incubator-carbondata","homepage":null,"size":40027,"stargazers_count":131,"watchers_count":131,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":130,"mirror_url":"git://git.apache.org/incubator-carbondata.git","open_issues_count":37,"forks":130,"open_issues":37,"watchers":131,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/incubator-carbondata/pulls/244"},"html":{"href":"https://github.com/apache/incubator-carbondata/pull/244"},"issue":{"href":"https://api.github.com/repos/apache/incubator-carbondata/issues/244"},"comments":{"href":"https://api.github.com/repos/apache/incubator-carbondata/issues/244/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/incubator-carbondata/pulls/244/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/incubator-carbondata/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/incubator-carbondata/pulls/244/commits"},"statuses":{"href":"https://api.github.com/repos/apache/incubator-carbondata/statuses/e6eb5d1137bd82beed642e7206ebb566dcb81fa3"}}}}
{"actor":{"display_login":"jackylk"}}