[ https://issues.apache.org/jira/browse/HIVE-7647?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14136496#comment-14136496 ]
Xuefu Zhang commented on HIVE-7647: ----------------------------------- +1 > Beeline does not honor --headerInterval and --color when executing with "-e" > ---------------------------------------------------------------------------- > > Key: HIVE-7647 > URL: https://issues.apache.org/jira/browse/HIVE-7647 > Project: Hive > Issue Type: Bug > Components: CLI > Affects Versions: 0.14.0 > Reporter: Naveen Gangam > Assignee: Naveen Gangam > Priority: Minor > Fix For: 0.14.0 > > Attachments: HIVE-7647.1.patch > > > --showHeader is being honored > [root@localhost ~]# beeline --showHeader=false -u > 'jdbc:hive2://localhost:10000/default' -n hive -d > org.apache.hive.jdbc.HiveDriver -e "select * from sample_07 limit 10;" > Connecting to jdbc:hive2://localhost:10000/default > Connected to: Apache Hive (version 0.12.0-cdh5.0.1) > Driver: Hive JDBC (version 0.12.0-cdh5.0.1) > Transaction isolation: TRANSACTION_REPEATABLE_READ > -hiveconf (No such file or directory) > +----------+--------------------------------------+------------+---------+ > | 00-0000 | All Occupations | 135185230 | 42270 | > | 11-0000 | Management occupations | 6152650 | 100310 | > | 11-1011 | Chief executives | 301930 | 160440 | > | 11-1021 | General and operations managers | 1697690 | 107970 | > | 11-1031 | Legislators | 64650 | 37980 | > | 11-2011 | Advertising and promotions managers | 36100 | 94720 | > | 11-2021 | Marketing managers | 166790 | 118160 | > | 11-2022 | Sales managers | 333910 | 110390 | > | 11-2031 | Public relations managers | 51730 | 101220 | > | 11-3011 | Administrative services managers | 246930 | 79500 | > +----------+--------------------------------------+------------+---------+ > 10 rows selected (0.838 seconds) > Beeline version 0.12.0-cdh5.1.0 by Apache Hive > Closing: org.apache.hive.jdbc.HiveConnection > --outputFormat is being honored. > [root@localhost ~]# beeline --outputFormat=csv -u > 'jdbc:hive2://localhost:10000/default' -n hive -d > org.apache.hive.jdbc.HiveDriver -e "select * from sample_07 limit 10;" > Connecting to jdbc:hive2://localhost:10000/default > Connected to: Apache Hive (version 0.12.0-cdh5.0.1) > Driver: Hive JDBC (version 0.12.0-cdh5.0.1) > Transaction isolation: TRANSACTION_REPEATABLE_READ > 'code','description','total_emp','salary' > '00-0000','All Occupations','135185230','42270' > '11-0000','Management occupations','6152650','100310' > '11-1011','Chief executives','301930','160440' > '11-1021','General and operations managers','1697690','107970' > '11-1031','Legislators','64650','37980' > '11-2011','Advertising and promotions managers','36100','94720' > '11-2021','Marketing managers','166790','118160' > '11-2022','Sales managers','333910','110390' > '11-2031','Public relations managers','51730','101220' > '11-3011','Administrative services managers','246930','79500' > 10 rows selected (0.664 seconds) > Beeline version 0.12.0-cdh5.1.0 by Apache Hive > Closing: org.apache.hive.jdbc.HiveConnection > both --color & --headerInterval are being honored when executing using "-f" > option (reads query from a file rather than the commandline) (cannot really > see the color here but use the terminal colors) > [root@localhost ~]# beeline --showheader=true --color=true --headerInterval=5 > -u 'jdbc:hive2://localhost:10000/default' -n hive -d > org.apache.hive.jdbc.HiveDriver -f /tmp/tmp.sql > Connecting to jdbc:hive2://localhost:10000/default > Connected to: Apache Hive (version 0.12.0-cdh5.0.1) > Driver: Hive JDBC (version 0.12.0-cdh5.0.1) > Transaction isolation: TRANSACTION_REPEATABLE_READ > Beeline version 0.12.0-cdh5.1.0 by Apache Hive > 0: jdbc:hive2://localhost> select * from sample_07 limit 8; > +----------+--------------------------------------+------------+---------+ > | code | description | total_emp | salary | > +----------+--------------------------------------+------------+---------+ > | 00-0000 | All Occupations | 135185230 | 42270 | > | 11-0000 | Management occupations | 6152650 | 100310 | > | 11-1011 | Chief executives | 301930 | 160440 | > | 11-1021 | General and operations managers | 1697690 | 107970 | > | 11-1031 | Legislators | 64650 | 37980 | > +----------+--------------------------------------+------------+---------+ > | code | description | total_emp | salary | > +----------+--------------------------------------+------------+---------+ > | 11-2011 | Advertising and promotions managers | 36100 | 94720 | > | 11-2021 | Marketing managers | 166790 | 118160 | > | 11-2022 | Sales managers | 333910 | 110390 | > +----------+--------------------------------------+------------+---------+ > 8 rows selected (0.921 seconds) > 0: jdbc:hive2://localhost> Closing: org.apache.hive.jdbc.HiveConnection > But when running > beeline --showheader=true --color=true --headerInterval=5 -u > 'jdbc:hive2://localhost:10000/default' -n hive -d > org.apache.hive.jdbc.HiveDriver -e "select * from sample_07 limit 8;" > headerInterval & color are being overridden in the code. > From Beeline.java > if (commands.size() > 0) { > // for single command execute, disable colorgetOpts().setColor(false); > getOpts().setHeaderInterval(-1); > This overrides the default behavior. The documentation states that the > default headerInterval is 100 for "table" output format. By default "table" > output format is used with "-e" option but that headerInterval is being set > to "-1" which results in header being printed after every row (since > HIVE-7200). -- This message was sent by Atlassian JIRA (v6.3.4#6332)