Pass a filter parameter to view in hive so that it is applied to the table as well.

I am creating a view in hive which unions two tables and has a lot of data. Is there any way to pass a filter parameter to view in hive so that it is applied to the table as well.

CREATE VIEW myview
AS
SELECT * FROM
(SELECT * FROM mytable
UNION
SELECT * datatable) temp;

If I run something like SELECT * FROM myview WHERE day='2019-02-01' It should return the union on the selected date only like….
SELECT * FROM mytable WHERE day='2019-02-01' UNION
SELECT * FROM datatable WHERE day='2019-02-01'

How do I create a view to do this. Please help me.
Thanks in advance.

Tagged:
Sign In or Register to comment.