1.15.1
User Documentation for Apache MADlib
array_ops.sql_in File Reference

implementation of array operations in SQL More...

Functions

anyarray array_add (anyarray x, anyarray y)
 Adds two arrays. It requires that all the values are NON-NULL. Return type is the same as the input type. More...
 
aggregate anyarray sum (anyarray)
 Aggregate, element-wise sum of arrays. It requires that all the values are NON-NULL. Return type is the same as the input type. More...
 
anyarray array_sub (anyarray x, anyarray y)
 Subtracts two arrays. It requires that all the values are NON-NULL. Return type is the same as the input type. More...
 
anyarray array_mult (anyarray x, anyarray y)
 Element-wise product of two arrays. It requires that all the values are NON-NULL. Return type is the same as the input type. More...
 
anyarray array_div (anyarray x, anyarray y)
 Element-wise division of two arrays. It requires that all the values are NON-NULL. Return type is the same as the input type. More...
 
float8 array_dot (anyarray x, anyarray y)
 Dot-product of two arrays. It requires that all the values are NON-NULL. Return type is the same as the input type. More...
 
bool array_contains (anyarray x, anyarray y)
 Checks whether one array contains the other. This function returns TRUE if each non-zero element in the right array equals to the element with the same index in the left array. More...
 
anyelement array_max (anyarray x)
 This function finds the maximum value in the array. NULLs are ignored. Return type is the same as the input type. More...
 
float8 [] array_max_index (anyarray x)
 This function finds the maximum value and corresponding index in the array. NULLs are ignored. Return type is the same as the input type. More...
 
anyelement array_min (anyarray x)
 This function finds the minimum value in the array. NULLs are ignored. Return type is the same as the input type. More...
 
float8 [] array_min_index (anyarray x)
 This function finds the minimum value and corresponding index in the array. NULLs are ignored. Return type is the same as the input type. More...
 
anyelement array_sum (anyarray x)
 This function finds the sum of the values in the array. NULLs are ignored. Return type is the same as the input type. More...
 
float8 array_sum_big (anyarray x)
 This function finds the sum of the values in the array. NULLs are ignored. Return type is always FLOAT8 regardless of input. This function is meant to replace array_sum() in the cases when sum may overflow the element type. More...
 
anyelement array_abs_sum (anyarray x)
 This function finds the sum of abs of the values in the array. NULLs are ignored. Return type is the same as the input type. More...
 
anyarray array_abs (anyarray x)
 This function takes an array as the input and finds absolute value of each element in the array, returning the resulting array. It requires that all the values are NON-NULL. More...
 
float8 array_mean (anyarray x)
 This function finds the mean of the values in the array. NULLs are ignored. More...
 
float8 array_stddev (anyarray x)
 This function finds the standard deviation of the values in the array. NULLs are ignored. More...
 
float8 [] array_of_float (integer k)
 This function creates an array of set size (the argument value) of FLOAT8, initializing the values to 0.0;. More...
 
bigint [] array_of_bigint (integer k)
 This function creates an array of set size (the argument value) of BIGINT, initializing the values to 0;. More...
 
anyarray array_fill (anyarray x, anyelement k)
 This functions set every values in the array to some desired value (provided as the argument). More...
 
anyarray array_cos (anyarray x)
 This function takes an array as the input and apply cos function element-wise, returning the resulting array. It requires that all the values are NON-NULL. Return type is the same as the input type. More...
 
anyarray array_scalar_mult (anyarray x, anyelement k)
 This function takes an array as the input and executes element-wise multiplication by the scalar provided as the second argument, returning the resulting array. It requires that all the values are NON-NULL. Return type is the same as the input type. More...
 
anyarray array_scalar_add (anyarray x, anyelement k)
 This function takes an array as the input and executes element-wise addition by the scalar provided as the second argument, returning the resulting array. It requires that all the values are NON-NULL. Return type is the same as the input type. More...
 
anyarray array_filter (anyarray x, anyelement k, text op)
 This function takes an array as the input and keep only elements that satisfy the operator on specified scalar. It requires that all the values are NON-NULL. Return type is the same as the input type. More...
 
anyarray array_filter (anyarray x, anyelement k)
 This function takes an array as the input and removes elements that equal to specified scalar. It requires that all the values are NON-NULL. Return type is the same as the input type. More...
 
anyarray array_filter (anyarray x)
 This function takes an array as the input and removes elements that equal to 0. It requires that all the values are NON-NULL. Return type is the same as the input type. More...
 
float8 [] array_sqrt (anyarray x)
 This function takes an array as the input and finds square root of each element in the array, returning the resulting array. It requires that all the values are NON-NULL. More...
 
anyarray array_pow (anyarray x, anyelement y)
 This function takes an array and a float8 as the input and finds power of each element in the array, returning the resulting array. It requires that all the values are NON-NULL. More...
 
float8 [] array_square (anyarray x)
 This function takes an array as the input and finds square of each element in the array, returning the resulting array. It requires that all the values are NON-NULL. More...
 
float8 [] normalize (anyarray x)
 This function normalizes an array as sum of squares to be 1. More...
 
boolean array_contains_null (anyarray x)
 Function to check if array contains NULL. More...
 
anyarray array_cum_sum (anyarray x)
 This function takes an array as the input and computes the cumulative sum with the first element being the same. It requires that all the values are NON-NULL. More...
 
anyarray array_cum_prod (anyarray x)
 This function takes an array as the input and computes the cumulative product with the first element being the same. It requires that all the values are NON-NULL. More...
 
