/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.drill.exec.vector.accessor; /** * Generic array reader. An array is one of the following: * * {@see ArrayWriter} */ public interface ArrayReader extends ColumnReader { /** * Number of elements in the array. * @return the number of elements */ int size(); /** * The object type of the list entry. All entries have the same * type. * @return the object type of each entry */ ObjectType entryType(); /** * Return the generic object reader for the array element. This * version does not position the reader, the client must * call {@link #setPosn(int)} to set the position. This form allows * up-front setup of the readers when convenient for the caller. */ ObjectReader entry(); ScalarReader scalar(); TupleReader tuple(); ArrayReader array(); VariantReader variant(); /** * Set the array reader to read a given array entry. Not used for * scalars, only for maps and arrays when using the non-indexed * methods {@link #entry()}, {@link #tuple()} and {@link #array()}. */ void setPosn(int index); void rewind(); /** * Move forward one position. * * @return true if another position is available, false if * the end of the array is reached */ boolean next(); }