• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

vortex-data / vortex / 16419679723

21 Jul 2025 02:23PM UTC coverage: 81.544%. First build
16419679723

Pull #3951

github

web-flow
Merge 69a40d17b into 56156aa03
Pull Request #3951: DuckDB Table Filters

115 of 179 new or added lines in 9 files covered. (64.25%)

42107 of 51637 relevant lines covered (81.54%)

170614.28 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

52.94
/vortex-duckdb/src/duckdb/table_function/bind.rs
1
// SPDX-License-Identifier: Apache-2.0
2
// SPDX-FileCopyrightText: Copyright the Vortex contributors
3

4
use std::ffi::CStr;
5

6
use vortex::error::vortex_err;
7

8
use crate::duckdb::data::Data;
9
use crate::duckdb::{LogicalType, TableFunction, Value, try_or_null};
10
use crate::{cpp, wrapper};
11

12
/// The native bind callback for a table function.
13
pub(crate) unsafe extern "C" fn bind_callback<T: TableFunction>(
199✔
14
    bind_input: cpp::duckdb_vx_tfunc_bind_input,
199✔
15
    bind_result: cpp::duckdb_vx_tfunc_bind_result,
199✔
16
    error_out: *mut cpp::duckdb_vx_error,
199✔
17
) -> cpp::duckdb_vx_data {
199✔
18
    let bind_input = unsafe { BindInput::own(bind_input) };
199✔
19
    let mut bind_result = unsafe { BindResult::own(bind_result) };
199✔
20

21
    try_or_null(error_out, || {
199✔
22
        let bind_data = T::bind(&bind_input, &mut bind_result)?;
199✔
23
        Ok(Data::from(Box::new(bind_data)).as_ptr())
199✔
24
    })
199✔
25
}
199✔
26

27
/// The native copy callback for bind data.
28
pub(crate) unsafe extern "C" fn bind_data_clone_callback<T: TableFunction>(
×
29
    bind_data: *const std::ffi::c_void,
×
30
    error_out: *mut cpp::duckdb_vx_error,
×
31
) -> cpp::duckdb_vx_data {
×
32
    try_or_null(error_out, || {
×
33
        let bind_data = unsafe {
×
34
            (bind_data as *const T::BindData)
×
35
                .as_ref()
×
36
                .ok_or(vortex_err!("bind_data is nullptr"))?
×
37
        };
38
        let copied_data = bind_data.clone();
×
39
        Ok(Data::from(Box::new(copied_data)).as_ptr())
×
40
    })
×
41
}
×
42

43
wrapper!(BindInput, cpp::duckdb_vx_tfunc_bind_input, |_| {});
199✔
44

45
impl BindInput {
46
    /// Returns the parameter at the given index.
47
    pub fn get_parameter(&self, index: usize) -> Option<Value> {
199✔
48
        let value_ptr =
199✔
49
            unsafe { cpp::duckdb_vx_tfunc_bind_input_get_parameter(self.as_ptr(), index as _) };
199✔
50
        if value_ptr.is_null() {
199✔
51
            None
×
52
        } else {
53
            Some(unsafe { Value::own(value_ptr) })
199✔
54
        }
55
    }
199✔
56

57
    /// Returns the named parameter with the given name, if it exists.
58
    pub fn get_named_parameter(&self, name: &CStr) -> Option<Value> {
×
59
        let value_ptr = unsafe {
×
60
            cpp::duckdb_vx_tfunc_bind_input_get_named_parameter(self.as_ptr(), name.as_ptr())
×
61
        };
62
        if value_ptr.is_null() {
×
63
            None
×
64
        } else {
65
            Some(unsafe { Value::own(value_ptr) })
×
66
        }
67
    }
×
68

69
    /// Returns the number of parameters bound to this function.
70
    pub fn parameter_count(&self) -> usize {
×
NEW
71
        unsafe { cpp::duckdb_vx_tfunc_bind_input_get_parameter_count(self.as_ptr()) }
×
72
    }
×
73
}
74

75
wrapper!(BindResult, cpp::duckdb_vx_tfunc_bind_result, |_| {});
199✔
76

77
impl BindResult {
78
    pub fn add_result_column(&self, name: &str, logical_type: &LogicalType) {
1,677✔
79
        unsafe {
80
            cpp::duckdb_vx_tfunc_bind_result_add_column(
1,677✔
81
                self.as_ptr(),
1,677✔
82
                name.as_ptr().cast(),
1,677✔
83
                name.len() as _,
1,677✔
84
                logical_type.as_ptr(),
1,677✔
85
            )
86
        }
87
    }
1,677✔
88
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc