Module: RedAmber::ArrowFunction

Included in:
Vector
Defined in:
lib/red_amber/helper.rb

Overview

Helper for Arrow Functions

Class Method Summary collapse

Class Method Details

.arrow_doc(function_name) ⇒ String

Show document of Arrow’s compute function.

Examples:

puts RedAmber::ArrowFunction.arrow_doc(:array_sort_indices)

# =>
array_sort_indices(array, {order=Ascending, null_placement=AtEnd}): Return the indices that would sort an array
------------------
This function computes an array of indices that define a stable sort
of the input array.  By default, Null values are considered greater
than any other value and are therefore sorted at the end of the array.
For floating-point types, NaNs are considered greater than any
other non-null value, but smaller than null values.

The handling of nulls and NaNs can be changed in ArraySortOptions.

Parameters:

  • function_name (Symbol)

    function name.

Returns:

  • (String)

    document of compute function object.



152
153
154
155
# File 'lib/red_amber/helper.rb', line 152

def arrow_doc(function_name)
  f = find(function_name)
  "#{f}\n#{'-' * function_name.size}\n#{f.doc.description}"
end

.find(function_name) ⇒ Arrow::Function

Find Arrow’s compute function.

https://arrow.apache.org/docs/cpp/compute.html

Examples:

RedAmber::ArrowFunction.find(:array_sort_indices)

# =>
#<Arrow::Function:0x7fa8838a0d80 ptr=0x7fa87e9b7320 array_sort_indices(array, {order=Ascending, null_placement=AtEnd}): Return the indices that would sort an array>

Parameters:

  • function_name (Symbol)

    function name.

Returns:

  • (Arrow::Function)

    arrow compute function object.



128
129
130
# File 'lib/red_amber/helper.rb', line 128

def find(function_name)
  Arrow::Function.find(function_name)
end