how can we test HIVE functions without referencing a table

If you are Java developer, you can write Junit Test cases and test the UDFs..

you can search the source code of all hive built in functions in grepcode.

http://grepcode.com/file/repo1.maven.org/maven2/org.apache.hive/hive-exec/1.0.0/org/apache/hadoop/hive/ql/udf/UDFWeekOfYear.java


You do not need table to test UDF since Hive 0.13.0.

See this Jira: HIVE-178 SELECT without FROM should assume a one-row table with no columns

Test:

hive> SELECT weekofyear('2013-12-31');

Result:

1

The source code (master branch) is here: UDFWeekOfYear.java

Tags:

Sql

Hive

Hiveql