Error Message: TOK_ALLCOLREF is not supported in current context - while Using DISTINCT in HIVE

user3107144 picture user3107144 · Jan 13, 2014 · Viewed 24.8k times · Source

I'm using the simple command: SELECT DISTINCT * FROM first_working_table; in HIVE 0.11, and I'm receiving the following error message:

FAILED: SemanticException TOK_ALLCOLREF is not supported in current context.

Does anyone know why this is happening? How can we solve it?

Thank you, Gal.

Answer

Nigel Tufnel picture Nigel Tufnel · Jan 13, 2014

Hive doesn't support DISTINCT * syntax. You can manually specify every field of the table to get the same result:

SELECT DISTINCT field1, field2, ...., fieldN
  FROM first_working_table