Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Is it possible to read and insert data to the same table from a same user in hive

Highlighted

Is it possible to read and insert data to the same table from a same user in hive

New Contributor

Hi,

we have internal table, which is partitioned on date.

In the first run we loaded the data for 10 days, and in the second run we are trying to load thee data for 365 days.

Mean while in parallel we have application query running on table to fetch results from 10 days for which data is already loaded.

Will hive wait tor data load to be completed for 365 days to fetch results for the select query or will this query be run in parallel.

Thank You,

VIjay

1 REPLY 1

Re: Is it possible to read and insert data to the same table from a same user in hive

Super Guru
@Vijay Shivakumar

when you are loading 365 days data if your insert query is not touching already loaded 10 days partitions and you are accessing already existed partitions then there will be no issues another application query won't wait for the load of 365 days.

If your table is not partitioned (or) inserting into existing partition and you are trying to access table (or) partition which is inserting the data then there will be Exclusive lock, in this case your application will wait for until all data is loaded into the table.

Vice versa if your application triggered first, accessing the data in the table and another job triggered to insert data into the same table in this case your insert query will wait until first application completed then insert query will be executed.

You can check locks on the tables by using

Use <db_name>;
Show locks <table_name>;

Refer to this and this and this links for more details regards to locks in hive.

Don't have an account?
Coming from Hortonworks? Activate your account here