Aliases for emitting UDFs are ignored

Details

Detail name Value
Changelog Number 2603
Type Bug
Status Resolved
Affected Versions EXASOL 6.0.0, Exasol 6.1.0, Exasol 6.2.0, Exasol 7.0.0
Fix Versions Exasol 8.0.0
Resolution Date 2022-04-20

Description

For emitting UDFs used in SQL statements, defining an alias on the emitted output would be ignored (the name of the output column is returned instead). Trying to use the defined alias returns an error message that it is not found.

Preparation

create lua scalar script my_emitting_udf(x double) emits(y1 double)
as
function run(ctx)
ctx.emit(ctx.x)
end

Example

-- Error: object A not found
select a from (select my_emitting_udf(4) as a);

Workaround

Move the alias from the UDF to a subquery which calls the UDF.

Example

select a from ( select y1 a from ( select my_emitting_udf(4) ) );
select a from ( select my_emitting_udf(4) ) as T(a);

Fix

Aliases are no longer ignored. As a consequence, naming an alias on an emitting UDF that returns several values will cause the error "Feature not supported: Multi-column aliases".

Changed behavior

Column aliases are no longer ignored for emitting UDFs. If they are used on an emitting UDF that returns more than one value, Exasol throws an error.