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
//! Bridge definitions for libcudf string find operations.
#[cxx::bridge(namespace = "cudf_shims")]
pub mod ffi {
unsafe extern "C++" {
include!("strings/find_shim.h");
include!("column_shim.h");
include!("table_shim.h");
type OwnedColumn = crate::column::ffi::OwnedColumn;
type OwnedTable = crate::table::ffi::OwnedTable;
/// Find first occurrence of target in each string, starting at `start`.
/// Returns an INT32 column of positions (-1 if not found).
fn str_find(col: &OwnedColumn, target: &str, start: i32) -> Result<UniquePtr<OwnedColumn>>;
/// Find last occurrence of target in each string.
/// Returns an INT32 column of positions (-1 if not found).
fn str_rfind(col: &OwnedColumn, target: &str) -> Result<UniquePtr<OwnedColumn>>;
/// Check if each string starts with the given target.
/// Returns a BOOL8 column.
fn str_starts_with(col: &OwnedColumn, target: &str) -> Result<UniquePtr<OwnedColumn>>;
/// Check if each string ends with the given target.
/// Returns a BOOL8 column.
fn str_ends_with(col: &OwnedColumn, target: &str) -> Result<UniquePtr<OwnedColumn>>;
/// Check if each string contains any of the target strings.
/// Returns a table of BOOL8 columns, one per target.
fn str_contains_multiple(
col: &OwnedColumn,
targets: &OwnedColumn,
) -> Result<UniquePtr<OwnedTable>>;
/// Find positions of multiple target strings in each string.
/// Returns a lists column of INT32 positions.
fn str_find_multiple(
col: &OwnedColumn,
targets: &OwnedColumn,
) -> Result<UniquePtr<OwnedColumn>>;
/// Find targets (column) in each string.
fn str_find_column(
col: &OwnedColumn,
targets: &OwnedColumn,
start: i32,
) -> Result<UniquePtr<OwnedColumn>>;
/// Find the nth instance of target in each string.
fn str_find_instance(
col: &OwnedColumn,
target: &str,
instance: i32,
) -> Result<UniquePtr<OwnedColumn>>;
/// Check if each string contains the corresponding target string (column-based).
fn str_contains_column(
col: &OwnedColumn,
targets: &OwnedColumn,
) -> Result<UniquePtr<OwnedColumn>>;
/// Check if each string starts with the corresponding target string (column-based).
fn str_starts_with_column(
col: &OwnedColumn,
targets: &OwnedColumn,
) -> Result<UniquePtr<OwnedColumn>>;
/// Check if each string ends with the corresponding target string (column-based).
fn str_ends_with_column(
col: &OwnedColumn,
targets: &OwnedColumn,
) -> Result<UniquePtr<OwnedColumn>>;
}
}