egalpin commented on code in PR #10234:
URL: https://github.com/apache/pinot/pull/10234#discussion_r1123446680


##########
pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotUpsertRestletResource.java:
##########
@@ -129,14 +129,25 @@ public String estimateHeapUsage(String 
tableSchemaConfigStr,
     // Estimated value space, it contains <segmentName, DocId, 
ComparisonValue(timestamp)> and overhead.
     // Here we only calculate the map content size. TODO: Add the map entry 
size and the array size within the map.
     int bytesPerValue = 60;
-    String comparisonColumn = 
tableConfig.getUpsertConfig().getComparisonColumn();
-    if (comparisonColumn != null) {
-      FieldSpec.DataType dt = 
schema.getFieldSpecFor(comparisonColumn).getDataType();
-      if (!dt.isFixedWidth()) {
-        String msg = "Not support data types for the comparison column";
-        throw new ControllerApplicationException(LOGGER, msg, 
Response.Status.BAD_REQUEST);
-      } else {
-        bytesPerValue = 52 + dt.size();
+    List<String> comparisonColumns = 
tableConfig.getUpsertConfig().getComparisonColumns();
+    if (comparisonColumns != null) {
+      int bytesPerArrayElem = 8;  // object ref
+      bytesPerValue = 52;
+      for (String columnName : comparisonColumns) {
+        FieldSpec.DataType dt = 
schema.getFieldSpecFor(columnName).getDataType();
+        if (!dt.isFixedWidth()) {
+          String msg = "Not support data types for the comparison column";
+          throw new ControllerApplicationException(LOGGER, msg, 
Response.Status.BAD_REQUEST);
+        } else {
+          if (comparisonColumns.size() == 1) {
+            bytesPerKey += dt.size();

Review Comment:
   Good catch, thanks!



-- 
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: commits-unsubscr...@pinot.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to