[GitHub] dhatchayani commented on a change in pull request #3126: [WIP][CARBONDATA-3293] Prune datamaps improvement

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[GitHub] dhatchayani commented on a change in pull request #3126: [WIP][CARBONDATA-3293] Prune datamaps improvement

GitBox
dhatchayani commented on a change in pull request #3126: [WIP][CARBONDATA-3293] Prune datamaps improvement
URL: https://github.com/apache/carbondata/pull/3126#discussion_r257878847
 
 

 ##########
 File path: core/src/main/java/org/apache/carbondata/core/indexstore/row/UnsafeDataMapRow.java
 ##########
 @@ -308,10 +315,27 @@ private int getSizeInBytes(int ordinal, int position) {
   }
 
   private int getPosition(int ordinal) {
-    int position = 0;
+    int data = 0;
     for (int i = 0; i < ordinal; i++) {
-      position += getSizeInBytes(i, position);
+      if (dataPosition.get(i) instanceof List) {
+        data += dataPosLength((List<Object>) dataPosition.get(i));
+      } else {
+        data += (int) dataPosition.get(i);
+      }
     }
-    return position;
+    return data;
   }
+
+  private int dataPosLength(List<Object> dataPosition) {
+    int sum = 0;
+    for (Object data : dataPosition) {
+      if (data instanceof List) {
+        sum += dataPosLength((List<Object>) data);
+      } else {
+        sum += (int) data;
 
 Review comment:
   no, it will not reach Integer.MAX. I have modified the existing code only. I think it will not cause any issues.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[hidden email]


With regards,
Apache Git Services