somandal commented on code in PR #10649:
URL: https://github.com/apache/pinot/pull/10649#discussion_r1171902582
##########
pinot-core/src/test/java/org/apache/pinot/core/query/aggregation/function/AggregationFunctionFactoryTest.java:
##########
@@ -255,25 +255,37 @@ public void testGetAggregationFunction() {
aggregationFunction =
AggregationFunctionFactory.getAggregationFunction(function,
DUMMY_QUERY_CONTEXT);
assertTrue(aggregationFunction instanceof
PercentileTDigestAggregationFunction);
assertEquals(aggregationFunction.getType(),
AggregationFunctionType.PERCENTILETDIGEST);
- assertEquals(aggregationFunction.getResultColumnName(),
"percentiletdigest(column, 99.0)");
+ assertEquals(aggregationFunction.getResultColumnName(),
"percentiletdigest(column, 99.0, 100.0)");
function = getFunction("PeRcEnTiLeTdIgEsT", "(column, 99.9999)");
aggregationFunction =
AggregationFunctionFactory.getAggregationFunction(function,
DUMMY_QUERY_CONTEXT);
assertTrue(aggregationFunction instanceof
PercentileTDigestAggregationFunction);
assertEquals(aggregationFunction.getType(),
AggregationFunctionType.PERCENTILETDIGEST);
- assertEquals(aggregationFunction.getResultColumnName(),
"percentiletdigest(column, 99.9999)");
+ assertEquals(aggregationFunction.getResultColumnName(),
"percentiletdigest(column, 99.9999, 100.0)");
+
+ function = getFunction("PeRcEnTiLeTdIgEsT", "(column, 99.9999, 1000)");
+ aggregationFunction =
AggregationFunctionFactory.getAggregationFunction(function,
DUMMY_QUERY_CONTEXT);
+ assertTrue(aggregationFunction instanceof
PercentileTDigestAggregationFunction);
+ assertEquals(aggregationFunction.getType(),
AggregationFunctionType.PERCENTILETDIGEST);
+ assertEquals(aggregationFunction.getResultColumnName(),
"percentiletdigest(column, 99.9999, 1000.0)");
function = getFunction("PeRcEnTiLeRaWtDiGeSt", "(column, 99)");
aggregationFunction =
AggregationFunctionFactory.getAggregationFunction(function,
DUMMY_QUERY_CONTEXT);
assertTrue(aggregationFunction instanceof
PercentileRawTDigestAggregationFunction);
assertEquals(aggregationFunction.getType(),
AggregationFunctionType.PERCENTILERAWTDIGEST);
- assertEquals(aggregationFunction.getResultColumnName(),
"percentilerawtdigest(column, 99.0)");
+ assertEquals(aggregationFunction.getResultColumnName(),
"percentilerawtdigest(column, 99.0, 100.0)");
Review Comment:
done, thanks for the suggestions @jasperjiaguo and @siddharthteotia
##########
pinot-core/src/main/java/org/apache/pinot/core/query/aggregation/function/AggregationFunctionFactory.java:
##########
@@ -143,6 +143,31 @@ public static AggregationFunction
getAggregationFunction(FunctionContext functio
// PercentileRawTDigestMV
return new
PercentileRawTDigestMVAggregationFunction(firstArgument, percentile);
}
+ } else if (numArguments == 3) {
+ // Triple arguments percentile (e.g. percentileTDigest(bar, 95,
1000), etc.) where the
+ // second argument is a decimal number from 0.0 to 100.0 and third
argument is a decimal number indicating
+ // the compression_factor for the TDigest. This can only be used for
TDigest type percentile functions to
+ // pass in a custom compression_factor. If the two argument version
is used the default compression_factor
+ // of 100.0 is used.
+ // Have to use literal string because we need to cast int to double
here.
+ double percentile =
parsePercentileToDouble(arguments.get(1).getLiteral().getStringValue());
+ double compressionFactor =
parseCompressionFactorToDouble(arguments.get(2).getLiteral().getStringValue());
Review Comment:
done
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]