Use of DISTINCT with SET EMITS script causes Internal Server Error
Details
| Detail name | Value |
|---|---|
| Changelog Number | 23957 |
| Type | Bug |
| Status | Resolved |
| Affected Versions | Exasol 8.9.0 |
| Fix Versions | Exasol 2025.1.9, Exasol 2026.1.0, Exasol 2025.2.1 |
| Resolution Date | 2026-02-18 |
Description
The use of DISTINCT keyword when calling a SET EMITS script resulted in internal server error.
Example:
CREATE SCHEMA test;
OPEN SCHEMA test;
CREATE OR REPLACE TABLE example_table (example_value VARCHAR(10));
INSERT INTO example_table VALUES ('1'), ('1'), ('2'), ('3'), ('3'), ('4');
-- The SET EMITS SCRIPT
--/
CREATE OR REPLACE PYTHON3 SET SCRIPT test.example_script(
placename VARCHAR(200)
)
EMITS (place VARCHAR(20000), latitude DOUBLE, longitude DOUBLE) AS
def run(ctx):
while True:
value = str(ctx.placename) if ctx.placename is not None else "NULL"
ctx.emit(f"{value} (Unavailable)", None, None)
if not ctx.next():
break
/
-- The use of DISTINCT while calling the script
-- Observed: Internal Server Error
-- Expected: 4 rows
SELECT DISTINCT
test.example_script(example_table.example_value)
FROM
example_table;
Workaround
Use the query calling the SET EMITS script as a subquery without DISTINCT. Use DISTINCT keyword on the outer query.
SELECT DISTINCT * FROM (SELECT
test.example_script(example_table.example_value)
FROM
example_table);
Fix
The use of DISTINCT with SET EMITS script now works as intended and produces the expected result.