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

Formatting Error with Temporary Functions #739

Closed
dmill166 opened this issue Apr 30, 2024 · 2 comments
Closed

Formatting Error with Temporary Functions #739

dmill166 opened this issue Apr 30, 2024 · 2 comments
Labels

Comments

@dmill166
Copy link

dmill166 commented Apr 30, 2024

Issue is with use of temporary function in SQL scripts. I illustrate the problem below. You can see that in the formatted result, there is now a space between foo_bar and the left parentheses (. This is no longer treated as a function and the function itself is no longer applied.
I also provide a corrected output where after formatting, the temporary function foo_bar has the ( immediately beside it (meaning the function will now be applied).

Which SQL and options did you provide as input?

CREATE TEMPORARY FUNCTION foo_bar AS 'FooBar' USING jar 'hdfs://localhost:9000/user/hive/FooBar.jar';

SELECT    foo_bar ('fwfrgwre12a3') fun_res ;

Expected Output

CREATE TEMPORARY FUNCTION foo_bar AS 'FooBar' USING jar 'hdfs://localhost:9000/user/hive/FooBar.jar';

SELECT
    foo_bar('fwfrgwre12a3') fun_res;

Actual Output

CREATE TEMPORARY FUNCTION foo_bar AS 'FooBar' USING jar 'hdfs://localhost:9000/user/hive/FooBar.jar';

SELECT
    foo_bar ('fwfrgwre12a3') fun_res;

Usage

  • How are you calling / using the library?
    • Right-click, then use "Format Document" option
  • What SQL language(s) does this apply to?
    • Specific example was a .hql extension, but multiple SQL variants support Temporary Functions, so this should be widely implemented
  • Which SQL Formatter version are you using?
    • Prettier SQL VSCode v1.6.0
@dmill166 dmill166 added the bug label Apr 30, 2024
@dmill166
Copy link
Author

Perusing the README, I did see that there is a successor to this extension, SQL Formatter VS Code (currently on v4.1.1).
image

I want to clarify that this issue ALSO exists there (would appreciate a fix in either/both locs :) ).

@nene
Copy link
Collaborator

nene commented May 2, 2024

Thanks for reporting.

This is duplicate of #444. It's a known problem with all user-defined functions (not just temporary ones).

@nene nene closed this as not planned Won't fix, can't repro, duplicate, stale May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants