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

Ingore shebang at top of file in datafusion-cli #11927

Merged
merged 1 commit into from
Aug 11, 2024
Merged

Conversation

PsiACE
Copy link
Member

@PsiACE PsiACE commented Aug 10, 2024

Which issue does this PR close?

Closes #11880 .

Rationale for this change

What changes are included in this PR?

to support traditional #! ... shebangs

#!/usr/bin/env -S datafusion-cli -f
SELECT 1;

or we can use something like

--() { :; }; exec datafusion-cli -f "$0"
SELECT 1;

Are these changes tested?

Are there any user-facing changes?

Signed-off-by: Chojan Shang <[email protected]>
@alamb alamb changed the title Ingore shebang at top of file Ingore shebang at top of file in datafusion-cli Aug 11, 2024
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @PsiACE !

I tested this manually

Before this PR:

andrewlamb@Andrews-MBP-2:~/Software/datafusion/datafusion-cli$ datafusion-cli  -f /tmp/foo.sql
DataFusion CLI v40.0.0
SQL error: ParserError("Expected: an SQL statement, found: #!")

With this PR:

andrewlamb@Andrews-MBP-2:~/Software/datafusion/datafusion-cli$ cargo run -- -f /tmp/foo.sql
...
DataFusion CLI v41.0.0
+----------+
| Int64(1) |
+----------+
| 1        |
+----------+
1 row(s) fetched.
Elapsed 0.008 seconds.

@PsiACE
Copy link
Member Author

PsiACE commented Aug 11, 2024

I tested this manually

I'm glad to see you confirmed it works manually. I hadn't thought about supporting #! , but I use fish as my default shell and something like --() wasn't generic enough.

@alamb alamb merged commit fd237f8 into apache:main Aug 11, 2024
25 checks passed
@alamb
Copy link
Contributor

alamb commented Aug 11, 2024

Thanks again @PsiACE

@PsiACE PsiACE deleted the shebang branch August 11, 2024 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

datafusion-cli: ignore hashbang at top of script
2 participants