我在Hive上运行类似于:
的查询SELECT *
FROM (SELECT a
FROM b
WHERE
sex = 'M'
AND degree = 'Bs'
AND age = 15
AND name LIKE 'L%'
);
错误是:
cannot recognize input near '<EOF>' '<EOF>' '<EOF>' in subquery source
答案 0 :(得分:20)
为Hive添加子查询的表别名是必需的。下面我使用't1'作为别名:
SELECT *
FROM (SELECT a
FROM b
WHERE
sex = 'M'
AND degree = 'Bs'
AND age = 15
AND name LIKE 'L%'
) t1 ;
答案 1 :(得分:2)
所有下选票都没有道理。 Hive通常不会产生正确的错误并且会导致懒惰&#34; EOF&#34;在你身边在这种情况下,您只需要为子查询指定表别名。 SELECT * FROM (.....) tbl_alias