Files
impala/testdata/workloads/functional-query/queries/QueryTest/functions-ddl.test
Michael Ho f0c2742641 IMPALA-2004: Implement "SHOW CREATE" for udfs and udas.
This patch extends the SHOW statement to also support
user-defined functions and user-defined aggregate functions.
The syntax of the new SHOW statements is as follows:

SHOW CREATE [AGGREGATE] FUNCTION [<db_name>.]<func_name>;

<db_name> and <func_name> are the names of the database
and udf/uda respectively.

Sample outputs of the new SHOW statements are as follows:

Query: show create function fn
+------------------------------------------------------------------+
| result                                                           |
+------------------------------------------------------------------+
| CREATE FUNCTION default.fn()                                     |
|  RETURNS INT                                                     |
|  LOCATION 'hdfs://localhost:20500/test-warehouse/libTestUdfs.so' |
|  SYMBOL='_Z2FnPN10impala_udf15FunctionContextE'                  |
|                                                                  |
+------------------------------------------------------------------+

Query: show create aggregate function agg_fn
+------------------------------------------------------------------------------------------+
| result                                                                                   |
+------------------------------------------------------------------------------------------+
| CREATE AGGREGATE FUNCTION default.agg_fn(INT)                                            |
|  RETURNS BIGINT                                                                          |
|  LOCATION 'hdfs://localhost:20500/test-warehouse/libudasample.so'                        |
|  UPDATE_FN='_Z11CountUpdatePN10impala_udf15FunctionContextERKNS_6IntValEPNS_9BigIntValE' |
|  INIT_FN='_Z9CountInitPN10impala_udf15FunctionContextEPNS_9BigIntValE'                   |
|  MERGE_FN='_Z10CountMergePN10impala_udf15FunctionContextERKNS_9BigIntValEPS2_'           |
|  FINALIZE_FN='_Z13CountFinalizePN10impala_udf15FunctionContextERKNS_9BigIntValE'         |
|                                                                                          |
+------------------------------------------------------------------------------------------+

Please note that all the overloaded functions which match
the given function name and category will be printed.

This patch also extends the python test infrastructure to
support expected results which include newline characters.
A new subsection comment called 'MULTI_LINE' has been added
for the 'RESULT' section. With this comment, a test can
include its multi-line output inside [ ] and the content
inside [ ] will be treated as a single line, including the
newline character.

Change-Id: Idbe433eeaf5e24ed55c31d905fea2a6160c46011
Reviewed-on: http://gerrit.cloudera.org:8080/1271
Reviewed-by: Dimitris Tsirogiannis <dtsirogiannis@cloudera.com>
Tested-by: Internal Jenkins
2015-10-23 05:11:07 +00:00

11 KiB