You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* add next release version increase udf class.
* delete fastutil dependency, directly extract intarrays code into project, reduce generate jar file size.
* add some bitwise functions
* add some map functions
* add day_of_year, geo, url functions and some unit test.
Copy file name to clipboardExpand all lines: README.md
+90-11Lines changed: 90 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -35,7 +35,7 @@ It will generate hive-third-functions-${version}-shaded.jar in target directory.
35
35
36
36
You can also directly download file from [release page](https://github.com/aaronshan/hive-third-functions/releases).
37
37
38
-
> current latest version is `2.1.0`
38
+
> current latest version is `2.2.0`
39
39
40
40
## Functions
41
41
@@ -51,31 +51,41 @@ You can also directly download file from [release page](https://github.com/aaron
51
51
52
52
| function| description |
53
53
|:--|:--|
54
-
|array_contains(array<E>, E) -> boolean | whether array contains value or not.|
54
+
|array_contains(array<E>, E) -> boolean | whether array contains value or not.|
55
55
|array_intersect(array, array) -> array | returns the two array's intersection, without duplicates.|
56
-
|array_max(array<E>) -> E | returns the maximum value of input array.|
57
-
|array_min(array<E>) -> E | returns the minimum value of input array.|
56
+
|array_max(array<E>) -> E | returns the maximum value of input array.|
57
+
|array_min(array<E>) -> E | returns the minimum value of input array.|
58
58
|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.|
59
59
|array_distinct(array) -> array | remove duplicate values from the 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.|
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.|
62
62
|array_reverse(array) -> array | reverse the array element.|
63
63
|array_sort(array) -> array | sorts and returns the array. The elements of array must be orderable.|
64
64
|array_concat(array, array) -> array | concatenates two arrays.|
65
-
|array_value_count(array<E>, E) -> long | count array's element number that element value equals given value.|
65
+
|array_value_count(array<E>, E) -> long | count array's element number that element value equals given value.|
66
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.|
67
-
|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.|
67
+
|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.|
68
68
69
-
### 3. date functions
69
+
### 3. map functions
70
+
| function| description |
71
+
|:--|:--|
72
+
|map_build(x<K>, y<V>) -> map<K, V>| returns a map created using the given key/value arrays.|
73
+
|map_concat(x<K, V>, y<K, V>) -> map<K,V>| returns the union of two maps. If a key is found in both `x` and `y`, that key’s value in the resulting map comes from `y`.|
74
+
|map_element_at(map<K, V>, key) -> V | returns value for given `key`, or `NULL` if the key is not contained in the map.|
75
+
|map_equals(x<K, V>, y<K, V>) -> boolean | whether map x equals with map y or not.|
76
+
77
+
### 4. date functions
70
78
71
79
| function| description |
72
80
|:--|:--|
73
81
|day_of_week(date_string \| date) -> int | day of week,if monday,return 1, sunday return 7, error return null.|
82
+
|day_of_year(date_string \| date) -> int | day of year. The value ranges from 1 to 366.|
74
83
|zodiac_en(date_string \| date) -> string | convert date to zodiac|
75
84
|zodiac_cn(date_string \| date) -> string | convert date to zodiac chinese |
|json_array_get(json, jsonPath) -> array(varchar) |returns the element at the specified index into the `json_array`. The index is zero-based.|
@@ -86,7 +96,17 @@ You can also directly download file from [release page](https://github.com/aaron
86
96
|json_extract_scalar(json, jsonPath) -> array(varchar) |like `json_extract`, but returns the result value as a string (as opposed to being encoded as JSON).|
87
97
|json_size(json, jsonPath) -> array(varchar) |like `json_extract`, but returns the size of the value. For objects or arrays, the size is the number of members, and the size of a scalar value is zero.|
88
98
89
-
### 5. china id card functions
99
+
### 6. bitwise functions
100
+
101
+
| function| description |
102
+
|:--|:--|
103
+
|bit_count(x, bits) -> bigint | count the number of bits set in `x` (treated as bits-bit signed integer) in 2’s complement representation |
104
+
|bitwise_and(x, y) -> bigint | returns the bitwise AND of `x` and `y` in 2’s complement arithmetic.|
105
+
|bitwise_not(x) -> bigint | returns the bitwise NOT of `x` in 2’s complement arithmetic. |
106
+
|bitwise_or(x, y) -> bigint | returns the bitwise OR of `x` and `y` in 2’s complement arithmetic.|
107
+
|bitwise_xor(x, y) -> bigint | returns the bitwise XOR of `x` and `y` in 2’s complement arithmetic. |
108
+
109
+
### 7. china id card functions
90
110
91
111
| function| description |
92
112
|:--|:--|
@@ -98,6 +118,27 @@ You can also directly download file from [release page](https://github.com/aaron
98
118
|is_valid_id_card(string) -> boolean |determine is valid china id card No.|
99
119
|id_card_info(string) -> json |get china id card info. include province, city, area etc.|
|gcj_to_bd(double,double) -> json | GCJ-02(火星坐标系) convert to BD-09(百度坐标系), 谷歌、高德——>百度|
127
+
|bd_to_gcj(double,double) -> json | BD-09(百度坐标系) convert to GCJ-02(火星坐标系), 百度——>谷歌、高德|
128
+
|wgs_to_gcj(double,double) -> json | WGS84(地球坐标系) convert to GCJ02(火星坐标系)|
129
+
|gcj_to_wgs(double,double) -> json | GCJ02(火星坐标系) convert to GPS84(地球坐标系), output coordinate WGS-84 accuracy within 1 to 2 meters.|
130
+
|gcj_extract_wgs(double,double) -> json | GCJ02(火星坐标系) convert to GPS84, output coordinate WGS-84 accuracy within 0.5 meters. but compute cost more time than `gcj_to_wgs`. |
0 commit comments