Skip to content

Make Accumulators and ScalarValue serializable #11369

@ameyc

Description

@ameyc

Is your feature request related to a problem or challenge?

When running continuous computations, we'd like to snapshot the state of our operators many of which use accumulators. This would be key to make computations over continuous streams a first class citizen in DataFusion (see #11365 ).

Describe the solution you'd like

Addition of a SerializableAccumulator trait -

pub trait SerializableAccumulator: Accumulator {
    fn serialize(&self) -> Result<Vec<u8>>;
    fn deserialize(bytes: &[u8]) -> Result<Box<dyn Accumulator>>
    where
        Self: Sized;
}

as well as a method on the Accumulator trait -

fn as_serializable(&self) -> Option<&dyn SerializableAccumulator> {
        None
    }

This would mean ScalarValue also needs to implement serialization to [u8]. We have a POC PR on our fork of DataFusion for this.

Would love to hear feedback from the community on this proposal.

Describe alternatives you've considered

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions