Using scalar-emits UDFs in GROUP_CONCAT crashes instead of giving an exception message
Details
| Detail name | Value |
|---|---|
| Changelog Number | 5897 |
| Type | Bug |
| Status | Resolved |
| Affected Versions | EXASOL 6.0.0, EXASolution 5.0.0, Exasol 6.1.0, Exasol 6.1.1 |
| Fix Versions | Exasol 6.1.2 |
| Resolution Date | 2019-04-29 |
Background
Aggregate functions can not immediately be applied on expressions that contain an scalar-emits UDF.
A subselect has to be used, like with analytical Functions.
Problem
The aggregate function GROUP_CONCAT is performing this check poorly, resulting in a "connection lost" / "internal server error" exception.
Example
create schema bug;
create python scalar script emit_something() emits (x int) as
def run(ctx):
emit(1)
/
create python scalar script return_something() returns int as
def run(ctx):
return 1
/
--works:
select GROUP_CONCAT(x) from (values 1,2,3 as p(x));
-- works:
select GROUP_CONCAT(return_something()) from (values 1,2,3 as p(x));
--gives a slightly confusing exception: "A scalar script can not be used as a set function"
select MAX(emit_something()) from (values 1,2,3 as p(x));
--crashes:
select GROUP_CONCAT(emit_something()) from (values 1,2,3 as p(x));
Fix
A proper "can not be used" exception should be thrown as in the example above.