Skip to content

[C#] Implement MapType #35243

@Platob

Description

@Platob

Describe the enhancement requested

Hello,

i started dev on new implementation of MapType, im wondering how it should be built ?

I think is a list of Struct which are like KeyValuePair c# class

using System.Collections.Generic;

namespace Apache.Arrow.Types
{
    public class MapType : NestedType
    {
        public override ArrowTypeId TypeId => ArrowTypeId.Map;
        public override string Name => "map";

        public Field KeyField => Fields[0];
        public Field ValueField => Fields[0];

        public IArrowType ValueDataType => Fields[0].DataType;

        public MapType(IArrowType keyType, IArrowType valueType, bool nullable)
            : this(new Field("key", keyType, false), new Field("value", keyType, false), nullable)
        {
        }

        public MapType(Field keyField, Field valueField, bool nullable)
            : this(new StructType(new List<Field>() { keyField, valueField }), nullable)
        {
        }

        public MapType(StructType structType, bool nullable) : this(new ListType(new Field("key_value", structType, nullable)), nullable)
        {
        }

        public MapType(ListType listType, bool nullable) : this(new Field("key_values", listType, nullable))
        {
        }

        public MapType(Field keyValueField) : base(keyValueField)
        {
        }

        public override void Accept(IArrowTypeVisitor visitor) => Accept(this, visitor);
    }
}

Component(s)

C#

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions