JingsongLi commented on a change in pull request #10022: [FLINK-14135][hive][orc] Introduce orc ColumnarRow reader for hive connector URL: https://github.com/apache/flink/pull/10022#discussion_r348411797
########## File path: flink-connectors/flink-orc/src/main/java/org/apache/flink/orc/OrcColumnarRowSplitReader.java ########## @@ -0,0 +1,192 @@ +/* + * 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.flink.orc; + +import org.apache.flink.core.fs.Path; +import org.apache.flink.table.api.DataTypes; +import org.apache.flink.table.dataformat.BaseRow; +import org.apache.flink.table.dataformat.ColumnarRow; +import org.apache.flink.table.dataformat.vector.ColumnVector; +import org.apache.flink.table.dataformat.vector.VectorizedColumnBatch; +import org.apache.flink.table.types.DataType; +import org.apache.flink.table.types.logical.ArrayType; +import org.apache.flink.table.types.logical.CharType; +import org.apache.flink.table.types.logical.DecimalType; +import org.apache.flink.table.types.logical.LogicalType; +import org.apache.flink.table.types.logical.MapType; +import org.apache.flink.table.types.logical.RowType; +import org.apache.flink.table.types.logical.VarCharType; + +import org.apache.hadoop.conf.Configuration; +import org.apache.orc.TypeDescription; + +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +import static org.apache.flink.orc.vector.AbstractOrcColumnVector.createVector; +import static org.apache.flink.orc.vector.AbstractOrcColumnVector.createVectorFromConstant; + +/** + * {@link OrcSplitReader} to read ORC files into {@link BaseRow}. + */ +public class OrcColumnarRowSplitReader extends OrcSplitReader<BaseRow> { + + // the vector of rows that is read in a batch + private final VectorizedColumnBatch columnarBatch; + + private final ColumnarRow row; + + public OrcColumnarRowSplitReader( + Configuration conf, + int[] selectedFields, + String[] fullFieldNames, + DataType[] fullFieldTypes, + List<String> partitionKeys, Review comment: Who should see partition concept? It need know partition to construct `VectorizedColumnBatch`. If move the construction of `VectorizedColumnBatch` out of this class. Then this class just only left: ``` @Override protected int fillRows() { int size = rowBatch.size; columnarBatch.setNumRows(size); return size; } @Override public BaseRow nextRecord(BaseRow reuse) { // return the next row row.setRowId(this.nextRow++); return row; } ``` ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services