Datetime Extract#

group datetime_extract

Enums

enum class datetime_component : uint8_t#

Types of datetime components that may be extracted.

Values:

enumerator YEAR#
enumerator MONTH#
enumerator DAY#
enumerator WEEKDAY#
enumerator HOUR#
enumerator MINUTE#
enumerator SECOND#
enumerator MILLISECOND#
enumerator MICROSECOND#
enumerator NANOSECOND#

Functions

std::unique_ptr<cudf::column> extract_year(cudf::column_view const &column, rmm::cuda_stream_view stream = cudf::get_default_stream(), rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref())#

Extracts year from any datetime type and returns an int16_t cudf::column.

Parameters:
  • columncudf::column_view of the input datetime values

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

  • mr – Device memory resource used to allocate device memory of the returned column

Throws:

cudf::logic_error – if input column datatype is not TIMESTAMP

Returns:

cudf::column of the extracted int16_t years

std::unique_ptr<cudf::column> extract_month(cudf::column_view const &column, rmm::cuda_stream_view stream = cudf::get_default_stream(), rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref())#

Extracts month from any datetime type and returns an int16_t cudf::column.

Parameters:
  • columncudf::column_view of the input datetime values

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

  • mr – Device memory resource used to allocate device memory of the returned column

Throws:

cudf::logic_error – if input column datatype is not TIMESTAMP

Returns:

cudf::column of the extracted int16_t months

std::unique_ptr<cudf::column> extract_day(cudf::column_view const &column, rmm::cuda_stream_view stream = cudf::get_default_stream(), rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref())#

Extracts day from any datetime type and returns an int16_t cudf::column.

Parameters:
  • columncudf::column_view of the input datetime values

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

  • mr – Device memory resource used to allocate device memory of the returned column

Throws:

cudf::logic_error – if input column datatype is not TIMESTAMP

Returns:

cudf::column of the extracted int16_t days

std::unique_ptr<cudf::column> extract_weekday(cudf::column_view const &column, rmm::cuda_stream_view stream = cudf::get_default_stream(), rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref())#

Extracts a weekday from any datetime type and returns an int16_t cudf::column.

Parameters:
  • columncudf::column_view of the input datetime values

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

  • mr – Device memory resource used to allocate device memory of the returned column

Throws:

cudf::logic_error – if input column datatype is not TIMESTAMP

Returns:

cudf::column of the extracted int16_t days

std::unique_ptr<cudf::column> extract_hour(cudf::column_view const &column, rmm::cuda_stream_view stream = cudf::get_default_stream(), rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref())#

Extracts hour from any datetime type and returns an int16_t cudf::column.

Parameters:
  • columncudf::column_view of the input datetime values

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

  • mr – Device memory resource used to allocate device memory of the returned column

Throws:

cudf::logic_error – if input column datatype is not TIMESTAMP

Returns:

cudf::column of the extracted int16_t hours

std::unique_ptr<cudf::column> extract_minute(cudf::column_view const &column, rmm::cuda_stream_view stream = cudf::get_default_stream(), rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref())#

Extracts minute from any datetime type and returns an int16_t cudf::column.

Parameters:
  • columncudf::column_view of the input datetime values

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

  • mr – Device memory resource used to allocate device memory of the returned column

Throws:

cudf::logic_error – if input column datatype is not TIMESTAMP

Returns:

cudf::column of the extracted int16_t minutes

std::unique_ptr<cudf::column> extract_second(cudf::column_view const &column, rmm::cuda_stream_view stream = cudf::get_default_stream(), rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref())#

Extracts second from any datetime type and returns an int16_t cudf::column.

Parameters:
  • columncudf::column_view of the input datetime values

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

  • mr – Device memory resource used to allocate device memory of the returned column

Throws:

cudf::logic_error – if input column datatype is not TIMESTAMP

Returns:

cudf::column of the extracted int16_t seconds

std::unique_ptr<cudf::column> extract_millisecond_fraction(cudf::column_view const &column, rmm::cuda_stream_view stream = cudf::get_default_stream(), rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref())#

Extracts millisecond fraction from any datetime type and returns an int16_t cudf::column.

A millisecond fraction is only the 3 digits that make up the millisecond portion of a duration. For example, the millisecond fraction of 1.234567890 seconds is 234.

Parameters:
  • columncudf::column_view of the input datetime values

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

  • mr – Device memory resource used to allocate device memory of the returned column

Throws:

cudf::logic_error – if input column datatype is not TIMESTAMP

Returns:

cudf::column of the extracted int16_t milliseconds

std::unique_ptr<cudf::column> extract_microsecond_fraction(cudf::column_view const &column, rmm::cuda_stream_view stream = cudf::get_default_stream(), rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref())#

Extracts microsecond fraction from any datetime type and returns an int16_t cudf::column.

A microsecond fraction is only the 3 digits that make up the microsecond portion of a duration. For example, the microsecond fraction of 1.234567890 seconds is 567.

Parameters:
  • columncudf::column_view of the input datetime values

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

  • mr – Device memory resource used to allocate device memory of the returned column

Throws:

cudf::logic_error – if input column datatype is not TIMESTAMP

Returns:

cudf::column of the extracted int16_t microseconds

std::unique_ptr<cudf::column> extract_nanosecond_fraction(cudf::column_view const &column, rmm::cuda_stream_view stream = cudf::get_default_stream(), rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref())#

Extracts nanosecond fraction from any datetime type and returns an int16_t cudf::column.

A nanosecond fraction is only the 3 digits that make up the nanosecond portion of a duration. For example, the nanosecond fraction of 1.234567890 seconds is 890.

Parameters:
  • columncudf::column_view of the input datetime values

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

  • mr – Device memory resource used to allocate device memory of the returned column

Throws:

cudf::logic_error – if input column datatype is not TIMESTAMP

Returns:

cudf::column of the extracted int16_t nanoseconds

std::unique_ptr<cudf::column> extract_datetime_component(cudf::column_view const &column, datetime_component component, rmm::cuda_stream_view stream = cudf::get_default_stream(), rmm::device_async_resource_ref mr = cudf::get_current_device_resource_ref())#

Extracts the specified datetime component from any datetime type and returns an int16_t cudf::column.

Parameters:
  • columncudf::column_view of the input datetime values

  • component – The datetime component to extract

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

  • mr – Device memory resource used to allocate device memory of the returned column

Throws:

cudf::logic_error – if input column datatype is not TIMESTAMP

Returns:

cudf::column of the extracted int16_t datetime component