]> git.proxmox.com Git - ceph.git/blame - ceph/src/arrow/java/vector/src/main/java/org/apache/arrow/vector/complex/impl/SingleListReaderImpl.java
import quincy 17.2.0
[ceph.git] / ceph / src / arrow / java / vector / src / main / java / org / apache / arrow / vector / complex / impl / SingleListReaderImpl.java
CommitLineData
1d09f67e
TL
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18package org.apache.arrow.vector.complex.impl;
19
20
21import org.apache.arrow.vector.complex.AbstractContainerVector;
22import org.apache.arrow.vector.complex.reader.FieldReader;
23import org.apache.arrow.vector.complex.writer.BaseWriter.ListWriter;
24import org.apache.arrow.vector.complex.writer.BaseWriter.StructWriter;
25import org.apache.arrow.vector.types.Types.MinorType;
26
27/**
28 * An implementation of {@link AbstractFieldReader} for lists vectors.
29 */
30@SuppressWarnings("unused")
31public class SingleListReaderImpl extends AbstractFieldReader {
32
33 private final String name;
34 private final AbstractContainerVector container;
35 private FieldReader reader;
36
37 /**
38 * Constructs a new instance.
39 *
40 * @param name The name of field to read in container.
41 * @param container The container holding a list.
42 */
43 public SingleListReaderImpl(String name, AbstractContainerVector container) {
44 super();
45 this.name = name;
46 this.container = container;
47 }
48
49 @Override
50 public void setPosition(int index) {
51 super.setPosition(index);
52 if (reader != null) {
53 reader.setPosition(index);
54 }
55 }
56
57 @Override
58 public Object readObject() {
59 return reader.readObject();
60 }
61
62 @Override
63 public FieldReader reader() {
64 if (reader == null) {
65 reader = container.getChild(name).getReader();
66 setPosition(idx());
67 }
68 return reader;
69 }
70
71 @Override
72 public MinorType getMinorType() {
73 return MinorType.LIST;
74 }
75
76 @Override
77 public boolean isSet() {
78 return false;
79 }
80
81 @Override
82 public void copyAsValue(ListWriter writer) {
83 throw new UnsupportedOperationException("Generic list copying not yet supported. Please resolve to typed list.");
84 }
85
86 @Override
87 public void copyAsField(String name, StructWriter writer) {
88 throw new UnsupportedOperationException("Generic list copying not yet supported. Please resolve to typed list.");
89 }
90
91}