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

Script fails if first line is a comment #42

Closed
JamesRTaylor opened this issue Apr 30, 2016 · 8 comments
Closed

Script fails if first line is a comment #42

JamesRTaylor opened this issue Apr 30, 2016 · 8 comments

Comments

@JamesRTaylor
Copy link

To repro install Apache Phoenix 4.7 and run the following command:

./sqlline.py localhost ../examples/STOCK_SYMBOL.sql 

You'll see the following error message:

1/5          -- test comment
Aborting command set because "force" is false and command failed: "-- test comment"

Here's what the script looks like:

-- test comment
CREATE TABLE IF NOT EXISTS STOCK_SYMBOL (SYMBOL VARCHAR NOT NULL PRIMARY KEY, COMPANY VARCHAR);
UPSERT INTO STOCK_SYMBOL VALUES ('CRM','SalesForce.com');
SELECT * FROM STOCK_SYMBOL;
@JamesRTaylor JamesRTaylor changed the title Lines beginning with -- are not treated as comments Scripts where the first line beginning with -- are not treated as comments Apr 30, 2016
@JamesRTaylor
Copy link
Author

Looks like it's only an issue if it's the first line in the .sql file.

@seva0stapenko
Copy link

In 4.4 (HDP 2.3/2.4) it's a problem with comments at the beginning, in the middle and at the end of the script. In 4.2 and prior SQL comments never were an issue (at least for HDP 2.0 through 2.2).
Since Hortonworks still ships phoenix 4.4 with their latest 2.4 release, would it be possible to create a patch for 4.4 branch?

@julianhyde
Copy link
Owner

@seva0stapenko While I work for hortonworks, sqlline is a project that I maintain as an individual. I don't think it is likely that hortonworks would issue a patch to fix a sqlline issue. First, maybe someone could contribute a patch to fix the issue. Then, it will at least appear in future versions of phoenix. And since sqlline is launched via a simple shell script, it should be possible to install a new sqlline without going through a formal back-port process.

@julianhyde
Copy link
Owner

Fixed in 20b1cce.

@julianhyde julianhyde changed the title Scripts where the first line beginning with -- are not treated as comments Script fails if first line is a comment May 14, 2016
@julianhyde
Copy link
Owner

Also fixed the case where the first line of the script is empty or only spaces.

@JamesRTaylor
Copy link
Author

Thanks, Julian!

@seva0stapenko
Copy link

As far as I can see, the fix did not make it into HDP 2.5.0. Scripts with the comments in the first line still cause sqlline to error out.

For my personal understanding, what is the relation between this repo and Apache Phoenix repo? If it's fixed here, will it be merged into Phoenix code-base at some point? Is there a Phoenix JIRA for this issue?

@julianhyde
Copy link
Owner

I haven't made a release of sqlline yet. I would make releases more often if there were more contributions.

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

No branches or pull requests

3 participants