smitajoshi12 commented on code in PR #4665:
URL: https://github.com/apache/ozone/pull/4665#discussion_r1194856476


##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/insights/insights.tsx:
##########
@@ -155,12 +165,45 @@ export class Insights extends 
React.Component<Record<string, object>, IInsightsS
         const lowerbound = upperboundPower > 10 ? size(2 ** (upperboundPower - 
1)) : size(0);
         return `${lowerbound} - ${upperbound}`;
       });
+      
+      const xyConatainerCountMap: Map<number, number> = 
containerCountResponse.reduce(
+        (map: Map<number, number>, current) => {
+          const fileSize = current.containerSize;

Review Comment:
   @dombizita 
   Completed Change Suggested by you.



##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/insights/insights.tsx:
##########
@@ -155,12 +165,45 @@ export class Insights extends 
React.Component<Record<string, object>, IInsightsS
         const lowerbound = upperboundPower > 10 ? size(2 ** (upperboundPower - 
1)) : size(0);
         return `${lowerbound} - ${upperbound}`;
       });
+      
+      const xyConatainerCountMap: Map<number, number> = 
containerCountResponse.reduce(
+        (map: Map<number, number>, current) => {
+          const fileSize = current.containerSize;
+          const oldCount = map.has(fileSize) ? map.get(fileSize)! : 0;
+          map.set(fileSize, oldCount + current.count);
+          return map;
+        }, new Map<number, number>());
+      // Calculate the previous power of 2 to find the lower bound of the range
+      // Ex: for 2048, the lower bound is 1024
+      const xContainerCountValues = 
Array.from(xyConatainerCountMap.keys()).map(value => {
+        const upperbound = size(value);
+        const upperboundPower = Math.log2(value);
+        // For 1024 which is 2^10, the lowerbound is 0, since we start binning
+        // after 2^10
+        const lowerbound = upperboundPower > 10 ? size(2 ** (upperboundPower - 
1)) : size(0);
+        return `${lowerbound} - ${upperbound}`;
+      });
+
+      let keysize = [];
+      keysize = Array.from(xyConatainerCountMap.keys()).map(value => {
+        return (size(value) );
+      });
+
       this.setState({
         plotData: [{
           type: 'bar',
           x: xValues,
           y: Array.from(xyMap.values()),

Review Comment:
   @dombizita 
   Completed Change Suggested by you.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to