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_r348870927
########## 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: The partition column generation should be contained in orc module, because the Orc Vectors are version related.(Hive 1.x has another package name). Another way I think is: 1.Extract a `ColumnarRowGenerator`, this class has method: `ColumnarRow generate(VectorizedRowBatch)`. We can have `PartitionedRowGenerator`. 2.Provide a factory: `OrcSplitReaderFactory`, hive module can use service finding to find this class. And generate reader. This is what I want to do later in order to support multiple versions. ---------------------------------------------------------------- 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: [email protected] With regards, Apache Git Services
