flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [flink] KurtYoung commented on a change in pull request #10022: [FLINK-14135][hive][orc] Introduce orc ColumnarRow reader for hive connector
Date Fri, 15 Nov 2019 12:06:58 GMT
KurtYoung 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_r346721079
 
 

 ##########
 File path: flink-connectors/flink-orc/src/main/java/org/apache/flink/orc/vector/AbstractOrcColumnVector.java
 ##########
 @@ -0,0 +1,175 @@
+/*
+ * 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.types.logical.DecimalType;
+import org.apache.flink.table.types.logical.LogicalType;
+
+import org.apache.hadoop.hive.common.type.HiveDecimal;
+import org.apache.hadoop.hive.ql.exec.vector.BytesColumnVector;
+import org.apache.hadoop.hive.ql.exec.vector.ColumnVector;
+import org.apache.hadoop.hive.ql.exec.vector.DecimalColumnVector;
+import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector;
+import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector;
+
+import java.math.BigDecimal;
+import java.nio.charset.StandardCharsets;
+import java.sql.Date;
+import java.sql.Time;
+
+import static org.apache.flink.table.runtime.functions.SqlDateTimeUtils.dateToInternal;
+import static org.apache.flink.table.runtime.functions.SqlDateTimeUtils.timeToInternal;
+
+/**
+ * This column vector is used to adapt hive's ColumnVector to Flink's ColumnVector.
+ */
+public abstract class AbstractOrcColumnVector implements
+		org.apache.flink.table.dataformat.vector.ColumnVector {
+
+	private ColumnVector vector;
+
+	AbstractOrcColumnVector(ColumnVector vector) {
+		this.vector = vector;
+	}
+
+	@Override
+	public boolean isNullAt(int i) {
+		return !vector.noNulls && vector.isNull[i];
+	}
+
+	@Override
+	public void reset() {
+		throw new UnsupportedOperationException();
+	}
+
+	public static org.apache.flink.table.dataformat.vector.ColumnVector createVector(
+			ColumnVector vector) {
+		if (vector instanceof LongColumnVector) {
+			return new OrcLongColumnVector((LongColumnVector) vector);
+		} else if (vector instanceof DoubleColumnVector) {
+			return new OrcDoubleColumnVector((DoubleColumnVector) vector);
+		} else if (vector instanceof BytesColumnVector) {
+			return new OrcBytesColumnVector((BytesColumnVector) vector);
+		} else if (vector instanceof DecimalColumnVector) {
+			return new OrcDecimalColumnVector((DecimalColumnVector) vector);
+		} else {
+			throw new UnsupportedOperationException("Unsupport vector: " + vector.getClass().getName());
+		}
+	}
+
+	/**
+	 * Create flink vector by hive vector from constant.
+	 */
+	public static org.apache.flink.table.dataformat.vector.ColumnVector createVectorFromConstant(
 
 Review comment:
   add some cases to cover this?

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message