qiuchenjian commented on a change in pull request #3126: [WIP][CARBONDATA-3293] Prune datamaps improvement
URL:
https://github.com/apache/carbondata/pull/3126#discussion_r257687356
##########
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:
does this sum will reach the Integer.MAX?
----------------------------------------------------------------
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