remove duplicate headers in hive-beeline

815 views Asked by At
Select ACCOUNT_NUMBER, BIN AS RISK_BIN FROM test.daily_call_routing2;" 
| python -c 'exec("import sys;import csv;reader = csv.reader(sys.stdin, 
dialect=csv.excel_tab);writer = csv.writer(sys.stdout, 
dialect=csv.excel)\nfor row in reader: writer.writerow(row)")' > 
$EXPORT_DIR//home/rabbid160/test_$DATE_STR.csv;**

When I'm trying to execute the above command in beeline-hive, I am able to see the data however with multiple headers in between. Can anyone please tell me how this can be solved to only one header and data following.

Example as follows:

+-------------------+-----------+--+
| account_number | risk_bin |
+-------------------+-----------+--+
| 8498310230444304 | 2 |
| 8778104140754717 | 2 |
| 8155100513664825 | 2 |
| 8155100513664825 | 2 |
| 8155400040004812 | 2 |
| 8155200521190266 | 2 |
| 8155300210482543 | 2 |
| 8497202241094288 | 2 |
| 8155500010197049 | 2 |
+-------------------+-----------+--+
| account_number | risk_bin |
+-------------------+-----------+--+
| 8155100030718781 | 2 |
| 8495444731138751 | 2 |
| 8498320015120250 | 2 |
| 8498330360083177 | 2 |
| 8155300210487112 | 2 |
| 8777701821146336 | 2 |
| 8497202461586765 | 2 |
| 8155400310837610 | 2 |

1

There are 1 answers

0
Shubhangi On

In beeline, the number of rows after which header should be repeated is defined by beeline variable headerinterval .

You may set headerinterval using beeline command !set headerinterval 100

Set headerinterval to large value so that possibly you will see header only once.