Copy Shift#

group copy_shift

Functions

std::unique_ptr<column> shift(column_view const &input, size_type offset, scalar const &fill_value, rmm::cuda_stream_view stream = cudf::get_default_stream(), rmm::device_async_resource_ref mr = rmm::mr::get_current_device_resource())#

Creates a new column by shifting all values by an offset.

Elements will be determined by output[idx] = input[idx - offset]. Some elements in the output may be indeterminable from the input. For those elements, the value will be determined by fill_values.

Examples
-------------------------------------------------
input       = [0, 1, 2, 3, 4]
offset      = 3
fill_values = @
return      = [@, @, @, 0, 1]
-------------------------------------------------
input       = [5, 4, 3, 2, 1]
offset      = -2
fill_values = 7
return      = [3, 2, 1, 7, 7]

Note

if the input is nullable, the output will be nullable.

Note

if the fill value is null, the output will be nullable.

Parameters:
  • input – Column to be shifted

  • offset – The offset by which to shift the input

  • fill_value – Fill value for indeterminable outputs

  • stream – CUDA stream used for device memory operations and kernel launches

  • mr – Device memory resource used to allocate the returned result’s device memory

Throws:
Returns:

The shifted column