Naveen Gangam created HIVE-7647: ----------------------------------- Summary: 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.13.0 Reporter: Naveen Gangam Assignee: Naveen Gangam Priority: Minor
--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) hive.aux.jars.path=file:/usr/lib/hive/lib/hive-hbase-handler-0.12.0-cdh5.0.1.jar,file:/usr/lib/hbase/hbase-hadoop-compat.jar,file:/usr/lib/hbase/hbase-protocol.jar,file:/usr/lib/hbase/hbase-hadoop2-compat.jar,file:/usr/lib/hbase/hbase-client.jar,file:/usr/lib/hbase/lib/htrace-core-2.01.jar,file:/usr/lib/hbase/lib/htrace-core.jar,file:/usr/lib/hbase/hbase-server.jar,file:/usr/lib/hbase/hbase-common.jar,file:/usr/share/java/mysql-connector-java.jar,file:/usr/share/cmf/lib/postgresql-9.0-801.jdbc4.jar (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 -hiveconf (No such file or directory) hive.aux.jars.path=file:/usr/lib/hive/lib/hive-hbase-handler-0.12.0-cdh5.0.1.jar,file:/usr/lib/hbase/hbase-hadoop-compat.jar,file:/usr/lib/hbase/hbase-protocol.jar,file:/usr/lib/hbase/hbase-hadoop2-compat.jar,file:/usr/lib/hbase/hbase-client.jar,file:/usr/lib/hbase/lib/htrace-core-2.01.jar,file:/usr/lib/hbase/lib/htrace-core.jar,file:/usr/lib/hbase/hbase-server.jar,file:/usr/lib/hbase/hbase-common.jar,file:/usr/share/java/mysql-connector-java.jar,file:/usr/share/cmf/lib/postgresql-9.0-801.jdbc4.jar (No such file or directory) '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 -hiveconf (No such file or directory) hive.aux.jars.path=file:/usr/lib/hive/lib/hive-hbase-handler-0.12.0-cdh5.0.1.jar,file:/usr/lib/hbase/hbase-hadoop-compat.jar,file:/usr/lib/hbase/hbase-protocol.jar,file:/usr/lib/hbase/hbase-hadoop2-compat.jar,file:/usr/lib/hbase/hbase-client.jar,file:/usr/lib/hbase/lib/htrace-core-2.01.jar,file:/usr/lib/hbase/lib/htrace-core.jar,file:/usr/lib/hbase/hbase-server.jar,file:/usr/lib/hbase/hbase-common.jar,file:/usr/share/java/mysql-connector-java.jar,file:/usr/share/cmf/lib/postgresql-9.0-801.jdbc4.jar (No such file or directory) 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.2#6252)