This is an automated email from the ASF dual-hosted git repository. jlli 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 81e1143f39 refactor code and doc occurrences of argmin/max -> exprmin/max (#11700) 81e1143f39 is described below commit 81e1143f39b7463443e4b59d0a9512c3651824a0 Author: Jia Guo <jia...@linkedin.com> AuthorDate: Thu Sep 28 14:41:19 2023 -0700 refactor code and doc occurrences of argmin/max -> exprmin/max (#11700) --- .../java/org/apache/pinot/core/common/ObjectSerDeUtils.java | 4 ++-- .../query/aggregation/function/ChildAggregationFunction.java | 2 +- .../aggregation/function/ParentAggregationFunction.java | 4 ++-- .../function/ParentExprMinMaxAggregationFunction.java | 10 +++++----- .../utils/exprminmax/ExprMinMaxMeasuringValSetWrapper.java | 2 +- .../query/aggregation/utils/exprminmax/ExprMinMaxObject.java | 12 ++++++------ .../utils/exprminmax/ExprMinMaxProjectionValSetWrapper.java | 2 +- .../utils/exprminmax/ExprMinMaxWrapperValSet.java | 4 ++-- .../utils/rewriter/ParentAggregationResultRewriter.java | 6 +++--- .../test/java/org/apache/pinot/queries/ExprMinMaxTest.java | 6 +++--- .../apache/pinot/queries/ResultRewriterRegressionTest.java | 6 +++--- 11 files changed, 29 insertions(+), 29 deletions(-) diff --git a/pinot-core/src/main/java/org/apache/pinot/core/common/ObjectSerDeUtils.java b/pinot-core/src/main/java/org/apache/pinot/core/common/ObjectSerDeUtils.java index 4f05bad761..d679419d0e 100644 --- a/pinot-core/src/main/java/org/apache/pinot/core/common/ObjectSerDeUtils.java +++ b/pinot-core/src/main/java/org/apache/pinot/core/common/ObjectSerDeUtils.java @@ -136,7 +136,7 @@ public class ObjectSerDeUtils { CovarianceTuple(32), VarianceTuple(33), PinotFourthMoment(34), - ArgMinMaxObject(35), + ExprMinMaxObject(35), KllDataSketch(36), IntegerTupleSketch(37), FrequentStringsSketch(38), @@ -233,7 +233,7 @@ public class ObjectSerDeUtils { } else if (value instanceof org.apache.datasketches.tuple.Sketch) { return ObjectType.IntegerTupleSketch; } else if (value instanceof ExprMinMaxObject) { - return ObjectType.ArgMinMaxObject; + return ObjectType.ExprMinMaxObject; } else if (value instanceof ItemsSketch) { return ObjectType.FrequentStringsSketch; } else if (value instanceof LongsSketch) { diff --git a/pinot-core/src/main/java/org/apache/pinot/core/query/aggregation/function/ChildAggregationFunction.java b/pinot-core/src/main/java/org/apache/pinot/core/query/aggregation/function/ChildAggregationFunction.java index b4ada7fb9f..f1005799f1 100644 --- a/pinot-core/src/main/java/org/apache/pinot/core/query/aggregation/function/ChildAggregationFunction.java +++ b/pinot-core/src/main/java/org/apache/pinot/core/query/aggregation/function/ChildAggregationFunction.java @@ -124,7 +124,7 @@ public abstract class ChildAggregationFunction implements AggregationFunction<Lo * CHILD_AGGREGATION_NAME_PREFIX + actual function type + operands + CHILD_AGGREGATION_SEPERATOR * + actual function type + parent aggregation function id + CHILD_KEY_SEPERATOR + column key in parent function * e.g. if the child aggregation function is "exprmax(0,a,b,x)", the name of the column is - * "pinotchildaggregationepxrmax(a,b,x)@argmax0_x" + * "pinotchildaggregationepxrmax(a,b,x)@exprmax0_x" */ @Override public final String getResultColumnName() { diff --git a/pinot-core/src/main/java/org/apache/pinot/core/query/aggregation/function/ParentAggregationFunction.java b/pinot-core/src/main/java/org/apache/pinot/core/query/aggregation/function/ParentAggregationFunction.java index 831cf2d766..9fb18bd347 100644 --- a/pinot-core/src/main/java/org/apache/pinot/core/query/aggregation/function/ParentAggregationFunction.java +++ b/pinot-core/src/main/java/org/apache/pinot/core/query/aggregation/function/ParentAggregationFunction.java @@ -47,8 +47,8 @@ public abstract class ParentAggregationFunction<I, F extends ParentAggregationFu // The name of the column is the prefix of the parent aggregation function + the name of the // aggregation function + the id of the parent aggregation function - // e.g. if the parent aggregation function is "argmax(0,3,a,b,c,x,y,z)", the name of the column is - // "pinotparentaggregationargmax0" + // e.g. if the parent aggregation function is "exprmax(0,3,a,b,c,x,y,z)", the name of the column is + // "pinotparentaggregationexprmax0" @Override public final String getResultColumnName() { return CommonConstants.RewriterConstants.PARENT_AGGREGATION_NAME_PREFIX diff --git a/pinot-core/src/main/java/org/apache/pinot/core/query/aggregation/function/ParentExprMinMaxAggregationFunction.java b/pinot-core/src/main/java/org/apache/pinot/core/query/aggregation/function/ParentExprMinMaxAggregationFunction.java index be1e935f25..6836a596a5 100644 --- a/pinot-core/src/main/java/org/apache/pinot/core/query/aggregation/function/ParentExprMinMaxAggregationFunction.java +++ b/pinot-core/src/main/java/org/apache/pinot/core/query/aggregation/function/ParentExprMinMaxAggregationFunction.java @@ -41,10 +41,10 @@ public class ParentExprMinMaxAggregationFunction extends ParentAggregationFuncti private final List<ExpressionContext> _measuringColumns; // list of columns that we project based on the min/max value private final List<ExpressionContext> _projectionColumns; - // true if we are doing argmax, false if we are doing argmin + // true if we are doing exprmax, false if we are doing exprmin private final boolean _isMax; // the id of the function, this is to associate the result of the parent aggregation function with the - // child aggregation functions having the same type(argmin/argmax) and measuring columns + // child aggregation functions having the same type(exprmin/exprmax) and measuring columns private final ExpressionContext _functionIdContext; private final ExpressionContext _numMeasuringColumnContext; // number of columns that we do min/max on @@ -226,7 +226,7 @@ public class ParentExprMinMaxAggregationFunction extends ParentAggregationFuncti break; default: throw new IllegalStateException( - "Cannot compute ArgMinMax projection on non-comparable type: " + blockValSet.getValueType()); + "Cannot compute exprminMax projection on non-comparable type: " + blockValSet.getValueType()); } } else { switch (blockValSet.getValueType()) { @@ -272,7 +272,7 @@ public class ParentExprMinMaxAggregationFunction extends ParentAggregationFuncti break; default: throw new IllegalStateException( - "Cannot compute ArgMinMax projection on non-comparable type: " + blockValSet.getValueType()); + "Cannot compute exprminMax projection on non-comparable type: " + blockValSet.getValueType()); } } } @@ -334,7 +334,7 @@ public class ParentExprMinMaxAggregationFunction extends ParentAggregationFuncti break; default: throw new IllegalStateException( - "Cannot compute ArgMinMax measuring on non-comparable type: " + blockValSet.getValueType()); + "Cannot compute exprminMax measuring on non-comparable type: " + blockValSet.getValueType()); } } // setup measuring column schema diff --git a/pinot-core/src/main/java/org/apache/pinot/core/query/aggregation/utils/exprminmax/ExprMinMaxMeasuringValSetWrapper.java b/pinot-core/src/main/java/org/apache/pinot/core/query/aggregation/utils/exprminmax/ExprMinMaxMeasuringValSetWrapper.java index f96530dc99..b88e7b2e1e 100644 --- a/pinot-core/src/main/java/org/apache/pinot/core/query/aggregation/utils/exprminmax/ExprMinMaxMeasuringValSetWrapper.java +++ b/pinot-core/src/main/java/org/apache/pinot/core/query/aggregation/utils/exprminmax/ExprMinMaxMeasuringValSetWrapper.java @@ -23,7 +23,7 @@ import org.apache.pinot.core.common.BlockValSet; /** - * Wrapper class for measuring columns in argmin/max aggregation function. + * Wrapper class for measuring columns in exprmin/max aggregation function. * Meanly used to do comparison without boxing primitive types. */ public class ExprMinMaxMeasuringValSetWrapper extends ExprMinMaxWrapperValSet { diff --git a/pinot-core/src/main/java/org/apache/pinot/core/query/aggregation/utils/exprminmax/ExprMinMaxObject.java b/pinot-core/src/main/java/org/apache/pinot/core/query/aggregation/utils/exprminmax/ExprMinMaxObject.java index ad487f3136..a169e7d136 100644 --- a/pinot-core/src/main/java/org/apache/pinot/core/query/aggregation/utils/exprminmax/ExprMinMaxObject.java +++ b/pinot-core/src/main/java/org/apache/pinot/core/query/aggregation/utils/exprminmax/ExprMinMaxObject.java @@ -149,17 +149,17 @@ public class ExprMinMaxObject implements ParentAggregationFunctionResultObject { * = 0: new key is the same as the current extremum * < 0: current key is still the extremum */ - public int compareAndSetKey(List<ExprMinMaxMeasuringValSetWrapper> argMinMaxWrapperValSets, int offset, + public int compareAndSetKey(List<ExprMinMaxMeasuringValSetWrapper> exprMinMaxWrapperValSets, int offset, boolean isMax) { Preconditions.checkState(_mutable, "Cannot compare and set key after the object is serialized"); if (!_isNull) { for (int i = 0; i < _sizeOfExtremumMeasuringKeys; i++) { - ExprMinMaxMeasuringValSetWrapper argMinMaxWrapperValSet = argMinMaxWrapperValSets.get(i); - int result = argMinMaxWrapperValSet.compare(offset, _extremumMeasuringKeys[i]); + ExprMinMaxMeasuringValSetWrapper exprMinMaxWrapperValSet = exprMinMaxWrapperValSets.get(i); + int result = exprMinMaxWrapperValSet.compare(offset, _extremumMeasuringKeys[i]); if (result != 0) { if (isMax ? result < 0 : result > 0) { for (int j = 0; j < _sizeOfExtremumMeasuringKeys; j++) { - _extremumMeasuringKeys[j] = argMinMaxWrapperValSets.get(j).getComparable(offset); + _extremumMeasuringKeys[j] = exprMinMaxWrapperValSets.get(j).getComparable(offset); } return 1; } @@ -170,7 +170,7 @@ public class ExprMinMaxObject implements ParentAggregationFunctionResultObject { _isNull = false; _extremumMeasuringKeys = new Comparable[_sizeOfExtremumMeasuringKeys]; for (int i = 0; i < _sizeOfExtremumMeasuringKeys; i++) { - _extremumMeasuringKeys[i] = argMinMaxWrapperValSets.get(i).getComparable(offset); + _extremumMeasuringKeys[i] = exprMinMaxWrapperValSets.get(i).getComparable(offset); } } return 0; @@ -278,7 +278,7 @@ public class ExprMinMaxObject implements ParentAggregationFunctionResultObject { } /** - * Merge two ArgMinMaxObjects + * Merge two exprminMaxObjects */ public ExprMinMaxObject merge(ExprMinMaxObject other, boolean isMax) { if (_isNull && other._isNull) { diff --git a/pinot-core/src/main/java/org/apache/pinot/core/query/aggregation/utils/exprminmax/ExprMinMaxProjectionValSetWrapper.java b/pinot-core/src/main/java/org/apache/pinot/core/query/aggregation/utils/exprminmax/ExprMinMaxProjectionValSetWrapper.java index e8a4a2910f..e855c55c9d 100644 --- a/pinot-core/src/main/java/org/apache/pinot/core/query/aggregation/utils/exprminmax/ExprMinMaxProjectionValSetWrapper.java +++ b/pinot-core/src/main/java/org/apache/pinot/core/query/aggregation/utils/exprminmax/ExprMinMaxProjectionValSetWrapper.java @@ -23,7 +23,7 @@ import org.apache.pinot.core.common.BlockValSet; /** - * Wrapper class for projection block value set for argmin/max aggregation function. + * Wrapper class for projection block value set for exprmin/max aggregation function. * Used to get the value from val set of different data types. */ public class ExprMinMaxProjectionValSetWrapper extends ExprMinMaxWrapperValSet { diff --git a/pinot-core/src/main/java/org/apache/pinot/core/query/aggregation/utils/exprminmax/ExprMinMaxWrapperValSet.java b/pinot-core/src/main/java/org/apache/pinot/core/query/aggregation/utils/exprminmax/ExprMinMaxWrapperValSet.java index 703d4b7dde..7090e4e9e0 100644 --- a/pinot-core/src/main/java/org/apache/pinot/core/query/aggregation/utils/exprminmax/ExprMinMaxWrapperValSet.java +++ b/pinot-core/src/main/java/org/apache/pinot/core/query/aggregation/utils/exprminmax/ExprMinMaxWrapperValSet.java @@ -23,8 +23,8 @@ import org.apache.pinot.core.common.BlockValSet; /** - * Wrapper class for the value sets of the column to do argmin/max on. - * This class is used for type-generic implementation of argmin/max. + * Wrapper class for the value sets of the column to do exprmin/max on. + * This class is used for type-generic implementation of exprmin/max. */ public class ExprMinMaxWrapperValSet { protected final DataSchema.ColumnDataType _dataType; diff --git a/pinot-core/src/main/java/org/apache/pinot/core/query/utils/rewriter/ParentAggregationResultRewriter.java b/pinot-core/src/main/java/org/apache/pinot/core/query/utils/rewriter/ParentAggregationResultRewriter.java index d650303f8c..d27de41752 100644 --- a/pinot-core/src/main/java/org/apache/pinot/core/query/utils/rewriter/ParentAggregationResultRewriter.java +++ b/pinot-core/src/main/java/org/apache/pinot/core/query/utils/rewriter/ParentAggregationResultRewriter.java @@ -190,11 +190,11 @@ public class ParentAggregationResultRewriter implements ResultRewriter { * For example, for a list of aggregation functions result: * 0 1 2 3 * | | | | - * "child_argmin(a, b, x) ,child_argmin(a, b, y), child_argmin(a, b, z), parent_argmin(a, b, x, y, z)" + * "child_exprmin(a, b, x) ,child_exprmin(a, b, y), child_exprmin(a, b, z), parent_exprmin(a, b, x, y, z)" * | | | * 0 1 2 - * offset of the parent of child_argmin(a, b, y) is 3 - * nested offset is child_argmin(a, b, y) is 1 + * offset of the parent of child_exprmin(a, b, y) is 3 + * nested offset is child_exprmin(a, b, y) is 1 */ private static class ChildFunctionMapping { private final ParentAggregationFunctionResultObject _parent; diff --git a/pinot-core/src/test/java/org/apache/pinot/queries/ExprMinMaxTest.java b/pinot-core/src/test/java/org/apache/pinot/queries/ExprMinMaxTest.java index b4e8f23973..413685dbe8 100644 --- a/pinot-core/src/test/java/org/apache/pinot/queries/ExprMinMaxTest.java +++ b/pinot-core/src/test/java/org/apache/pinot/queries/ExprMinMaxTest.java @@ -57,7 +57,7 @@ import static org.testng.Assert.fail; /** - * Queries test for argMin/argMax functions. + * Queries test for exprmin/exprmax functions. */ public class ExprMinMaxTest extends BaseQueriesTest { private static final File INDEX_DIR = new File(FileUtils.getTempDirectory(), "ExprMinMaxTest"); @@ -202,7 +202,7 @@ public class ExprMinMaxTest extends BaseQueriesTest { query = "SELECT expr_max(mvDoubleColumn, jsonColumn) FROM testTable"; brokerResponse = getBrokerResponse(query); Assert.assertTrue(brokerResponse.getProcessingExceptions().get(0).getMessage().contains( - "Cannot compute ArgMinMax measuring on non-comparable type: JSON" + "Cannot compute exprminMax measuring on non-comparable type: JSON" )); } @@ -533,7 +533,7 @@ public class ExprMinMaxTest extends BaseQueriesTest { assertEquals(rows.get(4)[2], new Object[]{27}); // TODO: The following query works because whenever we find an empty array in the result, we use null - // (see ArgMinMaxProjectionValSetWrapper). Ideally, we should be able to serialize empty array. + // (see exprminMaxProjectionValSetWrapper). Ideally, we should be able to serialize empty array. // requires fix for empty int arrays ser/de in DataBlock query = "SELECT stringColumn, expr_min(VALUE_IN(mvIntColumn,16,17,18,19,20,21,22,23,24,25,26,27), intColumn), " diff --git a/pinot-core/src/test/java/org/apache/pinot/queries/ResultRewriterRegressionTest.java b/pinot-core/src/test/java/org/apache/pinot/queries/ResultRewriterRegressionTest.java index 0e4cd336a5..e88122d510 100644 --- a/pinot-core/src/test/java/org/apache/pinot/queries/ResultRewriterRegressionTest.java +++ b/pinot-core/src/test/java/org/apache/pinot/queries/ResultRewriterRegressionTest.java @@ -36,7 +36,7 @@ public class ResultRewriterRegressionTest { public void setupRewriter() throws Exception { QueryRewriterFactory.init(String.join(",", QueryRewriterFactory.DEFAULT_QUERY_REWRITERS_CLASS_NAMES) - + ",org.apache.pinot.sql.parsers.rewriter.ArgMinMaxRewriter"); + + ",org.apache.pinot.sql.parsers.rewriter.ExprMinMaxRewriter"); ResultRewriterFactory .init("org.apache.pinot.core.query.utils.rewriter.ParentAggregationResultRewriter"); } @@ -48,7 +48,7 @@ public class ResultRewriterRegressionTest { public void setupRewriter() throws Exception { QueryRewriterFactory.init(String.join(",", QueryRewriterFactory.DEFAULT_QUERY_REWRITERS_CLASS_NAMES) - + ",org.apache.pinot.sql.parsers.rewriter.ArgMinMaxRewriter"); + + ",org.apache.pinot.sql.parsers.rewriter.ExprMinMaxRewriter"); ResultRewriterFactory .init("org.apache.pinot.core.query.utils.rewriter.ParentAggregationResultRewriter"); } @@ -61,7 +61,7 @@ public class ResultRewriterRegressionTest { public void setupRewriter() throws Exception { QueryRewriterFactory.init(String.join(",", QueryRewriterFactory.DEFAULT_QUERY_REWRITERS_CLASS_NAMES) - + ",org.apache.pinot.sql.parsers.rewriter.ArgMinMaxRewriter"); + + ",org.apache.pinot.sql.parsers.rewriter.ExprMinMaxRewriter"); ResultRewriterFactory .init("org.apache.pinot.core.query.utils.rewriter.ParentAggregationResultRewriter"); } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org