Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
PHILO-HE committed May 30, 2024
1 parent 3f9d0c8 commit 00a4e98
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 22 deletions.
12 changes: 6 additions & 6 deletions velox/docs/functions/spark/array.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ Array Functions

SELECT array_contains(array(1, 2, 3), 2); -- true

.. spark::function:: array_distinct(array(E)) -> array(E)
.. spark:function:: array_distinct(array(E)) -> array(E)
Remove duplicate values from the input array. ::

SELECT array_distinct(ARRAY [1, 2, 3]); -- [1, 2, 3]
SELECT array_distinct(ARRAY [1, 2, 1]); -- [1, 2]
SELECT array_distinct(ARRAY [1, NULL, NULL]); -- [1, NULL]

.. spark::function:: array_except(array(E) x, array(E) y) -> array(E)
.. spark:function:: array_except(array(E) x, array(E) y) -> array(E)
Returns an array of the elements in array ``x`` but not in array ``y``, without duplicates. ::

Expand All @@ -45,7 +45,7 @@ Array Functions

SELECT array_intersect(array(1, 2, 3), array(1, 3, 5)); -- [1,3]

.. spark::function:: array_max(array(E)) -> E
.. spark:function:: array_max(array(E)) -> E
Returns maximum non-NULL element of the array. Returns NULL if array is empty or all elements are NULL.
When E is DOUBLE or REAL, returns NaN if any element is NaN. ::
Expand All @@ -56,7 +56,7 @@ Array Functions
SELECT array_max(array()); -- NULL
SELECT array_max(array(-0.0001, -0.0002, -0.0003, float('nan'))); -- NaN

.. spark::function:: array_min(array(E)) -> E
.. spark:function:: array_min(array(E)) -> E
Returns minimum non-NULL element of the array. Returns NULL if array is empty or all elements are NULL.
When E is DOUBLE or REAL, NaN value is considered greater than any non-NaN value. ::
Expand All @@ -69,15 +69,15 @@ Array Functions
SELECT array_min(array(4.0, float('nan')]); -- 4.0
SELECT array_min(array(NULL, float('nan'))); -- NaN

.. spark::function:: array_position(x, element) -> bigint
.. spark:function:: array_position(x, element) -> bigint
Returns the position (1-based) of the first occurrence of the ``element`` in array ``x`` (or 0 if not found). ::

SELECT array_position(array(1, 2, 3), 2); -- 2
SELECT array_position(array(1, 2, 3), 4); -- 0
SELECT array_position(array(1, 2, 3, 2), 2); -- 2

.. spark::function:: array_remove(x, element) -> array
.. spark:function:: array_remove(x, element) -> array
Remove all elements that equal ``element`` from array ``x``. Returns NULL as result if ``element`` is NULL.
If array ``x`` is empty array, returns empty array. If all elements in array ``x`` are NULL but ``element`` is not NULL,
Expand Down
4 changes: 2 additions & 2 deletions velox/docs/functions/spark/binary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Binary Functions
================

.. spark::function:: crc32(binary) -> bigint
.. spark:function:: crc32(binary) -> bigint
Computes the crc32 checksum of ``binary``.

Expand Down Expand Up @@ -34,7 +34,7 @@ Binary Functions
Returns TRUE if ``bloomFilter`` might contain ``value``.

``bloomFilter`` is a VARBINARY computed using ::spark::function::`bloom_filter_agg` aggregate function.
``bloomFilter`` is a VARBINARY computed using ::spark:function::`bloom_filter_agg` aggregate function.
``value`` is a BIGINT.

.. spark:function:: sha1(x) -> varchar
Expand Down
6 changes: 3 additions & 3 deletions velox/docs/functions/spark/map.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Map Functions

SELECT map(array(1, 2), array(3, 4)); -- {[1, 2] -> [3, 4]}

.. spark::function:: map_entries(map(K,V)) -> array(row(K,V))
.. spark:function:: map_entries(map(K,V)) -> array(row(K,V))
Returns an array of all entries in the given map. ::

Expand All @@ -33,11 +33,11 @@ Map Functions

SELECT map_from_arrays(array(1.0, 3.0), array('2', '4')); -- {1.0 -> 2, 3.0 -> 4}

