mirror of
https://github.com/lancedb/lancedb.git
synced 2026-07-03 19:10:41 +00:00
feat: add polars dataframe integration (#3584)
This PR is part cleanup, part feature, part example. It removes `IntoArrow` and `IntoArrowStream`. There was only one redundant call site between the two. Once we moved everything to `Scannable` these traits no longer serve any purpose. It adds a `Scannable` impl for a polars DataFrame. We used to have this at one point for `IntoArrow` so this is more like a regression fix than anything. It adds an example (and unit test) which ensures we can ingest from a Polars DataFrame and export to one. LazyFrame support would be a follow-up (though a pretty straightforward one) but we've never had proper LazyFrame support before.
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
|
||||
use std::time::Duration;
|
||||
|
||||
use lancedb::{arrow::IntoArrow, ipc::ipc_file_to_batches, table::merge::MergeInsertBuilder};
|
||||
use lancedb::{ipc::ipc_file_to_batches, table::merge::MergeInsertBuilder};
|
||||
use napi::bindgen_prelude::*;
|
||||
use napi_derive::napi;
|
||||
|
||||
@@ -66,11 +66,9 @@ impl NativeMergeInsertBuilder {
|
||||
|
||||
#[napi(catch_unwind)]
|
||||
pub async fn execute(&self, buf: Buffer) -> napi::Result<MergeResult> {
|
||||
let data = ipc_file_to_batches(buf.to_vec())
|
||||
.and_then(IntoArrow::into_arrow)
|
||||
.map_err(|e| {
|
||||
napi::Error::from_reason(format!("Failed to read IPC file: {}", convert_error(&e)))
|
||||
})?;
|
||||
let data = ipc_file_to_batches(buf.to_vec()).map_err(|e| {
|
||||
napi::Error::from_reason(format!("Failed to read IPC file: {}", convert_error(&e)))
|
||||
})?;
|
||||
|
||||
let this = self.clone();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user