hive-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "muxin (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (HIVE-15822) beeline ignore all sql under comment after semicolon
Date Mon, 06 Feb 2017 08:58:44 GMT

     [ https://issues.apache.org/jira/browse/HIVE-15822?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

muxin updated HIVE-15822:
-------------------------
    Description: 
way to reproduce this error:
beeline -u jdbc:hive2://localhost:10000 -n test -e "
show databases;--some comment here
show tables;"

it will only execute 'show databases', and consider 
'--some comment here
show tables;'
as comment( all sql under the first comment appeared after semicolon).

when the comment is also end with semicolon, the result will be right.

the root cause is that beeline will only consider a entire command is inputed when a line
is end with semicolon, otherwise if this line is not started with '--' or '#' beeline will
combine it with next line until meet semicolon in the end. so actually the comment above is
not removed(which causes the error). then beeline split the entire line by ';', 'show databases'
is recognized and executed,
'--some comment here\n show tables' is considered a comment and discarded.

my solution is to just remove comment before split by ';', the code can refer to solution
2 for similar issue :https://issues.apache.org/jira/browse/HIVE-15820

  was:
way to reproduce this error:
beeline -u jdbc:hive2://localhost:10000 -n test -e "
show databases;--some comment here
show tables;"

it will only execute 'show databases', and consider 
'--some comment here
show tables;'
as comment, then ignore all sql under the first comment appeared after semicolon.

when the comment is also end with semicolon, the result will be right.

the root cause is that beeline will only consider a entire command is inputed when a line
is end with semicolon, otherwise if this line is not started with '--' or '#' beeline will
combine it with next line until meet semicolon in the end. so actually the comment above is
not removed(which causes the error). then beeline split the entire line by ';', 'show databases'
is recognized and executed,
'--some comment here\n show tables' is considered a comment and discarded.

my solution is to just remove comment before split by ';', the code can refer to solution
2 for similar issue :https://issues.apache.org/jira/browse/HIVE-15820


> beeline ignore all sql under comment after semicolon
> ----------------------------------------------------
>
>                 Key: HIVE-15822
>                 URL: https://issues.apache.org/jira/browse/HIVE-15822
>             Project: Hive
>          Issue Type: Bug
>          Components: Beeline, HiveServer2
>    Affects Versions: 1.2.1, 2.1.1
>            Reporter: muxin
>
> way to reproduce this error:
> beeline -u jdbc:hive2://localhost:10000 -n test -e "
> show databases;--some comment here
> show tables;"
> it will only execute 'show databases', and consider 
> '--some comment here
> show tables;'
> as comment( all sql under the first comment appeared after semicolon).
> when the comment is also end with semicolon, the result will be right.
> the root cause is that beeline will only consider a entire command is inputed when a
line is end with semicolon, otherwise if this line is not started with '--' or '#' beeline
will combine it with next line until meet semicolon in the end. so actually the comment above
is not removed(which causes the error). then beeline split the entire line by ';', 'show databases'
is recognized and executed,
> '--some comment here\n show tables' is considered a comment and discarded.
> my solution is to just remove comment before split by ';', the code can refer to solution
2 for similar issue :https://issues.apache.org/jira/browse/HIVE-15820



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message