Search code examples
snowflake-cloud-data-platformuser-defined-functions

Snowflake UDF is giving the error - Unsupported subquery type cannot be evaluated


I am getting this error on doing a select on UDF - "Unsupported subquery type cannot be evaluated", the parameters of the UDF are coming from the joins but not sure what is going wrong here. I have tried every suggestions but it is not working

It is SQL UDF - returning a varchar.

Any help will be appreciated


Solution

  • If the SQL UDF runs fine by itself. Then what will be happening is once you compose it into you main query you have forms a correlated sub-query that is not supported.

    If you have “awesome complex magic” in the udf, change it be a udtf and return those results for all rows abd then join to that. This is the optimal join pattern in snowflake. Aka instead of row-by-row lookups. Build tables of as complete as possible data and join those together.