Reputation: 1032
I am running a query on Hive similar to:
SELECT *
FROM (SELECT a
FROM b
WHERE
sex = 'M'
AND degree = 'Bs'
AND age = 15
AND name LIKE 'L%'
);
the error is:
cannot recognize input near '<EOF>' '<EOF>' '<EOF>' in subquery source
Upvotes: 22
Views: 25554
Reputation: 390
Adding a table alias for your subquery is necessary for Hive. Below I use 't1' as the alias:
SELECT *
FROM (SELECT a
FROM b
WHERE
sex = 'M'
AND degree = 'Bs'
AND age = 15
AND name LIKE 'L%'
) t1 ;
Upvotes: 40
Reputation: 93
All the down-votes are unjustified. Hive often does not produce correct error and throws lazy "EOF" at you. In this case you just need to specify table alias for your sub-query. SELECT * FROM (.....) tbl_alias
Upvotes: 6