(
rb: *mut paimon_read_builder,
columns: *const *const std::ffi::c_char,
)
| 120 | /// `columns` must be a null-terminated array of null-terminated C strings, or null for no projection. |
| 121 | #[no_mangle] |
| 122 | pub unsafe extern "C" fn paimon_read_builder_with_projection( |
| 123 | rb: *mut paimon_read_builder, |
| 124 | columns: *const *const std::ffi::c_char, |
| 125 | ) -> *mut paimon_error { |
| 126 | if let Err(e) = check_non_null(rb, "rb") { |
| 127 | return e; |
| 128 | } |
| 129 | |
| 130 | let state = &mut *((*rb).inner as *mut ReadBuilderState); |
| 131 | |
| 132 | if columns.is_null() { |
| 133 | state.projected_columns = None; |
| 134 | return std::ptr::null_mut(); |
| 135 | } |
| 136 | |
| 137 | let mut col_names = Vec::new(); |
| 138 | let mut ptr = columns; |
| 139 | while !(*ptr).is_null() { |
| 140 | let c_str = std::ffi::CStr::from_ptr(*ptr); |
| 141 | match c_str.to_str() { |
| 142 | Ok(s) => col_names.push(s.to_string()), |
| 143 | Err(e) => { |
| 144 | return paimon_error::from_paimon(paimon::Error::ConfigInvalid { |
| 145 | message: format!("Invalid UTF-8 in column name: {e}"), |
| 146 | }); |
| 147 | } |
| 148 | } |
| 149 | ptr = ptr.add(1); |
| 150 | } |
| 151 | |
| 152 | state.projected_columns = Some(col_names); |
| 153 | std::ptr::null_mut() |
| 154 | } |
| 155 | |
| 156 | /// Set a filter predicate for scan planning. |
| 157 | /// |
nothing calls this directly
no test coverage detected