[Java] MapVector written data does not meet expectations

未关闭
#40 4 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
java
领域
data

调研方向

使用 MapVector 和 UnionMapWriter 重现提供的 Java 代码片段,然后检查 MapVector 和 UnionMapWriter 的写入路径,了解其对不同键类型和值类型的处理。比较现有的 ListVector 文档示例,并将完成定义为以下任一项:成功写入具有混合类型的 MapVector,或提供一个有文档说明且可运行的 MapVector 示例,并由回归测试支持。

由索引模型根据 Issue 内容生成。

描述

Component: Documentation
What would you like help with?
    RootAllocator allocator = new RootAllocator(Long.MAX_VALUE);
    Map<String, String> metadata = new HashMap<>();
    metadata.put("K1", "V1");
    metadata.put("K2", "V2");
    Field a = new Field("key", FieldType.notNullable(new ArrowType.Int(32, true)), null);
    Field b = new Field("value", FieldType.nullable(new ArrowType.Int(32,true)), null);
    Schema schema = new Schema(asList(a, b), metadata);
    Field struct = new Field("struct", FieldType.notNullable(new ArrowType.Struct()), schema.getFields());
    StructVector structVector = new StructVector(Field.nullable("struct", struct.getType()), allocator, null);
    MapVector mapVector = new MapVector(Field.nullable("map", structVector.getField().getType()), allocator, null);
    mapVector.initializeChildrenFromFields(Collections.singletonList(struct));
    mapVector.allocateNew();
    
    UnionMapWriter writer = mapVector.getWriter();
    for (int i = 0; i < 10; i++) {
        writer.startMap();
        writer.setPosition(i);
        writer.key().writeInt(i);
        writer.value().writeInt(i * 10);
        writer.endMap();
    }
    writer.setValueCount(10);

when the types of key and value are different, data cannot be written .
Only examples of ListVector are available in the documentation on the official website ,Please provide an example of writing data to MapVector.

image

主要语言
Java
星标
95
派生
154
平均合并
2 天 10 小时
30 天内合并 PR
11

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

apache/arrow-java 的其他 Issue

查看 apache/arrow-java 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。