[
https://issues.apache.org/jira/browse/HIVE-10087?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14380690#comment-14380690
]
Naveen Gangam commented on HIVE-10087:
--------------------------------------
This is coming from the jline code. As it reads from the script file character
by character, it adds it to the StringBuffer and also echoes it to the
terminal, if mask character is null. In this case, we have set the mask
character to null character value to prevent this echo. When it encounters a
EOL character in the file aka ";", it completes the line and prints a newline
character and returns the line to beeline to be executed.
{code}
<snip>
case ACCEPT_LINE:
return accept();
</snip>
<snip>
public String accept() throws IOException {
moveToEnd();
println(); // output newline
flush();
return finishBuffer();
}
</snip>
<snip>
public final void println() throws IOException {
print(CR);
}
</snip>
{code}
If this newline were to be turned off, the first line of the result set would
be printed on the same line as the query. Something like this
{code}
$ beeline -u jdbc:hive2://localhost:10000/default --showHeader=false
--silent=false --outputformat=tsv2 -f query.sql
scan complete in 2ms
Connecting to jdbc:hive2://localhost:10000/default
0: jdbc:hive2://localhost> select * from booleantest limit 5;true t
false f
TRUE T
FALSE F
ZERO 0
{code}
jline code does not provide any APIs to allow me to dictate this. Something
like this should fix this. I will file a jira against jline.
{code}
public final void println() throws IOException {
if (mask == null)
print(CR);
}
{code}
For now, we may have to get by with what we have.
> Beeline's --silent option should suppress query from being echoed when
> running with -f option
> ---------------------------------------------------------------------------------------------
>
> Key: HIVE-10087
> URL: https://issues.apache.org/jira/browse/HIVE-10087
> Project: Hive
> Issue Type: Bug
> Components: Beeline
> Affects Versions: 0.13.0
> Reporter: Naveen Gangam
> Assignee: Naveen Gangam
> Priority: Minor
> Attachments: HIVE-10087.patch
>
>
> The {{-e}} and the {{-f}} options behave differently.
> {code}
> beeline -u jdbc:hive2://localhost:10000/default --showHeader=false
> --silent=true -f select.sql
> 0: jdbc:hive2://localhost:10000/default> select * from sample_07 limit 5;
> --------------------------------------------------------------------------------------
> 00-0000 All Occupations 134354250 40690
> 11-0000 Management occupations 6003930 96150
> 11-1011 Chief executives 299160 151370
> 11-1021 General and operations managers 1655410 103780
> 11-1031 Legislators 61110 33880
> --------------------------------------------------------------------------------------
> beeline -u jdbc:hive2://localhost:10000/default --showHeader=false
> --silent=true -e "select * from sample_07 limit 5;"
> --------------------------------------------------------------------------------------
> 00-0000 All Occupations 134354250 40690
> 11-0000 Management occupations 6003930 96150
> 11-1011 Chief executives 299160 151370
> 11-1021 General and operations managers 1655410 103780
> 11-1031 Legislators 61110 33880
> --------------------------------------------------------------------------------------
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)