aharpervc opened a new pull request, #1839:
URL: https://github.com/apache/datafusion-sqlparser-rs/pull/1839

   Note: temporarily rebased on 
https://github.com/apache/datafusion-sqlparser-rs/pull/1834, prior to that 
being merged; I will rebase once it's on main.
   
   ---
   
   This PR adds support for table valued functions for SQL Server, both inline 
& multi statement functions. For reference, that's the B & C documentation 
here: 
https://learn.microsoft.com/en-us/sql/t-sql/statements/create-function-transact-sql?view=sql-server-ver16#b-create-an-inline-table-valued-function
   
   Inline TVF's are defined with `AS RETURN`, so we have a new 
`CreateFunctionBody::AsReturn` variant accordingly. Functions using "AS RETURN" 
don't have BEGIN/END, so that part of the parsing logic is now conditional. 
Additionally, the data type parser now supports "RETURNS TABLE" without a table 
definition.
   
   Multi statement TVF's use named table expressions, so a new `NamedTable` 
data type variant was added. I didn't see a great way to integrate this into 
the existing data type parser (especially without rewinding), so creating this 
data type happens inside the parse create function logic first by parsing the 
identifier, then parsing the table definition, then using those elements to 
produce a NamedTable.
   
   I also added a new test example for each of these scenarios.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to