Home
libcudf
cucim
cudf-java
cudf
cugraph
cuml
cuproj
cusignal
cuspatial
cuxfilter
dask-cuda
dask-cudf
kvikio
libcudf
libcuml
libcuproj
libcuspatial
libkvikio
librmm
raft
rapids-cmake
rmm
legacy (23.08)
nightly (23.12)
stable (23.10)
legacy (23.08)
include
cudf
datetime.hpp
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2019-2023, NVIDIA CORPORATION.
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*/
16
17
#pragma once
18
19
#include <
cudf/types.hpp
>
20
21
#include <
rmm/mr/device/per_device_resource.hpp
>
22
23
#include <memory>
24
30
namespace
cudf
{
31
namespace
datetime {
48
std::unique_ptr<cudf::column>
extract_year
(
49
cudf::column_view
const
&
column
,
50
rmm::mr::device_memory_resource
* mr = rmm::mr::get_current_device_resource());
51
62
std::unique_ptr<cudf::column>
extract_month
(
63
cudf::column_view
const
&
column
,
64
rmm::mr::device_memory_resource
* mr = rmm::mr::get_current_device_resource());
65
76
std::unique_ptr<cudf::column>
extract_day
(
77
cudf::column_view
const
&
column
,
78
rmm::mr::device_memory_resource
* mr = rmm::mr::get_current_device_resource());
79
90
std::unique_ptr<cudf::column>
extract_weekday
(
91
cudf::column_view
const
&
column
,
92
rmm::mr::device_memory_resource
* mr = rmm::mr::get_current_device_resource());
93
104
std::unique_ptr<cudf::column>
extract_hour
(
105
cudf::column_view
const
&
column
,
106
rmm::mr::device_memory_resource
* mr = rmm::mr::get_current_device_resource());
107
118
std::unique_ptr<cudf::column>
extract_minute
(
119
cudf::column_view
const
&
column
,
120
rmm::mr::device_memory_resource
* mr = rmm::mr::get_current_device_resource());
121
132
std::unique_ptr<cudf::column>
extract_second
(
133
cudf::column_view
const
&
column
,
134
rmm::mr::device_memory_resource
* mr = rmm::mr::get_current_device_resource());
135
149
std::unique_ptr<cudf::column>
extract_millisecond_fraction
(
150
cudf::column_view
const
&
column
,
151
rmm::mr::device_memory_resource
* mr = rmm::mr::get_current_device_resource());
152
166
std::unique_ptr<cudf::column>
extract_microsecond_fraction
(
167
cudf::column_view
const
&
column
,
168
rmm::mr::device_memory_resource
* mr = rmm::mr::get_current_device_resource());
169
183
std::unique_ptr<cudf::column>
extract_nanosecond_fraction
(
184
cudf::column_view
const
&
column
,
185
rmm::mr::device_memory_resource
* mr = rmm::mr::get_current_device_resource());
186
// end of group
204
std::unique_ptr<cudf::column>
last_day_of_month
(
205
cudf::column_view
const
&
column
,
206
rmm::mr::device_memory_resource
* mr = rmm::mr::get_current_device_resource());
207
218
std::unique_ptr<cudf::column>
day_of_year
(
219
cudf::column_view
const
&
column
,
220
rmm::mr::device_memory_resource
* mr = rmm::mr::get_current_device_resource());
221
252
std::unique_ptr<cudf::column>
add_calendrical_months
(
253
cudf::column_view
const
& timestamps,
254
cudf::column_view
const
& months,
255
rmm::mr::device_memory_resource
* mr = rmm::mr::get_current_device_resource());
256
287
std::unique_ptr<cudf::column>
add_calendrical_months
(
288
cudf::column_view
const
& timestamps,
289
cudf::scalar
const
& months,
290
rmm::mr::device_memory_resource
* mr = rmm::mr::get_current_device_resource());
291
305
std::unique_ptr<cudf::column>
is_leap_year
(
306
cudf::column_view
const
&
column
,
307
rmm::mr::device_memory_resource
* mr = rmm::mr::get_current_device_resource());
308
321
std::unique_ptr<cudf::column>
days_in_month
(
322
cudf::column_view
const
&
column
,
323
rmm::mr::device_memory_resource
* mr = rmm::mr::get_current_device_resource());
324
337
std::unique_ptr<cudf::column>
extract_quarter
(
338
cudf::column_view
const
&
column
,
339
rmm::mr::device_memory_resource
* mr = rmm::mr::get_current_device_resource());
340
345
enum class
rounding_frequency
: int32_t {
346
DAY,
347
HOUR,
348
MINUTE,
349
SECOND,
350
MILLISECOND,
351
MICROSECOND,
352
NANOSECOND
353
};
354
365
std::unique_ptr<cudf::column>
ceil_datetimes
(
366
cudf::column_view
const
&
column
,
367
rounding_frequency
freq,
368
rmm::mr::device_memory_resource
* mr = rmm::mr::get_current_device_resource());
369
380
std::unique_ptr<cudf::column>
floor_datetimes
(
381
cudf::column_view
const
&
column
,
382
rounding_frequency
freq,
383
rmm::mr::device_memory_resource
* mr = rmm::mr::get_current_device_resource());
384
395
std::unique_ptr<cudf::column>
round_datetimes
(
396
cudf::column_view
const
&
column
,
397
rounding_frequency
freq,
398
rmm::mr::device_memory_resource
* mr = rmm::mr::get_current_device_resource());
399
// end of group
401
402
}
// namespace datetime
403
}
// namespace cudf
per_device_resource.hpp
cudf::column
A container of nullable device data as a column of elements.
Definition:
column.hpp:48
cudf::column_view
A non-owning, immutable view of device data as a column of elements, some of which may be null as ind...
Definition:
column_view.hpp:313
types.hpp
Type declarations for libcudf.
cudf::datetime::add_calendrical_months
std::unique_ptr< cudf::column > add_calendrical_months(cudf::column_view const ×tamps, cudf::scalar const &months, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Adds or subtracts a number of months from the datetime type and returns a timestamp column that is of...
cudf::datetime::extract_quarter
std::unique_ptr< cudf::column > extract_quarter(cudf::column_view const &column, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Returns the quarter of the date.
cudf::datetime::extract_hour
std::unique_ptr< cudf::column > extract_hour(cudf::column_view const &column, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Extracts hour from any datetime type and returns an int16_t cudf::column.
cudf::datetime::round_datetimes
std::unique_ptr< cudf::column > round_datetimes(cudf::column_view const &column, rounding_frequency freq, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Round datetimes to the nearest multiple of the given frequency.
cudf::datetime::day_of_year
std::unique_ptr< cudf::column > day_of_year(cudf::column_view const &column, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Computes the day number since the start of the year from the datetime and returns an int16_t cudf::co...
cudf::datetime::is_leap_year
std::unique_ptr< cudf::column > is_leap_year(cudf::column_view const &column, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Check if the year of the given date is a leap year.
cudf::datetime::extract_microsecond_fraction
std::unique_ptr< cudf::column > extract_microsecond_fraction(cudf::column_view const &column, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Extracts microsecond fraction from any datetime type and returns an int16_t cudf::column.
cudf::datetime::floor_datetimes
std::unique_ptr< cudf::column > floor_datetimes(cudf::column_view const &column, rounding_frequency freq, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Round datetimes down to the nearest multiple of the given frequency.
cudf::datetime::days_in_month
std::unique_ptr< cudf::column > days_in_month(cudf::column_view const &column, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Extract the number of days in the month.
cudf::datetime::extract_month
std::unique_ptr< cudf::column > extract_month(cudf::column_view const &column, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Extracts month from any datetime type and returns an int16_t cudf::column.
cudf::datetime::extract_year
std::unique_ptr< cudf::column > extract_year(cudf::column_view const &column, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Extracts year from any datetime type and returns an int16_t cudf::column.
cudf::datetime::extract_weekday
std::unique_ptr< cudf::column > extract_weekday(cudf::column_view const &column, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Extracts a weekday from any datetime type and returns an int16_t cudf::column.
cudf::scalar
An owning class to represent a singular value.
Definition:
scalar.hpp:48
cudf::datetime::rounding_frequency
rounding_frequency
Fixed frequencies supported by datetime rounding functions ceil, floor, round.
Definition:
datetime.hpp:345
cudf
cuDF interfaces
Definition:
aggregation.hpp:34
cudf::datetime::extract_millisecond_fraction
std::unique_ptr< cudf::column > extract_millisecond_fraction(cudf::column_view const &column, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Extracts millisecond fraction from any datetime type and returns an int16_t cudf::column.
cudf::datetime::extract_nanosecond_fraction
std::unique_ptr< cudf::column > extract_nanosecond_fraction(cudf::column_view const &column, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Extracts nanosecond fraction from any datetime type and returns an int16_t cudf::column.
cudf::datetime::extract_day
std::unique_ptr< cudf::column > extract_day(cudf::column_view const &column, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Extracts day from any datetime type and returns an int16_t cudf::column.
rmm::mr::device_memory_resource
cudf::datetime::ceil_datetimes
std::unique_ptr< cudf::column > ceil_datetimes(cudf::column_view const &column, rounding_frequency freq, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Round datetimes up to the nearest multiple of the given frequency.
cudf::datetime::extract_minute
std::unique_ptr< cudf::column > extract_minute(cudf::column_view const &column, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Extracts minute from any datetime type and returns an int16_t cudf::column.
cudf::datetime::extract_second
std::unique_ptr< cudf::column > extract_second(cudf::column_view const &column, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Extracts second from any datetime type and returns an int16_t cudf::column.
cudf::datetime::last_day_of_month
std::unique_ptr< cudf::column > last_day_of_month(cudf::column_view const &column, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Computes the last day of the month in datetime type and returns a TIMESTAMP_DAYS cudf::column.
Generated by
1.8.20