This is an automated email from the ASF dual-hosted git repository. xiangfu pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/pinot.git
The following commit(s) were added to refs/heads/master by this push: new 15f27118a9 Check data table version on server only for null handling (#9508) 15f27118a9 is described below commit 15f27118a994796db15a10d281ad8656681d49eb Author: Xiaotian (Jackie) Jiang <17555551+jackie-ji...@users.noreply.github.com> AuthorDate: Sat Oct 1 22:01:43 2022 -0700 Check data table version on server only for null handling (#9508) --- .../pinot/core/query/request/ServerQueryRequest.java | 16 ++++++++++++++-- .../org/apache/pinot/core/util/QueryOptionsUtils.java | 8 +------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/pinot-core/src/main/java/org/apache/pinot/core/query/request/ServerQueryRequest.java b/pinot-core/src/main/java/org/apache/pinot/core/query/request/ServerQueryRequest.java index c272c7ffed..ec10d0c228 100644 --- a/pinot-core/src/main/java/org/apache/pinot/core/query/request/ServerQueryRequest.java +++ b/pinot-core/src/main/java/org/apache/pinot/core/query/request/ServerQueryRequest.java @@ -18,12 +18,15 @@ */ package org.apache.pinot.core.query.request; +import com.google.common.base.Preconditions; import java.util.List; import java.util.Map; import org.apache.pinot.common.metrics.ServerMetrics; import org.apache.pinot.common.proto.Server; import org.apache.pinot.common.request.BrokerRequest; import org.apache.pinot.common.request.InstanceRequest; +import org.apache.pinot.common.request.PinotQuery; +import org.apache.pinot.core.common.datatable.DataTableFactory; import org.apache.pinot.core.query.request.context.QueryContext; import org.apache.pinot.core.query.request.context.TimerContext; import org.apache.pinot.core.query.request.context.utils.QueryContextConverterUtils; @@ -56,7 +59,7 @@ public class ServerQueryRequest { _enableTrace = instanceRequest.isEnableTrace(); _enableStreaming = false; _segmentsToQuery = instanceRequest.getSearchSegments(); - _queryContext = QueryContextConverterUtils.getQueryContext(instanceRequest.getQuery().getPinotQuery()); + _queryContext = getQueryContext(instanceRequest.getQuery().getPinotQuery()); _timerContext = new TimerContext(_queryContext.getTableName(), serverMetrics, queryArrivalTimeMs); } @@ -83,10 +86,19 @@ public class ServerQueryRequest { } else { throw new UnsupportedOperationException("Unsupported payloadType: " + payloadType); } - _queryContext = QueryContextConverterUtils.getQueryContext(brokerRequest.getPinotQuery()); + _queryContext = getQueryContext(brokerRequest.getPinotQuery()); _timerContext = new TimerContext(_queryContext.getTableName(), serverMetrics, queryArrivalTimeMs); } + private static QueryContext getQueryContext(PinotQuery pinotQuery) { + QueryContext queryContext = QueryContextConverterUtils.getQueryContext(pinotQuery); + if (queryContext.isNullHandlingEnabled()) { + Preconditions.checkState(DataTableFactory.getDataTableVersion() >= DataTableFactory.VERSION_4, + "Null handling cannot be enabled for data table version smaller than 4"); + } + return queryContext; + } + /** * As _requestId can be same across brokers, so use _brokerId and _requestId together to uniquely identify a query. * @return unique query Id within a pinot cluster. diff --git a/pinot-core/src/main/java/org/apache/pinot/core/util/QueryOptionsUtils.java b/pinot-core/src/main/java/org/apache/pinot/core/util/QueryOptionsUtils.java index dc40e20a88..d9bb078817 100644 --- a/pinot-core/src/main/java/org/apache/pinot/core/util/QueryOptionsUtils.java +++ b/pinot-core/src/main/java/org/apache/pinot/core/util/QueryOptionsUtils.java @@ -21,7 +21,6 @@ package org.apache.pinot.core.util; import com.google.common.base.Preconditions; import java.util.Map; import javax.annotation.Nullable; -import org.apache.pinot.core.common.datatable.DataTableFactory; import org.apache.pinot.spi.utils.CommonConstants.Broker.Request.QueryOptionKey; import org.apache.pinot.spi.utils.CommonConstants.Broker.Request.QueryOptionValue; @@ -91,12 +90,7 @@ public class QueryOptionsUtils { } public static boolean isNullHandlingEnabled(Map<String, String> queryOptions) { - boolean nullHandlingEnabled = Boolean.parseBoolean(queryOptions.get(QueryOptionKey.ENABLE_NULL_HANDLING)); - if (nullHandlingEnabled) { - Preconditions.checkState(DataTableFactory.getDataTableVersion() >= DataTableFactory.VERSION_4, - "Null handling cannot be enabled for data table version smaller than 4"); - } - return nullHandlingEnabled; + return Boolean.parseBoolean(queryOptions.get(QueryOptionKey.ENABLE_NULL_HANDLING)); } public static boolean isServerReturnFinalResult(Map<String, String> queryOptions) { --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org