Commit 0d80347
authored
Register DISTINCT_COUNT_APPROX logical marker in PPLFuncImpTable (opensearch-project#5466)
PPL parser fails with "Cannot resolve function: DISTINCT_COUNT_APPROX" on
any execution path that does not construct OpenSearchExecutionEngine
(unified-query / analytics-engine / DataFusion), because the UDAF was
only registered to PPLFuncImpTable.aggExternalFunctionRegistry as a
side effect of that constructor.
Add a logical marker class DistinctCountApproxLogicalAggFunction in
core, expose it as PPLBuiltinOperators.DISTINCT_COUNT_APPROX, and register
it inside PPLFuncImpTable.AggBuilder.populate() alongside other built-in
aggregates. The marker has no JVM execution: init / add / result throw
UnsupportedOperationException, mirroring the pattern already used by
RelevanceQueryFunction.RelevanceQueryImplementor for match-family
functions which similarly have no JVM semantics.
Behavior on V3 path is preserved: OpenSearchExecutionEngine still
registers the real HyperLogLog++ DistinctCountApproxAggFunction in
aggExternalFunctionRegistry, and getImplementation() consults that
external registry first, so the marker is overridden whenever the V3
constructor has run. AggregateAnalyzer continues to translate the
operator to OpenSearch cardinality DSL via the BuiltinFunctionName
switch which is independent of the wrapped SqlAggFunction instance.
Operand metadata for the marker is null to match the existing external
registration's permissive type policy and avoid introducing new type
rejections that would surface as regressions in existing dc IT.
Signed-off-by: Songkan Tang <songkant@amazon.com>1 parent d5ee441 commit 0d80347
3 files changed
Lines changed: 86 additions & 0 deletions
File tree
- core/src/main/java/org/opensearch/sql
- calcite/udf/udaf
- expression/function
Lines changed: 61 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
Lines changed: 17 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
| |||
508 | 509 | | |
509 | 510 | | |
510 | 511 | | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
511 | 528 | | |
512 | 529 | | |
513 | 530 | | |
| |||
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| 63 | + | |
63 | 64 | | |
64 | 65 | | |
65 | 66 | | |
| |||
1426 | 1427 | | |
1427 | 1428 | | |
1428 | 1429 | | |
| 1430 | + | |
| 1431 | + | |
| 1432 | + | |
| 1433 | + | |
| 1434 | + | |
| 1435 | + | |
| 1436 | + | |
1429 | 1437 | | |
1430 | 1438 | | |
1431 | 1439 | | |
| |||
0 commit comments