1

I am thinking about make a query as a function in Hive. For example

SELECT * FROM TABLE WHERE COLUMN=VALUE

I want to make VALUE as an argument of the function. Each time I pass a particular value into it, it can output the query result. I found an example here How to return result of a SELECT inside a function in PostgreSQL? ,which is exactly same as what I want to do. But this example is not in Hive.

Any help is greatly appreciated!

Community
  • 1
  • 1
frederick
  • 11
  • 3

1 Answers1

0

This is a bit long for a comment.

What you are looking for is a table-valued function. Or, in Hive-speak, a UDTF (user-defined table-valued function).

Defining one is not trivial, but it is definitely possible. The place to start is with the documentation, here.

Gordon Linoff
  • 1,242,037
  • 58
  • 646
  • 786