Run queries from external files as subqueries

2013-06-20 Thread Sha Liu
Hi, While working on some complex queries with multiple level of subqueries, I'm wonder if it is possible in Hive to refactor these subqueries into different files and instruct the enclosing query to execute these files. This way these subqueries can potentially be reused by other questions or

Re: Run queries from external files as subqueries

2013-06-20 Thread Bertrand Dechoux
I am afraid that there is no automatic way of doing so. But that would be the same answer whether the question is about hive or any relational database. (I would be glad to have counter examples.) You might want to look at oozie in order to manage worflow. But the creation of the worflow is

Re: Run queries from external files as subqueries

2013-06-20 Thread Jan DolinĂ¡r
Quick and dirty way to do such thing would be to use some kind of preprocessor. To avoid writing one, you could use e.g. the one from GCC, with just a little help from sed: gcc -E -x c query.hql -o- | sed '/#/d' preprocessed.hql hive -f preprocessed.hql Where query.hql can contain for