Bharath Vissapragada has posted comments on this change.

Change subject: IMPALA-2336: Ignore trailing comments in non-interactive mode
......................................................................


Patch Set 2:

(4 comments)

http://gerrit.cloudera.org:8080/#/c/3169/2/shell/impala_shell.py
File shell/impala_shell.py:

Line 1171:   # Remove trailing comments, if any
> Please explain why this is needed
Done


Line 1172:   if query_list and not sqlparse.format(query_list[-1], 
strip_comments=True).strip("\n"):
> Why only look at the last item in the list? Why not pop all the empty items
Added a comment above. Hope it makes it clear. Trailing comment issue is a 
problem only with last element in the list (since all the trailing comments are 
grouped together into one query in that list). So we check if its only just a 
comment and pop it off if it isn't


http://gerrit.cloudera.org:8080/#/c/3169/2/tests/shell/test_file_comments.sql
File tests/shell/test_file_comments.sql:

Line 18: select * from foo where '--';
> this sql is actually valid - my bad, can you make it valie, e.g.
@Alex: 
- Made it a valid query
- However nested multi-line comments are ambiguous, I think the parser is 
greedy and matches the first */ and ends the comment there. Else we can parse 
the same file multiple ways. It doesn't work with mysql either. For ex:

/* test
/* select 1; */ */
select 1;

ERROR 1064 (42000) at line 2: You have an error in your SQL syntax; check the 
manual that corresponds to your MySQL server version for the right syntax to 
use near '*/


Line 21: */
> Doesn't the comment end at the line above? I think this line should be part
Yea , sry. Nested multiple block comments are ambiguous. Removed it. The 
intention here was to put a valid sql in the block comment and make sure the 
parser treats it as a comment rather than a query.


-- 
To view, visit http://gerrit.cloudera.org:8080/3169
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I723763ef7eedd03cf22058fadf06e9673a0d94d2
Gerrit-PatchSet: 2
Gerrit-Project: Impala
Gerrit-Branch: cdh5-2.6.0_5.8.0
Gerrit-Owner: Bharath Vissapragada <[email protected]>
Gerrit-Reviewer: Alex Behm <[email protected]>
Gerrit-Reviewer: Bharath Vissapragada <[email protected]>
Gerrit-Reviewer: Casey Ching <[email protected]>
Gerrit-Reviewer: Ishaan Joshi <[email protected]>
Gerrit-HasComments: Yes

Reply via email to