Pankaj
Pankaj

Reputation: 369

How to use output of hive query in another hive query?

Hello Friends,

I want to use output of one query in another query.

set iCount = 12;

This constant value is fine, but I don't know how to set this variable dynamically as given below.

set iCount = select count(distinct colName) from table;

This will result a string, whatever query is passed. Instead of query I want result of this query.

Thanks in advance

Pankaj Sharma

Upvotes: 1

Views: 507

Answers (1)

Balduz
Balduz

Reputation: 3570

You can't do it that way. You could try using Oozie to automate the hive query and the java process you want to execute, storing the output of the hive query in a directory that the java program will read from.

Upvotes: 1

Related Questions