From c7c33f710bcb5bbedcc03a0e3a5dff516c942173 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cyang-haitao=E2=80=9D?= <“445849784@qq.com”> Date: Thu, 28 Jul 2022 11:34:13 +0800 Subject: [PATCH] spark and hive adaptation type --- .../hive/ql/omnidata/OmniDataUtils.java | 15 +- .../ql/omnidata/decode/AbstractDecoding.java | 207 ++++++++++++++++++ .../hive/ql}/omnidata/decode/Decode.java | 26 +-- .../hive/ql}/omnidata/decode/Decoding.java | 176 ++++++++++++++- .../hive/ql/omnidata/decode/PageDecoding.java | 10 +- .../ql/omnidata/decode/PageDeserializer.java | 2 +- .../omnidata/decode/type/ArrayDecodeType.java | 46 ++++ .../decode/type/BooleanDecodeType.java | 33 +++ .../omnidata/decode/type/ByteDecodeType.java | 33 +++ .../omnidata/decode/type/DateDecodeType.java | 33 +++ .../decode/type/DecimalDecodeType.java | 52 +++++ .../ql}/omnidata/decode/type/DecodeType.java | 29 +-- .../decode/type/DoubleDecodeType.java | 33 +++ .../omnidata/decode/type/FloatDecodeType.java | 33 +++ .../omnidata/decode/type/IntDecodeType.java | 33 +++ .../omnidata/decode/type/LongDecodeType.java | 33 +++ .../decode/type/LongToByteDecodeType.java | 33 +++ .../decode/type/LongToFloatDecodeType.java | 33 +++ .../decode/type/LongToIntDecodeType.java | 33 +++ .../decode/type/LongToShortDecodeType.java | 33 +++ .../omnidata/decode/type/MapDecodeType.java | 35 +-- .../omnidata/decode/type/RowDecodeType.java | 33 +++ .../omnidata/decode/type/ShortDecodeType.java | 33 +++ .../decode/type/TimestampDecodeType.java | 33 +++ .../decode/type/VarcharDecodeType.java | 33 +++ .../ql/omnidata/reader/OmniDataAdapter.java | 3 +- .../omnidata/decode/AbstractDecoding.java | 61 ------ .../omnidata/exception/OmniDataException.java | 1 + .../omnidata/decode/AbstractDecoding.java | 205 +++++++++++++++++ .../boostkit/omnidata/decode/Decode.java | 17 +- .../boostkit/omnidata/decode/Decoding.java | 194 ++++++++++++++-- .../omnidata/decode/type/ArrayDecodeType.java | 35 +-- .../decode/type/BooleanDecodeType.java | 25 +-- .../omnidata/decode/type/ByteDecodeType.java | 25 +-- .../omnidata/decode/type/DateDecodeType.java | 25 +-- .../decode/type/DecimalDecodeType.java | 43 ++-- .../omnidata/decode/type/DecodeType.java | 26 +-- .../decode/type/DoubleDecodeType.java | 25 +-- .../omnidata/decode/type/FloatDecodeType.java | 25 +-- .../omnidata/decode/type/IntDecodeType.java | 25 +-- .../omnidata/decode/type/LongDecodeType.java | 25 +-- .../decode/type/LongToByteDecodeType.java | 23 +- .../decode/type/LongToFloatDecodeType.java | 24 +- .../decode/type/LongToIntDecodeType.java | 24 +- .../decode/type/LongToShortDecodeType.java | 24 +- .../omnidata/decode/type/MapDecodeType.java | 32 +-- .../omnidata/decode/type/RowDecodeType.java | 25 +-- .../omnidata/decode/type/ShortDecodeType.java | 25 +-- .../decode/type/TimestampDecodeType.java | 33 +++ .../decode/type/VarcharDecodeType.java | 25 +-- .../omnidata/decode/AbstractDecoding.java | 60 ----- .../omnidata/decode/type/ArrayDecodeType.java | 36 --- .../decode/type/BooleanDecodeType.java | 35 --- .../omnidata/decode/type/ByteDecodeType.java | 35 --- .../omnidata/decode/type/DateDecodeType.java | 35 --- .../decode/type/DoubleDecodeType.java | 35 --- .../omnidata/decode/type/FloatDecodeType.java | 35 --- .../omnidata/decode/type/IntDecodeType.java | 35 --- .../omnidata/decode/type/LongDecodeType.java | 35 --- .../decode/type/LongToByteDecodeType.java | 33 --- .../decode/type/LongToFloatDecodeType.java | 34 --- .../decode/type/LongToIntDecodeType.java | 34 --- .../decode/type/LongToShortDecodeType.java | 34 --- .../omnidata/decode/type/RowDecodeType.java | 35 --- .../omnidata/decode/type/ShortDecodeType.java | 35 --- .../decode/type/TimestampDecodeType.java | 35 --- .../decode/type/VarcharDecodeType.java | 35 --- 67 files changed, 1691 insertions(+), 1013 deletions(-) create mode 100644 omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/AbstractDecoding.java rename omnidata/{omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit => omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql}/omnidata/decode/Decode.java (36%) rename omnidata/omnidata-hive-connector/{stub/server/src/main/java/com/huawei/boostkit => connector/src/main/java/org/apache/hadoop/hive/ql}/omnidata/decode/Decoding.java (41%) create mode 100644 omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/ArrayDecodeType.java create mode 100644 omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/BooleanDecodeType.java create mode 100644 omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/ByteDecodeType.java create mode 100644 omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/DateDecodeType.java create mode 100644 omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/DecimalDecodeType.java rename omnidata/{omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit => omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql}/omnidata/decode/type/DecodeType.java (39%) create mode 100644 omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/DoubleDecodeType.java create mode 100644 omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/FloatDecodeType.java create mode 100644 omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/IntDecodeType.java create mode 100644 omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/LongDecodeType.java create mode 100644 omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/LongToByteDecodeType.java create mode 100644 omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/LongToFloatDecodeType.java create mode 100644 omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/LongToIntDecodeType.java create mode 100644 omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/LongToShortDecodeType.java rename omnidata/{omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit => omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql}/omnidata/decode/type/MapDecodeType.java (45%) create mode 100644 omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/RowDecodeType.java create mode 100644 omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/ShortDecodeType.java create mode 100644 omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/TimestampDecodeType.java create mode 100644 omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/VarcharDecodeType.java delete mode 100644 omnidata/omnidata-hive-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/AbstractDecoding.java create mode 100644 omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/AbstractDecoding.java rename omnidata/{omnidata-hive-connector/stub/server => omnidata-spark-connector/connector}/src/main/java/com/huawei/boostkit/omnidata/decode/Decode.java (59%) rename omnidata/omnidata-spark-connector/{stub/server => connector}/src/main/java/com/huawei/boostkit/omnidata/decode/Decoding.java (40%) rename omnidata/{omnidata-hive-connector/stub/server => omnidata-spark-connector/connector}/src/main/java/com/huawei/boostkit/omnidata/decode/type/ArrayDecodeType.java (48%) rename omnidata/{omnidata-hive-connector/stub/server => omnidata-spark-connector/connector}/src/main/java/com/huawei/boostkit/omnidata/decode/type/BooleanDecodeType.java (45%) rename omnidata/{omnidata-hive-connector/stub/server => omnidata-spark-connector/connector}/src/main/java/com/huawei/boostkit/omnidata/decode/type/ByteDecodeType.java (45%) rename omnidata/{omnidata-hive-connector/stub/server => omnidata-spark-connector/connector}/src/main/java/com/huawei/boostkit/omnidata/decode/type/DateDecodeType.java (45%) rename omnidata/omnidata-spark-connector/{stub/server => connector}/src/main/java/com/huawei/boostkit/omnidata/decode/type/DecimalDecodeType.java (41%) rename omnidata/{omnidata-hive-connector/stub/server => omnidata-spark-connector/connector}/src/main/java/com/huawei/boostkit/omnidata/decode/type/DecodeType.java (48%) rename omnidata/{omnidata-hive-connector/stub/server => omnidata-spark-connector/connector}/src/main/java/com/huawei/boostkit/omnidata/decode/type/DoubleDecodeType.java (45%) rename omnidata/{omnidata-hive-connector/stub/server => omnidata-spark-connector/connector}/src/main/java/com/huawei/boostkit/omnidata/decode/type/FloatDecodeType.java (45%) rename omnidata/{omnidata-hive-connector/stub/server => omnidata-spark-connector/connector}/src/main/java/com/huawei/boostkit/omnidata/decode/type/IntDecodeType.java (45%) rename omnidata/{omnidata-hive-connector/stub/server => omnidata-spark-connector/connector}/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongDecodeType.java (45%) rename omnidata/{omnidata-hive-connector/stub/server => omnidata-spark-connector/connector}/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongToByteDecodeType.java (45%) rename omnidata/{omnidata-hive-connector/stub/server => omnidata-spark-connector/connector}/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongToFloatDecodeType.java (45%) rename omnidata/{omnidata-hive-connector/stub/server => omnidata-spark-connector/connector}/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongToIntDecodeType.java (45%) rename omnidata/{omnidata-hive-connector/stub/server => omnidata-spark-connector/connector}/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongToShortDecodeType.java (44%) rename omnidata/{omnidata-hive-connector/stub/server => omnidata-spark-connector/connector}/src/main/java/com/huawei/boostkit/omnidata/decode/type/MapDecodeType.java (53%) rename omnidata/{omnidata-hive-connector/stub/server => omnidata-spark-connector/connector}/src/main/java/com/huawei/boostkit/omnidata/decode/type/RowDecodeType.java (45%) rename omnidata/{omnidata-hive-connector/stub/server => omnidata-spark-connector/connector}/src/main/java/com/huawei/boostkit/omnidata/decode/type/ShortDecodeType.java (45%) create mode 100644 omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/type/TimestampDecodeType.java rename omnidata/{omnidata-hive-connector/stub/server => omnidata-spark-connector/connector}/src/main/java/com/huawei/boostkit/omnidata/decode/type/VarcharDecodeType.java (45%) delete mode 100644 omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/AbstractDecoding.java delete mode 100644 omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/ArrayDecodeType.java delete mode 100644 omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/BooleanDecodeType.java delete mode 100644 omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/ByteDecodeType.java delete mode 100644 omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/DateDecodeType.java delete mode 100644 omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/DoubleDecodeType.java delete mode 100644 omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/FloatDecodeType.java delete mode 100644 omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/IntDecodeType.java delete mode 100644 omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongDecodeType.java delete mode 100644 omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongToByteDecodeType.java delete mode 100644 omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongToFloatDecodeType.java delete mode 100644 omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongToIntDecodeType.java delete mode 100644 omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongToShortDecodeType.java delete mode 100644 omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/RowDecodeType.java delete mode 100644 omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/ShortDecodeType.java delete mode 100644 omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/TimestampDecodeType.java delete mode 100644 omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/VarcharDecodeType.java diff --git a/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/OmniDataUtils.java b/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/OmniDataUtils.java index aa5005dc6..4b2901689 100644 --- a/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/OmniDataUtils.java +++ b/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/OmniDataUtils.java @@ -31,7 +31,6 @@ import static io.prestosql.spi.type.TinyintType.TINYINT; import static io.prestosql.spi.type.VarcharType.VARCHAR; import static java.lang.Float.floatToIntBits; -import com.huawei.boostkit.omnidata.decode.type.*; import com.huawei.boostkit.omnidata.model.Column; import com.huawei.boostkit.omnidata.model.Predicate; @@ -41,6 +40,20 @@ import io.prestosql.spi.type.CharType; import io.prestosql.spi.type.Type; import io.prestosql.spi.type.VarcharType; +import org.apache.hadoop.hive.ql.omnidata.decode.type.DecodeType; +import org.apache.hadoop.hive.ql.omnidata.decode.type.LongDecodeType; +import org.apache.hadoop.hive.ql.omnidata.decode.type.BooleanDecodeType; +import org.apache.hadoop.hive.ql.omnidata.decode.type.LongToByteDecodeType; +import org.apache.hadoop.hive.ql.omnidata.decode.type.VarcharDecodeType; +import org.apache.hadoop.hive.ql.omnidata.decode.type.LongToIntDecodeType; +import org.apache.hadoop.hive.ql.omnidata.decode.type.DoubleDecodeType; +import org.apache.hadoop.hive.ql.omnidata.decode.type.LongToFloatDecodeType; +import org.apache.hadoop.hive.ql.omnidata.decode.type.LongToShortDecodeType; +import org.apache.hadoop.hive.ql.omnidata.decode.type.ByteDecodeType; +import org.apache.hadoop.hive.ql.omnidata.decode.type.DateDecodeType; +import org.apache.hadoop.hive.ql.omnidata.decode.type.FloatDecodeType; +import org.apache.hadoop.hive.ql.omnidata.decode.type.IntDecodeType; +import org.apache.hadoop.hive.ql.omnidata.decode.type.ShortDecodeType; import org.apache.hadoop.hive.ql.omnidata.operator.predicate.NdpPredicateInfo; import org.apache.hadoop.hive.serde2.typeinfo.CharTypeInfo; import org.apache.hadoop.hive.serde2.typeinfo.TypeInfo; diff --git a/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/AbstractDecoding.java b/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/AbstractDecoding.java new file mode 100644 index 000000000..e7816d5d9 --- /dev/null +++ b/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/AbstractDecoding.java @@ -0,0 +1,207 @@ +/* + * Copyright (C) 2022-2022. Huawei Technologies Co., Ltd. All rights reserved. + * Licensed 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.hadoop.hive.ql.omnidata.decode; + + +import com.huawei.boostkit.omnidata.exception.OmniDataException; + +import io.airlift.slice.SliceInput; +import io.prestosql.spi.type.DateType; +import io.prestosql.spi.type.RowType; + +import org.apache.hadoop.hive.ql.omnidata.decode.type.DecimalDecodeType; +import org.apache.hadoop.hive.ql.omnidata.decode.type.DecodeType; +import org.apache.hadoop.hive.ql.omnidata.decode.type.LongToByteDecodeType; +import org.apache.hadoop.hive.ql.omnidata.decode.type.LongToFloatDecodeType; +import org.apache.hadoop.hive.ql.omnidata.decode.type.LongToIntDecodeType; +import org.apache.hadoop.hive.ql.omnidata.decode.type.LongToShortDecodeType; +import org.apache.hadoop.hive.ql.omnidata.decode.type.TimestampDecodeType; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.nio.charset.StandardCharsets; +import java.util.HashMap; +import java.util.Map; +import java.util.Optional; +import java.util.stream.IntStream; + +/** + * Abstract decoding + * + * @param decoding type + * @since 2022-07-28 + */ +public abstract class AbstractDecoding + implements Decoding +{ + private static final Map DECODE_METHODS; + + static { + DECODE_METHODS = new HashMap<>(); + Method[] methods = Decoding.class.getDeclaredMethods(); + for (Method method : methods) { + if (method.isAnnotationPresent(Decode.class)) { + DECODE_METHODS.put(method.getAnnotation(Decode.class).value(), method); + } + } + } + + private Method getDecodeMethod(String decodeName) + { + return DECODE_METHODS.get(decodeName); + } + + private String getDecodeName(SliceInput input) + { + int length = input.readInt(); + byte[] bytes = new byte[length]; + input.readBytes(bytes); + + return new String(bytes, StandardCharsets.UTF_8); + } + + private Optional typeToDecodeName(DecodeType type) + { + Class javaType = null; + if (type.getJavaType().isPresent()) { + javaType = type.getJavaType().get(); + } + if (javaType == double.class) { + return Optional.of("DOUBLE_ARRAY"); + } + else if (javaType == float.class) { + return Optional.of("FLOAT_ARRAY"); + } + else if (javaType == int.class) { + return Optional.of("INT_ARRAY"); + } + else if (javaType == long.class) { + return Optional.of("LONG_ARRAY"); + } + else if (javaType == byte.class) { + return Optional.of("BYTE_ARRAY"); + } + else if (javaType == boolean.class) { + return Optional.of("BOOLEAN_ARRAY"); + } + else if (javaType == short.class) { + return Optional.of("SHORT_ARRAY"); + } + else if (javaType == String.class) { + return Optional.of("VARIABLE_WIDTH"); + } + else if (javaType == RowType.class) { + return Optional.of("ROW"); + } + else if (javaType == DateType.class) { + return Optional.of("DATE"); + } + else if (javaType == LongToIntDecodeType.class) { + return Optional.of("LONG_TO_INT"); + } + else if (javaType == LongToShortDecodeType.class) { + return Optional.of("LONG_TO_SHORT"); + } + else if (javaType == LongToByteDecodeType.class) { + return Optional.of("LONG_TO_BYTE"); + } + else if (javaType == LongToFloatDecodeType.class) { + return Optional.of("LONG_TO_FLOAT"); + } + else if (javaType == DecimalDecodeType.class) { + return Optional.of("DECIMAL"); + } + else if (javaType == TimestampDecodeType.class) { + return Optional.of("TIMESTAMP"); + } + else { + return Optional.empty(); + } + } + + private boolean[] getIsNullValue(byte value) + { + boolean[] isNullValue = new boolean[8]; + isNullValue[0] = ((value & 0b1000_0000) != 0); + isNullValue[1] = ((value & 0b0100_0000) != 0); + isNullValue[2] = ((value & 0b0010_0000) != 0); + isNullValue[3] = ((value & 0b0001_0000) != 0); + isNullValue[4] = ((value & 0b0000_1000) != 0); + isNullValue[5] = ((value & 0b0000_0100) != 0); + isNullValue[6] = ((value & 0b0000_0010) != 0); + isNullValue[7] = ((value & 0b0000_0001) != 0); + + return isNullValue; + } + + @Override + public T decode(Optional type, SliceInput sliceInput) + { + try { + String decodeName = getDecodeName(sliceInput); + if (type.isPresent()) { + Optional decodeNameOpt = typeToDecodeName(type.get()); + if ("DECIMAL".equals(decodeNameOpt.orElse(decodeName)) && !"RLE".equals(decodeName)) { + Method method = getDecodeMethod("DECIMAL"); + return (T) method.invoke(this, type, sliceInput, decodeName); + } + if (!"RLE".equals(decodeName)) { + decodeName = decodeNameOpt.orElse(decodeName); + } + } + Method method = getDecodeMethod(decodeName); + return (T) method.invoke(this, type, sliceInput); + } + catch (IllegalAccessException | InvocationTargetException e) { + throw new OmniDataException("decode failed " + e.getMessage()); + } + } + + /** + * decode Null Bits + * + * @param sliceInput sliceInput + * @param positionCount positionCount + * @return decode boolean[] + * @since 2022-07-18 + */ + public Optional decodeNullBits(SliceInput sliceInput, int positionCount) + { + if (!sliceInput.readBoolean()) { + return Optional.empty(); + } + + // read null bits 8 at a time + boolean[] valueIsNull = new boolean[positionCount]; + for (int position = 0; position < (positionCount & ~0b111); position += 8) { + boolean[] nextEightValue = getIsNullValue(sliceInput.readByte()); + int finalPosition = position; + IntStream.range(0, 8).forEach(pos -> valueIsNull[finalPosition + pos] = nextEightValue[pos]); + } + + // read last null bits + if ((positionCount & 0b111) > 0) { + byte value = sliceInput.readByte(); + int maskInt = 0b1000_0000; + for (int pos = positionCount & ~0b111; pos < positionCount; pos++) { + valueIsNull[pos] = ((value & maskInt) != 0); + maskInt >>>= 1; + } + } + + return Optional.of(valueIsNull); + } +} diff --git a/omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/Decode.java b/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/Decode.java similarity index 36% rename from omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/Decode.java rename to omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/Decode.java index 1868fea3a..346d34d86 100644 --- a/omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/Decode.java +++ b/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/Decode.java @@ -1,13 +1,10 @@ /* - * Copyright (C) Huawei Technologies Co., Ltd. 2021-2022. All rights reserved. - * 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 + * Copyright (C) 2022-2022. Huawei Technologies Co., Ltd. All rights reserved. + * Licensed 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 + * 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, @@ -16,20 +13,17 @@ * limitations under the License. */ -package com.huawei.boostkit.omnidata.decode; +package org.apache.hadoop.hive.ql.omnidata.decode; import com.google.inject.BindingAnnotation; -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; +import java.lang.annotation.*; @Documented @Retention(RetentionPolicy.RUNTIME) -@Target({ElementType.METHOD}) +@Target(ElementType.METHOD) @BindingAnnotation -public @interface Decode { +public @interface Decode +{ String value(); } diff --git a/omnidata/omnidata-hive-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/Decoding.java b/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/Decoding.java similarity index 41% rename from omnidata/omnidata-hive-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/Decoding.java rename to omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/Decoding.java index c7911d939..a34eab6d0 100644 --- a/omnidata/omnidata-hive-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/Decoding.java +++ b/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/Decoding.java @@ -1,12 +1,8 @@ /* - * Copyright (C) Huawei Technologies Co., Ltd. 2021-2022. All rights reserved. - * 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 + * Copyright (C) 2022-2022. Huawei Technologies Co., Ltd. All rights reserved. + * Licensed 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 * @@ -17,77 +13,233 @@ * limitations under the License. */ -package com.huawei.boostkit.omnidata.decode; +package org.apache.hadoop.hive.ql.omnidata.decode; -import com.huawei.boostkit.omnidata.decode.type.DecodeType; import io.airlift.slice.SliceInput; +import org.apache.hadoop.hive.ql.omnidata.decode.type.DecodeType; + import java.lang.reflect.InvocationTargetException; import java.util.Optional; -public interface Decoding { - +/** + * Decode Slice to type + * + * @param + * @since 2022-07-28 + */ +public interface Decoding +{ + /** + * decode + * + * @param type decode type + * @param sliceInput content + * @return T + */ T decode(Optional type, SliceInput sliceInput); + /** + * decode array type + * + * @param type type of data to decode + * @param sliceInput data to decode + * @return T + */ @Decode("ARRAY") T decodeArray(Optional type, SliceInput sliceInput); + /** + * decode byte array type + * + * @param type type of data to decode + * @param sliceInput data to decode + * @return T + */ @Decode("BYTE_ARRAY") T decodeByteArray(Optional type, SliceInput sliceInput); + /** + * decode boolean array type + * + * @param type type of data to decode + * @param sliceInput data to decode + * @return T + */ @Decode("BOOLEAN_ARRAY") T decodeBooleanArray(Optional type, SliceInput sliceInput); + /** + * decode int array type + * + * @param type type of data to decode + * @param sliceInput data to decode + * @return T + */ @Decode("INT_ARRAY") T decodeIntArray(Optional type, SliceInput sliceInput); + /** + * decode int128 array type + * + * @param type type of data to decode + * @param sliceInput data to decode + * @return T + */ @Decode("INT128_ARRAY") T decodeInt128Array(Optional type, SliceInput sliceInput); + /** + * decode short array type + * + * @param type type of data to decode + * @param sliceInput data to decode + * @return T + */ @Decode("SHORT_ARRAY") T decodeShortArray(Optional type, SliceInput sliceInput); + /** + * decode long array type + * + * @param type type of data to decode + * @param sliceInput data to decode + * @return T + */ @Decode("LONG_ARRAY") T decodeLongArray(Optional type, SliceInput sliceInput); + /** + * decode float array type + * + * @param type type of data to decode + * @param sliceInput data to decode + * @return T + */ @Decode("FLOAT_ARRAY") T decodeFloatArray(Optional type, SliceInput sliceInput); + /** + * decode double array type + * + * @param type type of data to decode + * @param sliceInput data to decode + * @return T + */ @Decode("DOUBLE_ARRAY") T decodeDoubleArray(Optional type, SliceInput sliceInput); + /** + * decode map type + * + * @param type type of data to decode + * @param sliceInput data to decode + * @return T + */ @Decode("MAP") T decodeMap(Optional type, SliceInput sliceInput); + /** + * decode map element type + * + * @param type type of data to decode + * @param sliceInput data to decode + * @return T + */ @Decode("MAP_ELEMENT") T decodeSingleMap(Optional type, SliceInput sliceInput); + /** + * decode variable width type + * + * @param type type of data to decode + * @param sliceInput data to decode + * @return T + */ @Decode("VARIABLE_WIDTH") T decodeVariableWidth(Optional type, SliceInput sliceInput); + /** + * decode dictionary type + * + * @param type type of data to decode + * @param sliceInput data to decode + * @return T + */ @Decode("DICTIONARY") T decodeDictionary(Optional type, SliceInput sliceInput); + /** + * decode rle type + * + * @param type type of data to decode + * @param sliceInput data to decode + * @return T + * @throws InvocationTargetException throw invocation target exception + * @throws IllegalAccessException throw illegal access exception + */ @Decode("RLE") T decodeRunLength(Optional type, SliceInput sliceInput) throws InvocationTargetException, IllegalAccessException; + /** + * decode row type + * + * @param type type of data to decode + * @param sliceInput data to decode + * @return T + */ @Decode("ROW") T decodeRow(Optional type, SliceInput sliceInput); + /** + * decode date type + * + * @param type type of data to decode + * @param sliceInput data to decode + * @return T + */ @Decode("DATE") T decodeDate(Optional type, SliceInput sliceInput); + /** + * decode long to int type + * + * @param type type of data to decode + * @param sliceInput data to decode + * @return T + */ @Decode("LONG_TO_INT") T decodeLongToInt(Optional type, SliceInput sliceInput); + /** + * decode long to short type + * + * @param type type of data to decode + * @param sliceInput data to decode + * @return T + */ @Decode("LONG_TO_SHORT") T decodeLongToShort(Optional type, SliceInput sliceInput); + /** + * decode long to byte type + * + * @param type type of data to decode + * @param sliceInput data to decode + * @return T + */ @Decode("LONG_TO_BYTE") T decodeLongToByte(Optional type, SliceInput sliceInput); + /** + * decode long to float type + * + * @param type type of data to decode + * @param sliceInput data to decode + * @return T + */ @Decode("LONG_TO_FLOAT") T decodeLongToFloat(Optional type, SliceInput sliceInput); } diff --git a/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/PageDecoding.java b/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/PageDecoding.java index a0c15a62d..1c3a24b40 100644 --- a/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/PageDecoding.java +++ b/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/PageDecoding.java @@ -24,18 +24,20 @@ import static io.airlift.slice.SizeOf.SIZE_OF_INT; import static java.lang.Double.longBitsToDouble; import static java.lang.Float.intBitsToFloat; -import com.huawei.boostkit.omnidata.decode.AbstractDecoding; - -import com.huawei.boostkit.omnidata.decode.type.*; import io.airlift.slice.SliceInput; import io.airlift.slice.Slices; - import io.prestosql.spi.type.DateType; + 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.DoubleColumnVector; import org.apache.hadoop.hive.ql.exec.vector.LongColumnVector; import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; +import org.apache.hadoop.hive.ql.omnidata.decode.type.DecodeType; +import org.apache.hadoop.hive.ql.omnidata.decode.type.LongToFloatDecodeType; +import org.apache.hadoop.hive.ql.omnidata.decode.type.LongToIntDecodeType; +import org.apache.hadoop.hive.ql.omnidata.decode.type.LongToByteDecodeType; +import org.apache.hadoop.hive.ql.omnidata.decode.type.LongToShortDecodeType; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; diff --git a/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/PageDeserializer.java b/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/PageDeserializer.java index 0b63aa1f3..ffd4a94ac 100644 --- a/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/PageDeserializer.java +++ b/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/PageDeserializer.java @@ -20,12 +20,12 @@ package org.apache.hadoop.hive.ql.omnidata.decode; import com.huawei.boostkit.omnidata.decode.Deserializer; -import com.huawei.boostkit.omnidata.decode.type.DecodeType; import io.airlift.slice.SliceInput; import io.hetu.core.transport.execution.buffer.SerializedPage; import org.apache.hadoop.hive.ql.exec.vector.ColumnVector; +import org.apache.hadoop.hive.ql.omnidata.decode.type.DecodeType; import java.util.ArrayList; import java.util.List; diff --git a/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/ArrayDecodeType.java b/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/ArrayDecodeType.java new file mode 100644 index 000000000..c50506969 --- /dev/null +++ b/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/ArrayDecodeType.java @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2022-2022. Huawei Technologies Co., Ltd. All rights reserved. + * Licensed 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.hadoop.hive.ql.omnidata.decode.type; + +import java.util.Optional; + +/** + * Array decode type + * + * @param decode type + * @since 2022-07-28 + */ +public class ArrayDecodeType + implements DecodeType +{ + private final T elementType; + + public ArrayDecodeType(T elementType) + { + this.elementType = elementType; + } + + public T getElementType() + { + return elementType; + } + + @Override + public Optional> getJavaType() + { + return Optional.empty(); + } +} diff --git a/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/BooleanDecodeType.java b/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/BooleanDecodeType.java new file mode 100644 index 000000000..4698af832 --- /dev/null +++ b/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/BooleanDecodeType.java @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2022-2022. Huawei Technologies Co., Ltd. All rights reserved. + * Licensed 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.hadoop.hive.ql.omnidata.decode.type; + +import java.util.Optional; + +/** + * Boolean decode type + * + * @since 2022-07-28 + */ +public class BooleanDecodeType + implements DecodeType +{ + @Override + public Optional> getJavaType() + { + return Optional.of(boolean.class); + } +} diff --git a/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/ByteDecodeType.java b/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/ByteDecodeType.java new file mode 100644 index 000000000..a538fc303 --- /dev/null +++ b/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/ByteDecodeType.java @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2022-2022. Huawei Technologies Co., Ltd. All rights reserved. + * Licensed 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.hadoop.hive.ql.omnidata.decode.type; + +import java.util.Optional; + +/** + * Byte decode type + * + * @since 2022-07-28 + */ +public class ByteDecodeType + implements DecodeType +{ + @Override + public Optional> getJavaType() + { + return Optional.of(byte.class); + } +} diff --git a/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/DateDecodeType.java b/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/DateDecodeType.java new file mode 100644 index 000000000..d2f26e11c --- /dev/null +++ b/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/DateDecodeType.java @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2022-2022. Huawei Technologies Co., Ltd. All rights reserved. + * Licensed 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.hadoop.hive.ql.omnidata.decode.type; + +import java.util.Optional; + +/** + * Date Decode Type + * + * @since 2022-07-28 + */ +public class DateDecodeType + implements DecodeType +{ + @Override + public Optional> getJavaType() + { + return Optional.of(io.prestosql.spi.type.DateType.class); + } +} diff --git a/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/DecimalDecodeType.java b/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/DecimalDecodeType.java new file mode 100644 index 000000000..b4768b343 --- /dev/null +++ b/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/DecimalDecodeType.java @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2022-2022. Huawei Technologies Co., Ltd. All rights reserved. + * Licensed 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.hadoop.hive.ql.omnidata.decode.type; + +import java.util.Optional; + +/** + * Decimal decode type + * + * @since 2022-07-28 + */ +public class DecimalDecodeType + implements DecodeType +{ + private final int precision; + private final int scale; + + public DecimalDecodeType(int precision, int scale) + { + this.precision = precision; + this.scale = scale; + } + + public int getPrecision() + { + return precision; + } + + public int getScale() + { + return scale; + } + + @Override + public Optional> getJavaType() + { + return Optional.of(DecimalDecodeType.class); + } +} diff --git a/omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/DecodeType.java b/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/DecodeType.java similarity index 39% rename from omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/DecodeType.java rename to omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/DecodeType.java index baa358ab8..8c55b9d78 100644 --- a/omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/DecodeType.java +++ b/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/DecodeType.java @@ -1,13 +1,10 @@ /* - * Copyright (C) Huawei Technologies Co., Ltd. 2021-2022. All rights reserved. - * 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 + * Copyright (C) 2022-2022. Huawei Technologies Co., Ltd. All rights reserved. + * Licensed 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 + * 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, @@ -16,17 +13,21 @@ * limitations under the License. */ -package com.huawei.boostkit.omnidata.decode.type; - +package org.apache.hadoop.hive.ql.omnidata.decode.type; import java.util.Optional; /** - * Decode java type + * Dcode java type * - * @since 2020-07-31 + * @since 2022-07-28 */ -public interface DecodeType { +public interface DecodeType +{ + /** + * get java class type + * + * @return class type + */ Optional> getJavaType(); } - diff --git a/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/DoubleDecodeType.java b/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/DoubleDecodeType.java new file mode 100644 index 000000000..8c3a2c1c6 --- /dev/null +++ b/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/DoubleDecodeType.java @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2022-2022. Huawei Technologies Co., Ltd. All rights reserved. + * Licensed 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.hadoop.hive.ql.omnidata.decode.type; + +import java.util.Optional; + +/** + * Double decode type + * + * @since 2022-07-28 + */ +public class DoubleDecodeType + implements DecodeType +{ + @Override + public Optional> getJavaType() + { + return Optional.of(double.class); + } +} diff --git a/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/FloatDecodeType.java b/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/FloatDecodeType.java new file mode 100644 index 000000000..b20d39f36 --- /dev/null +++ b/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/FloatDecodeType.java @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2022-2022. Huawei Technologies Co., Ltd. All rights reserved. + * Licensed 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.hadoop.hive.ql.omnidata.decode.type; + +import java.util.Optional; + +/** + * Float decode type + * + * @since 2022-07-28 + */ +public class FloatDecodeType + implements DecodeType +{ + @Override + public Optional> getJavaType() + { + return Optional.of(float.class); + } +} diff --git a/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/IntDecodeType.java b/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/IntDecodeType.java new file mode 100644 index 000000000..9de37ccdd --- /dev/null +++ b/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/IntDecodeType.java @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2022-2022. Huawei Technologies Co., Ltd. All rights reserved. + * Licensed 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.hadoop.hive.ql.omnidata.decode.type; + +import java.util.Optional; + +/** + * Int decode type + * + * @since 2022-07-28 + */ +public class IntDecodeType + implements DecodeType +{ + @Override + public Optional> getJavaType() + { + return Optional.of(int.class); + } +} diff --git a/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/LongDecodeType.java b/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/LongDecodeType.java new file mode 100644 index 000000000..e6f37480d --- /dev/null +++ b/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/LongDecodeType.java @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2022-2022. Huawei Technologies Co., Ltd. All rights reserved. + * Licensed 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.hadoop.hive.ql.omnidata.decode.type; + +import java.util.Optional; + +/** + * Long decode type + * + * @since 2022-07-28 + */ +public class LongDecodeType + implements DecodeType +{ + @Override + public Optional> getJavaType() + { + return Optional.of(long.class); + } +} diff --git a/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/LongToByteDecodeType.java b/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/LongToByteDecodeType.java new file mode 100644 index 000000000..b2909ab9d --- /dev/null +++ b/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/LongToByteDecodeType.java @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2022-2022. Huawei Technologies Co., Ltd. All rights reserved. + * Licensed 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.hadoop.hive.ql.omnidata.decode.type; + +import java.util.Optional; + +/** + * Long To Byte decode + * + * @since 2022-07-28 + */ +public class LongToByteDecodeType + implements DecodeType +{ + @Override + public Optional> getJavaType() + { + return Optional.of(LongToByteDecodeType.class); + } +} diff --git a/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/LongToFloatDecodeType.java b/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/LongToFloatDecodeType.java new file mode 100644 index 000000000..bc08631ad --- /dev/null +++ b/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/LongToFloatDecodeType.java @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2022-2022. Huawei Technologies Co., Ltd. All rights reserved. + * Licensed 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.hadoop.hive.ql.omnidata.decode.type; + +import java.util.Optional; + +/** + * Double To Float decode + * + * @since 2022-07-28 + */ +public class LongToFloatDecodeType + implements DecodeType +{ + @Override + public Optional> getJavaType() + { + return Optional.of(LongToFloatDecodeType.class); + } +} diff --git a/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/LongToIntDecodeType.java b/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/LongToIntDecodeType.java new file mode 100644 index 000000000..a438ca7df --- /dev/null +++ b/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/LongToIntDecodeType.java @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2022-2022. Huawei Technologies Co., Ltd. All rights reserved. + * Licensed 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.hadoop.hive.ql.omnidata.decode.type; + +import java.util.Optional; + +/** + * Long To Int decode + * + * @since 2022-07-28 + */ +public class LongToIntDecodeType + implements DecodeType +{ + @Override + public Optional> getJavaType() + { + return Optional.of(LongToIntDecodeType.class); + } +} diff --git a/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/LongToShortDecodeType.java b/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/LongToShortDecodeType.java new file mode 100644 index 000000000..614ba4ea2 --- /dev/null +++ b/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/LongToShortDecodeType.java @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2022-2022. Huawei Technologies Co., Ltd. All rights reserved. + * Licensed 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.hadoop.hive.ql.omnidata.decode.type; + +import java.util.Optional; + +/** + * 功能描述 + * + * @since 2022-07-28 + */ +public class LongToShortDecodeType + implements DecodeType +{ + @Override + public Optional> getJavaType() + { + return Optional.of(LongToShortDecodeType.class); + } +} diff --git a/omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/MapDecodeType.java b/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/MapDecodeType.java similarity index 45% rename from omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/MapDecodeType.java rename to omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/MapDecodeType.java index 1cad9c3ba..bf9681227 100644 --- a/omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/MapDecodeType.java +++ b/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/MapDecodeType.java @@ -1,13 +1,10 @@ /* - * Copyright (C) Huawei Technologies Co., Ltd. 2021-2022. All rights reserved. - * 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 + * Copyright (C) 2022-2022. Huawei Technologies Co., Ltd. All rights reserved. + * Licensed 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 + * 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, @@ -16,8 +13,7 @@ * limitations under the License. */ -package com.huawei.boostkit.omnidata.decode.type; - +package org.apache.hadoop.hive.ql.omnidata.decode.type; import java.util.Optional; @@ -26,12 +22,23 @@ import java.util.Optional; * * @param k * @param v - * @since 2021-07-31 + * @since 2022-07-28 */ -public class MapDecodeType implements DecodeType { +public class MapDecodeType + implements DecodeType +{ + private final K keyType; + private final V valueType; + + public MapDecodeType(K keyType, V valueType) + { + this.keyType = keyType; + this.valueType = valueType; + } + @Override - public Optional> getJavaType() { + public Optional> getJavaType() + { return Optional.empty(); } } - diff --git a/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/RowDecodeType.java b/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/RowDecodeType.java new file mode 100644 index 000000000..5d341a403 --- /dev/null +++ b/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/RowDecodeType.java @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2022-2022. Huawei Technologies Co., Ltd. All rights reserved. + * Licensed 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.hadoop.hive.ql.omnidata.decode.type; + +import java.util.Optional; + +/** + * Row decode type + * + * @since 2022-07-28 + */ +public class RowDecodeType + implements DecodeType +{ + @Override + public Optional> getJavaType() + { + return Optional.of(io.prestosql.spi.type.RowType.class); + } +} diff --git a/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/ShortDecodeType.java b/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/ShortDecodeType.java new file mode 100644 index 000000000..696afd324 --- /dev/null +++ b/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/ShortDecodeType.java @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2022-2022. Huawei Technologies Co., Ltd. All rights reserved. + * Licensed 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.hadoop.hive.ql.omnidata.decode.type; + +import java.util.Optional; + +/** + * Short decode type + * + * @since 2022-07-28 + */ +public class ShortDecodeType + implements DecodeType +{ + @Override + public Optional> getJavaType() + { + return Optional.of(short.class); + } +} diff --git a/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/TimestampDecodeType.java b/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/TimestampDecodeType.java new file mode 100644 index 000000000..ee0089921 --- /dev/null +++ b/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/TimestampDecodeType.java @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2022-2022. Huawei Technologies Co., Ltd. All rights reserved. + * Licensed 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.hadoop.hive.ql.omnidata.decode.type; + +import java.util.Optional; + +/** + * Timestamp decode type + * + * @since 2022-07-28 + */ +public class TimestampDecodeType + implements DecodeType +{ + @Override + public Optional> getJavaType() + { + return Optional.of(TimestampDecodeType.class); + } +} diff --git a/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/VarcharDecodeType.java b/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/VarcharDecodeType.java new file mode 100644 index 000000000..a02594b16 --- /dev/null +++ b/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/decode/type/VarcharDecodeType.java @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2022-2022. Huawei Technologies Co., Ltd. All rights reserved. + * Licensed 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.hadoop.hive.ql.omnidata.decode.type; + +import java.util.Optional; + +/** + * Varchar decode type + * + * @since 2022-07-28 + */ +public class VarcharDecodeType + implements DecodeType +{ + @Override + public Optional> getJavaType() + { + return Optional.of(String.class); + } +} diff --git a/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/reader/OmniDataAdapter.java b/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/reader/OmniDataAdapter.java index 8d1bcedef..6833bda29 100644 --- a/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/reader/OmniDataAdapter.java +++ b/omnidata/omnidata-hive-connector/connector/src/main/java/org/apache/hadoop/hive/ql/omnidata/reader/OmniDataAdapter.java @@ -21,7 +21,7 @@ package org.apache.hadoop.hive.ql.omnidata.reader; import static org.apache.hadoop.hive.ql.omnidata.OmniDataUtils.addPartitionValues; -import com.huawei.boostkit.omnidata.decode.type.DecodeType; + import com.huawei.boostkit.omnidata.exception.OmniDataException; import com.huawei.boostkit.omnidata.exception.OmniErrorCode; import com.huawei.boostkit.omnidata.model.Predicate; @@ -39,6 +39,7 @@ import org.apache.hadoop.hive.ql.exec.vector.VectorizedRowBatch; import org.apache.hadoop.hive.ql.omnidata.OmniDataUtils; import org.apache.hadoop.hive.ql.omnidata.config.NdpConf; import org.apache.hadoop.hive.ql.omnidata.decode.PageDeserializer; +import org.apache.hadoop.hive.ql.omnidata.decode.type.DecodeType; import org.apache.hadoop.hive.ql.omnidata.operator.predicate.NdpPredicateInfo; import org.apache.hadoop.hive.ql.omnidata.status.NdpStatusManager; import org.apache.hadoop.mapred.FileSplit; diff --git a/omnidata/omnidata-hive-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/AbstractDecoding.java b/omnidata/omnidata-hive-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/AbstractDecoding.java deleted file mode 100644 index 043e176cf..000000000 --- a/omnidata/omnidata-hive-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/AbstractDecoding.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (C) Huawei Technologies Co., Ltd. 2021-2022. All rights reserved. - * 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 com.huawei.boostkit.omnidata.decode; - -import com.huawei.boostkit.omnidata.decode.type.DecodeType; - -import io.airlift.slice.SliceInput; - -import java.lang.reflect.Method; -import java.util.Optional; - -/** - * Abstract decoding - * - * @param decoding type - * @since 2021-07-31 - */ -public abstract class AbstractDecoding implements Decoding { - - private Method getDecodeMethod(String decodeName) { - return null; - } - - private String getDecodeName(SliceInput input) { - return null; - } - - private Optional typeToDecodeName(DecodeType type) { - return null; - } - - @Override - public T decode(Optional type, SliceInput sliceInput) { - return null; - } - - public Optional decodeNullBits(SliceInput sliceInput, int positionCount) { - return null; - } - - private boolean[] getIsNullValue(byte value) { - return null; - } -} diff --git a/omnidata/omnidata-hive-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/exception/OmniDataException.java b/omnidata/omnidata-hive-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/exception/OmniDataException.java index e4a84faff..1e64530ff 100644 --- a/omnidata/omnidata-hive-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/exception/OmniDataException.java +++ b/omnidata/omnidata-hive-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/exception/OmniDataException.java @@ -25,5 +25,6 @@ public class OmniDataException extends RuntimeException { public OmniErrorCode getErrorCode() { return OMNIDATA_GENERIC_ERROR; } + public OmniDataException(String message) {} } diff --git a/omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/AbstractDecoding.java b/omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/AbstractDecoding.java new file mode 100644 index 000000000..c0cfd90c0 --- /dev/null +++ b/omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/AbstractDecoding.java @@ -0,0 +1,205 @@ +/* + * Copyright (C) 2022-2022. Huawei Technologies Co., Ltd. All rights reserved. + * Licensed 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 com.huawei.boostkit.omnidata.decode; + +import com.huawei.boostkit.omnidata.exception.OmniDataException; +import com.huawei.boostkit.omnidata.decode.type.DecimalDecodeType; +import com.huawei.boostkit.omnidata.decode.type.DecodeType; +import com.huawei.boostkit.omnidata.decode.type.LongToByteDecodeType; +import com.huawei.boostkit.omnidata.decode.type.LongToFloatDecodeType; +import com.huawei.boostkit.omnidata.decode.type.LongToIntDecodeType; +import com.huawei.boostkit.omnidata.decode.type.LongToShortDecodeType; +import com.huawei.boostkit.omnidata.decode.type.TimestampDecodeType; + +import io.airlift.slice.SliceInput; +import io.prestosql.spi.type.DateType; +import io.prestosql.spi.type.RowType; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.nio.charset.StandardCharsets; +import java.util.HashMap; +import java.util.Map; +import java.util.Optional; +import java.util.stream.IntStream; + +/** + * Abstract decoding + * + * @param decoding type + * @since 2022-07-28 + */ +public abstract class AbstractDecoding + implements Decoding +{ + private static final Map DECODE_METHODS; + + static { + DECODE_METHODS = new HashMap<>(); + Method[] methods = Decoding.class.getDeclaredMethods(); + for (Method method : methods) { + if (method.isAnnotationPresent(Decode.class)) { + DECODE_METHODS.put(method.getAnnotation(Decode.class).value(), method); + } + } + } + + private Method getDecodeMethod(String decodeName) + { + return DECODE_METHODS.get(decodeName); + } + + private String getDecodeName(SliceInput input) + { + int length = input.readInt(); + byte[] bytes = new byte[length]; + input.readBytes(bytes); + + return new String(bytes, StandardCharsets.UTF_8); + } + + private Optional typeToDecodeName(DecodeType type) + { + Class javaType = null; + if (type.getJavaType().isPresent()) { + javaType = type.getJavaType().get(); + } + if (javaType == double.class) { + return Optional.of("DOUBLE_ARRAY"); + } + else if (javaType == float.class) { + return Optional.of("FLOAT_ARRAY"); + } + else if (javaType == int.class) { + return Optional.of("INT_ARRAY"); + } + else if (javaType == long.class) { + return Optional.of("LONG_ARRAY"); + } + else if (javaType == byte.class) { + return Optional.of("BYTE_ARRAY"); + } + else if (javaType == boolean.class) { + return Optional.of("BOOLEAN_ARRAY"); + } + else if (javaType == short.class) { + return Optional.of("SHORT_ARRAY"); + } + else if (javaType == String.class) { + return Optional.of("VARIABLE_WIDTH"); + } + else if (javaType == RowType.class) { + return Optional.of("ROW"); + } + else if (javaType == DateType.class) { + return Optional.of("DATE"); + } + else if (javaType == LongToIntDecodeType.class) { + return Optional.of("LONG_TO_INT"); + } + else if (javaType == LongToShortDecodeType.class) { + return Optional.of("LONG_TO_SHORT"); + } + else if (javaType == LongToByteDecodeType.class) { + return Optional.of("LONG_TO_BYTE"); + } + else if (javaType == LongToFloatDecodeType.class) { + return Optional.of("LONG_TO_FLOAT"); + } + else if (javaType == DecimalDecodeType.class) { + return Optional.of("DECIMAL"); + } + else if (javaType == TimestampDecodeType.class) { + return Optional.of("TIMESTAMP"); + } + else { + return Optional.empty(); + } + } + + private boolean[] getIsNullValue(byte value) + { + boolean[] isNullValue = new boolean[8]; + isNullValue[0] = ((value & 0b1000_0000) != 0); + isNullValue[1] = ((value & 0b0100_0000) != 0); + isNullValue[2] = ((value & 0b0010_0000) != 0); + isNullValue[3] = ((value & 0b0001_0000) != 0); + isNullValue[4] = ((value & 0b0000_1000) != 0); + isNullValue[5] = ((value & 0b0000_0100) != 0); + isNullValue[6] = ((value & 0b0000_0010) != 0); + isNullValue[7] = ((value & 0b0000_0001) != 0); + + return isNullValue; + } + + @Override + public T decode(Optional type, SliceInput sliceInput) + { + try { + String decodeName = getDecodeName(sliceInput); + if (type.isPresent()) { + Optional decodeNameOpt = typeToDecodeName(type.get()); + if ("DECIMAL".equals(decodeNameOpt.orElse(decodeName)) && !"RLE".equals(decodeName)) { + Method method = getDecodeMethod("DECIMAL"); + return (T) method.invoke(this, type, sliceInput, decodeName); + } + if (!"RLE".equals(decodeName)) { + decodeName = decodeNameOpt.orElse(decodeName); + } + } + Method method = getDecodeMethod(decodeName); + return (T) method.invoke(this, type, sliceInput); + } + catch (IllegalAccessException | InvocationTargetException e) { + throw new OmniDataException("decode failed " + e.getMessage()); + } + } + + /** + * decode Null Bits + * + * @param sliceInput sliceInput + * @param positionCount positionCount + * @return decode boolean[] + * @since 2022-07-18 + */ + public Optional decodeNullBits(SliceInput sliceInput, int positionCount) + { + if (!sliceInput.readBoolean()) { + return Optional.empty(); + } + + // read null bits 8 at a time + boolean[] valueIsNull = new boolean[positionCount]; + for (int position = 0; position < (positionCount & ~0b111); position += 8) { + boolean[] nextEightValue = getIsNullValue(sliceInput.readByte()); + int finalPosition = position; + IntStream.range(0, 8).forEach(pos -> valueIsNull[finalPosition + pos] = nextEightValue[pos]); + } + + // read last null bits + if ((positionCount & 0b111) > 0) { + byte value = sliceInput.readByte(); + int maskInt = 0b1000_0000; + for (int pos = positionCount & ~0b111; pos < positionCount; pos++) { + valueIsNull[pos] = ((value & maskInt) != 0); + maskInt >>>= 1; + } + } + + return Optional.of(valueIsNull); + } +} diff --git a/omnidata/omnidata-hive-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/Decode.java b/omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/Decode.java similarity index 59% rename from omnidata/omnidata-hive-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/Decode.java rename to omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/Decode.java index d2ead0e4d..97aeaa650 100644 --- a/omnidata/omnidata-hive-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/Decode.java +++ b/omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/Decode.java @@ -1,12 +1,8 @@ /* - * Copyright (C) Huawei Technologies Co., Ltd. 2021-2022. All rights reserved. - * 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 + * Copyright (C) 2022-2022. Huawei Technologies Co., Ltd. All rights reserved. + * Licensed 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 * @@ -29,8 +25,9 @@ import java.lang.annotation.Target; @Documented @Retention(RetentionPolicy.RUNTIME) -@Target({ElementType.METHOD}) +@Target(ElementType.METHOD) @BindingAnnotation -public @interface Decode { +public @interface Decode +{ String value(); } diff --git a/omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/Decoding.java b/omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/Decoding.java similarity index 40% rename from omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/Decoding.java rename to omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/Decoding.java index 3c306e386..d874a891d 100644 --- a/omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/Decoding.java +++ b/omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/Decoding.java @@ -1,13 +1,10 @@ /* - * Copyright (C) Huawei Technologies Co., Ltd. 2021-2022. All rights reserved. - * 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 + * Copyright (C) 2022-2022. Huawei Technologies Co., Ltd. All rights reserved. + * Licensed 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 + * 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, @@ -18,82 +15,251 @@ package com.huawei.boostkit.omnidata.decode; -import com.huawei.boostkit.omnidata.decode.type.DecodeType; - -import io.airlift.slice.Slice; import io.airlift.slice.SliceInput; +import com.huawei.boostkit.omnidata.decode.type.DecodeType; + import java.lang.reflect.InvocationTargetException; import java.util.Optional; -public interface Decoding { - +/** + * Decode Slice to type + * + * @param + * @since 2022-07-28 + */ +public interface Decoding +{ + /** + * decode + * + * @param type decode type + * @param sliceInput content + * @return T + */ T decode(Optional type, SliceInput sliceInput); + /** + * decode array type + * + * @param type type of data to decode + * @param sliceInput data to decode + * @return T + */ @Decode("ARRAY") T decodeArray(Optional type, SliceInput sliceInput); + /** + * decode byte array type + * + * @param type type of data to decode + * @param sliceInput data to decode + * @return T + */ @Decode("BYTE_ARRAY") T decodeByteArray(Optional type, SliceInput sliceInput); + /** + * decode boolean array type + * + * @param type type of data to decode + * @param sliceInput data to decode + * @return T + */ @Decode("BOOLEAN_ARRAY") T decodeBooleanArray(Optional type, SliceInput sliceInput); + /** + * decode int array type + * + * @param type type of data to decode + * @param sliceInput data to decode + * @return T + */ @Decode("INT_ARRAY") T decodeIntArray(Optional type, SliceInput sliceInput); + /** + * decode int128 array type + * + * @param type type of data to decode + * @param sliceInput data to decode + * @return T + */ @Decode("INT128_ARRAY") T decodeInt128Array(Optional type, SliceInput sliceInput); + /** + * decode short array type + * + * @param type type of data to decode + * @param sliceInput data to decode + * @return T + */ @Decode("SHORT_ARRAY") T decodeShortArray(Optional type, SliceInput sliceInput); + /** + * decode long array type + * + * @param type type of data to decode + * @param sliceInput data to decode + * @return T + */ @Decode("LONG_ARRAY") T decodeLongArray(Optional type, SliceInput sliceInput); + /** + * decode float array type + * + * @param type type of data to decode + * @param sliceInput data to decode + * @return T + */ @Decode("FLOAT_ARRAY") T decodeFloatArray(Optional type, SliceInput sliceInput); + /** + * decode double array type + * + * @param type type of data to decode + * @param sliceInput data to decode + * @return T + */ @Decode("DOUBLE_ARRAY") T decodeDoubleArray(Optional type, SliceInput sliceInput); + /** + * decode map type + * + * @param type type of data to decode + * @param sliceInput data to decode + * @return T + */ @Decode("MAP") T decodeMap(Optional type, SliceInput sliceInput); + /** + * decode map element type + * + * @param type type of data to decode + * @param sliceInput data to decode + * @return T + */ @Decode("MAP_ELEMENT") T decodeSingleMap(Optional type, SliceInput sliceInput); + /** + * decode variable width type + * + * @param type type of data to decode + * @param sliceInput data to decode + * @return T + */ @Decode("VARIABLE_WIDTH") T decodeVariableWidth(Optional type, SliceInput sliceInput); + /** + * decode dictionary type + * + * @param type type of data to decode + * @param sliceInput data to decode + * @return T + */ @Decode("DICTIONARY") T decodeDictionary(Optional type, SliceInput sliceInput); + /** + * decode rle type + * + * @param type type of data to decode + * @param sliceInput data to decode + * @return T + * @throws InvocationTargetException throw invocation target exception + * @throws IllegalAccessException throw illegal access exception + */ @Decode("RLE") T decodeRunLength(Optional type, SliceInput sliceInput) - throws InvocationTargetException, IllegalAccessException; + throws InvocationTargetException, IllegalAccessException; + /** + * decode row type + * + * @param type type of data to decode + * @param sliceInput data to decode + * @return T + */ @Decode("ROW") T decodeRow(Optional type, SliceInput sliceInput); + /** + * decode date type + * + * @param type type of data to decode + * @param sliceInput data to decode + * @return T + */ @Decode("DATE") T decodeDate(Optional type, SliceInput sliceInput); + /** + * decode long to int type + * + * @param type type of data to decode + * @param sliceInput data to decode + * @return T + */ @Decode("LONG_TO_INT") T decodeLongToInt(Optional type, SliceInput sliceInput); + /** + * decode long to short type + * + * @param type type of data to decode + * @param sliceInput data to decode + * @return T + */ @Decode("LONG_TO_SHORT") T decodeLongToShort(Optional type, SliceInput sliceInput); + /** + * decode long to byte type + * + * @param type type of data to decode + * @param sliceInput data to decode + * @return T + */ @Decode("LONG_TO_BYTE") T decodeLongToByte(Optional type, SliceInput sliceInput); + /** + * decode long to float type + * + * @param type type of data to decode + * @param sliceInput data to decode + * @return T + */ @Decode("LONG_TO_FLOAT") T decodeLongToFloat(Optional type, SliceInput sliceInput); + /** + * decode decimal type + * + * @param type type of data to decode + * @param sliceInput data to decode + * @param decodeType storage type of decimal + * @return T + */ @Decode("DECIMAL") T decodeDecimal(Optional type, SliceInput sliceInput, String decodeType); + /** + * decode timestamp type + * + * @param type type of data to decode + * @param sliceInput data to decode + * @return T + */ @Decode("TIMESTAMP") T decodeTimestamp(Optional type, SliceInput sliceInput); } diff --git a/omnidata/omnidata-hive-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/ArrayDecodeType.java b/omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/type/ArrayDecodeType.java similarity index 48% rename from omnidata/omnidata-hive-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/ArrayDecodeType.java rename to omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/type/ArrayDecodeType.java index ca2f9942a..e424f0d1f 100644 --- a/omnidata/omnidata-hive-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/ArrayDecodeType.java +++ b/omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/type/ArrayDecodeType.java @@ -1,12 +1,8 @@ /* - * Copyright (C) Huawei Technologies Co., Ltd. 2021-2022. All rights reserved. - * 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 + * Copyright (C) 2022-2022. Huawei Technologies Co., Ltd. All rights reserved. + * Licensed 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 * @@ -19,19 +15,32 @@ package com.huawei.boostkit.omnidata.decode.type; - import java.util.Optional; /** * Array decode type * * @param decode type - * @since 2021-07-31 + * @since 2022-07-28 */ -public class ArrayDecodeType implements DecodeType { +public class ArrayDecodeType + implements DecodeType +{ + private final T elementType; + + public ArrayDecodeType(T elementType) + { + this.elementType = elementType; + } + + public T getElementType() + { + return elementType; + } + @Override - public Optional> getJavaType() { + public Optional> getJavaType() + { return Optional.empty(); } } - diff --git a/omnidata/omnidata-hive-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/BooleanDecodeType.java b/omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/type/BooleanDecodeType.java similarity index 45% rename from omnidata/omnidata-hive-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/BooleanDecodeType.java rename to omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/type/BooleanDecodeType.java index 2bb62cc26..6c785bb63 100644 --- a/omnidata/omnidata-hive-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/BooleanDecodeType.java +++ b/omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/type/BooleanDecodeType.java @@ -1,12 +1,8 @@ /* - * Copyright (C) Huawei Technologies Co., Ltd. 2021-2022. All rights reserved. - * 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 + * Copyright (C) 2022-2022. Huawei Technologies Co., Ltd. All rights reserved. + * Licensed 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 * @@ -19,18 +15,19 @@ package com.huawei.boostkit.omnidata.decode.type; - import java.util.Optional; /** * Boolean decode type * - * @since 2021-07-31 + * @since 2022-07-28 */ -public class BooleanDecodeType implements DecodeType { +public class BooleanDecodeType + implements DecodeType +{ @Override - public Optional> getJavaType() { - return Optional.empty(); + public Optional> getJavaType() + { + return Optional.of(boolean.class); } } - diff --git a/omnidata/omnidata-hive-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/ByteDecodeType.java b/omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/type/ByteDecodeType.java similarity index 45% rename from omnidata/omnidata-hive-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/ByteDecodeType.java rename to omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/type/ByteDecodeType.java index 25b93469f..10ae47d39 100644 --- a/omnidata/omnidata-hive-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/ByteDecodeType.java +++ b/omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/type/ByteDecodeType.java @@ -1,12 +1,8 @@ /* - * Copyright (C) Huawei Technologies Co., Ltd. 2021-2022. All rights reserved. - * 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 + * Copyright (C) 2022-2022. Huawei Technologies Co., Ltd. All rights reserved. + * Licensed 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 * @@ -19,18 +15,19 @@ package com.huawei.boostkit.omnidata.decode.type; - import java.util.Optional; /** * Byte decode type * - * @since 2021-07-31 + * @since 2022-07-28 */ -public class ByteDecodeType implements DecodeType { +public class ByteDecodeType + implements DecodeType +{ @Override - public Optional> getJavaType() { - return Optional.empty(); + public Optional> getJavaType() + { + return Optional.of(byte.class); } } - diff --git a/omnidata/omnidata-hive-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/DateDecodeType.java b/omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/type/DateDecodeType.java similarity index 45% rename from omnidata/omnidata-hive-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/DateDecodeType.java rename to omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/type/DateDecodeType.java index 63a74e326..b1ed31589 100644 --- a/omnidata/omnidata-hive-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/DateDecodeType.java +++ b/omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/type/DateDecodeType.java @@ -1,12 +1,8 @@ /* - * Copyright (C) Huawei Technologies Co., Ltd. 2021-2022. All rights reserved. - * 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 + * Copyright (C) 2022-2022. Huawei Technologies Co., Ltd. All rights reserved. + * Licensed 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 * @@ -19,18 +15,19 @@ package com.huawei.boostkit.omnidata.decode.type; - import java.util.Optional; /** * Date Decode Type * - * @since 2021-07-31 + * @since 2022-07-28 */ -public class DateDecodeType implements DecodeType { +public class DateDecodeType + implements DecodeType +{ @Override - public Optional> getJavaType() { - return Optional.empty(); + public Optional> getJavaType() + { + return Optional.of(io.prestosql.spi.type.DateType.class); } } - diff --git a/omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/DecimalDecodeType.java b/omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/type/DecimalDecodeType.java similarity index 41% rename from omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/DecimalDecodeType.java rename to omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/type/DecimalDecodeType.java index d4cc6666e..fd331aa6d 100644 --- a/omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/DecimalDecodeType.java +++ b/omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/type/DecimalDecodeType.java @@ -1,13 +1,10 @@ /* - * Copyright (C) Huawei Technologies Co., Ltd. 2021-2022. All rights reserved. - * 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 + * Copyright (C) 2022-2022. Huawei Technologies Co., Ltd. All rights reserved. + * Licensed 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 + * 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, @@ -18,30 +15,38 @@ package com.huawei.boostkit.omnidata.decode.type; - import java.util.Optional; /** * Decimal decode type * - * @since 2021-07-31 + * @since 2022-07-28 */ -public class DecimalDecodeType implements DecodeType { - - public int getPrecision() { - return 0; +public class DecimalDecodeType + implements DecodeType +{ + private final int precision; + private final int scale; + + public DecimalDecodeType(int precision, int scale) + { + this.precision = precision; + this.scale = scale; } - public int getScale() { - return 0; + public int getPrecision() + { + return precision; } - public DecimalDecodeType(int v1, int v2) { + public int getScale() + { + return scale; } @Override - public Optional> getJavaType() { + public Optional> getJavaType() + { return Optional.of(DecimalDecodeType.class); } } - diff --git a/omnidata/omnidata-hive-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/DecodeType.java b/omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/type/DecodeType.java similarity index 48% rename from omnidata/omnidata-hive-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/DecodeType.java rename to omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/type/DecodeType.java index da47d3c49..b430f3a7a 100644 --- a/omnidata/omnidata-hive-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/DecodeType.java +++ b/omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/type/DecodeType.java @@ -1,12 +1,8 @@ /* - * Copyright (C) Huawei Technologies Co., Ltd. 2021-2022. All rights reserved. - * 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 + * Copyright (C) 2022-2022. Huawei Technologies Co., Ltd. All rights reserved. + * Licensed 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 * @@ -19,15 +15,19 @@ package com.huawei.boostkit.omnidata.decode.type; - import java.util.Optional; /** - * Decode java type + * Dcode java type * - * @since 2020-07-31 + * @since 2022-07-28 */ -public interface DecodeType { +public interface DecodeType +{ + /** + * get java class type + * + * @return class type + */ Optional> getJavaType(); } - diff --git a/omnidata/omnidata-hive-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/DoubleDecodeType.java b/omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/type/DoubleDecodeType.java similarity index 45% rename from omnidata/omnidata-hive-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/DoubleDecodeType.java rename to omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/type/DoubleDecodeType.java index aba7ad5ec..744425912 100644 --- a/omnidata/omnidata-hive-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/DoubleDecodeType.java +++ b/omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/type/DoubleDecodeType.java @@ -1,12 +1,8 @@ /* - * Copyright (C) Huawei Technologies Co., Ltd. 2021-2022. All rights reserved. - * 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 + * Copyright (C) 2022-2022. Huawei Technologies Co., Ltd. All rights reserved. + * Licensed 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 * @@ -19,18 +15,19 @@ package com.huawei.boostkit.omnidata.decode.type; - import java.util.Optional; /** * Double decode type * - * @since 2021-07-31 + * @since 2022-07-28 */ -public class DoubleDecodeType implements DecodeType { +public class DoubleDecodeType + implements DecodeType +{ @Override - public Optional> getJavaType() { - return Optional.empty(); + public Optional> getJavaType() + { + return Optional.of(double.class); } } - diff --git a/omnidata/omnidata-hive-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/FloatDecodeType.java b/omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/type/FloatDecodeType.java similarity index 45% rename from omnidata/omnidata-hive-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/FloatDecodeType.java rename to omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/type/FloatDecodeType.java index 3b8977452..3ec0b38ef 100644 --- a/omnidata/omnidata-hive-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/FloatDecodeType.java +++ b/omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/type/FloatDecodeType.java @@ -1,12 +1,8 @@ /* - * Copyright (C) Huawei Technologies Co., Ltd. 2021-2022. All rights reserved. - * 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 + * Copyright (C) 2022-2022. Huawei Technologies Co., Ltd. All rights reserved. + * Licensed 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 * @@ -19,18 +15,19 @@ package com.huawei.boostkit.omnidata.decode.type; - import java.util.Optional; /** * Float decode type * - * @since 2020-07-31 + * @since 2022-07-28 */ -public class FloatDecodeType implements DecodeType { +public class FloatDecodeType + implements DecodeType +{ @Override - public Optional> getJavaType() { - return Optional.empty(); + public Optional> getJavaType() + { + return Optional.of(float.class); } } - diff --git a/omnidata/omnidata-hive-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/IntDecodeType.java b/omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/type/IntDecodeType.java similarity index 45% rename from omnidata/omnidata-hive-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/IntDecodeType.java rename to omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/type/IntDecodeType.java index 49331b421..cf608a5aa 100644 --- a/omnidata/omnidata-hive-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/IntDecodeType.java +++ b/omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/type/IntDecodeType.java @@ -1,12 +1,8 @@ /* - * Copyright (C) Huawei Technologies Co., Ltd. 2021-2022. All rights reserved. - * 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 + * Copyright (C) 2022-2022. Huawei Technologies Co., Ltd. All rights reserved. + * Licensed 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 * @@ -19,18 +15,19 @@ package com.huawei.boostkit.omnidata.decode.type; - import java.util.Optional; /** * Int decode type * - * @since 2021-07-31 + * @since 2022-07-28 */ -public class IntDecodeType implements DecodeType { +public class IntDecodeType + implements DecodeType +{ @Override - public Optional> getJavaType() { - return Optional.empty(); + public Optional> getJavaType() + { + return Optional.of(int.class); } } - diff --git a/omnidata/omnidata-hive-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongDecodeType.java b/omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongDecodeType.java similarity index 45% rename from omnidata/omnidata-hive-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongDecodeType.java rename to omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongDecodeType.java index 8fa2a5993..b6fc885f9 100644 --- a/omnidata/omnidata-hive-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongDecodeType.java +++ b/omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongDecodeType.java @@ -1,12 +1,8 @@ /* - * Copyright (C) Huawei Technologies Co., Ltd. 2021-2022. All rights reserved. - * 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 + * Copyright (C) 2022-2022. Huawei Technologies Co., Ltd. All rights reserved. + * Licensed 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 * @@ -19,18 +15,19 @@ package com.huawei.boostkit.omnidata.decode.type; - import java.util.Optional; /** * Long decode type * - * @since 2021-07-31 + * @since 2022-07-28 */ -public class LongDecodeType implements DecodeType { +public class LongDecodeType + implements DecodeType +{ @Override - public Optional> getJavaType() { - return Optional.empty(); + public Optional> getJavaType() + { + return Optional.of(long.class); } } - diff --git a/omnidata/omnidata-hive-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongToByteDecodeType.java b/omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongToByteDecodeType.java similarity index 45% rename from omnidata/omnidata-hive-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongToByteDecodeType.java rename to omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongToByteDecodeType.java index c6baf6864..7f8c82689 100644 --- a/omnidata/omnidata-hive-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongToByteDecodeType.java +++ b/omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongToByteDecodeType.java @@ -1,12 +1,8 @@ /* - * Copyright (C) Huawei Technologies Co., Ltd. 2021-2022. All rights reserved. - * 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 + * Copyright (C) 2022-2022. Huawei Technologies Co., Ltd. All rights reserved. + * Licensed 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 * @@ -24,11 +20,14 @@ import java.util.Optional; /** * Long To Byte decode * - * @since 2021-08-26 + * @since 2022-07-28 */ -public class LongToByteDecodeType implements DecodeType { +public class LongToByteDecodeType + implements DecodeType +{ @Override - public Optional> getJavaType() { - return Optional.empty(); + public Optional> getJavaType() + { + return Optional.of(LongToByteDecodeType.class); } } diff --git a/omnidata/omnidata-hive-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongToFloatDecodeType.java b/omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongToFloatDecodeType.java similarity index 45% rename from omnidata/omnidata-hive-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongToFloatDecodeType.java rename to omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongToFloatDecodeType.java index aa78baed9..5b0eb5c3f 100644 --- a/omnidata/omnidata-hive-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongToFloatDecodeType.java +++ b/omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongToFloatDecodeType.java @@ -1,12 +1,8 @@ /* - * Copyright (C) Huawei Technologies Co., Ltd. 2021-2022. All rights reserved. - * 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 + * Copyright (C) 2022-2022. Huawei Technologies Co., Ltd. All rights reserved. + * Licensed 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 * @@ -19,17 +15,19 @@ package com.huawei.boostkit.omnidata.decode.type; - import java.util.Optional; /** * Double To Float decode * - * @since 2021-08-26 + * @since 2022-07-28 */ -public class LongToFloatDecodeType implements DecodeType { +public class LongToFloatDecodeType + implements DecodeType +{ @Override - public Optional> getJavaType() { - return Optional.empty(); + public Optional> getJavaType() + { + return Optional.of(LongToFloatDecodeType.class); } } diff --git a/omnidata/omnidata-hive-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongToIntDecodeType.java b/omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongToIntDecodeType.java similarity index 45% rename from omnidata/omnidata-hive-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongToIntDecodeType.java rename to omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongToIntDecodeType.java index 026087694..237e22940 100644 --- a/omnidata/omnidata-hive-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongToIntDecodeType.java +++ b/omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongToIntDecodeType.java @@ -1,12 +1,8 @@ /* - * Copyright (C) Huawei Technologies Co., Ltd. 2021-2022. All rights reserved. - * 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 + * Copyright (C) 2022-2022. Huawei Technologies Co., Ltd. All rights reserved. + * Licensed 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 * @@ -19,17 +15,19 @@ package com.huawei.boostkit.omnidata.decode.type; - import java.util.Optional; /** * Long To Int decode * - * @since 2021-08-26 + * @since 2022-07-28 */ -public class LongToIntDecodeType implements DecodeType { +public class LongToIntDecodeType + implements DecodeType +{ @Override - public Optional> getJavaType() { - return Optional.empty(); + public Optional> getJavaType() + { + return Optional.of(LongToIntDecodeType.class); } } diff --git a/omnidata/omnidata-hive-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongToShortDecodeType.java b/omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongToShortDecodeType.java similarity index 44% rename from omnidata/omnidata-hive-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongToShortDecodeType.java rename to omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongToShortDecodeType.java index 475e988a5..7e2fc5b53 100644 --- a/omnidata/omnidata-hive-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongToShortDecodeType.java +++ b/omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongToShortDecodeType.java @@ -1,12 +1,8 @@ /* - * Copyright (C) Huawei Technologies Co., Ltd. 2021-2022. All rights reserved. - * 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 + * Copyright (C) 2022-2022. Huawei Technologies Co., Ltd. All rights reserved. + * Licensed 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 * @@ -19,17 +15,19 @@ package com.huawei.boostkit.omnidata.decode.type; - import java.util.Optional; /** * 功能描述 * - * @since 2021-08-26 + * @since 2022-07-28 */ -public class LongToShortDecodeType implements DecodeType { +public class LongToShortDecodeType + implements DecodeType +{ @Override - public Optional> getJavaType() { - return Optional.empty(); + public Optional> getJavaType() + { + return Optional.of(LongToShortDecodeType.class); } } diff --git a/omnidata/omnidata-hive-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/MapDecodeType.java b/omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/type/MapDecodeType.java similarity index 53% rename from omnidata/omnidata-hive-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/MapDecodeType.java rename to omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/type/MapDecodeType.java index 651e4e776..3cadb7b63 100644 --- a/omnidata/omnidata-hive-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/MapDecodeType.java +++ b/omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/type/MapDecodeType.java @@ -1,12 +1,8 @@ /* - * Copyright (C) Huawei Technologies Co., Ltd. 2021-2022. All rights reserved. - * 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 + * Copyright (C) 2022-2022. Huawei Technologies Co., Ltd. All rights reserved. + * Licensed 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 * @@ -19,7 +15,6 @@ package com.huawei.boostkit.omnidata.decode.type; - import java.util.Optional; /** @@ -27,12 +22,23 @@ import java.util.Optional; * * @param k * @param v - * @since 2021-07-31 + * @since 2022-07-28 */ -public class MapDecodeType implements DecodeType { +public class MapDecodeType + implements DecodeType +{ + private final K keyType; + private final V valueType; + + public MapDecodeType(K keyType, V valueType) + { + this.keyType = keyType; + this.valueType = valueType; + } + @Override - public Optional> getJavaType() { + public Optional> getJavaType() + { return Optional.empty(); } } - diff --git a/omnidata/omnidata-hive-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/RowDecodeType.java b/omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/type/RowDecodeType.java similarity index 45% rename from omnidata/omnidata-hive-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/RowDecodeType.java rename to omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/type/RowDecodeType.java index c96a465a2..dafc8e668 100644 --- a/omnidata/omnidata-hive-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/RowDecodeType.java +++ b/omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/type/RowDecodeType.java @@ -1,12 +1,8 @@ /* - * Copyright (C) Huawei Technologies Co., Ltd. 2021-2022. All rights reserved. - * 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 + * Copyright (C) 2022-2022. Huawei Technologies Co., Ltd. All rights reserved. + * Licensed 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 * @@ -19,18 +15,19 @@ package com.huawei.boostkit.omnidata.decode.type; - import java.util.Optional; /** * Row decode type * - * @since 2020-07-31 + * @since 2022-07-28 */ -public class RowDecodeType implements DecodeType { +public class RowDecodeType + implements DecodeType +{ @Override - public Optional> getJavaType() { - return Optional.empty(); + public Optional> getJavaType() + { + return Optional.of(io.prestosql.spi.type.RowType.class); } } - diff --git a/omnidata/omnidata-hive-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/ShortDecodeType.java b/omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/type/ShortDecodeType.java similarity index 45% rename from omnidata/omnidata-hive-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/ShortDecodeType.java rename to omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/type/ShortDecodeType.java index bcad30b00..6788cf15d 100644 --- a/omnidata/omnidata-hive-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/ShortDecodeType.java +++ b/omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/type/ShortDecodeType.java @@ -1,12 +1,8 @@ /* - * Copyright (C) Huawei Technologies Co., Ltd. 2021-2022. All rights reserved. - * 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 + * Copyright (C) 2022-2022. Huawei Technologies Co., Ltd. All rights reserved. + * Licensed 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 * @@ -19,18 +15,19 @@ package com.huawei.boostkit.omnidata.decode.type; - import java.util.Optional; /** * Short decode type * - * @since 2021-07-31 + * @since 2022-07-28 */ -public class ShortDecodeType implements DecodeType { +public class ShortDecodeType + implements DecodeType +{ @Override - public Optional> getJavaType() { - return Optional.empty(); + public Optional> getJavaType() + { + return Optional.of(short.class); } } - diff --git a/omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/type/TimestampDecodeType.java b/omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/type/TimestampDecodeType.java new file mode 100644 index 000000000..cc28839b4 --- /dev/null +++ b/omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/type/TimestampDecodeType.java @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2022-2022. Huawei Technologies Co., Ltd. All rights reserved. + * Licensed 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 com.huawei.boostkit.omnidata.decode.type; + +import java.util.Optional; + +/** + * Timestamp decode type + * + * @since 2022-07-28 + */ +public class TimestampDecodeType + implements DecodeType +{ + @Override + public Optional> getJavaType() + { + return Optional.of(TimestampDecodeType.class); + } +} diff --git a/omnidata/omnidata-hive-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/VarcharDecodeType.java b/omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/type/VarcharDecodeType.java similarity index 45% rename from omnidata/omnidata-hive-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/VarcharDecodeType.java rename to omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/type/VarcharDecodeType.java index d56b0177e..c9053c241 100644 --- a/omnidata/omnidata-hive-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/VarcharDecodeType.java +++ b/omnidata/omnidata-spark-connector/connector/src/main/java/com/huawei/boostkit/omnidata/decode/type/VarcharDecodeType.java @@ -1,12 +1,8 @@ /* - * Copyright (C) Huawei Technologies Co., Ltd. 2021-2022. All rights reserved. - * 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 + * Copyright (C) 2022-2022. Huawei Technologies Co., Ltd. All rights reserved. + * Licensed 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 * @@ -19,18 +15,19 @@ package com.huawei.boostkit.omnidata.decode.type; - import java.util.Optional; /** * Varchar decode type * - * @since 2020-07-31 + * @since 2022-07-28 */ -public class VarcharDecodeType implements DecodeType { +public class VarcharDecodeType + implements DecodeType +{ @Override - public Optional> getJavaType() { - return Optional.empty(); + public Optional> getJavaType() + { + return Optional.of(String.class); } } - diff --git a/omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/AbstractDecoding.java b/omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/AbstractDecoding.java deleted file mode 100644 index 6b2088be3..000000000 --- a/omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/AbstractDecoding.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (C) Huawei Technologies Co., Ltd. 2021-2022. All rights reserved. - * 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 com.huawei.boostkit.omnidata.decode; - -import com.huawei.boostkit.omnidata.decode.type.DecodeType; - -import io.airlift.slice.SliceInput; - -import java.lang.reflect.Method; -import java.util.Optional; - -/** - * Abstract decoding - * - * @param decoding type - * @since 2021-07-31 - */ -public abstract class AbstractDecoding implements Decoding { - - private Method getDecodeMethod(String decodeName) { - return null; - } - - private String getDecodeName(SliceInput input) { - return null; - } - - private Optional typeToDecodeName(DecodeType type) { - return null; - } - - @Override - public T decode(Optional type, SliceInput sliceInput) { - return null; - } - - public Optional decodeNullBits(SliceInput sliceInput, int positionCount) { - return null; - } - - private boolean[] getIsNullValue(byte value) { - return null; - } -} diff --git a/omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/ArrayDecodeType.java b/omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/ArrayDecodeType.java deleted file mode 100644 index c2bbe4cd8..000000000 --- a/omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/ArrayDecodeType.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) Huawei Technologies Co., Ltd. 2021-2022. All rights reserved. - * 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 com.huawei.boostkit.omnidata.decode.type; - - -import java.util.Optional; - -/** - * Array decode type - * - * @param decode type - * @since 2021-07-31 - */ -public class ArrayDecodeType implements DecodeType { - @Override - public Optional> getJavaType() { - return Optional.empty(); - } -} - diff --git a/omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/BooleanDecodeType.java b/omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/BooleanDecodeType.java deleted file mode 100644 index b01dd25d9..000000000 --- a/omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/BooleanDecodeType.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) Huawei Technologies Co., Ltd. 2021-2022. All rights reserved. - * 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 com.huawei.boostkit.omnidata.decode.type; - - -import java.util.Optional; - -/** - * Boolean decode type - * - * @since 2021-07-31 - */ -public class BooleanDecodeType implements DecodeType { - @Override - public Optional> getJavaType() { - return Optional.empty(); - } -} - diff --git a/omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/ByteDecodeType.java b/omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/ByteDecodeType.java deleted file mode 100644 index a73cad659..000000000 --- a/omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/ByteDecodeType.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) Huawei Technologies Co., Ltd. 2021-2022. All rights reserved. - * 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 com.huawei.boostkit.omnidata.decode.type; - - -import java.util.Optional; - -/** - * Byte decode type - * - * @since 2021-07-31 - */ -public class ByteDecodeType implements DecodeType { - @Override - public Optional> getJavaType() { - return Optional.empty(); - } -} - diff --git a/omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/DateDecodeType.java b/omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/DateDecodeType.java deleted file mode 100644 index 88bb3c7e6..000000000 --- a/omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/DateDecodeType.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) Huawei Technologies Co., Ltd. 2021-2022. All rights reserved. - * 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 com.huawei.boostkit.omnidata.decode.type; - - -import java.util.Optional; - -/** - * Date Decode Type - * - * @since 2021-07-31 - */ -public class DateDecodeType implements DecodeType { - @Override - public Optional> getJavaType() { - return Optional.empty(); - } -} - diff --git a/omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/DoubleDecodeType.java b/omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/DoubleDecodeType.java deleted file mode 100644 index d24dd8b03..000000000 --- a/omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/DoubleDecodeType.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) Huawei Technologies Co., Ltd. 2021-2022. All rights reserved. - * 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 com.huawei.boostkit.omnidata.decode.type; - - -import java.util.Optional; - -/** - * Double decode type - * - * @since 2021-07-31 - */ -public class DoubleDecodeType implements DecodeType { - @Override - public Optional> getJavaType() { - return Optional.empty(); - } -} - diff --git a/omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/FloatDecodeType.java b/omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/FloatDecodeType.java deleted file mode 100644 index 2f78a39b2..000000000 --- a/omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/FloatDecodeType.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) Huawei Technologies Co., Ltd. 2021-2022. All rights reserved. - * 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 com.huawei.boostkit.omnidata.decode.type; - - -import java.util.Optional; - -/** - * Float decode type - * - * @since 2020-07-31 - */ -public class FloatDecodeType implements DecodeType { - @Override - public Optional> getJavaType() { - return Optional.empty(); - } -} - diff --git a/omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/IntDecodeType.java b/omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/IntDecodeType.java deleted file mode 100644 index 9157a551a..000000000 --- a/omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/IntDecodeType.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) Huawei Technologies Co., Ltd. 2021-2022. All rights reserved. - * 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 com.huawei.boostkit.omnidata.decode.type; - - -import java.util.Optional; - -/** - * Int decode type - * - * @since 2021-07-31 - */ -public class IntDecodeType implements DecodeType { - @Override - public Optional> getJavaType() { - return Optional.empty(); - } -} - diff --git a/omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongDecodeType.java b/omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongDecodeType.java deleted file mode 100644 index d5bf88700..000000000 --- a/omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongDecodeType.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) Huawei Technologies Co., Ltd. 2021-2022. All rights reserved. - * 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 com.huawei.boostkit.omnidata.decode.type; - - -import java.util.Optional; - -/** - * Long decode type - * - * @since 2021-07-31 - */ -public class LongDecodeType implements DecodeType { - @Override - public Optional> getJavaType() { - return Optional.empty(); - } -} - diff --git a/omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongToByteDecodeType.java b/omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongToByteDecodeType.java deleted file mode 100644 index 203f8c2b3..000000000 --- a/omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongToByteDecodeType.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (C) Huawei Technologies Co., Ltd. 2021-2022. All rights reserved. - * 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 com.huawei.boostkit.omnidata.decode.type; - -import java.util.Optional; - -/** - * Long To Byte decode - * - * @since 2021-08-26 - */ -public class LongToByteDecodeType implements DecodeType { - @Override - public Optional> getJavaType() { - return Optional.empty(); - } -} diff --git a/omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongToFloatDecodeType.java b/omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongToFloatDecodeType.java deleted file mode 100644 index dbabcecd7..000000000 --- a/omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongToFloatDecodeType.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (C) Huawei Technologies Co., Ltd. 2021-2022. All rights reserved. - * 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 com.huawei.boostkit.omnidata.decode.type; - - -import java.util.Optional; - -/** - * Double To Float decode - * - * @since 2021-08-26 - */ -public class LongToFloatDecodeType implements DecodeType { - @Override - public Optional> getJavaType() { - return Optional.empty(); - } -} diff --git a/omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongToIntDecodeType.java b/omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongToIntDecodeType.java deleted file mode 100644 index 45cc45097..000000000 --- a/omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongToIntDecodeType.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (C) Huawei Technologies Co., Ltd. 2021-2022. All rights reserved. - * 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 com.huawei.boostkit.omnidata.decode.type; - - -import java.util.Optional; - -/** - * Long To Int decode - * - * @since 2021-08-26 - */ -public class LongToIntDecodeType implements DecodeType { - @Override - public Optional> getJavaType() { - return Optional.empty(); - } -} diff --git a/omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongToShortDecodeType.java b/omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongToShortDecodeType.java deleted file mode 100644 index 69e49e334..000000000 --- a/omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongToShortDecodeType.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (C) Huawei Technologies Co., Ltd. 2021-2022. All rights reserved. - * 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 com.huawei.boostkit.omnidata.decode.type; - - -import java.util.Optional; - -/** - * 功能描述 - * - * @since 2021-08-26 - */ -public class LongToShortDecodeType implements DecodeType { - @Override - public Optional> getJavaType() { - return Optional.empty(); - } -} diff --git a/omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/RowDecodeType.java b/omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/RowDecodeType.java deleted file mode 100644 index 5c5cba0d8..000000000 --- a/omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/RowDecodeType.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) Huawei Technologies Co., Ltd. 2021-2022. All rights reserved. - * 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 com.huawei.boostkit.omnidata.decode.type; - - -import java.util.Optional; - -/** - * Row decode type - * - * @since 2020-07-31 - */ -public class RowDecodeType implements DecodeType { - @Override - public Optional> getJavaType() { - return Optional.empty(); - } -} - diff --git a/omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/ShortDecodeType.java b/omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/ShortDecodeType.java deleted file mode 100644 index 06ccafa03..000000000 --- a/omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/ShortDecodeType.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) Huawei Technologies Co., Ltd. 2021-2022. All rights reserved. - * 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 com.huawei.boostkit.omnidata.decode.type; - - -import java.util.Optional; - -/** - * Short decode type - * - * @since 2021-07-31 - */ -public class ShortDecodeType implements DecodeType { - @Override - public Optional> getJavaType() { - return Optional.empty(); - } -} - diff --git a/omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/TimestampDecodeType.java b/omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/TimestampDecodeType.java deleted file mode 100644 index dd1b6ea39..000000000 --- a/omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/TimestampDecodeType.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) Huawei Technologies Co., Ltd. 2021-2022. All rights reserved. - * 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 com.huawei.boostkit.omnidata.decode.type; - - -import java.util.Optional; - -/** - * Timestamp decode type - * - * @since 2021-07-31 - */ -public class TimestampDecodeType implements DecodeType { - @Override - public Optional> getJavaType() { - return Optional.empty(); - } -} - diff --git a/omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/VarcharDecodeType.java b/omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/VarcharDecodeType.java deleted file mode 100644 index 43c787431..000000000 --- a/omnidata/omnidata-spark-connector/stub/server/src/main/java/com/huawei/boostkit/omnidata/decode/type/VarcharDecodeType.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) Huawei Technologies Co., Ltd. 2021-2022. All rights reserved. - * 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 com.huawei.boostkit.omnidata.decode.type; - - -import java.util.Optional; - -/** - * Varchar decode type - * - * @since 2020-07-31 - */ -public class VarcharDecodeType implements DecodeType { - @Override - public Optional> getJavaType() { - return Optional.empty(); - } -} - -- Gitee