Skip to content

Support Map as a ScalarValue #11128

Closed

Description

@Blizzara

Is your feature request related to a problem or challenge?

ScalarValue does not currently support Maps, see e.g. #8262 (comment).

#6485 is probably related as well, though I'm not 100% sure

I ran into this when looking to implement Substrait -> DF conversion for MapType

Describe the solution you'd like

Implement ScalarValue::Map and all the related functionality

Describe alternatives you've considered

No response

Additional context

No response

Activity

  1. goldmedal commented on Jun 27, 2024

    @goldmedal
    Contributor

    take

  2. goldmedal commented on Jun 27, 2024

    @goldmedal
    Contributor

    I'm interested in this issue.
    As @alamb said in #8262 (comment) :

    l I think ScalarValue::Map can follow the model of ScalarValue::List (as Maps are just lists of structs, as I undertand):

    I think I can used a list of structs with the same type struct to implemented a basic version like:

    List<Struct<K, V>>
    

    Then, provide the HashMap (or others) implementation for the physical plan.
    Does it make sense?

  3. alamb commented on Jun 27, 2024

    @alamb
    Contributor

    I think ScalarValue::Map should follow the same pattern as ScalarValue::List ScalarValue::Struct

    List(Arc<ListArray>),

    So that would mean a single element MapArray: https://docs.rs/arrow/latest/arrow/array/struct.MapArray.html

    enum ScalarValue {
      ...
      Map(Arc<MapArray>)
      ...
    }

    Does that make sense?

  4. goldmedal commented on Jun 27, 2024

    @goldmedal
    Contributor
    enum ScalarValue {
      ...
      Map(Arc<MapArray>)
      ...
    }

    Does that make sense?

    Many thanks! It looks good to me. I didn't notice this struct. I will try to follow this pattern to implement this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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