MCPcopy Create free account
hub / github.com/apache/paimon-rust / build_leaf_predicate

Function build_leaf_predicate

bindings/c/src/table.rs:720–755  ·  view source on GitHub ↗

Helper to build a leaf predicate without a datum (IS NULL / IS NOT NULL).

(
    table: *const paimon_table,
    column: *const std::ffi::c_char,
    build_fn: impl FnOnce(&PredicateBuilder, &str) -> paimon::Result<Predicate>,
)

Source from the content-addressed store, hash-verified

718
719/// Helper to build a leaf predicate without a datum (IS NULL / IS NOT NULL).
720unsafe fn build_leaf_predicate(
721 table: *const paimon_table,
722 column: *const std::ffi::c_char,
723 build_fn: impl FnOnce(&PredicateBuilder, &str) -> paimon::Result<Predicate>,
724) -> paimon_result_predicate {
725 if let Err(e) = check_non_null(table, "table") {
726 return paimon_result_predicate {
727 predicate: std::ptr::null_mut(),
728 error: e,
729 };
730 }
731 let col_name = match validate_cstr(column, "column") {
732 Ok(s) => s,
733 Err(e) => {
734 return paimon_result_predicate {
735 predicate: std::ptr::null_mut(),
736 error: e,
737 }
738 }
739 };
740 let table_ref = &*((*table).inner as *const Table);
741 let pb = PredicateBuilder::new(table_ref.schema().fields());
742 match build_fn(&pb, &col_name) {
743 Ok(pred) => {
744 let inner = Box::into_raw(Box::new(pred)) as *mut c_void;
745 paimon_result_predicate {
746 predicate: Box::into_raw(Box::new(paimon_predicate { inner })),
747 error: std::ptr::null_mut(),
748 }
749 }
750 Err(e) => paimon_result_predicate {
751 predicate: std::ptr::null_mut(),
752 error: paimon_error::from_paimon(e),
753 },
754 }
755}
756
757/// Create an equality predicate: `column = datum`.
758///

Callers 2

paimon_predicate_is_nullFunction · 0.85

Calls 4

check_non_nullFunction · 0.85
validate_cstrFunction · 0.85
fieldsMethod · 0.45
schemaMethod · 0.45

Tested by

no test coverage detected