Hive rewriting table

I am new to Hive and I wanted to know if the rewrite insert would overwrite the existing table that I created. I want to filter out an already created table by calling it in TableA to select only those rows where the age is greater than 18. Can I achieve this using the insert rewrite table?

I'm thinking of writing something like:

INSERT OVERWRITE TABLE TableA SELECT a.Age FROM TableA WHERE a.Age > = 18 

Does the table I created have NA entries, but I assume that after filtering this table, there will be no names in the "Age" column?

+5
source share
1 answer

Autofiltration and insertion are not supported, but in the hive.

I would suggest the following steps in your case:

  • Create a similar table, say tabB, with the same structure.

     create table tabB like tableA; 

2. Then you can apply your filter and paste it into this new table.

  INSERT OVERWRITE TABLE tabB SELECT a.Age FROM TableA WHERE a.Age > = 18 

Hope this helps.

+18
source

Source: https://habr.com/ru/post/1203895/


All Articles