diff --git a/pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/BaseBrokerRequestHandler.java b/pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/BaseBrokerRequestHandler.java index 46a0839ddec..e120087c238 100644 --- a/pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/BaseBrokerRequestHandler.java +++ b/pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/BaseBrokerRequestHandler.java @@ -101,6 +101,7 @@ import org.apache.pinot.spi.utils.CommonConstants; import org.apache.pinot.spi.utils.CommonConstants.Broker; import org.apache.pinot.spi.utils.CommonConstants.Broker.Request.QueryOptionKey; +import org.apache.pinot.spi.utils.DataSizeUtils; import org.apache.pinot.spi.utils.TimestampIndexUtils; import org.apache.pinot.spi.utils.builder.TableNameBuilder; import org.apache.pinot.sql.FilterKind; @@ -1773,17 +1774,17 @@ private void setMaxServerResponseSizeBytes(int numServers, Map q } // BrokerConfig - Long maxServerResponseSizeBrokerConfig = - _config.getProperty(Broker.CONFIG_OF_MAX_SERVER_RESPONSE_SIZE_BYTES, Long.class); + String maxServerResponseSizeBrokerConfig = _config.getProperty(Broker.CONFIG_OF_MAX_SERVER_RESPONSE_SIZE_BYTES); if (maxServerResponseSizeBrokerConfig != null) { - queryOptions.put(QueryOptionKey.MAX_SERVER_RESPONSE_SIZE_BYTES, Long.toString(maxServerResponseSizeBrokerConfig)); + queryOptions.put(QueryOptionKey.MAX_SERVER_RESPONSE_SIZE_BYTES, + Long.toString(DataSizeUtils.toBytes(maxServerResponseSizeBrokerConfig))); return; } - Long maxQueryResponseSizeBrokerConfig = - _config.getProperty(Broker.CONFIG_OF_MAX_QUERY_RESPONSE_SIZE_BYTES, Long.class); + + String maxQueryResponseSizeBrokerConfig = _config.getProperty(Broker.CONFIG_OF_MAX_QUERY_RESPONSE_SIZE_BYTES); if (maxQueryResponseSizeBrokerConfig != null) { queryOptions.put(QueryOptionKey.MAX_SERVER_RESPONSE_SIZE_BYTES, - Long.toString(maxQueryResponseSizeBrokerConfig / numServers)); + Long.toString(DataSizeUtils.toBytes(maxQueryResponseSizeBrokerConfig) / numServers)); } } diff --git a/pinot-spi/src/main/java/org/apache/pinot/spi/utils/CommonConstants.java b/pinot-spi/src/main/java/org/apache/pinot/spi/utils/CommonConstants.java index 238af43595d..ba8d5213b5a 100644 --- a/pinot-spi/src/main/java/org/apache/pinot/spi/utils/CommonConstants.java +++ b/pinot-spi/src/main/java/org/apache/pinot/spi/utils/CommonConstants.java @@ -329,12 +329,14 @@ public static class Broker { // Broker config indicating the maximum serialized response size across all servers for a query. This value is // equally divided across all servers processing the query. + // The value can be in human readable format (e.g. '200K', '200KB', '0.2MB') or in raw bytes (e.g. '200000'). public static final String CONFIG_OF_MAX_QUERY_RESPONSE_SIZE_BYTES = "pinot.broker.max.query.response.size.bytes"; // Broker config indicating the maximum length of the serialized response per server for a query. + // If both "server.response.size" and "query.response.size" are set, then the "server.response.size" takes + // precedence over "query.response.size" (i.e., "query.response.size" will be ignored). public static final String CONFIG_OF_MAX_SERVER_RESPONSE_SIZE_BYTES = "pinot.broker.max.server.response.size.bytes"; - public static class Request { public static final String SQL = "sql"; public static final String TRACE = "trace";