PushJoinsIntoUnions optimization with NULL constants in UNION ALL operand causes unexpected exception
Details
| Detail name | Value |
|---|---|
| Changelog Number | 30753 |
| Type | Bug |
| Status | Resolved |
| Affected Versions | Exasol 8.34.0 |
| Fix Versions | Exasol 2026.1.0, Exasol 2025.1.11 |
| Resolution Date | 2026-05-15 |
Description
Query eligible for PushJoinsIntoUnions optimization with NULL constants in a wrapping select in UNION ALL operands throws unexpected exception like “Feature not supported: Incomparable Types"
Example
-- Preparation
create table A (A1 int);
create table A_ (A1 bigint);
create table B (B1 int, B2 int);
-- Expected: query runs without errors
-- Observed: "Feature not supported: Incomparable Types: BOOLEAN and DECIMAL(18,0)!" exception
select * from (
select A1 Y from A
union all
select N from (select null N order by false))
inner join B
on B1=y and B2 = y+2 and B2=3;
Workaround
- Add explicit cast to a desired type in the UNION ALL operand OR on the lookup referencing UNION ALL. For the example from above:
- Disable PushJoinsIntoUnions optimization by rewriting the query (e.g. wrapping UNION ALL with a simple select with ORDER BY FALSE). For the example from above:
select * from (
select A1 Y from A
union all
select cast(N as int) from (select null N order by false))
inner join B
on B1=y and B2 = y+2 and B2=3;select * from (
select * from (
select A1 Y from A
union all
select N from (select null N order by false))
order by false)
inner join B
on B1=y and B2 = y+2 and B2=3;
Fix
Query runs as expected.