Skip to content
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

Using "isnull" function introduces a space between function name and opening parenthesis #641

Closed
williamscs opened this issue Nov 11, 2024 · 4 comments · Fixed by #644
Closed
Labels
bug Something isn't working

Comments

@williamscs
Copy link

williamscs commented Nov 11, 2024

Describe the bug
Using SQL Server's "isnull" function introduces a space between function name and parentheses. This doesn't happen with other functions like "nullif".

To Reproduce
I used the main site's "try it out" section to reproduce.

Before fmt
image

select isnull(column, 'some string'), nullif(25, 25);

After fmt
image

select isnull (column, 'some string'), nullif(25, 25)
;

Expected behavior
I would expect 'isnull' to be treated the same as 'nullif' where there is no space between the function name and the parenthesis.

Actual behavior
A space is introduced.

@tconbeer
Copy link
Owner

That is because, in Postgres and other dialects, isnull is an operator that returns a boolean:
image

We can improve the parser to treat isnull( as a function instead.

@tconbeer tconbeer added the bug Something isn't working label Nov 11, 2024
@hongtron
Copy link

I'm noticing the same behavior with filter, which looks to be a keyword in Postgres, but is a function in SparkSQL:

             map_from_entries(
-                filter(
+                filter (
                     transform(

Should I open a separate issue for that, or can it be addressed here?

@tconbeer
Copy link
Owner

together is fine. thanks

@williamscs
Copy link
Author

Thank you, @tconbeer !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants