diff --git a/omnidata/omnidata-openlookeng-connector/connector/pom.xml b/omnidata/omnidata-openlookeng-connector/connector/pom.xml index 6a398d6e76d9f0a3e0957e815b84b743d5d778fb..a7da4baaac8b51a788d89daacb1fea4e6ad2482d 100644 --- a/omnidata/omnidata-openlookeng-connector/connector/pom.xml +++ b/omnidata/omnidata-openlookeng-connector/connector/pom.xml @@ -14,6 +14,7 @@ ${os.detected.arch} + 1.4.0 30.1.1-jre 206 9.4.43.v20210629 @@ -42,6 +43,20 @@ io.hetu.core presto-plugin-toolkit + + + guava + com.google.guava + + + json + io.airlift + + + guice + com.google.inject + + @@ -53,11 +68,35 @@ io.hetu.core hetu-common + + + guava + com.google.guava + + io.hetu.core presto-orc + + + slice + io.airlift + + + guava + com.google.guava + + + joda-time + joda-time + + + guice + com.google.inject + + @@ -68,6 +107,18 @@ org.apache.parquet parquet-encoding + + slice + io.airlift + + + guava + com.google.guava + + + joda-time + joda-time + @@ -79,16 +130,42 @@ io.hetu.core presto-expressions + + + guava + com.google.guava + + io.hetu.core presto-memory-context + + + guava + com.google.guava + + io.hetu.core presto-rcfile + + + slice + io.airlift + + + guava + com.google.guava + + + joda-time + joda-time + + @@ -99,6 +176,12 @@ io.prestosql.hive hive-apache + + + joda-time + joda-time + + @@ -109,21 +192,53 @@ io.airlift aircompressor + + + slice + io.airlift + + io.airlift stats + + + slice + io.airlift + + + guava + com.google.guava + + io.airlift bootstrap + + + guava + com.google.guava + + + guice + com.google.inject + + io.airlift concurrent + + + guava + com.google.guava + + @@ -134,17 +249,51 @@ io.airlift event + + + guava + com.google.guava + + + joda-time + joda-time + + + guice + com.google.inject + + io.airlift json ${dep.arilift.version} + + + guava + com.google.guava + + + guice + com.google.inject + + io.airlift configuration + + + guava + com.google.guava + + + guice + com.google.inject + + @@ -157,6 +306,12 @@ com.google.inject guice 5.0.1 + + + guava + com.google.guava + + @@ -210,16 +365,38 @@ com.google.cloud.bigdataoss util + + + guava + com.google.guava + + + j2objc-annotations + com.google.j2objc + + com.google.cloud.bigdataoss gcsio + + + guava + com.google.guava + + com.google.cloud.bigdataoss util-hadoop + + + guava + com.google.guava + + @@ -344,6 +521,12 @@ com.google.cloud.bigdataoss gcs-connector + + + guava + com.google.guava + + @@ -367,6 +550,16 @@ io.airlift log-manager runtime + + + guava + com.google.guava + + + guice + com.google.inject + + @@ -379,6 +572,14 @@ com.google.code.gson gson + + slice + io.airlift + + + joda-time + joda-time + @@ -411,10 +612,23 @@ provided + + com.huawei.boostkit + boostkit-omnidata-common + ${dep.omnidata.version} + ${dep.os.arch} + + + guice + com.google.inject + + + + com.huawei.boostkit boostkit-omnidata-client - 1.4.0 + ${dep.omnidata.version} ${dep.os.arch} @@ -543,17 +757,45 @@ com.google.code.gson gson + + slice + io.airlift + + + joda-time + joda-time + io.airlift testing-mysql-server test + + + guava + com.google.guava + + io.hetu.core hetu-metastore test + + + guava + com.google.guava + + + json + io.airlift + + + guice + com.google.inject + + io.hetu.core @@ -572,6 +814,34 @@ org.bouncycastle bcprov-jdk15on + + slice + io.airlift + + + guava + com.google.guava + + + plexus-classworlds + org.codehaus.plexus + + + plexus-cipher + org.sonatype.plexus + + + json + io.airlift + + + joda-time + joda-time + + + guice + com.google.inject + @@ -585,36 +855,114 @@ org.bouncycastle bcprov-jdk15on + + slice + io.airlift + + + guava + com.google.guava + + + json + io.airlift + + + joda-time + joda-time + + + guice + com.google.inject + io.hetu.core presto-client test + + + slice + io.airlift + + + guava + com.google.guava + + + json + io.airlift + + io.hetu.core presto-parser test + + + slice + io.airlift + + + guava + com.google.guava + + io.hetu.core presto-tests test + + + slice + io.airlift + + + guava + com.google.guava + + + json + io.airlift + + + joda-time + joda-time + + + guice + com.google.inject + + io.hetu.core presto-tpch test + + + guava + com.google.guava + + io.airlift.tpch tpch test + + + guava + com.google.guava + + @@ -633,6 +981,12 @@ io.airlift testing test + + + guava + com.google.guava + + @@ -652,6 +1006,20 @@ io.hetu.core presto-benchmark test + + + guava + com.google.guava + + + json + io.airlift + + + guice + com.google.inject + + @@ -668,6 +1036,16 @@ io.hetu.core hetu-transport + + + slice + io.airlift + + + guava + com.google.guava + + @@ -687,6 +1065,10 @@ com.google.errorprone error_prone_annotations + + guava + com.google.guava + @@ -697,10 +1079,38 @@ io.airlift discovery + + + guava + com.google.guava + + + json + io.airlift + + + guice + com.google.inject + + io.airlift http-client + + + guava + com.google.guava + + + json + io.airlift + + + guice + com.google.inject + + javax.annotation diff --git a/omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/AbstractDecoding.java b/omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/AbstractDecoding.java deleted file mode 100644 index a1b7d5a1e223f0bf4c3f8b438c6fc2a2f7be8455..0000000000000000000000000000000000000000 --- a/omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/AbstractDecoding.java +++ /dev/null @@ -1,204 +0,0 @@ -/* - * 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 io.prestosql.plugin.hive.omnidata.decode; - -import com.huawei.boostkit.omnidata.exception.OmniDataException; -import io.airlift.slice.SliceInput; -import io.prestosql.plugin.hive.omnidata.decode.type.DecimalDecodeType; -import io.prestosql.plugin.hive.omnidata.decode.type.DecodeType; -import io.prestosql.plugin.hive.omnidata.decode.type.LongToByteDecodeType; -import io.prestosql.plugin.hive.omnidata.decode.type.LongToFloatDecodeType; -import io.prestosql.plugin.hive.omnidata.decode.type.LongToIntDecodeType; -import io.prestosql.plugin.hive.omnidata.decode.type.LongToShortDecodeType; -import io.prestosql.plugin.hive.omnidata.decode.type.TimestampDecodeType; -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-18 - */ -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-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/impl/OpenLooKengDecoding.java b/omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/impl/OpenLooKengDecoding.java index 66cf8fc9afc6eee5aaafc2eab1b5bba442c0212e..2c717657480dfe5bfe2839c63ce3827651b77873 100644 --- a/omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/impl/OpenLooKengDecoding.java +++ b/omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/impl/OpenLooKengDecoding.java @@ -15,12 +15,12 @@ package io.prestosql.plugin.hive.omnidata.decode.impl; +import com.huawei.boostkit.omnidata.decode.AbstractDecoding; +import com.huawei.boostkit.omnidata.decode.type.ArrayDecodeType; +import com.huawei.boostkit.omnidata.decode.type.DecodeType; import io.airlift.slice.Slice; import io.airlift.slice.SliceInput; import io.airlift.slice.Slices; -import io.prestosql.plugin.hive.omnidata.decode.AbstractDecoding; -import io.prestosql.plugin.hive.omnidata.decode.type.ArrayDecodeType; -import io.prestosql.plugin.hive.omnidata.decode.type.DecodeType; import io.prestosql.spi.block.Block; import io.prestosql.spi.block.ByteArrayBlock; import io.prestosql.spi.block.DictionaryBlock; diff --git a/omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/type/BooleanDecodeType.java b/omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/type/BooleanDecodeType.java deleted file mode 100644 index e1d5fe64a4f615c5a488d24790390dd8d1976db9..0000000000000000000000000000000000000000 --- a/omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/type/BooleanDecodeType.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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 io.prestosql.plugin.hive.omnidata.decode.type; - -import java.util.Optional; - -/** - * Boolean decode type - * - * @since 2022-07-18 - */ -public class BooleanDecodeType - implements DecodeType -{ - @Override - public Optional> getJavaType() - { - return Optional.of(boolean.class); - } -} diff --git a/omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/type/ByteDecodeType.java b/omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/type/ByteDecodeType.java deleted file mode 100644 index 33fe178b76ac641eaac2a7e83be9374493ccb900..0000000000000000000000000000000000000000 --- a/omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/type/ByteDecodeType.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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 io.prestosql.plugin.hive.omnidata.decode.type; - -import java.util.Optional; - -/** - * Byte decode type - * - * @since 2022-07-18 - */ -public class ByteDecodeType - implements DecodeType -{ - @Override - public Optional> getJavaType() - { - return Optional.of(byte.class); - } -} diff --git a/omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/type/DateDecodeType.java b/omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/type/DateDecodeType.java deleted file mode 100644 index d173d70f91a6ac326ae464b9080bbca5f4172ddd..0000000000000000000000000000000000000000 --- a/omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/type/DateDecodeType.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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 io.prestosql.plugin.hive.omnidata.decode.type; - -import java.util.Optional; - -/** - * Date Decode Type - * - * @since 2022-07-18 - */ -public class DateDecodeType - implements DecodeType -{ - @Override - public Optional> getJavaType() - { - return Optional.of(io.prestosql.spi.type.DateType.class); - } -} diff --git a/omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/type/DoubleDecodeType.java b/omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/type/DoubleDecodeType.java deleted file mode 100644 index b1a4b789ec2b598419b125b2a1577540e8b949f2..0000000000000000000000000000000000000000 --- a/omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/type/DoubleDecodeType.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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 io.prestosql.plugin.hive.omnidata.decode.type; - -import java.util.Optional; - -/** - * Double decode type - * - * @since 2022-07-18 - */ -public class DoubleDecodeType - implements DecodeType -{ - @Override - public Optional> getJavaType() - { - return Optional.of(double.class); - } -} diff --git a/omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/type/FloatDecodeType.java b/omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/type/FloatDecodeType.java deleted file mode 100644 index fdd9f725cdd83bca7b7ea366f67863907d44962a..0000000000000000000000000000000000000000 --- a/omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/type/FloatDecodeType.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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 io.prestosql.plugin.hive.omnidata.decode.type; - -import java.util.Optional; - -/** - * Float decode type - * - * @since 2022-07-18 - */ -public class FloatDecodeType - implements DecodeType -{ - @Override - public Optional> getJavaType() - { - return Optional.of(float.class); - } -} diff --git a/omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/type/IntDecodeType.java b/omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/type/IntDecodeType.java deleted file mode 100644 index 129760ad46ed62fba774575aa76a3de165aa3f10..0000000000000000000000000000000000000000 --- a/omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/type/IntDecodeType.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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 io.prestosql.plugin.hive.omnidata.decode.type; - -import java.util.Optional; - -/** - * Int decode type - * - * @since 2022-07-18 - */ -public class IntDecodeType - implements DecodeType -{ - @Override - public Optional> getJavaType() - { - return Optional.of(int.class); - } -} diff --git a/omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/type/LongDecodeType.java b/omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/type/LongDecodeType.java deleted file mode 100644 index af78cdcff0dcff5c9670068e68c48b0699a49201..0000000000000000000000000000000000000000 --- a/omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/type/LongDecodeType.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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 io.prestosql.plugin.hive.omnidata.decode.type; - -import java.util.Optional; - -/** - * Long decode type - * - * @since 2022-07-18 - */ -public class LongDecodeType - implements DecodeType -{ - @Override - public Optional> getJavaType() - { - return Optional.of(long.class); - } -} diff --git a/omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/type/RowDecodeType.java b/omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/type/RowDecodeType.java deleted file mode 100644 index d91008e406357857fdcb8c45cee72342bc61644e..0000000000000000000000000000000000000000 --- a/omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/type/RowDecodeType.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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 io.prestosql.plugin.hive.omnidata.decode.type; - -import java.util.Optional; - -/** - * Row decode type - * - * @since 2022-07-18 - */ -public class RowDecodeType - implements DecodeType -{ - @Override - public Optional> getJavaType() - { - return Optional.of(io.prestosql.spi.type.RowType.class); - } -} diff --git a/omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/type/ShortDecodeType.java b/omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/type/ShortDecodeType.java deleted file mode 100644 index 6256173124bf52e15a8d3de77ec79d153346372d..0000000000000000000000000000000000000000 --- a/omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/type/ShortDecodeType.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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 io.prestosql.plugin.hive.omnidata.decode.type; - -import java.util.Optional; - -/** - * Short decode type - * - * @since 2022-07-18 - */ -public class ShortDecodeType - implements DecodeType -{ - @Override - public Optional> getJavaType() - { - return Optional.of(short.class); - } -} diff --git a/omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/type/VarcharDecodeType.java b/omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/type/VarcharDecodeType.java deleted file mode 100644 index 42f2f2f55676c746fa3d410034ffc62e405bac65..0000000000000000000000000000000000000000 --- a/omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/type/VarcharDecodeType.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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 io.prestosql.plugin.hive.omnidata.decode.type; - -import java.util.Optional; - -/** - * Varchar decode type - * - * @since 2022-07-18 - */ -public class VarcharDecodeType - implements DecodeType -{ - @Override - public Optional> getJavaType() - { - return Optional.of(String.class); - } -} diff --git a/omnidata/omnidata-openlookeng-connector/connector/src/test/java/io/prestosql/plugin/hive/omnidata/decode/TestOpenLooKengDeserializer.java b/omnidata/omnidata-openlookeng-connector/connector/src/test/java/io/prestosql/plugin/hive/omnidata/decode/TestOpenLooKengDeserializer.java index b70349af7d54b913ec2cd3031081627e370d2eda..56a946e81b03a9a695c2786f2329b08212395a29 100644 --- a/omnidata/omnidata-openlookeng-connector/connector/src/test/java/io/prestosql/plugin/hive/omnidata/decode/TestOpenLooKengDeserializer.java +++ b/omnidata/omnidata-openlookeng-connector/connector/src/test/java/io/prestosql/plugin/hive/omnidata/decode/TestOpenLooKengDeserializer.java @@ -16,6 +16,12 @@ package io.prestosql.plugin.hive.omnidata.decode; import com.google.common.collect.ImmutableList; +import com.huawei.boostkit.omnidata.decode.type.ArrayDecodeType; +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.exception.OmniDataException; import com.huawei.boostkit.omnidata.serialize.OmniDataBlockEncodingSerde; import io.airlift.compress.Decompressor; @@ -27,14 +33,6 @@ import io.hetu.core.transport.execution.buffer.PagesSerdeFactory; import io.hetu.core.transport.execution.buffer.SerializedPage; import io.prestosql.plugin.hive.omnidata.decode.impl.OpenLooKengDecoding; import io.prestosql.plugin.hive.omnidata.decode.impl.OpenLooKengDeserializer; -import io.prestosql.plugin.hive.omnidata.decode.type.ArrayDecodeType; -import io.prestosql.plugin.hive.omnidata.decode.type.DateDecodeType; -import io.prestosql.plugin.hive.omnidata.decode.type.DecodeType; -import io.prestosql.plugin.hive.omnidata.decode.type.LongDecodeType; -import io.prestosql.plugin.hive.omnidata.decode.type.LongToByteDecodeType; -import io.prestosql.plugin.hive.omnidata.decode.type.LongToFloatDecodeType; -import io.prestosql.plugin.hive.omnidata.decode.type.LongToIntDecodeType; -import io.prestosql.plugin.hive.omnidata.decode.type.LongToShortDecodeType; import io.prestosql.spi.Page; import io.prestosql.spi.PageBuilder; import io.prestosql.spi.block.Block; @@ -119,7 +117,7 @@ public class TestOpenLooKengDeserializer // deserialize page DecodeType[] decodeTypes = new DecodeType[] { new LongToIntDecodeType(), new LongToShortDecodeType(), new LongToByteDecodeType(), - new LongToFloatDecodeType(), new DateDecodeType() + new LongToFloatDecodeType() }; OpenLooKengDecoding blockDecoding = new OpenLooKengDecoding(); @@ -218,10 +216,10 @@ public class TestOpenLooKengDeserializer SerializedPage serializedPage = pagesSerde.serialize(page); //deserialize page - DecodeType[] decodeTypes = new DecodeType[] {new ArrayDecodeType<>(new LongDecodeType())}; + DecodeType[] decodeTypes = new DecodeType[] {new ArrayDecodeType<>(new LongToIntDecodeType())}; DecodeType firstType = decodeTypes[0]; if (firstType instanceof ArrayDecodeType) { - assertEquals(((ArrayDecodeType) firstType).getElementType().getClass(), LongDecodeType.class); + assertEquals(((ArrayDecodeType) firstType).getElementType().getClass(), LongToIntDecodeType.class); } else { throw new OmniDataException("except arrayType"); diff --git a/omnidata/omnidata-openlookeng-connector/connector/src/test/java/io/prestosql/plugin/hive/omnidata/decode/type/TestOmniDataDecodeTypes.java b/omnidata/omnidata-openlookeng-connector/connector/src/test/java/io/prestosql/plugin/hive/omnidata/decode/type/TestOmniDataDecodeTypes.java index 937bdf55640bf08b5ec4ddb45a839332a9160754..4df4d652cdad74a3bc22bd79574eb7db58784c62 100644 --- a/omnidata/omnidata-openlookeng-connector/connector/src/test/java/io/prestosql/plugin/hive/omnidata/decode/type/TestOmniDataDecodeTypes.java +++ b/omnidata/omnidata-openlookeng-connector/connector/src/test/java/io/prestosql/plugin/hive/omnidata/decode/type/TestOmniDataDecodeTypes.java @@ -15,11 +15,11 @@ package io.prestosql.plugin.hive.omnidata.decode.type; -import io.prestosql.spi.type.RowType; +import com.huawei.boostkit.omnidata.decode.type.DecimalDecodeType; +import com.huawei.boostkit.omnidata.decode.type.DecodeType; +import com.huawei.boostkit.omnidata.decode.type.TimestampDecodeType; import org.testng.annotations.Test; -import java.util.Optional; - import static org.testng.Assert.assertEquals; /** @@ -39,41 +39,5 @@ public class TestOmniDataDecodeTypes // Test TimestampDecodeType DecodeType timestampDecodeType = new TimestampDecodeType(); assertEquals(timestampDecodeType.getJavaType().get(), TimestampDecodeType.class); - - // Test VarcharDecodeType - DecodeType varcharDecodeType = new VarcharDecodeType(); - assertEquals(varcharDecodeType.getJavaType().get(), String.class); - - // Test ShortDecodeType - DecodeType shortDecodeType = new ShortDecodeType(); - assertEquals(shortDecodeType.getJavaType().get(), short.class); - - // Test RowDecodeType - DecodeType rowDecodeType = new RowDecodeType(); - assertEquals(rowDecodeType.getJavaType().get(), RowType.class); - - // Test MapDecodeType - DecodeType mapDecodeType = new MapDecodeType(new ShortDecodeType(), new ShortDecodeType()); - assertEquals(mapDecodeType.getJavaType(), Optional.empty()); - - // Test IntDecodeType - DecodeType intDecodeType = new IntDecodeType(); - assertEquals(intDecodeType.getJavaType().get(), int.class); - - // Test FloatDecodeType - DecodeType floatDecodeType = new FloatDecodeType(); - assertEquals(floatDecodeType.getJavaType().get(), float.class); - - // Test DoubleDecodeType - DecodeType doubleDecodeType = new DoubleDecodeType(); - assertEquals(doubleDecodeType.getJavaType().get(), double.class); - - // Test ByteDecodeType - DecodeType byteDecodeType = new ByteDecodeType(); - assertEquals(byteDecodeType.getJavaType().get(), byte.class); - - // Test BooleanDecodeType - DecodeType booleanDecodeType = new BooleanDecodeType(); - assertEquals(booleanDecodeType.getJavaType().get(), boolean.class); } } diff --git a/omnidata/omnidata-openlookeng-connector/stub/client/pom.xml b/omnidata/omnidata-openlookeng-connector/stub/client/pom.xml index 7d0fc97e9b0bce13b6fc42d7fcb32fd8f3956547..32bb1ab323654764c03469df9a16f7a79992bdfc 100644 --- a/omnidata/omnidata-openlookeng-connector/stub/client/pom.xml +++ b/omnidata/omnidata-openlookeng-connector/stub/client/pom.xml @@ -13,21 +13,12 @@ boostkit-omnidata-client jar - - 2.8.0 - - - commons-io - commons-io - ${dep.commons.io.version} - - - io.hetu.core - hetu-transport - 1.6.1 - compile + com.huawei.boostkit + boostkit-omnidata-common + ${project.version} + ${dep.os.arch} \ No newline at end of file diff --git a/omnidata/omnidata-openlookeng-connector/stub/common/pom.xml b/omnidata/omnidata-openlookeng-connector/stub/common/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..ba66aeac9eacc7eeef54555455db32d1db177a20 --- /dev/null +++ b/omnidata/omnidata-openlookeng-connector/stub/common/pom.xml @@ -0,0 +1,55 @@ + + + + + com.huawei.boostkit + omniDataStub + 1.4.0 + + + 4.0.0 + boostkit-omnidata-common + jar + + + 2.8.0 + + + + + commons-io + commons-io + ${dep.commons.io.version} + + + io.hetu.core + hetu-transport + 1.6.1 + compile + + + objenesis + org.objenesis + + + slice + io.airlift + + + + + com.google.inject + guice + 5.0.1 + compile + + + guava + com.google.guava + + + + + \ No newline at end of file diff --git a/omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/type/MapDecodeType.java b/omnidata/omnidata-openlookeng-connector/stub/common/src/main/java/com/huawei/boostkit/omnidata/decode/AbstractDecoding.java similarity index 31% rename from omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/type/MapDecodeType.java rename to omnidata/omnidata-openlookeng-connector/stub/common/src/main/java/com/huawei/boostkit/omnidata/decode/AbstractDecoding.java index 887689ebe2e96b401d204a658077c6175264464b..68f45467ac8d2a5b64302ebdbd322b0d239119e0 100644 --- a/omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/type/MapDecodeType.java +++ b/omnidata/omnidata-openlookeng-connector/stub/common/src/main/java/com/huawei/boostkit/omnidata/decode/AbstractDecoding.java @@ -13,31 +13,76 @@ * limitations under the License. */ -package io.prestosql.plugin.hive.omnidata.decode.type; +package com.huawei.boostkit.omnidata.decode; +import com.huawei.boostkit.omnidata.exception.OmniDataException; +import io.airlift.slice.SliceInput; +import com.huawei.boostkit.omnidata.decode.type.DecodeType; + +import java.lang.reflect.Method; +import java.nio.charset.StandardCharsets; +import java.util.HashMap; +import java.util.Map; import java.util.Optional; /** - * MapDecode type + * Abstract decoding * - * @param k - * @param v + * @param decoding type * @since 2022-07-18 */ -public class MapDecodeType - implements DecodeType +public abstract class AbstractDecoding + implements Decoding { - private final K keyType; - private final V valueType; + 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); + } + } + } - public MapDecodeType(K keyType, V valueType) + private Method getDecodeMethod(String decodeName) { - this.keyType = keyType; - this.valueType = valueType; + return DECODE_METHODS.get(decodeName); + } + + private String getDecodeName(SliceInput input) + { + byte[] bytes = new byte[10]; + + return new String(bytes, StandardCharsets.UTF_8); + } + + private Optional typeToDecodeName(DecodeType type) + { + return Optional.empty(); + } + + private boolean[] getIsNullValue(byte value) + { + return new boolean[8]; } @Override - public Optional> getJavaType() + public T decode(Optional type, SliceInput sliceInput) + { + throw new OmniDataException("decode failed"); + } + + /** + * decode Null Bits + * + * @param sliceInput sliceInput + * @param positionCount positionCount + * @return decode boolean[] + * @since 2022-07-18 + */ + public Optional decodeNullBits(SliceInput sliceInput, int positionCount) { return Optional.empty(); } diff --git a/omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/Decode.java b/omnidata/omnidata-openlookeng-connector/stub/common/src/main/java/com/huawei/boostkit/omnidata/decode/Decode.java similarity index 95% rename from omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/Decode.java rename to omnidata/omnidata-openlookeng-connector/stub/common/src/main/java/com/huawei/boostkit/omnidata/decode/Decode.java index efea3a4904d5ff4df9570fb6c495e8751fc1735d..97aeaa650ce0b43c4a4da8de87f9a50bc3f27bcf 100644 --- a/omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/Decode.java +++ b/omnidata/omnidata-openlookeng-connector/stub/common/src/main/java/com/huawei/boostkit/omnidata/decode/Decode.java @@ -13,7 +13,7 @@ * limitations under the License. */ -package io.prestosql.plugin.hive.omnidata.decode; +package com.huawei.boostkit.omnidata.decode; import com.google.inject.BindingAnnotation; diff --git a/omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/Decoding.java b/omnidata/omnidata-openlookeng-connector/stub/common/src/main/java/com/huawei/boostkit/omnidata/decode/Decoding.java similarity index 98% rename from omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/Decoding.java rename to omnidata/omnidata-openlookeng-connector/stub/common/src/main/java/com/huawei/boostkit/omnidata/decode/Decoding.java index 3f14fc7f467885f095bb3c59b272aefed38b6325..c496247a02b6ebb2854978efc44cd102cd0ea4d2 100644 --- a/omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/Decoding.java +++ b/omnidata/omnidata-openlookeng-connector/stub/common/src/main/java/com/huawei/boostkit/omnidata/decode/Decoding.java @@ -13,10 +13,10 @@ * limitations under the License. */ -package io.prestosql.plugin.hive.omnidata.decode; +package com.huawei.boostkit.omnidata.decode; import io.airlift.slice.SliceInput; -import io.prestosql.plugin.hive.omnidata.decode.type.DecodeType; +import com.huawei.boostkit.omnidata.decode.type.DecodeType; import java.lang.reflect.InvocationTargetException; import java.util.Optional; diff --git a/omnidata/omnidata-openlookeng-connector/stub/client/src/main/java/com/huawei/boostkit/omnidata/decode/Deserializer.java b/omnidata/omnidata-openlookeng-connector/stub/common/src/main/java/com/huawei/boostkit/omnidata/decode/Deserializer.java similarity index 100% rename from omnidata/omnidata-openlookeng-connector/stub/client/src/main/java/com/huawei/boostkit/omnidata/decode/Deserializer.java rename to omnidata/omnidata-openlookeng-connector/stub/common/src/main/java/com/huawei/boostkit/omnidata/decode/Deserializer.java diff --git a/omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/type/ArrayDecodeType.java b/omnidata/omnidata-openlookeng-connector/stub/common/src/main/java/com/huawei/boostkit/omnidata/decode/type/ArrayDecodeType.java similarity index 95% rename from omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/type/ArrayDecodeType.java rename to omnidata/omnidata-openlookeng-connector/stub/common/src/main/java/com/huawei/boostkit/omnidata/decode/type/ArrayDecodeType.java index be2650369e1e0af5600e5d70249e933769b748a2..05e812f5e3c3b965a4e2cb2428b362a882e75b9b 100644 --- a/omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/type/ArrayDecodeType.java +++ b/omnidata/omnidata-openlookeng-connector/stub/common/src/main/java/com/huawei/boostkit/omnidata/decode/type/ArrayDecodeType.java @@ -13,7 +13,7 @@ * limitations under the License. */ -package io.prestosql.plugin.hive.omnidata.decode.type; +package com.huawei.boostkit.omnidata.decode.type; import java.util.Optional; diff --git a/omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/type/DecimalDecodeType.java b/omnidata/omnidata-openlookeng-connector/stub/common/src/main/java/com/huawei/boostkit/omnidata/decode/type/DecimalDecodeType.java similarity index 95% rename from omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/type/DecimalDecodeType.java rename to omnidata/omnidata-openlookeng-connector/stub/common/src/main/java/com/huawei/boostkit/omnidata/decode/type/DecimalDecodeType.java index 779e93e384b3e861bf41f1b761a3ff699e2689a6..440a36c9494060a72cc425fbd109e4557288392e 100644 --- a/omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/type/DecimalDecodeType.java +++ b/omnidata/omnidata-openlookeng-connector/stub/common/src/main/java/com/huawei/boostkit/omnidata/decode/type/DecimalDecodeType.java @@ -13,7 +13,7 @@ * limitations under the License. */ -package io.prestosql.plugin.hive.omnidata.decode.type; +package com.huawei.boostkit.omnidata.decode.type; import java.util.Optional; diff --git a/omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/type/DecodeType.java b/omnidata/omnidata-openlookeng-connector/stub/common/src/main/java/com/huawei/boostkit/omnidata/decode/type/DecodeType.java similarity index 94% rename from omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/type/DecodeType.java rename to omnidata/omnidata-openlookeng-connector/stub/common/src/main/java/com/huawei/boostkit/omnidata/decode/type/DecodeType.java index 47dc317e408ba1d290fa7c62927f5a05b3ecf6d1..6920673a1eb70eb3a9bb2b58d487d55d8308df26 100644 --- a/omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/type/DecodeType.java +++ b/omnidata/omnidata-openlookeng-connector/stub/common/src/main/java/com/huawei/boostkit/omnidata/decode/type/DecodeType.java @@ -13,7 +13,7 @@ * limitations under the License. */ -package io.prestosql.plugin.hive.omnidata.decode.type; +package com.huawei.boostkit.omnidata.decode.type; import java.util.Optional; diff --git a/omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/type/LongToByteDecodeType.java b/omnidata/omnidata-openlookeng-connector/stub/common/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongToByteDecodeType.java similarity index 94% rename from omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/type/LongToByteDecodeType.java rename to omnidata/omnidata-openlookeng-connector/stub/common/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongToByteDecodeType.java index 7c87a0578fd8ed0c87c33c58a219f821db665f17..754e34c14343825f6efcce61fb45e3b454d7459f 100644 --- a/omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/type/LongToByteDecodeType.java +++ b/omnidata/omnidata-openlookeng-connector/stub/common/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongToByteDecodeType.java @@ -13,7 +13,7 @@ * limitations under the License. */ -package io.prestosql.plugin.hive.omnidata.decode.type; +package com.huawei.boostkit.omnidata.decode.type; import java.util.Optional; diff --git a/omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/type/LongToFloatDecodeType.java b/omnidata/omnidata-openlookeng-connector/stub/common/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongToFloatDecodeType.java similarity index 94% rename from omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/type/LongToFloatDecodeType.java rename to omnidata/omnidata-openlookeng-connector/stub/common/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongToFloatDecodeType.java index f073f157e2f74d9c97e120894d68fa90ba309868..f4d504857d8a15f43577a68a6ee741e4b9c5ff67 100644 --- a/omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/type/LongToFloatDecodeType.java +++ b/omnidata/omnidata-openlookeng-connector/stub/common/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongToFloatDecodeType.java @@ -13,7 +13,7 @@ * limitations under the License. */ -package io.prestosql.plugin.hive.omnidata.decode.type; +package com.huawei.boostkit.omnidata.decode.type; import java.util.Optional; diff --git a/omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/type/LongToIntDecodeType.java b/omnidata/omnidata-openlookeng-connector/stub/common/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongToIntDecodeType.java similarity index 94% rename from omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/type/LongToIntDecodeType.java rename to omnidata/omnidata-openlookeng-connector/stub/common/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongToIntDecodeType.java index a78dab75241099548f923ca84fda3ef47c5b646c..f05ca7c4f9fc8e2ce49683acec6413e377b665c4 100644 --- a/omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/type/LongToIntDecodeType.java +++ b/omnidata/omnidata-openlookeng-connector/stub/common/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongToIntDecodeType.java @@ -13,7 +13,7 @@ * limitations under the License. */ -package io.prestosql.plugin.hive.omnidata.decode.type; +package com.huawei.boostkit.omnidata.decode.type; import java.util.Optional; diff --git a/omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/type/LongToShortDecodeType.java b/omnidata/omnidata-openlookeng-connector/stub/common/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongToShortDecodeType.java similarity index 94% rename from omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/type/LongToShortDecodeType.java rename to omnidata/omnidata-openlookeng-connector/stub/common/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongToShortDecodeType.java index 9c0491e1dfcaed735e69f0e6e0bfb02cf8cd1bde..9c56597a9d6d24f5098eaabdf01f81b87ab38b3f 100644 --- a/omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/type/LongToShortDecodeType.java +++ b/omnidata/omnidata-openlookeng-connector/stub/common/src/main/java/com/huawei/boostkit/omnidata/decode/type/LongToShortDecodeType.java @@ -13,7 +13,7 @@ * limitations under the License. */ -package io.prestosql.plugin.hive.omnidata.decode.type; +package com.huawei.boostkit.omnidata.decode.type; import java.util.Optional; diff --git a/omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/type/TimestampDecodeType.java b/omnidata/omnidata-openlookeng-connector/stub/common/src/main/java/com/huawei/boostkit/omnidata/decode/type/TimestampDecodeType.java similarity index 94% rename from omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/type/TimestampDecodeType.java rename to omnidata/omnidata-openlookeng-connector/stub/common/src/main/java/com/huawei/boostkit/omnidata/decode/type/TimestampDecodeType.java index 375e75769b82728cd58af32367126ae8d7ec4812..4d7f79536d4023493c4b2f0136cfd87c5dfc455c 100644 --- a/omnidata/omnidata-openlookeng-connector/connector/src/main/java/io/prestosql/plugin/hive/omnidata/decode/type/TimestampDecodeType.java +++ b/omnidata/omnidata-openlookeng-connector/stub/common/src/main/java/com/huawei/boostkit/omnidata/decode/type/TimestampDecodeType.java @@ -13,7 +13,7 @@ * limitations under the License. */ -package io.prestosql.plugin.hive.omnidata.decode.type; +package com.huawei.boostkit.omnidata.decode.type; import java.util.Optional; diff --git a/omnidata/omnidata-openlookeng-connector/stub/client/src/main/java/com/huawei/boostkit/omnidata/exception/OmniDataException.java b/omnidata/omnidata-openlookeng-connector/stub/common/src/main/java/com/huawei/boostkit/omnidata/exception/OmniDataException.java similarity index 100% rename from omnidata/omnidata-openlookeng-connector/stub/client/src/main/java/com/huawei/boostkit/omnidata/exception/OmniDataException.java rename to omnidata/omnidata-openlookeng-connector/stub/common/src/main/java/com/huawei/boostkit/omnidata/exception/OmniDataException.java diff --git a/omnidata/omnidata-openlookeng-connector/stub/client/src/main/java/com/huawei/boostkit/omnidata/exception/OmniErrorCode.java b/omnidata/omnidata-openlookeng-connector/stub/common/src/main/java/com/huawei/boostkit/omnidata/exception/OmniErrorCode.java similarity index 100% rename from omnidata/omnidata-openlookeng-connector/stub/client/src/main/java/com/huawei/boostkit/omnidata/exception/OmniErrorCode.java rename to omnidata/omnidata-openlookeng-connector/stub/common/src/main/java/com/huawei/boostkit/omnidata/exception/OmniErrorCode.java diff --git a/omnidata/omnidata-openlookeng-connector/stub/client/src/main/java/com/huawei/boostkit/omnidata/expression/OmniExpressionChecker.java b/omnidata/omnidata-openlookeng-connector/stub/common/src/main/java/com/huawei/boostkit/omnidata/expression/OmniExpressionChecker.java similarity index 100% rename from omnidata/omnidata-openlookeng-connector/stub/client/src/main/java/com/huawei/boostkit/omnidata/expression/OmniExpressionChecker.java rename to omnidata/omnidata-openlookeng-connector/stub/common/src/main/java/com/huawei/boostkit/omnidata/expression/OmniExpressionChecker.java diff --git a/omnidata/omnidata-openlookeng-connector/stub/client/src/main/java/com/huawei/boostkit/omnidata/model/AggregationInfo.java b/omnidata/omnidata-openlookeng-connector/stub/common/src/main/java/com/huawei/boostkit/omnidata/model/AggregationInfo.java similarity index 80% rename from omnidata/omnidata-openlookeng-connector/stub/client/src/main/java/com/huawei/boostkit/omnidata/model/AggregationInfo.java rename to omnidata/omnidata-openlookeng-connector/stub/common/src/main/java/com/huawei/boostkit/omnidata/model/AggregationInfo.java index 787cb4f89965261b7a453a5a73c68b897893f5a1..9fd7abb4d1ccce8d50fee1f6ecd189a733fd7660 100644 --- a/omnidata/omnidata-openlookeng-connector/stub/client/src/main/java/com/huawei/boostkit/omnidata/model/AggregationInfo.java +++ b/omnidata/omnidata-openlookeng-connector/stub/common/src/main/java/com/huawei/boostkit/omnidata/model/AggregationInfo.java @@ -20,7 +20,6 @@ import com.google.common.base.Objects; import io.prestosql.spi.relation.CallExpression; import io.prestosql.spi.relation.RowExpression; -import java.util.Collections; import java.util.List; import java.util.Map; @@ -47,14 +46,7 @@ public class AggregationInfo { @Override public boolean equals(Object object) { - if (this == object) { - return true; - } - if (!(object instanceof AggregationInfo)) { - return false; - } - AggregationInfo that = (AggregationInfo) object; - return aggregations.equals(that.aggregations) && groupingKeys.equals(that.groupingKeys); + return true; } @Override @@ -83,14 +75,7 @@ public class AggregationInfo { @Override public boolean equals(Object object) { - if (this == object) { - return true; - } - if (!(object instanceof AggregateFunction)) { - return false; - } - AggregateFunction that = (AggregateFunction) object; - return callExpression.equals(that.callExpression) && isDistinct == that.isDistinct; + return true; } @Override diff --git a/omnidata/omnidata-openlookeng-connector/stub/client/src/main/java/com/huawei/boostkit/omnidata/model/Column.java b/omnidata/omnidata-openlookeng-connector/stub/common/src/main/java/com/huawei/boostkit/omnidata/model/Column.java similarity index 100% rename from omnidata/omnidata-openlookeng-connector/stub/client/src/main/java/com/huawei/boostkit/omnidata/model/Column.java rename to omnidata/omnidata-openlookeng-connector/stub/common/src/main/java/com/huawei/boostkit/omnidata/model/Column.java diff --git a/omnidata/omnidata-openlookeng-connector/stub/client/src/main/java/com/huawei/boostkit/omnidata/model/Predicate.java b/omnidata/omnidata-openlookeng-connector/stub/common/src/main/java/com/huawei/boostkit/omnidata/model/Predicate.java similarity index 100% rename from omnidata/omnidata-openlookeng-connector/stub/client/src/main/java/com/huawei/boostkit/omnidata/model/Predicate.java rename to omnidata/omnidata-openlookeng-connector/stub/common/src/main/java/com/huawei/boostkit/omnidata/model/Predicate.java diff --git a/omnidata/omnidata-openlookeng-connector/stub/client/src/main/java/com/huawei/boostkit/omnidata/model/TaskSource.java b/omnidata/omnidata-openlookeng-connector/stub/common/src/main/java/com/huawei/boostkit/omnidata/model/TaskSource.java similarity index 100% rename from omnidata/omnidata-openlookeng-connector/stub/client/src/main/java/com/huawei/boostkit/omnidata/model/TaskSource.java rename to omnidata/omnidata-openlookeng-connector/stub/common/src/main/java/com/huawei/boostkit/omnidata/model/TaskSource.java diff --git a/omnidata/omnidata-openlookeng-connector/stub/client/src/main/java/com/huawei/boostkit/omnidata/model/datasource/DataSource.java b/omnidata/omnidata-openlookeng-connector/stub/common/src/main/java/com/huawei/boostkit/omnidata/model/datasource/DataSource.java similarity index 100% rename from omnidata/omnidata-openlookeng-connector/stub/client/src/main/java/com/huawei/boostkit/omnidata/model/datasource/DataSource.java rename to omnidata/omnidata-openlookeng-connector/stub/common/src/main/java/com/huawei/boostkit/omnidata/model/datasource/DataSource.java diff --git a/omnidata/omnidata-openlookeng-connector/stub/client/src/main/java/com/huawei/boostkit/omnidata/model/datasource/hdfs/HdfsOrcDataSource.java b/omnidata/omnidata-openlookeng-connector/stub/common/src/main/java/com/huawei/boostkit/omnidata/model/datasource/hdfs/HdfsOrcDataSource.java similarity index 100% rename from omnidata/omnidata-openlookeng-connector/stub/client/src/main/java/com/huawei/boostkit/omnidata/model/datasource/hdfs/HdfsOrcDataSource.java rename to omnidata/omnidata-openlookeng-connector/stub/common/src/main/java/com/huawei/boostkit/omnidata/model/datasource/hdfs/HdfsOrcDataSource.java diff --git a/omnidata/omnidata-openlookeng-connector/stub/client/src/main/java/com/huawei/boostkit/omnidata/model/datasource/hdfs/HdfsParquetDataSource.java b/omnidata/omnidata-openlookeng-connector/stub/common/src/main/java/com/huawei/boostkit/omnidata/model/datasource/hdfs/HdfsParquetDataSource.java similarity index 100% rename from omnidata/omnidata-openlookeng-connector/stub/client/src/main/java/com/huawei/boostkit/omnidata/model/datasource/hdfs/HdfsParquetDataSource.java rename to omnidata/omnidata-openlookeng-connector/stub/common/src/main/java/com/huawei/boostkit/omnidata/model/datasource/hdfs/HdfsParquetDataSource.java diff --git a/omnidata/omnidata-openlookeng-connector/stub/client/src/main/java/com/huawei/boostkit/omnidata/model/datasource/hdfs/HdfsRecordDataSource.java b/omnidata/omnidata-openlookeng-connector/stub/common/src/main/java/com/huawei/boostkit/omnidata/model/datasource/hdfs/HdfsRecordDataSource.java similarity index 100% rename from omnidata/omnidata-openlookeng-connector/stub/client/src/main/java/com/huawei/boostkit/omnidata/model/datasource/hdfs/HdfsRecordDataSource.java rename to omnidata/omnidata-openlookeng-connector/stub/common/src/main/java/com/huawei/boostkit/omnidata/model/datasource/hdfs/HdfsRecordDataSource.java diff --git a/omnidata/omnidata-openlookeng-connector/stub/client/src/main/java/com/huawei/boostkit/omnidata/serialize/OmniDataBlockEncodingSerde.java b/omnidata/omnidata-openlookeng-connector/stub/common/src/main/java/com/huawei/boostkit/omnidata/serialize/OmniDataBlockEncodingSerde.java similarity index 79% rename from omnidata/omnidata-openlookeng-connector/stub/client/src/main/java/com/huawei/boostkit/omnidata/serialize/OmniDataBlockEncodingSerde.java rename to omnidata/omnidata-openlookeng-connector/stub/common/src/main/java/com/huawei/boostkit/omnidata/serialize/OmniDataBlockEncodingSerde.java index 7ebc828d2b80453fd99af2f565bd4aedf53a6e6a..6a3592d1dd84d29f72a75d852067dc3432f496a4 100644 --- a/omnidata/omnidata-openlookeng-connector/stub/client/src/main/java/com/huawei/boostkit/omnidata/serialize/OmniDataBlockEncodingSerde.java +++ b/omnidata/omnidata-openlookeng-connector/stub/common/src/main/java/com/huawei/boostkit/omnidata/serialize/OmniDataBlockEncodingSerde.java @@ -36,7 +36,6 @@ import io.prestosql.spi.block.VariableWidthBlockEncoding; import java.nio.charset.StandardCharsets; import java.util.Map; -import java.util.Optional; public class OmniDataBlockEncodingSerde implements BlockEncodingSerde { private final Map blockEncodings; @@ -60,18 +59,13 @@ public class OmniDataBlockEncodingSerde implements BlockEncodingSerde { private static String readLengthPrefixedString(SliceInput sliceInput) { - int length = sliceInput.readInt(); - byte[] bytes = new byte[length]; - sliceInput.readBytes(bytes); + byte[] bytes = new byte[10]; return new String(bytes, StandardCharsets.UTF_8); } private static void writeLengthPrefixedString(SliceOutput sliceOutput, String value) { - byte[] bytes = value.getBytes(StandardCharsets.UTF_8); - sliceOutput.writeInt(bytes.length); - sliceOutput.writeBytes(bytes); } @Override @@ -83,23 +77,5 @@ public class OmniDataBlockEncodingSerde implements BlockEncodingSerde { @Override public void writeBlock(SliceOutput output, Block block) { - Block readBlock = block; - while (true) { - String encodingName = readBlock.getEncodingName(); - - BlockEncoding blockEncoding = blockEncodings.get(encodingName); - - Optional replacementBlock = blockEncoding.replacementBlockForWrite(readBlock); - if (replacementBlock.isPresent()) { - readBlock = replacementBlock.get(); - continue; - } - - writeLengthPrefixedString(output, encodingName); - - blockEncoding.writeBlock(this, output, readBlock); - - break; - } } } diff --git a/omnidata/omnidata-openlookeng-connector/stub/pom.xml b/omnidata/omnidata-openlookeng-connector/stub/pom.xml index 53b988c2a371f17eb77b76d4621c19130f5ee439..1386a697b5943eeaf32d56676ea772838c32ed54 100644 --- a/omnidata/omnidata-openlookeng-connector/stub/pom.xml +++ b/omnidata/omnidata-openlookeng-connector/stub/pom.xml @@ -10,16 +10,26 @@ 1.4.0 + common client 1.6.1 ${os.detected.arch} + 1.8 + 1.8 + UTF-8 + + com.huawei.boostkit + boostkit-omnidata-common + ${project.version} + ${dep.os.arch} + com.huawei.boostkit boostkit-omnidata-client @@ -39,6 +49,12 @@ io.hetu.core presto-spi ${dep.hetu.version} + + + objenesis + org.objenesis + +