Synapse
NewAdd Lakehouse Support for UDTFs (User-Defined Table Functions, aka TVFs or Table-Value Functions)
Jonathan Boarman on 08 Jun 2024 18:03:44
Being able to create a UDTF (user-defined table function), also known as a tabular UDF, table UDF, UDF table function, or a TVF (user-defined table-value function), are incredibly useful and very powerful, especially in combination with LATERAL invocations.
Other platforms, such as SQL Server has offered this feature for more than 20 years back, which means this has been around long enough to develop deep and frequent use cases in more mature data teams.
Documentation from a few major data platforms covering their implementation usage:
- Databricks – Create a SQL table function -- https://docs.databricks.com/en/sql/language-manual/sql-ref-syntax-ddl-create-sql-function.html#create-a-sql-table-function
- Snowflake – Creating Tabular SQL UDFs (UDTFs) -- https://docs.snowflake.com/en/developer-guide/udf/sql/udf-sql-tabular-functions
- BigQuery – Creating table-valued functions (TVF) --https://cloud.google.com/bigquery/docs/table-functions
- Postgres – SQL Functions Returning TABLE -- https://www.postgresql.org/docs/current/xfunc-sql.html#XFUNC-SQL-FUNCTIONS-RETURNING-TABLE
- SAP HANA – Table user-defined functions (TUDF) -- https://help.sap.com/docs/SAP_HANA_PLATFORM/de2486ee947e43e684d39702027f8a94/2fc6d7beebd14c579457092e91519082.html?q=create%20function
- IBM DB2 – CREATE FUNCTION (user-defined external table) --https://www.ibm.com/docs/en/db2/11.5?topic=statements-create-function-external-table
- Oracle – Pipelined Table Functions -- https://docs.oracle.com/en/database/oracle/oracle-database/19/lnpls/PIPELINED-clause.html
- MSSQL – Inline and Multi-statement table-valued functions (TVF/MSTVF) -- https://learn.microsoft.com/en-us/sql/relational-databases/user-defined-functions/create-user-defined-functions-database-engine?view=sql-server-ver16#inline-table-valued-function-tvf
- Comments (2)
RE: Add Lakehouse Support for UDTFs (User-Defined Table Functions, aka TVFs or Table-Value Functions)
working with PII data in Microsoft Fabric Lakehouse and need to implement on-the-fly decryption for Power BI reports. current challenges are, I have encrypted data stored in Fabric Lakehouse tables.I need to decrypt this data dynamically when it's accessed by Power BI reports.I attempted to create a permanent view using a temporary decryption function, but encountered an errorin above scenario udf are very useful
RE: Add Lakehouse Support for UDTFs (User-Defined Table Functions, aka TVFs or Table-Value Functions)
Here's the related issue within the Apache Spark project for Spark SQL ([SPARK-39247] Support returning a table or set of rows in CREATE FUNCTION): https://issues.apache.org/jira/browse/SPARK-39247