Skip to content

Commit 6be140d

Browse files
committed
fix tests
1 parent e9e8122 commit 6be140d

File tree

2 files changed

+31
-3
lines changed

2 files changed

+31
-3
lines changed

crates/duckdb/src/r2d2.rs

+13-3
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,21 @@
4040
//! .unwrap()
4141
//! }
4242
//! ```
43-
use crate::{vscalar::VScalar, vtab::VTab, Config, Connection, Error, Result};
43+
use crate::{Config, Connection, Error, Result};
4444
use std::{
45-
fmt::Debug,
4645
path::Path,
4746
sync::{Arc, Mutex},
4847
};
4948

49+
#[cfg(feature = "vscalar")]
50+
use crate::vscalar::VScalar;
51+
#[cfg(feature = "vscalar")]
52+
use std::fmt::Debug;
53+
54+
55+
#[cfg(feature = "vtab")]
56+
use crate::vtab::VTab;
57+
5058
/// An `r2d2::ManageConnection` for `duckdb::Connection`s.
5159
pub struct DuckdbConnectionManager {
5260
connection: Arc<Mutex<Connection>>,
@@ -81,13 +89,15 @@ impl DuckdbConnectionManager {
8189
}
8290

8391
/// Register a table function.
92+
#[cfg(feature = "vtab")]
8493
pub fn register_table_function<T: VTab>(&self, name: &str) -> Result<()> {
8594
let conn = self.connection.lock().unwrap();
8695
conn.register_table_function::<T>(name)
8796
}
8897

8998
/// Register a scalar function.
90-
pub fn register_scalar<S: VScalar>(&self, name: &str) -> Result<()>
99+
#[cfg(feature = "vscalar")]
100+
pub fn register_scalar_function<S: VScalar>(&self, name: &str) -> Result<()>
91101
where
92102
S::State: Debug,
93103
{

crates/duckdb/src/vtab/arrow.rs

+18
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,15 @@ pub fn write_arrow_array_to_vector(
539539
&mut chunk.flat_vector(),
540540
);
541541
}
542+
DataType::Utf8View => {
543+
string_view_array_to_vector(
544+
col.as_ref()
545+
.as_any()
546+
.downcast_ref::<StringViewArray>()
547+
.ok_or_else(|| Box::<dyn std::error::Error>::from("Unable to downcast to StringViewArray"))?,
548+
&mut chunk.flat_vector(),
549+
);
550+
}
542551
DataType::Binary => {
543552
binary_array_to_vector(as_generic_binary_array(col.as_ref()), &mut chunk.flat_vector());
544553
}
@@ -554,6 +563,15 @@ pub fn write_arrow_array_to_vector(
554563
&mut chunk.flat_vector(),
555564
);
556565
}
566+
DataType::BinaryView => {
567+
binary_view_array_to_vector(
568+
col.as_ref()
569+
.as_any()
570+
.downcast_ref::<BinaryViewArray>()
571+
.ok_or_else(|| Box::<dyn std::error::Error>::from("Unable to downcast to BinaryViewArray"))?,
572+
&mut chunk.flat_vector(),
573+
);
574+
}
557575
DataType::List(_) => {
558576
list_array_to_vector(as_list_array(col.as_ref()), &mut chunk.list_vector())?;
559577
}

0 commit comments

Comments
 (0)