YGY-001 opened a new issue, #2553:
URL: https://github.com/apache/age/issues/2553
**Title**
`avg(toFloat(...))` followed by `UNION` fails with `UNION types double
precision and agtype cannot be matched`
**Reproduction**
```sql
LOAD 'age';
SET search_path = ag_catalog, public;
SELECT ag_catalog.create_graph('age_issue_case19');
SELECT *
FROM ag_catalog.cypher('age_issue_case19', $$
RETURN avg(toFloat(1)) AS value
UNION ALL
RETURN null AS value
$$) AS (value agtype);
```
**Expected**
The query returns two rows: `1.0` and `null`. The equivalent query is
accepted by Neo4j, and AGE can return the aggregate by itself.
**Actual**
```text
ERROR: UNION types double precision and agtype cannot be matched
```
**Controls**
These queries succeed on the same fresh graph:
```cypher
RETURN avg(toFloat(1)) AS value
```
```cypher
RETURN toFloat(1) AS value
UNION ALL
RETURN null AS value
```
The failure is specific to combining the numeric aggregate result with a
`UNION` branch. It does not require a graph pattern, writes, an entity, or a
probe projection. Current-log Case 3197 and its full fixture reproduce this
error on AGE 1.8.0.
This is separate from #2525: #2525 requires a numeric aggregate to be used in
a `CASE WHEN ... IS NULL THEN ... ELSE ... END` expression and reports a
boolean conversion error. This reduction contains no `CASE` and fails during
`UNION` type resolution.
**Environment**
Apache AGE `1.8.0` on PostgreSQL `18.6`, Docker image
`apache/age:release_PG18_1.8.0`.
--
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]