[ 
https://issues.apache.org/jira/browse/HIVE-19231?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16459875#comment-16459875
 ] 

Naveen Gangam commented on HIVE-19231:
--------------------------------------

[~aihuaxu] Running a beeline command using a cron job seems to be resulting in 
similar output that we were seeing that caused this issue.
{code:java}
  PID          S TTY          TIME COMMAND
22756 ?        S ?        00:00:00 bash /usr/lib/hive/bin/beeline -u 
jdbc:hive2://localhost:10000 -n hive -p hive -e select * from sample_08 where 
salary > 50000
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=512M; 
support was removed in 8.0
Java HotSpot(TM) 64-Bit Server VM warning: Using incremental CMS is deprecated 
and will likely be removed in a future release
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=512M; 
support was removed in 8.0
scan complete in 2ms
Connecting to jdbc:hive2://localhost:10000
Connected to: Apache Hive (version 1.1.0-cdh5.14.3-SNAPSHOT)
Driver: Hive JDBC (version 1.1.0-cdh5.14.3-SNAPSHOT)
Transaction isolation: TRANSACTION_REPEATABLE_READ
INFO  : Compiling 
command(queryId=hive_20180501100505_a212817e-e909-4e95-a449-581229c9dbc0): 
select * from sample_08 where salary > 50000
INFO  : Semantic Analysis Completed
INFO  : Returning Hive schema: 
Schema(fieldSchemas:[FieldSchema(name:sample_08.code, type:string, 
comment:null), FieldSchema(name:sample_08.description, type:string, 
comment:null), FieldSchema(name:samp
le_08.total_emp, type:int, comment:null), FieldSchema(name:sample_08.salary, 
type:int, comment:null)], properties:null)
INFO  : Completed compiling 
command(queryId=hive_20180501100505_a212817e-e909-4e95-a449-581229c9dbc0); Time 
taken: 0.123 seconds
INFO  : Executing 
command(queryId=hive_20180501100505_a212817e-e909-4e95-a449-581229c9dbc0): 
select * from sample_08 where salary > 50000
INFO  : Query ID = hive_20180501100505_a212817e-e909-4e95-a449-581229c9dbc0
INFO  : Total jobs = 1
INFO  : Launching Job 1 out of 1
INFO  : Starting task [Stage-1:MAPRED] in serial mode
INFO  : Number of reduce tasks is set to 0 since there's no reduce operator
INFO  : number of splits:1
INFO  : Submitting tokens for job: job_1525165852892_0012
INFO  : The url to track the job: 
http://<SNIPPED>:8088/proxy/application_1525165852892_0012/
INFO  : Starting Job = job_1525165852892_0012, Tracking URL = 
http://<SNIPPED>:8088/proxy/application_1525165852892_0012/
INFO  : Kill Command = /usr/lib/hadoop/bin/hadoop job  -kill 
job_1525165852892_0012
INFO  : Hadoop job information for Stage-1: number of mappers: 1; number of 
reducers: 0
INFO  : 2018-05-01 10:05:10,966 Stage-1 map = 0%,  reduce = 0%
INFO  : 2018-05-01 10:05:18,294 Stage-1 map = 100%,  reduce = 0%, Cumulative 
CPU 3.89 sec
INFO  : MapReduce Total cumulative CPU time: 3 seconds 890 msec
INFO  : Ended Job = job_1525165852892_0012
INFO  : MapReduce Jobs Launched:
INFO  : Stage-Stage-1: Map: 1   Cumulative CPU: 3.89 sec   HDFS Read: 50608 
HDFS Write: 16567 SUCCESS
INFO  : Total MapReduce CPU Time Spent: 3 seconds 890 msec
INFO  : Completed executing 
command(queryId=hive_20180501100505_a212817e-e909-4e95-a449-581229c9dbc0); Time 
taken: 13.981 seconds
INFO  : OK
{code}

However, running as a cron job with or without the fix does not seem to 
reproduce the issue whether running the script runs beeline in background or 
foreground (I suspect the way cron is run, it can never be run as a foreground 
process). So it appears we are good for this usecase as well.

Do you have additional concerns? Thanks

> Beeline generates garbled output when using UnsupportedTerminal
> ---------------------------------------------------------------
>
>                 Key: HIVE-19231
>                 URL: https://issues.apache.org/jira/browse/HIVE-19231
>             Project: Hive
>          Issue Type: Bug
>          Components: Beeline
>    Affects Versions: 2.1.0
>            Reporter: Naveen Gangam
>            Assignee: Naveen Gangam
>            Priority: Major
>         Attachments: HIVE-19231.patch
>
>
> We had a customer that was using some sort of front end that would invoke 
> beeline commands with some query files on a node that that remote to the HS2 
> node.
> So beeline runs locally on this edge but connects to a remote HS2. Since the 
> fix made in HIVE-14342, the beeline started producing garbled line in the 
> output. Something like
> {code:java}
> ^Mnull                                                   ^Mnull^Mnull         
>                                           ^Mnull00-0000 All Occupations 
> 135185230       42270
> 11-0000       Management occupations  6152650 100310{code}
>  
> I havent been able to reproduce the issue locally as I do not have their 
> system, but with some additional instrumentation I have been able to get some 
> info regarding the beeline process.
> Essentially, such invocation causes beeline process to run with 
> {{-Djline.terminal=jline.UnsupportedTerminal}} all the time and thus causes 
> the issue. They can run the same beeline command directly in the shell on the 
> same host and it does not cause this issue.
> PID            S   TTY          TIME COMMAND
> 44107  S    S  ?        00:00:00 bash beeline -u ...
> PID              S     TTY          TIME COMMAND
> 48453  S+   S     pts/4    00:00:00 bash beeline -u ...
> Somehow that process wasnt attached to any local terminals. So the check made 
> for /dev/stdin wouldnt work.
>  
> Instead an additional check to check the TTY session of the process before 
> using the UnsupportedTerminal (which really should only be used for 
> backgrounded beeline sessions) seems to resolve the issue.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to