This is an automated email from the ASF dual-hosted git repository. mayanks pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git
The following commit(s) were added to refs/heads/master by this push: new 589b1aa Fix new broker to old server backward compatibility issue. (#5342) 589b1aa is described below commit 589b1aa8a4cfedadff27654884ae22dc8e73790b Author: Mayank Shrivastava <mshrivast...@linkedin.com> AuthorDate: Wed May 6 15:45:50 2020 -0700 Fix new broker to old server backward compatibility issue. (#5342) With PR #5259 and #5275, the broker starts to send aggregation function arguments in a new field in the thrift class. While new server prefers new field and falls back to old field, in case of new broker and old server the server is unable to find values in the field. This PR fixes this issue by adding both old and new field in the broker. We will need to change back broker to stop setting the old field with a future release. --- .../pinot/pql/parsers/PinotQuery2BrokerRequestConverter.java | 7 +++++++ .../org/apache/pinot/pql/parsers/pql2/ast/FunctionCallAstNode.java | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/pinot-common/src/main/java/org/apache/pinot/pql/parsers/PinotQuery2BrokerRequestConverter.java b/pinot-common/src/main/java/org/apache/pinot/pql/parsers/PinotQuery2BrokerRequestConverter.java index eeda5ef..16fe3ad 100644 --- a/pinot-common/src/main/java/org/apache/pinot/pql/parsers/PinotQuery2BrokerRequestConverter.java +++ b/pinot-common/src/main/java/org/apache/pinot/pql/parsers/PinotQuery2BrokerRequestConverter.java @@ -42,6 +42,7 @@ import org.apache.pinot.common.request.PinotQuery; import org.apache.pinot.common.request.QuerySource; import org.apache.pinot.common.request.Selection; import org.apache.pinot.common.request.SelectionSort; +import org.apache.pinot.parsers.CompilerConstants; import org.apache.pinot.pql.parsers.pql2.ast.FilterKind; import org.apache.pinot.pql.parsers.pql2.ast.OrderByAstNode; @@ -259,6 +260,12 @@ public class PinotQuery2BrokerRequestConverter { aggregationInfo.setAggregationType(functionName); aggregationInfo.setExpressions(args); aggregationInfo.setIsInSelectList(true); + + // For backward compatibility (new broker - old server), also set the old way. + // TODO: remove with a major version change. + aggregationInfo.putToAggregationParams(CompilerConstants.COLUMN_KEY_IN_AGGREGATION_INFO, + String.join(CompilerConstants.AGGREGATION_FUNCTION_ARG_SEPARATOR, args)); + return aggregationInfo; } diff --git a/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/FunctionCallAstNode.java b/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/FunctionCallAstNode.java index 390be8c..3e356db 100644 --- a/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/FunctionCallAstNode.java +++ b/pinot-common/src/main/java/org/apache/pinot/pql/parsers/pql2/ast/FunctionCallAstNode.java @@ -25,6 +25,7 @@ import java.util.TreeSet; import org.apache.pinot.common.function.AggregationFunctionType; import org.apache.pinot.common.request.AggregationInfo; import org.apache.pinot.common.request.transform.TransformExpressionTree; +import org.apache.pinot.parsers.CompilerConstants; import org.apache.pinot.pql.parsers.Pql2CompilationException; import org.apache.pinot.spi.utils.EqualityUtils; @@ -120,6 +121,11 @@ public class FunctionCallAstNode extends BaseAstNode { aggregationInfo.setExpressions(functionArgs); aggregationInfo.setIsInSelectList(_isInSelectList); + // For backward compatibility (new broker - old server), also set the old way. + // TODO: remove with a major version change. + aggregationInfo.putToAggregationParams(CompilerConstants.COLUMN_KEY_IN_AGGREGATION_INFO, + String.join(CompilerConstants.AGGREGATION_FUNCTION_ARG_SEPARATOR, functionArgs)); + return aggregationInfo; } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org