set< record > array_unnest_2d_to_1d (anyarray x, int unnest_row_id, anyarray unnest_result)
 This function takes a 2-D array as the input and unnests it by one level. It returns a set of 1-D arrays that correspond to rows of the input array as well as an ID column containing row positions occupied by those 1-D arrays within the 2-D array (the ID column values start with 1 and not 0) More...
 
text array_unnest_2d_to_1d ()
 

Detailed Description

Date
April 2011

Function Documentation

◆ array_abs()

anyarray array_abs ( anyarray  x)
Parameters
xArray x
Returns
Absolute value of all elements of x.

◆ array_abs_sum()

anyelement array_abs_sum ( anyarray  x)
Parameters
xArray x
Returns
Sum of absolute value of x

◆ array_add()

anyarray array_add ( anyarray  x,
anyarray  y 
)
Parameters
xArray x
yArray y
Returns
Sum of x and y.

◆ array_contains()

bool array_contains ( anyarray  x,
anyarray  y 
)
Parameters
xArray x
yArray y
Returns
Returns true if x contains y.

◆ array_contains_null()

boolean array_contains_null ( anyarray  x)
Parameters
xArray x.
Returns
True if x has NULL value else False.

◆ array_cos()

anyarray array_cos ( anyarray  x)
Parameters
xArray x
Returns
Array with each element of cos(x).

◆ array_cum_prod()

anyarray array_cum_prod ( anyarray  x)
Parameters
xArray x
Returns
Cumulative product of the elements in x.

◆ array_cum_sum()

anyarray array_cum_sum ( anyarray  x)
Parameters
xArray x
Returns
Cumulative sum of the elements in x.

◆ array_div()

anyarray array_div ( anyarray  x,
anyarray  y 
)
Parameters
xArray x
yArray y
Returns
Element-wise division of x and y.

◆ array_dot()

float8 array_dot ( anyarray  x,
anyarray  y 
)
Parameters
xArray x
yArray y
Returns
Dot-product of x and y.

◆ array_fill()

anyarray array_fill ( anyarray  x,
anyelement  k 
)
Parameters
xSome array
kDesired value
Returns
Fills array with desired value.

◆ array_filter() [1/3]

anyarray array_filter ( anyarray  x,
anyelement  k,
text  op 
)
Parameters
xArray x
kScalar
opOperator
Returns
Filtered array.

◆ array_filter() [2/3]

anyarray array_filter ( anyarray  x,
anyelement  k 
)
Parameters
xArray x
kScalar
Returns
Filtered array.

◆ array_filter() [3/3]

anyarray array_filter ( anyarray  x)
Parameters
xArray x
Returns
Filtered array.

◆ array_max()

anyelement array_max ( anyarray  x)
Parameters
xArray x
Returns
Max of x.

◆ array_max_index()

float8 [] array_max_index ( anyarray  x)
Parameters
xArray x
Returns
Array as [max, index].

◆ array_mean()

float8 array_mean ( anyarray  x)
Parameters
xArray x
Returns
Mean of x.

◆ array_min()

anyelement array_min ( anyarray  x)
Parameters
xArray x
Returns
Min of x.

◆ array_min_index()

float8 [] array_min_index ( anyarray  x)
Parameters
xArray x
Returns
Array as [min, index].

◆ array_mult()

anyarray array_mult ( anyarray  x,
anyarray  y 
)
Parameters
xArray x
yArray y
Returns
Element-wise product of x and y.

◆ array_of_bigint()

bigint [] array_of_bigint ( integer  k)
Parameters
kArray size.
Returns
Array of size k.

◆ array_of_float()

float8 [] array_of_float ( integer  k)
Parameters
kArray size
Returns
Array of size k.

◆ array_pow()

anyarray array_pow ( anyarray  x,
anyelement  y 
)
Parameters
xArray x
yDesired power
Returns
Power of y for all elements of x.

◆ array_scalar_add()

anyarray array_scalar_add ( anyarray  x,
anyelement  k 
)
Parameters
xArray x
kScalar
Returns
Array with each element of x added by scalar.

◆ array_scalar_mult()

anyarray array_scalar_mult ( anyarray  x,
anyelement  k 
)
Parameters
xArray x
kScalar
Returns
Array with each element of x multiplied by scalar.

◆ array_sqrt()

float8 [] array_sqrt ( anyarray  x)
Parameters
xArray x
Returns
Square root of all elements of x.

◆ array_square()

float8 [] array_square ( anyarray  x)
Parameters
xArray x
Returns
Square of all elements of x.

◆ array_stddev()

float8 array_stddev ( anyarray  x)
Parameters
xArray x
Returns
Standard deviation of x.

◆ array_sub()

anyarray array_sub ( anyarray  x,
anyarray  y 
)
Parameters
xArray x
yArray y
Returns
x-y.

◆ array_sum()

anyelement array_sum ( anyarray  x)
Parameters
xArray x
Returns
Sum of x.

◆ array_sum_big()

float8 array_sum_big ( anyarray  x)
Parameters
xArray x
Returns
Sum of x.

◆ array_unnest_2d_to_1d() [1/2]

set<record> array_unnest_2d_to_1d ( anyarray  x,
int  unnest_row_id,
anyarray  unnest_result 
)
Parameters
xArray x
Returns
Set of 1-D arrays that corrspond to rows of x and an ID column.

◆ array_unnest_2d_to_1d() [2/2]

text array_unnest_2d_to_1d ( )

◆ normalize()

float8 [] normalize ( anyarray  x)
Parameters
xArray x.
Returns
Array normalized by its 2-norm.

◆ sum()

aggregate anyarray sum ( anyarray  )
Parameters
xArray x
Returns
Sum of x