Commit 109375d
authored
[Calcite] Make containsNestedAggregator tolerate flat-leaf schemas (opensearch-project#5423)
* [Calcite] Make containsNestedAggregator tolerate flat-leaf schemas
The check splits each aggregator argument on '.' and looks up the
leading token as a top-level ARRAY column (the OpenSearch `nested`
marker). It used relBuilder.field(root), which throws when the column
doesn't exist.
That works for the classic path, which always exposes a top-level
column for object/nested parents. It breaks the analytics-engine
path, which emits only flat leaves ("city.name", "city.location.latitude")
— parent placeholders can't round-trip through Substrait. Any
aggregation against an object-field leaf (e.g. stats max(city.location.latitude))
crashed with "Field [city] not found".
Use RelDataType.getField, which returns null on miss. A null lookup
is the correct "not nested" answer. Behavior unchanged for relations
that do have a top-level ARRAY column.
Signed-off-by: Marc Handalian <marc.handalian@gmail.com>
* fix spotless
Signed-off-by: Marc Handalian <marc.handalian@gmail.com>
---------
Signed-off-by: Marc Handalian <marc.handalian@gmail.com>1 parent 9124664 commit 109375d
1 file changed
Lines changed: 17 additions & 2 deletions
Lines changed: 17 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1538 | 1538 | | |
1539 | 1539 | | |
1540 | 1540 | | |
| 1541 | + | |
| 1542 | + | |
| 1543 | + | |
| 1544 | + | |
| 1545 | + | |
| 1546 | + | |
| 1547 | + | |
| 1548 | + | |
| 1549 | + | |
| 1550 | + | |
1541 | 1551 | | |
1542 | | - | |
| 1552 | + | |
1543 | 1553 | | |
1544 | | - | |
| 1554 | + | |
| 1555 | + | |
| 1556 | + | |
| 1557 | + | |
| 1558 | + | |
| 1559 | + | |
1545 | 1560 | | |
1546 | 1561 | | |
1547 | 1562 | | |
| |||
0 commit comments