1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
//! Bridge definitions for libcudf string conversion operations.
#[cxx::bridge(namespace = "cudf_shims")]
pub mod ffi {
unsafe extern "C++" {
include!("strings/convert_shim.h");
include!("column_shim.h");
type OwnedColumn = crate::column::ffi::OwnedColumn;
/// Convert string column to integer column of the specified type.
/// `type_id` corresponds to `cudf::type_id` (e.g., INT32, INT64).
fn str_to_integers(col: &OwnedColumn, type_id: i32) -> Result<UniquePtr<OwnedColumn>>;
/// Convert integer column to string column.
fn str_from_integers(col: &OwnedColumn) -> Result<UniquePtr<OwnedColumn>>;
/// Convert string column to float column of the specified type.
/// `type_id` corresponds to `cudf::type_id` (e.g., FLOAT32, FLOAT64).
fn str_to_floats(col: &OwnedColumn, type_id: i32) -> Result<UniquePtr<OwnedColumn>>;
/// Convert float column to string column.
fn str_from_floats(col: &OwnedColumn) -> Result<UniquePtr<OwnedColumn>>;
// ── Booleans ──────────────────────────────────────────────
/// Convert string column to boolean column using `true_str` as the true value.
fn str_to_booleans(col: &OwnedColumn, true_str: &str) -> Result<UniquePtr<OwnedColumn>>;
/// Convert boolean column to string column.
fn str_from_booleans(
col: &OwnedColumn,
true_str: &str,
false_str: &str,
) -> Result<UniquePtr<OwnedColumn>>;
// ── Timestamps ────────────────────────────────────────────
/// Convert string column to timestamp column.
fn str_to_timestamps(
col: &OwnedColumn,
format: &str,
type_id: i32,
) -> Result<UniquePtr<OwnedColumn>>;
/// Convert timestamp column to string column.
fn str_from_timestamps(col: &OwnedColumn, format: &str) -> Result<UniquePtr<OwnedColumn>>;
// ── Durations ─────────────────────────────────────────────
/// Convert string column to duration column.
fn str_to_durations(
col: &OwnedColumn,
format: &str,
type_id: i32,
) -> Result<UniquePtr<OwnedColumn>>;
/// Convert duration column to string column.
fn str_from_durations(col: &OwnedColumn, format: &str) -> Result<UniquePtr<OwnedColumn>>;
// ── Fixed Point ───────────────────────────────────────────
/// Convert string column to fixed-point (decimal) column.
fn str_to_fixed_point(
col: &OwnedColumn,
type_id: i32,
scale: i32,
) -> Result<UniquePtr<OwnedColumn>>;
/// Convert fixed-point column to string column.
fn str_from_fixed_point(col: &OwnedColumn) -> Result<UniquePtr<OwnedColumn>>;
// ── Type Checks ───────────────────────────────────────────
/// Check if each string is a valid integer representation.
fn str_is_integer(col: &OwnedColumn) -> Result<UniquePtr<OwnedColumn>>;
/// Check if each string is a valid float representation.
fn str_is_float(col: &OwnedColumn) -> Result<UniquePtr<OwnedColumn>>;
// ── Hex ───────────────────────────────────────────────────
/// Convert hex string column to integer column.
fn str_hex_to_integers(col: &OwnedColumn, type_id: i32) -> Result<UniquePtr<OwnedColumn>>;
/// Convert integer column to hex string column.
fn str_integers_to_hex(col: &OwnedColumn) -> Result<UniquePtr<OwnedColumn>>;
// ── IPv4 ──────────────────────────────────────────────────
/// Convert IPv4 string column to integer column.
fn str_ipv4_to_integers(col: &OwnedColumn) -> Result<UniquePtr<OwnedColumn>>;
/// Convert integer column to IPv4 string column.
fn str_integers_to_ipv4(col: &OwnedColumn) -> Result<UniquePtr<OwnedColumn>>;
// ── URL ───────────────────────────────────────────────────
/// URL-encode each string.
fn str_url_encode(col: &OwnedColumn) -> Result<UniquePtr<OwnedColumn>>;
/// URL-decode each string.
fn str_url_decode(col: &OwnedColumn) -> Result<UniquePtr<OwnedColumn>>;
// ── Fixed Point Check ─────────────────────────────────────
/// Check if each string is a valid fixed-point representation for the given type.
fn str_is_fixed_point(col: &OwnedColumn, type_id: i32) -> Result<UniquePtr<OwnedColumn>>;
// ── Integer Cast (encode/decode) ──────────────────────────
/// Encode strings as integer values (byte representation).
fn str_cast_to_integer(col: &OwnedColumn, type_id: i32) -> Result<UniquePtr<OwnedColumn>>;
/// Decode integer-encoded values back to strings.
fn str_cast_from_integer(col: &OwnedColumn) -> Result<UniquePtr<OwnedColumn>>;
// ── Format List Column ────────────────────────────────────
/// Convert a list column of strings into a formatted strings column.
fn str_format_list_column(col: &OwnedColumn) -> Result<UniquePtr<OwnedColumn>>;
// ── Additional Validators ─────────────────────────────────
/// Check if each string is a valid timestamp for the given format.
fn str_is_timestamp(col: &OwnedColumn, format: &str) -> Result<UniquePtr<OwnedColumn>>;
/// Check if each string is a valid hex representation.
fn str_is_hex(col: &OwnedColumn) -> Result<UniquePtr<OwnedColumn>>;
/// Check if each string is a valid IPv4 address.
fn str_is_ipv4(col: &OwnedColumn) -> Result<UniquePtr<OwnedColumn>>;
}
}