Skip to content

Commit

Permalink
fix more clippy issue
Browse files Browse the repository at this point in the history
Change-Id: I0fa1758d9e2a40b0daaf37fc3887998d7d72e534
  • Loading branch information
wangfenjin committed Jan 18, 2023
1 parent abf87c2 commit 8fddbf7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
3 changes: 3 additions & 0 deletions src/table_function/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -352,19 +352,22 @@ pub struct ReplacementScanInfo(pub(crate) duckdb_replacement_scan_info);

impl ReplacementScanInfo {
/// Sets the replacement function name to use. If this function is called in the replacement callback, the replacement scan is performed. If it is not called, the replacement callback is not performed.
#[allow(dead_code)]
pub fn set_function_name(&mut self, function_name: &str) {
unsafe {
let function_name = CString::new(function_name).unwrap();
duckdb_replacement_scan_set_function_name(self.0, function_name.as_ptr());
}
}
/// Adds a parameter to the replacement scan function.
#[allow(dead_code)]
pub fn add_parameter(&mut self, parameter: Value) {
unsafe {
duckdb_replacement_scan_add_parameter(self.0, parameter.0);
}
}
/// Report that an error has occurred while executing the replacement scan.
#[allow(dead_code)]
pub fn set_error(&mut self, error: &str) {
unsafe {
let error = CString::new(error).unwrap();
Expand Down
12 changes: 7 additions & 5 deletions src/table_function/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,16 @@ pub enum LogicalTypeId {
Struct = ffi::DUCKDB_TYPE_DUCKDB_TYPE_STRUCT as isize,
Map = ffi::DUCKDB_TYPE_DUCKDB_TYPE_MAP as isize,
Uuid = ffi::DUCKDB_TYPE_DUCKDB_TYPE_UUID as isize,
Union = ffi::DUCKDB_TYPE_DUCKDB_TYPE_UNION as isize,
Json = ffi::DUCKDB_TYPE_DUCKDB_TYPE_JSON as isize,
Union = ffi::DUCKDB_TYPE_DUCKDB_TYPE_UNION as isize,
}

use ffi::{
duckdb_create_list_type, duckdb_create_logical_type, duckdb_create_map_type, duckdb_destroy_logical_type,
duckdb_get_type_id, duckdb_logical_type, idx_t,
};
use num_traits::FromPrimitive;
use std::collections::HashMap;
use std::ffi::{c_char, CString};
use std::ops::Deref;

/// Represents a logical type in the database - the underlying physical type can differ depending on the implementation
#[derive(Debug)]
Expand All @@ -85,6 +83,11 @@ pub struct LogicalType {
}

impl LogicalType {
/// Creates a map type from type id.
///
/// # Arguments
/// * `type`: The type id.
/// * `returns`: The logical type.
pub fn new(typ: LogicalTypeId) -> Self {
unsafe {
Self {
Expand Down Expand Up @@ -218,8 +221,7 @@ impl Drop for Value {
}
}
use ffi::{
duckdb_validity_row_is_valid, duckdb_validity_set_row_invalid, duckdb_validity_set_row_valid,
duckdb_validity_set_row_validity, duckdb_vector, duckdb_vector_assign_string_element,
duckdb_validity_row_is_valid, duckdb_validity_set_row_validity, duckdb_vector, duckdb_vector_assign_string_element,
duckdb_vector_assign_string_element_len, duckdb_vector_ensure_validity_writable, duckdb_vector_get_column_type,
duckdb_vector_get_data, duckdb_vector_get_validity, duckdb_vector_size,
};
Expand Down

0 comments on commit 8fddbf7

Please sign in to comment.