MAPREDUCE服务 MRS-SHOW FUNCTIONS:示例

时间:2024-07-02 16:39:36

示例

SHOW functions;
 
--使用LIKE子句
show functions like 'boo_%';
 Function | Return Type | Argument Types | Function Type | Deterministic | Description 
----------|-------------|----------------|---------------|---------------|-------------
 bool_and | boolean     | boolean        | aggregate     | true          |             
 bool_or  | boolean     | boolean        | aggregate     | true          |             
(2 rows)

--如果匹配字符串中有字符与通配符冲突,可以指定转义字符来标识,示例为查询default这个schema下,table_name前缀为"t_" 的所有table,转义字符为"\":
SHOW FUNCTIONS LIKE 'array\_%' escape '\';
  Function     | Return Type |         Argument Types          | Function Type | Deterministic 
|                                              Description                                               | Variable Arity | Built In 
-----------------|-------------|---------------------------------|---------------|---------------
|--------------------------------------------------------------------------------------------------------|----------------|----------
 array_agg       | array(T)    | T                               | aggregate     | true          
| return an array of values                                                                              | false          | true     
 array_contains  | boolean     | array(T), T                     | scalar        | true          
| Determines whether given value exists in the array                                                     | false          | true     
 array_distinct  | array(E)    | array(E)                        | scalar        | true          
| Remove duplicate values from the given array                                                           | false          | true     
 array_except    | array(E)    | array(E), array(E)              | scalar        | true          
| Returns an array of elements that are in the first array but not the second, without duplicates.       | false          | true     
 array_intersect | array(E)    | array(E), array(E)              | scalar        | true          
| Intersects elements of the two given arrays                                                            | false          | true     
 array_join      | varchar     | array(T), varchar               | scalar        | true          
| Concatenates the elements of the given array using a delimiter and an optional string to replace nulls | false          | true     
 array_join      | varchar     | array(T), varchar, varchar      | scalar        | true          
| Concatenates the elements of the given array using a delimiter and an optional string to replace nulls | false          | true     
 array_max       | T           | array(T)                        | scalar        | true          
| Get maximum value of array                                                                             | false          | true     
 array_min       | T           | array(T)                        | scalar        | true          
| Get minimum value of array                                                                             | false          | true     
 array_position  | bigint      | array(T), T                     | scalar        | true          
| Returns the position of the first occurrence of the given value in array (or 0 if not found)           | false          | true     
 array_remove    | array(E)    | array(E), E                     | scalar        | true          
| Remove specified values from the given array                                                           | false          | true     
 array_sort      | array(E)    | array(E)                        | scalar        | true          
| Sorts the given array in ascending order according to the natural ordering of its elements.            | false          | true     
 array_sort      | array(T)    | array(T), function(T,T,integer) | scalar        | true          
| Sorts the given array with a lambda comparator.                                                        | false          | true     
 array_union     | array(E)    | array(E), array(E)              | scalar        | true          
| Union elements of the two given arrays                                                                 | false          | true     

--查看所有JAVA函数
SHOW external functions;
  Function                  |   Owner   
----------------------------|-----------
 example.namespace02.repeat | admintest 
 hetu.default.add_two       | admintest 
(2 rows)

--查看给定函数的定义信息
SHOW external function example.namespace02.repeat;
          External Function           
--------------------------------------
External FUNCTION example.namespace02.repeat (
    s varchar,                        
    n integer    
 )
 RETURNS varchar  

 COMMENT 'repeat'
 LANGUAGE JAVA
 DETERMINISTIC
 CALLED ON NULL INPUT
 SYMBOL com.test.udf.hetuengine.functions.repeat
 URI hdfs://hacluster/user/hetuserver/udf/data/hetu_udf/udf-test-0.0.1-SNAPSHOT.jar

 FUNCPROPERTIES (
    owner = 'admintest'
 )
support.huaweicloud.com/cmpntguide-lts-mrs/mrs_01_300158.html