.. spark::function:: map_keys(x(K,V)) -> array(K)
.. spark:function:: map_keys(x(K,V)) -> array(K)
Returns all the keys in the map ``x``.

.. spark::function:: map_values(x(K,V)) -> array(V)
.. spark:function:: map_values(x(K,V)) -> array(V)
Returns all the values in the map ``x``.

Expand Down
10 changes: 5 additions & 5 deletions velox/docs/functions/spark/math.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ Mathematical Functions
Returns inverse hyperbolic cosine of ``x``.

.. spark::function:: asin(x) -> double
.. spark:function:: asin(x) -> double
Returns the arc sine of ``x``.

.. spark:function:: asinh(x) -> double
Returns inverse hyperbolic sine of ``x``.

.. spark::function:: atan(x) -> double
.. spark:function:: atan(x) -> double
Returns the arc tangent of ``x``.

Expand Down Expand Up @@ -66,7 +66,7 @@ Mathematical Functions
Returns ``x`` rounded up to the nearest integer.
Supported types are: BIGINT and DOUBLE.

.. spark::function:: cos(x) -> double
.. spark:function:: cos(x) -> double
Returns the cosine of ``x``.

Expand All @@ -82,7 +82,7 @@ Mathematical Functions
Returns the cosecant of ``x``.

.. spark::function:: degrees(x) -> double
.. spark:function:: degrees(x) -> double
Converts angle x in radians to degrees.

Expand Down Expand Up @@ -147,7 +147,7 @@ Mathematical Functions
Returns true if x is Nan, or false otherwise. Returns false is x is NULL.
Supported types are: REAL, DOUBLE.

.. spark::function:: log1p(x) -> double
.. spark:function:: log1p(x) -> double
Returns the natural logarithm of the “given value ``x`` plus one”.
Return NULL if x is less than or equal to -1.
Expand Down
6 changes: 3 additions & 3 deletions velox/docs/functions/spark/regexp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ difference of the character classes.

See https://github.com/google/re2/wiki/Syntax for more information.

.. spark::function:: like(string, pattern) -> boolean
.. spark:function:: like(string, pattern) -> boolean
like(string, pattern, escape) -> boolean
Evaluates if the ``string`` matches the ``pattern``. Patterns can contain
Expand Down Expand Up @@ -58,14 +58,14 @@ See https://github.com/google/re2/wiki/Syntax for more information.

SELECT regexp_extract('1a 2b 14m', '(\d+)([a-z]+)', 2); -- 'a'

.. spark::function:: regexp_extract_all(string, pattern) -> array(varchar):
.. spark:function:: regexp_extract_all(string, pattern) -> array(varchar):
Returns the substring(s) matched by the regular expression ``pattern``
in ``string``::

SELECT regexp_extract_all('1a 2b 14m', '\d+'); -- [1, 2, 14]

.. spark::function:: regexp_extract_all(string, pattern, group) -> array(varchar):
.. spark:function:: regexp_extract_all(string, pattern, group) -> array(varchar):
:noindex:

Finds all occurrences of the regular expression ``pattern`` in
Expand Down
2 changes: 1 addition & 1 deletion velox/docs/functions/spark/string.rst
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ Unless specified otherwise, all functions return NULL if at least one of the arg
SELECT replace('ABCabc', 'abc', ''); -- ABC
SELECT replace('ABCabc', 'abc', 'DEF'); -- ABCDEF

.. spark::function:: reverse(string) -> varchar
.. spark:function:: reverse(string) -> varchar
Returns input string with characters in reverse order.

Expand Down
4 changes: 2 additions & 2 deletions velox/docs/functions/spark/url.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ digits after the percent character "%". All the url extract functions will retur
Encoding Functions
------------------
.. spark::function:: url_encode(value) -> varchar
.. spark:function:: url_encode(value) -> varchar
Escapes ``value`` by encoding it so that it can be safely included in
URL query parameter names and values:
Expand All @@ -60,7 +60,7 @@ Encoding Functions
as the string ``%XX`` where ``XX`` is the uppercase hexadecimal
value of the UTF-8 byte.
.. spark::function:: url_decode(value) -> varchar
.. spark:function:: url_decode(value) -> varchar
Unescapes the URL encoded ``value``.
This function is the inverse of :func:`url_encode`.

0 comments on commit 00a4e98

Please sign in to comment.