Skip to content

Commit 677b542

Browse files
committed
add or revise function description
1 parent 56821a2 commit 677b542

35 files changed

+138
-10
lines changed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,19 +51,19 @@ You can also directly download file from [release page](https://github.com/aaron
5151

5252
| function| description |
5353
|:--|:--|
54-
|array_contains(array, value) -> boolean | whether ARRAY contains value or not.|
55-
|array_intersect(array, array) -> array | returns the two array's intersection, without duplicates..|
54+
|array_contains(array<E>, E) -> boolean | whether array contains value or not.|
55+
|array_intersect(array, array) -> array | returns the two array's intersection, without duplicates.|
5656
|array_max(array<E>) -> E | returns the maximum value of input array.|
5757
|array_min(array<E>) -> E | returns the minimum value of input array.|
5858
|array_join(array, delimiter, null_replacement) -> string | concatenates the elements of the given array using the delimiter and an optional `null_replacement` to replace nulls.|
5959
|array_distinct(array) -> array | remove duplicate values from the array.|
60-
|array_position(array, value) -> long | returns the position of the first occurrence of the element in array (or 0 if not found).|
61-
|array_remove(array, value) -> array | remove all elements that equal element from array.|
60+
|array_position(array<E>, E) -> long | returns the position of the first occurrence of the element in array (or 0 if not found).|
61+
|array_remove(array<E>, E) -> array | remove all elements that equal element from array.|
6262
|array_reverse(array) -> array | reverse the array element.|
63-
|array_sort(array) -> array | sorts and returns the array x. The elements of x must be orderable..|
63+
|array_sort(array) -> array | sorts and returns the array. The elements of array must be orderable.|
6464
|array_concat(array, array) -> array | concatenates two arrays.|
65-
|array_value_count(array, value) -> long | count ARRAY's element number that element value equals given value.|
66-
|array_slice(array, start, length) -> array | subsets array starting from index start (or starting from the end if start is negative) with a length of length|
65+
|array_value_count(array<E>, E) -> long | count array's element number that element value equals given value.|
66+
|array_slice(array, start, length) -> array | subsets array starting from index start (or starting from the end if start is negative) with a length of length.|
6767
|array_element_at(array<E>, index) -> E | returns element of array at given index. If index < 0, element_at accesses elements from the last to the first.|
6868

6969
### 3. date functions
@@ -79,7 +79,7 @@ You can also directly download file from [release page](https://github.com/aaron
7979
| function| description |
8080
|:--|:--|
8181
|json_array_get(json, jsonPath) -> array(varchar) |returns the element at the specified index into the `json_array`. The index is zero-based.|
82-
|json_array_length(json, jsonPath) -> array(varchar) |Returns the array length of `json` (a string containing a JSON array).|
82+
|json_array_length(json, jsonPath) -> array(varchar) |returns the array length of `json` (a string containing a JSON array).|
8383
|json_array_extract(json, jsonPath) -> array(varchar) |extract json array by given jsonPath.|
8484
|json_array_extract_scalar(json, jsonPath) -> array(varchar) |like `json_array_extract`, but returns the result value as a string (as opposed to being encoded as JSON).|
8585
|json_extract(json, jsonPath) -> array(varchar) |extract json by given jsonPath.|

src/main/java/cc/shanruifeng/functions/array/UDFArrayConcat.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package cc.shanruifeng.functions.array;
22

33
import java.util.ArrayList;
4+
import org.apache.hadoop.hive.ql.exec.Description;
45
import org.apache.hadoop.hive.ql.exec.UDFArgumentException;
56
import org.apache.hadoop.hive.ql.exec.UDFArgumentLengthException;
67
import org.apache.hadoop.hive.ql.exec.UDFArgumentTypeException;
@@ -13,6 +14,9 @@
1314
* @date 2016-07-26
1415
* @time 17:30
1516
*/
17+
@Description(name = "array_concat"
18+
, value = "_FUNC_(array, array) - concatenates two arrays."
19+
, extended = "Example:\n > select _FUNC_(array, array) from src;")
1620
public class UDFArrayConcat extends GenericUDF {
1721
private static final int ARG_COUNT = 2; // Number of arguments to this UDF
1822
private transient ListObjectInspector leftArrayOI;

src/main/java/cc/shanruifeng/functions/array/UDFArrayContains.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package cc.shanruifeng.functions.array;
22

3+
import org.apache.hadoop.hive.ql.exec.Description;
34
import org.apache.hadoop.hive.ql.exec.UDFArgumentException;
45
import org.apache.hadoop.hive.ql.exec.UDFArgumentLengthException;
56
import org.apache.hadoop.hive.ql.exec.UDFArgumentTypeException;
@@ -15,6 +16,9 @@
1516
* @author ruifeng.shan
1617
* @date 2015-3-23
1718
*/
19+
@Description(name = "array_contains"
20+
, value = "_FUNC_(array<E>, E) - whether array contains value or not."
21+
, extended = "Example:\n > select _FUNC_(array, value) from src;")
1822
public class UDFArrayContains extends GenericUDF {
1923

2024
private static final int ARRAY_IDX = 0;

src/main/java/cc/shanruifeng/functions/array/UDFArrayDistinct.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import it.unimi.dsi.fastutil.ints.IntArrays;
44
import java.util.ArrayList;
5+
import org.apache.hadoop.hive.ql.exec.Description;
56
import org.apache.hadoop.hive.ql.exec.UDFArgumentException;
67
import org.apache.hadoop.hive.ql.exec.UDFArgumentLengthException;
78
import org.apache.hadoop.hive.ql.exec.UDFArgumentTypeException;
@@ -16,6 +17,9 @@
1617
* @date 2016-07-26
1718
* @time 17:29
1819
*/
20+
@Description(name = "array_distinct"
21+
, value = "_FUNC_(array) - remove duplicate values from the array."
22+
, extended = "Example:\n > select _FUNC_(array) from src;")
1923
public class UDFArrayDistinct extends GenericUDF {
2024
private static final int INITIAL_SIZE = 128;
2125
private static final int ARG_COUNT = 1; // Number of arguments to this UDF

src/main/java/cc/shanruifeng/functions/array/UDFArrayElementAt.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package cc.shanruifeng.functions.array;
22

3+
import org.apache.hadoop.hive.ql.exec.Description;
34
import org.apache.hadoop.hive.ql.exec.UDFArgumentException;
45
import org.apache.hadoop.hive.ql.exec.UDFArgumentLengthException;
56
import org.apache.hadoop.hive.ql.exec.UDFArgumentTypeException;
@@ -16,6 +17,9 @@
1617
* @date 2016-07-27
1718
* @time 10:09
1819
*/
20+
@Description(name = "array_element_at"
21+
, value = "_FUNC_(array<E>, index) - returns element of array at given index. If index < 0, element_at accesses elements from the last to the first."
22+
, extended = "Example:\n > select _FUNC_(array, index) from src;")
1923
public class UDFArrayElementAt extends GenericUDF {
2024

2125
private static final int ARRAY_IDX = 0;

src/main/java/cc/shanruifeng/functions/array/UDFArrayIntersect.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import it.unimi.dsi.fastutil.ints.IntArrays;
44
import java.util.ArrayList;
5+
import org.apache.hadoop.hive.ql.exec.Description;
56
import org.apache.hadoop.hive.ql.exec.UDFArgumentException;
67
import org.apache.hadoop.hive.ql.exec.UDFArgumentLengthException;
78
import org.apache.hadoop.hive.ql.exec.UDFArgumentTypeException;
@@ -17,6 +18,9 @@
1718
* @date 2016-07-26
1819
* @time 11:57
1920
*/
21+
@Description(name = "array_intersect"
22+
, value = "_FUNC_(array, array) - returns the two array's intersection, without duplicates."
23+
, extended = "Example:\n > select _FUNC_(array, array) from src;")
2024
public class UDFArrayIntersect extends GenericUDF {
2125
private static final int INITIAL_SIZE = 128;
2226
private static final int ARG_COUNT = 2; // Number of arguments to this UDF

src/main/java/cc/shanruifeng/functions/array/UDFArrayJoin.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package cc.shanruifeng.functions.array;
22

3+
import org.apache.hadoop.hive.ql.exec.Description;
34
import org.apache.hadoop.hive.ql.exec.UDFArgumentException;
45
import org.apache.hadoop.hive.ql.exec.UDFArgumentLengthException;
56
import org.apache.hadoop.hive.ql.exec.UDFArgumentTypeException;
@@ -17,6 +18,9 @@
1718
* @date 2016-07-26
1819
* @time 17:31
1920
*/
21+
@Description(name = "array_join"
22+
, value = "_FUNC_(array<E>, delimiter, null_replacement) - concatenates the elements of the given array using the delimiter and an optional null_replacement to replace nulls."
23+
, extended = "Example:\n > select _FUNC_(array, delimiter) from src;\n> select _FUNC_(array, delimiter, null_replacement) from src;")
2024
public class UDFArrayJoin extends GenericUDF {
2125

2226
private static final int ARRAY_IDX = 0;

src/main/java/cc/shanruifeng/functions/array/UDFArrayMax.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package cc.shanruifeng.functions.array;
22

33
import it.unimi.dsi.fastutil.ints.IntArrays;
4+
import org.apache.hadoop.hive.ql.exec.Description;
45
import org.apache.hadoop.hive.ql.exec.UDFArgumentException;
56
import org.apache.hadoop.hive.ql.exec.UDFArgumentLengthException;
67
import org.apache.hadoop.hive.ql.exec.UDFArgumentTypeException;
@@ -17,6 +18,9 @@
1718
* @date 2016-07-26
1819
* @time 17:31
1920
*/
21+
@Description(name = "array_max"
22+
, value = "_FUNC_(array) - returns the maximum value of input array."
23+
, extended = "Example:\n > select _FUNC_(array) from src;")
2024
public class UDFArrayMax extends GenericUDF {
2125
private static final int INITIAL_SIZE = 128;
2226
private static final int ARG_COUNT = 1; // Number of arguments to this UDF

src/main/java/cc/shanruifeng/functions/array/UDFArrayMin.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package cc.shanruifeng.functions.array;
22

33
import it.unimi.dsi.fastutil.ints.IntArrays;
4+
import org.apache.hadoop.hive.ql.exec.Description;
45
import org.apache.hadoop.hive.ql.exec.UDFArgumentException;
56
import org.apache.hadoop.hive.ql.exec.UDFArgumentLengthException;
67
import org.apache.hadoop.hive.ql.exec.UDFArgumentTypeException;
@@ -17,6 +18,9 @@
1718
* @date 2016-07-26
1819
* @time 17:32
1920
*/
21+
@Description(name = "array_min"
22+
, value = "_FUNC_(array) - returns the minimum value of input array."
23+
, extended = "Example:\n > select _FUNC_(array) from src;")
2024
public class UDFArrayMin extends GenericUDF {
2125
private static final int INITIAL_SIZE = 128;
2226
private static final int ARG_COUNT = 1; // Number of arguments to this UDF

src/main/java/cc/shanruifeng/functions/array/UDFArrayPosition.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package cc.shanruifeng.functions.array;
22

3+
import org.apache.hadoop.hive.ql.exec.Description;
34
import org.apache.hadoop.hive.ql.exec.UDFArgumentException;
45
import org.apache.hadoop.hive.ql.exec.UDFArgumentLengthException;
56
import org.apache.hadoop.hive.ql.exec.UDFArgumentTypeException;
@@ -16,6 +17,9 @@
1617
* @date 2016-07-26
1718
* @time 17:32
1819
*/
20+
@Description(name = "array_position"
21+
, value = "_FUNC_(array<E>, E) - returns the position of the first occurrence of the element in array (or 0 if not found)."
22+
, extended = "Example:\n > select _FUNC_(array, value) from src;")
1923
public class UDFArrayPosition extends GenericUDF {
2024

2125
private static final int ARRAY_IDX = 0;

0 commit comments

Comments
 (0)