I have a table that contains rows belonging to various dates. I want to CREATE A VIEW which should give me the data based on the date
CREATE VIEW newusers
AS
SELECT DISTINCT T1.uuid
FROM user_visit T1
WHERE T1.firstSeen="20140522";
I do not want to fix WHERE T1.firstSeen="20140522"; it can be any date like 20140525 etc. Is there any way that I can create a view with date as parameter?
Not really sure if creating a view with such variable actually works. With Hive 1.2 an onwards, this is what happens when you create table.
When creating a view, it always takes the static constant value. The one thing that might work would be staying outside the prompt, something like this.
In the hive script, just replace the date with a variable:
Then give that variable a value when invoking hive:
Or just set it from within hive: