File tree Expand file tree Collapse file tree
opensearch/src/main/java/org/opensearch/sql/opensearch Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5555import org .opensearch .sql .planner .physical .PhysicalPlan ;
5656import org .opensearch .sql .storage .TableScanOperator ;
5757
58+ import static org .opensearch .sql .expression .function .BuiltinFunctionName .DISTINCT_COUNT_APPROX ;
59+
5860/** OpenSearch execution engine implementation. */
5961public class OpenSearchExecutionEngine implements ExecutionEngine {
6062 private static final Logger logger = LogManager .getLogger (OpenSearchExecutionEngine .class );
@@ -282,10 +284,10 @@ private void registerOpenSearchFunctions() {
282284 SqlUserDefinedAggFunction approxDistinctCountFunction =
283285 UserDefinedFunctionUtils .createUserDefinedAggFunction (
284286 DistinctCountApproxAggFunction .class ,
285- "APPROX_DISTINCT_COUNT" ,
287+ DISTINCT_COUNT_APPROX . toString () ,
286288 ReturnTypes .BIGINT_FORCE_NULLABLE ,
287289 null );
288290 PPLFuncImpTable .INSTANCE .registerExternalAggOperator (
289- BuiltinFunctionName . DISTINCT_COUNT_APPROX , approxDistinctCountFunction );
291+ DISTINCT_COUNT_APPROX , approxDistinctCountFunction );
290292 }
291293}
Original file line number Diff line number Diff line change @@ -495,6 +495,11 @@ yield switch (functionName) {
495495 }
496496 yield Pair .of (aggBuilder , new SinglePercentileParser (aggFieldName ));
497497 }
498+ case DISTINCT_COUNT_APPROX -> Pair .of (
499+ helper .build (
500+ !args .isEmpty () ? args .getFirst () : null ,
501+ AggregationBuilders .cardinality (aggFieldName )),
502+ new SingleValueParser (aggFieldName ));
498503 default -> throw new AggregateAnalyzer .AggregateAnalyzerException (
499504 String .format ("Unsupported push-down aggregator %s" , aggCall .getAggregation ()));
500505 };
You can’t perform that action at this time.
0 commit comments