mirror of
https://github.com/lancedb/lancedb.git
synced 2026-09-21 20:45:57 +00:00
feat(rust): make MetadataEraserExec public (#4213)
Export `MetadataEraserExec` and its constructor from `lancedb::table::datafusion`. Engines that serialise a physical plan containing a LanceDB scan have to rebuild the operator outside this crate, which a private type makes impossible.
This commit is contained in:
@@ -33,11 +33,23 @@ use crate::{
|
||||
use arrow_schema::{DataType, Field};
|
||||
use lance_index::scalar::FullTextSearchQuery;
|
||||
|
||||
/// Datafusion attempts to maintain batch metadata
|
||||
/// An execution plan that erases Arrow schema-level metadata from its input's batches.
|
||||
///
|
||||
/// This is needless and it triggers bugs in DF. This operator erases metadata from the batches.
|
||||
/// DataFusion attempts to maintain batch metadata. This is needless and it triggers bugs in
|
||||
/// DF, so [`BaseTableAdapter::scan`] wraps every scan it produces in one of these.
|
||||
///
|
||||
/// ```
|
||||
/// use std::sync::Arc;
|
||||
///
|
||||
/// use datafusion_physical_plan::ExecutionPlan;
|
||||
/// use lancedb::table::datafusion::MetadataEraserExec;
|
||||
///
|
||||
/// # fn erase_metadata(scan: Arc<dyn ExecutionPlan>) -> Arc<dyn ExecutionPlan> {
|
||||
/// Arc::new(MetadataEraserExec::new(scan))
|
||||
/// # }
|
||||
/// ```
|
||||
#[derive(Debug)]
|
||||
struct MetadataEraserExec {
|
||||
pub struct MetadataEraserExec {
|
||||
input: Arc<dyn ExecutionPlan>,
|
||||
schema: Arc<ArrowSchema>,
|
||||
properties: Arc<PlanProperties>,
|
||||
@@ -62,7 +74,8 @@ impl MetadataEraserExec {
|
||||
)
|
||||
}
|
||||
|
||||
fn new(input: Arc<dyn ExecutionPlan>) -> Self {
|
||||
/// Wrap `input` in an operator that strips schema-level metadata from its batches.
|
||||
pub fn new(input: Arc<dyn ExecutionPlan>) -> Self {
|
||||
let schema = Arc::new(
|
||||
input
|
||||
.schema()
|
||||
|
||||
Reference in New Issue
Block a user