JingsongLi commented on a change in pull request #12985: URL: https://github.com/apache/flink/pull/12985#discussion_r466844085
########## File path: flink-formats/flink-orc/src/main/java/org/apache/flink/orc/vector/OrcLegacyTimestampColumnVector.java ########## @@ -0,0 +1,168 @@ +/* + * 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.vector; + +import org.apache.flink.table.data.TimestampData; +import org.apache.flink.util.FlinkRuntimeException; + +import org.apache.hadoop.hive.ql.exec.vector.ColumnVector; +import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.sql.Timestamp; +import java.time.LocalDateTime; + +/** + * This class is used to adapt to Hive's legacy (2.0.x) timestamp column vector which is a LongColumnVector. + * This class does not import TimestampColumnVector and provides utils to decide whether new or legacy column + * vector should be used. + */ +public class OrcLegacyTimestampColumnVector extends AbstractOrcColumnVector implements + org.apache.flink.table.data.vector.TimestampColumnVector { + + private static final Logger LOG = LoggerFactory.getLogger(OrcLegacyTimestampColumnVector.class); + + private static Class hiveTSColVectorClz; + private static Constructor constructor; + private static Method getTimeMethod; + private static Method getNanosMethod; + private static Method fillMethod; + private static boolean hiveTSColVectorAvailable = false; + + static { + try { + hiveTSColVectorClz = Class.forName("org.apache.hadoop.hive.ql.exec.vector.TimestampColumnVector"); Review comment: Can you have a `TimestampUtil`, and then decide using `OrcTimestampColumnVector` or a `LongOrcTimestampVector`? ########## File path: flink-formats/flink-orc/src/main/java/org/apache/flink/orc/vector/OrcLegacyTimestampColumnVector.java ########## @@ -0,0 +1,168 @@ +/* + * 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.vector; + +import org.apache.flink.table.data.TimestampData; +import org.apache.flink.util.FlinkRuntimeException; + +import org.apache.hadoop.hive.ql.exec.vector.ColumnVector; +import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.sql.Timestamp; +import java.time.LocalDateTime; + +/** + * This class is used to adapt to Hive's legacy (2.0.x) timestamp column vector which is a LongColumnVector. + * This class does not import TimestampColumnVector and provides utils to decide whether new or legacy column + * vector should be used. + */ +public class OrcLegacyTimestampColumnVector extends AbstractOrcColumnVector implements + org.apache.flink.table.data.vector.TimestampColumnVector { + + private static final Logger LOG = LoggerFactory.getLogger(OrcLegacyTimestampColumnVector.class); + + private static Class hiveTSColVectorClz; + private static Constructor constructor; + private static Method getTimeMethod; + private static Method getNanosMethod; + private static Method fillMethod; + private static boolean hiveTSColVectorAvailable = false; + + static { + try { + hiveTSColVectorClz = Class.forName("org.apache.hadoop.hive.ql.exec.vector.TimestampColumnVector"); Review comment: Can you have a `TimestampUtil`, and then decide using `OrcTimestampColumnVector` or a `OrcLongTimestampVector`? ---------------------------------------------------------------- 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