Skip to content

Serializing custom TableSource implementations fails #16749

@colinmarc

Description

@colinmarc

Describe the bug

LogicalExtensionCodec allows providing a custom serialization strategy for a TableProvider, but the calling code always expects a DefaultTableSource to unwrap:

let provider = source_as_provider(source)?;

Which calls source_as_provider:

pub fn source_as_provider(
source: &Arc<dyn TableSource>,
) -> datafusion_common::Result<Arc<dyn TableProvider>> {
match source
.as_ref()
.as_any()
.downcast_ref::<DefaultTableSource>()
{
Some(source) => Ok(Arc::clone(&source.table_provider)),
_ => internal_err!("TableSource was not DefaultTableSource"),
}
}

It would be better if LogicalExtensionCodec had encode_table_source instead of encode_table_provider.

To Reproduce

No response

Expected behavior

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions