Connecting to Hive with Tez as execution engine:
hive --hiveconf hive.execution.engine=Tez
For showing headers when a table is queried:
set hive.cli.print.header=true;
When we use reserved key words we get error this can be avoided by setting the following param:
set hive.support.sql11.reserved.keywords=false;
set hive.optimize.index.filter=false;
Listing tables:
show tables;
Switching to a db:
use <db-name>;
When partition doesn't show up in a Hive table then repair the table using the command:
msck repair table <table-name>
Listing partitions:
show partitions <table-name>
Drop partition:
alter table email_features drop partition(year=2018,month=05,day=15);
For displaying the table DDL statement:
show create table <table-name>
Creating Hive table:
Alter table:
Drop a partition from the table:
ALTER TABLE my_table drop partition(year=2018,month=05,day=06);
Change the location of the path in the external Hive table:
ALTER TABLE my_table SET LOCATION "hdfs://path/to/file";
To drop all partitions in Hive table:
alter table schema.table drop partition (partitioncolumn != '');
hive --hiveconf hive.execution.engine=Tez
For showing headers when a table is queried:
set hive.cli.print.header=true;
When we use reserved key words we get error this can be avoided by setting the following param:
set hive.support.sql11.reserved.keywords=false;
set hive.optimize.index.filter=false;
Listing tables:
show tables;
Switching to a db:
use <db-name>;
When partition doesn't show up in a Hive table then repair the table using the command:
msck repair table <table-name>
Listing partitions:
show partitions <table-name>
Drop partition:
alter table email_features drop partition(year=2018,month=05,day=15);
For displaying the table DDL statement:
show create table <table-name>
Creating Hive table:
Alter table:
Drop a partition from the table:
ALTER TABLE my_table drop partition(year=2018,month=05,day=06);
Change the location of the path in the external Hive table:
ALTER TABLE my_table SET LOCATION "hdfs://path/to/file";
To drop all partitions in Hive table:
alter table schema.table drop partition (partitioncolumn != '');
No comments:
Post a Comment