-
Notifications
You must be signed in to change notification settings - Fork 769
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RETURNS NULL ON NULL INPUT for CREATE FUNCTION in Snowflake Dialect is not supported #3503
Comments
>>> create_text = """
... CREATE OR REPLACE FUNCTION ibis_udfs.public.object_values("obj" OBJECT)
... RETURNS ARRAY
... LANGUAGE JAVASCRIPT
... STRICT
... AS
... $$ return Object.values(obj) $$
... """
>>> expr = sqlglot.parse_one(create_text, dialect='snowflake')
>>> expr
Create(
this=UserDefinedFunction(
this=Dot(
this=Dot(
this=Identifier(this=ibis_udfs, quoted=False),
expression=Identifier(this=public, quoted=False)),
expression=Identifier(this=object_values, quoted=False)),
expressions=[
ColumnDef(
this=Identifier(this=obj, quoted=True),
kind=DataType(this=Type.OBJECT, nested=True))],
wrapped=True),
kind=FUNCTION,
replace=True,
expression=Alias(
this=Column(
this=Identifier(this=STRICT, quoted=False)),
alias=Identifier(this=return Object.values(obj) , quoted=False)),
properties=Properties(
expressions=[
ReturnsProperty(
this=DataType(this=Type.ARRAY, nested=True)),
LanguageProperty(
this=Var(this=JAVASCRIPT))]))
>>> print(expr)
CREATE OR REPLACE FUNCTION ibis_udfs.public.object_values("obj" OBJECT) RETURNS ARRAY LANGUAGE JAVASCRIPT AS STRICT AS return Object.values(obj)
raises the error:
|
this isn’t high priority for us, feel free to submit a pr for this. we welcome well documented, tested, and conforming prs, but won’t have time to implement this one for you |
@georgesittas Thank you! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Before you file an issue
parse_one(sql, read="spark")
ast.sql(dialect="duckdb")
Fully reproducible code snippet
Please include a fully reproducible code snippet or the input sql, dialect, and expected output.
pip install 'sqlglot@git+ssh://git@github.com/tobymao/sqlglot.git'
Official Documentation
Please include links to official SQL documentation related to your issue.
https://docs.snowflake.com/en/sql-reference/sql/create-function#optional-parameters
The text was updated successfully, but these errors were encountered: