From 3b4836d375306e2f126e90306c9dfacbb39fbd88 Mon Sep 17 00:00:00 2001 From: Jongyoung Park Date: Sat, 23 Apr 2016 12:21:06 +0900 Subject: [PATCH 1/9] complie works --- .../org/apache/tajo/datum/Inet4Datum.java | 140 ------------------ .../main/java/org/apache/tajo/type/Inet4.java | 28 ---- .../org/apache/tajo/datum/TestInet4Datum.java | 98 ------------ .../function/geoip/GeoIPCountryInet4.java | 54 ------- .../function/geoip/GeoIPInCountryInet4.java | 61 -------- 5 files changed, 381 deletions(-) delete mode 100644 tajo-common/src/main/java/org/apache/tajo/datum/Inet4Datum.java delete mode 100644 tajo-common/src/main/java/org/apache/tajo/type/Inet4.java delete mode 100644 tajo-common/src/test/java/org/apache/tajo/datum/TestInet4Datum.java delete mode 100644 tajo-core/src/main/java/org/apache/tajo/engine/function/geoip/GeoIPCountryInet4.java delete mode 100644 tajo-core/src/main/java/org/apache/tajo/engine/function/geoip/GeoIPInCountryInet4.java diff --git a/tajo-common/src/main/java/org/apache/tajo/datum/Inet4Datum.java b/tajo-common/src/main/java/org/apache/tajo/datum/Inet4Datum.java deleted file mode 100644 index ab1799bac4..0000000000 --- a/tajo-common/src/main/java/org/apache/tajo/datum/Inet4Datum.java +++ /dev/null @@ -1,140 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.tajo.datum; - -import com.google.common.base.Preconditions; -import com.google.common.primitives.UnsignedInteger; -import com.google.gson.annotations.Expose; -import org.apache.tajo.exception.InvalidOperationException; -import org.apache.tajo.util.Bytes; - -import static org.apache.tajo.common.TajoDataTypes.Type; - -public class Inet4Datum extends Datum { - private static final int size = 4; - @Expose private final int address; - - Inet4Datum(int encoded) { - super(Type.INET4); - this.address = encoded; - } - - public Inet4Datum(String addr) { - super(Type.INET4); - String [] elems = addr.split("\\."); - address = Integer.parseInt(elems[3]) & 0xFF - | ((Integer.parseInt(elems[2]) << 8) & 0xFF00) - | ((Integer.parseInt(elems[1]) << 16) & 0xFF0000) - | ((Integer.parseInt(elems[0]) << 24) & 0xFF000000); - } - - public Inet4Datum(byte[] addr) { - super(Type.INET4); - Preconditions.checkArgument(addr.length == size); - address = addr[3] & 0xFF - | ((addr[2] << 8) & 0xFF00) - | ((addr[1] << 16) & 0xFF0000) - | ((addr[0] << 24) & 0xFF000000); - } - - public Inet4Datum(byte[] addr, int offset, int length) { - super(Type.INET4); - Preconditions.checkArgument(length == size); - address = addr[offset + 3] & 0xFF - | ((addr[offset + 2] << 8) & 0xFF00) - | ((addr[offset + 1] << 16) & 0xFF0000) - | ((addr[offset] << 24) & 0xFF000000); - } - - @Override - public int asInt4() { - return this.address; - } - - @Override - public long asInt8() { - return UnsignedInteger.asUnsigned(address).longValue(); - } - - @Override - public byte[] asByteArray() { - byte[] addr = new byte[size]; - addr[0] = (byte) ((address >>> 24) & 0xFF); - addr[1] = (byte) ((address >>> 16) & 0xFF); - addr[2] = (byte) ((address >>> 8) & 0xFF); - addr[3] = (byte) (address & 0xFF); - return addr; - } - - @Override - public String asChars() { - return numericToTextFormat(asByteArray()); - } - - @Override - public int size() { - return size; - } - - @Override - public int hashCode() { - return address; - } - - @Override - public boolean equals(Object obj) { - if (obj instanceof Inet4Datum) { - Inet4Datum other = (Inet4Datum) obj; - return this.address == other.address; - } - - return false; - } - - @Override - public Datum equalsTo(Datum datum) { - switch (datum.type()) { - case INET4: - return DatumFactory.createBool(this.address == ((Inet4Datum) datum).address); - case NULL_TYPE: - return datum; - default: - throw new InvalidOperationException(datum.type()); - } - } - - @Override - public int compareTo(Datum datum) { - switch (datum.type()) { - case INET4: - byte[] bytes = asByteArray(); - byte[] other = datum.asByteArray(); - return Bytes.compareTo(bytes, 0, size, other, 0, size); - case NULL_TYPE: - return -1; - default: - throw new InvalidOperationException(datum.type()); - } - } - - static String numericToTextFormat(byte[] src) { - return (src[0] & 0xff) + "." + (src[1] & 0xff) + "." + (src[2] & 0xff) - + "." + (src[3] & 0xff); - } -} diff --git a/tajo-common/src/main/java/org/apache/tajo/type/Inet4.java b/tajo-common/src/main/java/org/apache/tajo/type/Inet4.java deleted file mode 100644 index 05dc0cf198..0000000000 --- a/tajo-common/src/main/java/org/apache/tajo/type/Inet4.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.tajo.type; - -import org.apache.tajo.common.TajoDataTypes; - -public class Inet4 extends Type { - @Override - public TajoDataTypes.Type baseType() { - return TajoDataTypes.Type.INET4; - } -} diff --git a/tajo-common/src/test/java/org/apache/tajo/datum/TestInet4Datum.java b/tajo-common/src/test/java/org/apache/tajo/datum/TestInet4Datum.java deleted file mode 100644 index 14ebc7c912..0000000000 --- a/tajo-common/src/test/java/org/apache/tajo/datum/TestInet4Datum.java +++ /dev/null @@ -1,98 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.tajo.datum; - -import org.apache.tajo.json.CommonGsonHelper; -import org.junit.Before; -import org.junit.Test; - -import java.util.Arrays; - -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -public class TestInet4Datum { - - @Before - public void setUp() throws Exception { - } - - @Test - public final void testEquals() { - Inet4Datum ip1 = new Inet4Datum("192.168.0.1"); - Inet4Datum ip2 = new Inet4Datum("192.168.0.1"); - - assertEquals(ip1, ip2); - - Inet4Datum ip3 = new Inet4Datum(ip1.asByteArray()); - assertEquals(ip1, ip3); - Inet4Datum ip4 = DatumFactory.createInet4(ip1.asByteArray()); - assertEquals(ip1, ip4); - } - - @Test - public final void testGreaterThan() { - Inet4Datum ip1 = new Inet4Datum("193.168.0.1"); - Inet4Datum ip2 = new Inet4Datum("192.168.100.1"); - - assertEquals(ip1.compareTo(ip2), 1); - } - - @Test - public final void testLessThan() { - Inet4Datum ip1 = new Inet4Datum("192.168.100.1"); - Inet4Datum ip2 = new Inet4Datum("193.168.0.1"); - - assertEquals(ip1.compareTo(ip2), -1); - } - - @Test - public final void testAsByteArray() { - byte[] bytes = {(byte) 0xA3, (byte) 0x98, 0x17, (byte) 0xDE}; - Inet4Datum ip = new Inet4Datum(bytes); - assertTrue(Arrays.equals(bytes, ip.asByteArray())); - } - - @Test - public final void testAsChars() { - Inet4Datum ip = new Inet4Datum("163.152.23.222"); - assertEquals("163.152.23.222", ip.asChars()); - } - - @Test - public final void testSize() { - Datum d = DatumFactory.createInet4("163.152.23.222"); - assertEquals(4, d.size()); - } - - @Test - public final void testJson() { - Datum d = DatumFactory.createInet4("163.152.163.152"); - String json = d.toJson(); - Datum fromJson = CommonGsonHelper.fromJson(json, Datum.class); - assertTrue(d.equalsTo(fromJson).asBool()); - } - - @Test - public final void testAsTextBytes() { - Datum d = DatumFactory.createInet4("163.152.23.222"); - assertArrayEquals(d.toString().getBytes(), d.asTextBytes()); - } -} diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/geoip/GeoIPCountryInet4.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/geoip/GeoIPCountryInet4.java deleted file mode 100644 index 8e69766ca0..0000000000 --- a/tajo-core/src/main/java/org/apache/tajo/engine/function/geoip/GeoIPCountryInet4.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.tajo.engine.function.geoip; - -import org.apache.tajo.catalog.Column; -import org.apache.tajo.common.TajoDataTypes; -import org.apache.tajo.common.TajoDataTypes.Type; -import org.apache.tajo.datum.Datum; -import org.apache.tajo.datum.NullDatum; -import org.apache.tajo.datum.TextDatum; -import org.apache.tajo.plan.function.GeneralFunction; -import org.apache.tajo.engine.function.annotation.Description; -import org.apache.tajo.engine.function.annotation.ParamTypes; -import org.apache.tajo.storage.Tuple; -import org.apache.tajo.util.GeoIPUtil; - -@Description( - functionName = "geoip_country_code", - description = "Convert an ipv4 address to a geoip country code.", - example = "> SELECT geoip_country_code(8.8.8.8);\n" - + "US", - returnType = TajoDataTypes.Type.TEXT, - paramTypes = {@ParamTypes(paramTypes = {Type.INET4})} -) -public class GeoIPCountryInet4 extends GeneralFunction { - - public GeoIPCountryInet4() { - super(new Column[] {new Column("ipv4_address", TajoDataTypes.Type.INET4)}); - } - - @Override - public Datum eval(Tuple params) { - if (params.isBlankOrNull(0)) { - return NullDatum.get(); - } - return new TextDatum(GeoIPUtil.getCountryCode(params.getText(0))); - } -} diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/function/geoip/GeoIPInCountryInet4.java b/tajo-core/src/main/java/org/apache/tajo/engine/function/geoip/GeoIPInCountryInet4.java deleted file mode 100644 index 91673569c0..0000000000 --- a/tajo-core/src/main/java/org/apache/tajo/engine/function/geoip/GeoIPInCountryInet4.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.tajo.engine.function.geoip; - -import org.apache.tajo.catalog.Column; -import org.apache.tajo.common.TajoDataTypes; -import org.apache.tajo.common.TajoDataTypes.Type; -import org.apache.tajo.datum.Datum; -import org.apache.tajo.datum.DatumFactory; -import org.apache.tajo.datum.NullDatum; -import org.apache.tajo.plan.function.GeneralFunction; -import org.apache.tajo.engine.function.annotation.Description; -import org.apache.tajo.engine.function.annotation.ParamTypes; -import org.apache.tajo.storage.Tuple; -import org.apache.tajo.util.GeoIPUtil; - -@Description( - functionName = "geoip_in_country", - description = "If the given country code is same with the country code of the given address, it returns true. " - + "Otherwise, returns false", - example = "geoip_in_country(8.8.8.8, 'US')" - + "true", - returnType = TajoDataTypes.Type.BOOLEAN, - paramTypes = {@ParamTypes(paramTypes = {Type.INET4, Type.TEXT})} -) -public class GeoIPInCountryInet4 extends GeneralFunction { - - public GeoIPInCountryInet4() { - super(new Column[] {new Column("ipv4_address", TajoDataTypes.Type.INET4), - new Column("country_code", TajoDataTypes.Type.TEXT)}); - } - - @Override - public Datum eval(Tuple params) { - if (params.isBlankOrNull(0) || params.isBlankOrNull(1)) { - return NullDatum.get(); - } - - String addr = params.getText(0); - String otherCode = params.getText(1); - String thisCode = GeoIPUtil.getCountryCode(addr); - - return DatumFactory.createBool(thisCode.equals(otherCode)); - } -} From 11c572f52f97518c40209e94cfdabe6007882a93 Mon Sep 17 00:00:00 2001 From: Jongyoung Park Date: Sat, 23 Apr 2016 12:22:24 +0900 Subject: [PATCH 2/9] missing modifications --- .../java/org/apache/tajo/DataTypeUtil.java | 2 - .../org/apache/tajo/catalog/CatalogUtil.java | 2 - .../org/apache/tajo/catalog/SchemaUtil.java | 4 -- .../apache/tajo/catalog/TypeConverter.java | 2 - .../org/apache/tajo/storage/RowStoreUtil.java | 17 ----- .../apache/tajo/common/type/TajoTypeUtil.java | 1 - .../org/apache/tajo/datum/DatumFactory.java | 24 ------- .../java/org/apache/tajo/storage/VTuple.java | 17 ----- .../tuple/memory/CompactRowBlockWriter.java | 10 --- .../apache/tajo/tuple/memory/HeapTuple.java | 2 - .../tuple/memory/OffHeapRowBlockUtils.java | 6 -- .../tajo/tuple/memory/OffHeapRowWriter.java | 5 -- .../apache/tajo/tuple/memory/RowWriter.java | 2 - .../apache/tajo/tuple/memory/UnSafeTuple.java | 2 - .../main/java/org/apache/tajo/type/Type.java | 4 -- tajo-common/src/main/proto/DataTypes.proto | 3 - .../tajo/tuple/memory/TestMemoryRowBlock.java | 24 ++----- .../engine/codegen/TestEvalCodeGenerator.java | 8 --- .../planner/TestUniformRangePartition.java | 63 ------------------- .../planner/physical/TestRadixSort.java | 8 +-- .../tajo/engine/query/TestCreateTable.java | 2 - .../tajo/engine/util/BenchmarkSort.java | 9 +-- .../tajo/engine/util/TestTupleUtil.java | 2 - .../engine/codegen/EvalCodeGenerator.java | 1 - .../engine/codegen/TajoGeneratorAdapter.java | 9 +-- .../planner/RangePartitionAlgorithm.java | 7 --- .../engine/planner/UniformRangePartition.java | 42 +------------ .../planner/physical/ComparableVector.java | 11 +--- .../planner/physical/ExternalSortExec.java | 3 - .../engine/planner/physical/RadixSort.java | 3 - .../apache/tajo/parser/sql/SQLAnalyzer.java | 7 --- .../function/stream/CSVLineSerializer.java | 2 - .../TextFieldSerializerDeserializer.java | 6 -- .../tajo/plan/verifier/ExprsVerifier.java | 8 --- .../org/apache/tajo/parser/sql/SQLLexer.g4 | 2 - .../org/apache/tajo/parser/sql/SQLParser.g4 | 6 -- .../storage/BinarySerializerDeserializer.java | 5 -- .../org/apache/tajo/storage/RowStoreUtil.java | 16 ----- .../storage/TextSerializerDeserializer.java | 6 -- .../apache/tajo/storage/TestFrameTuple.java | 14 ++--- .../apache/tajo/storage/TestLazyTuple.java | 9 +-- .../java/org/apache/tajo/storage/RawFile.java | 4 -- .../java/org/apache/tajo/storage/RowFile.java | 13 ---- .../apache/tajo/storage/avro/AvroScanner.java | 7 +-- .../storage/json/JsonLineDeserializer.java | 8 --- .../tajo/storage/json/JsonLineSerializer.java | 1 - .../apache/tajo/storage/orc/package-info.java | 4 -- .../storage/parquet/TajoRecordConverter.java | 17 ----- .../storage/parquet/TajoSchemaConverter.java | 4 -- .../storage/parquet/TajoWriteSupport.java | 2 - .../tajo/storage/parquet/package-info.java | 4 -- .../sequencefile/SequenceFileAppender.java | 1 - .../sequencefile/SequenceFileScanner.java | 1 - .../text/TextFieldSerializerDeserializer.java | 6 -- .../tajo/storage/thirdparty/orc/OrcUtils.java | 1 - .../thirdparty/orc/TreeReaderFactory.java | 56 ----------------- .../storage/thirdparty/orc/WriterImpl.java | 3 +- .../tajo/storage/TestDelimitedTextFile.java | 2 - .../org/apache/tajo/storage/TestStorages.java | 46 +++++--------- .../tajo/storage/json/TestJsonSerDe.java | 6 +- .../storage/parquet/TestSchemaConverter.java | 2 - .../tajo/storage/raw/TestDirectRawFile.java | 21 +------ 62 files changed, 47 insertions(+), 538 deletions(-) diff --git a/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/DataTypeUtil.java b/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/DataTypeUtil.java index c12aa291f6..fe9210921f 100644 --- a/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/DataTypeUtil.java +++ b/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/DataTypeUtil.java @@ -71,8 +71,6 @@ private static void putAcceptableType(Type given, Type define) { putAcceptableType(DATE, DATE); putAcceptableType(TEXT, TEXT); - - putAcceptableType(INET4, INET4); } public static boolean isUpperCastable(Type define, Type given) { diff --git a/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/CatalogUtil.java b/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/CatalogUtil.java index 76990f2792..7c2e1afaf9 100644 --- a/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/CatalogUtil.java +++ b/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/CatalogUtil.java @@ -963,8 +963,6 @@ public static Pair, String> getPartitionKeyNamePair(Stri TUtil.putToNestedMap(OPERATION_CASTING_MAP, Type.TIME, Type.TIME, Type.TIME); TUtil.putToNestedMap(OPERATION_CASTING_MAP, Type.DATE, Type.DATE, Type.DATE); - - TUtil.putToNestedMap(OPERATION_CASTING_MAP, Type.INET4, Type.INET4, Type.INET4); } // table default properties diff --git a/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/SchemaUtil.java b/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/SchemaUtil.java index c0b60a31bc..3f09e8cfe6 100644 --- a/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/SchemaUtil.java +++ b/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/SchemaUtil.java @@ -244,10 +244,6 @@ public static int getColByteSize(Column col) { return 4; case FLOAT8: return 8; - case INET4: - return 4; - case INET6: - return 16; case TEXT: return 256; case BLOB: diff --git a/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/TypeConverter.java b/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/TypeConverter.java index f82cc03593..94cab4dc65 100644 --- a/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/TypeConverter.java +++ b/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/TypeConverter.java @@ -67,8 +67,6 @@ public static Type convert(TajoDataTypes.Type legacyBaseType) { return Text(); case BLOB: return Blob(); - case INET4: - return Inet4(); case NULL_TYPE: return Null(); case ANY: diff --git a/tajo-client/src/main/java/org/apache/tajo/storage/RowStoreUtil.java b/tajo-client/src/main/java/org/apache/tajo/storage/RowStoreUtil.java index bc23af8634..36183247b7 100644 --- a/tajo-client/src/main/java/org/apache/tajo/storage/RowStoreUtil.java +++ b/tajo-client/src/main/java/org/apache/tajo/storage/RowStoreUtil.java @@ -150,12 +150,6 @@ public Tuple toTuple(byte[] bytes) { tuple.put(i, DatumFactory.createBlob(_bytes)); break; - case INET4: - byte[] _ipv4 = new byte[4]; - bb.get(_ipv4); - tuple.put(i, DatumFactory.createInet4(_ipv4)); - break; - default: throw new TajoRuntimeException( new UnsupportedException("data type '" + col.getDataType().getType().name() + "'")); @@ -251,13 +245,6 @@ public byte[] toBytes(Tuple tuple) { bb.putInt(bytes.length); bb.put(bytes); break; - case INET4: - byte[] ipBytes = tuple.getBytes(i); - bb.put(ipBytes); - break; - case INET6: - bb.put(tuple.getBytes(i)); - break; default: throw new TajoRuntimeException( new UnsupportedException("data type '" + col.getDataType().getType().name() + "'")); @@ -316,10 +303,6 @@ private int estimateTupleDataSize(Tuple tuple) { case BLOB: size += (4 + tuple.getBytes(i).length); break; - case INET4: - case INET6: - size += tuple.getBytes(i).length; - break; default: throw new TajoRuntimeException( new UnsupportedException("data type '" + col.getDataType().getType().name() + "'")); diff --git a/tajo-common/src/main/java/org/apache/tajo/common/type/TajoTypeUtil.java b/tajo-common/src/main/java/org/apache/tajo/common/type/TajoTypeUtil.java index ecaeeb1f5d..bbab9deab7 100644 --- a/tajo-common/src/main/java/org/apache/tajo/common/type/TajoTypeUtil.java +++ b/tajo-common/src/main/java/org/apache/tajo/common/type/TajoTypeUtil.java @@ -175,7 +175,6 @@ public static boolean isSigned(Type type) { case DATE: case TIME: case TIMESTAMP: - case INET4: case VARCHAR: case CHAR: case TEXT: return false; diff --git a/tajo-common/src/main/java/org/apache/tajo/datum/DatumFactory.java b/tajo-common/src/main/java/org/apache/tajo/datum/DatumFactory.java index e9ac0c560b..10edc49f38 100644 --- a/tajo-common/src/main/java/org/apache/tajo/datum/DatumFactory.java +++ b/tajo-common/src/main/java/org/apache/tajo/datum/DatumFactory.java @@ -66,8 +66,6 @@ public static Class getDatumClass(Type type) { return BitDatum.class; case BLOB: return BlobDatum.class; - case INET4: - return Inet4Datum.class; case ANY: return AnyDatum.class; case NULL_TYPE: @@ -106,8 +104,6 @@ public static Datum createFromString(DataType dataType, String value) { return createInterval(value); case BLOB: return createBlob(value); - case INET4: - return createInet4(value); default: throw new TajoRuntimeException(new UnsupportedDataTypeException(dataType.toString())); } @@ -142,8 +138,6 @@ public static Datum createFromBytes(DataType dataType, byte[] bytes) { return createBit(bytes[0]); case BLOB: return createBlob(bytes); - case INET4: - return createInet4(bytes); case PROTOBUF: try { return ProtobufDatumFactory.createDatum(dataType, bytes); @@ -388,22 +382,6 @@ public static BlobDatum createBlob(String plainString) { return new BlobDatum(Base64.encodeBase64(plainString.getBytes())); } - public static Inet4Datum createInet4(int encoded) { - return new Inet4Datum(encoded); - } - - public static Inet4Datum createInet4(byte[] val) { - return new Inet4Datum(val); - } - - public static Inet4Datum createInet4(byte[] val, int offset, int length) { - return new Inet4Datum(val, offset, length); - } - - public static Inet4Datum createInet4(String val) { - return new Inet4Datum(val); - } - public static AnyDatum createAny(Datum val) { return new AnyDatum(val); } @@ -455,8 +433,6 @@ public static Datum cast(Datum operandDatum, DataType target, @Nullable TimeZone return DatumFactory.createTimestamp(operandDatum, tz); case BLOB: return DatumFactory.createBlob(operandDatum.asByteArray()); - case INET4: - return DatumFactory.createInet4(operandDatum.asByteArray()); case ANY: return DatumFactory.createAny(operandDatum); default: diff --git a/tajo-common/src/main/java/org/apache/tajo/storage/VTuple.java b/tajo-common/src/main/java/org/apache/tajo/storage/VTuple.java index 0ad7202527..cee769433e 100644 --- a/tajo-common/src/main/java/org/apache/tajo/storage/VTuple.java +++ b/tajo-common/src/main/java/org/apache/tajo/storage/VTuple.java @@ -21,7 +21,6 @@ import com.google.gson.annotations.Expose; import org.apache.tajo.common.TajoDataTypes; import org.apache.tajo.datum.Datum; -import org.apache.tajo.datum.Inet4Datum; import org.apache.tajo.datum.IntervalDatum; import org.apache.tajo.datum.ProtobufDatum; import org.apache.tajo.exception.NotImplementedException; @@ -177,22 +176,6 @@ public double getFloat8(int fieldId) { return values[fieldId].asFloat8(); } - public Inet4Datum getIPv4(int fieldId) { - return (Inet4Datum) values[fieldId]; - } - - public byte [] getIPv4Bytes(int fieldId) { - return values[fieldId].asByteArray(); - } - - public InetAddress getIPv6(int fieldId) { - throw new TajoRuntimeException(new NotImplementedException()); - } - - public byte[] getIPv6Bytes(int fieldId) { - throw new TajoRuntimeException(new NotImplementedException()); - } - @Override public String getText(int fieldId) { return values[fieldId].asChars(); diff --git a/tajo-common/src/main/java/org/apache/tajo/tuple/memory/CompactRowBlockWriter.java b/tajo-common/src/main/java/org/apache/tajo/tuple/memory/CompactRowBlockWriter.java index 67d5f8c922..c74eb7533c 100644 --- a/tajo-common/src/main/java/org/apache/tajo/tuple/memory/CompactRowBlockWriter.java +++ b/tajo-common/src/main/java/org/apache/tajo/tuple/memory/CompactRowBlockWriter.java @@ -405,16 +405,6 @@ public void putInterval(IntervalDatum val) { forwardField(length); } - @Override - public void putInet4(int val) { - ensureSize(SizeOf.SIZE_OF_INT); - long addr = currentAddr(); - - PlatformDependent.putInt(addr, val); - curFieldIdx++; - forwardField(SizeOf.SIZE_OF_INT); - } - @Override public void putProtoDatum(ProtobufDatum val) { putBlob(val.asByteArray()); diff --git a/tajo-common/src/main/java/org/apache/tajo/tuple/memory/HeapTuple.java b/tajo-common/src/main/java/org/apache/tajo/tuple/memory/HeapTuple.java index 330b363e37..1a0c67f606 100644 --- a/tajo-common/src/main/java/org/apache/tajo/tuple/memory/HeapTuple.java +++ b/tajo-common/src/main/java/org/apache/tajo/tuple/memory/HeapTuple.java @@ -161,8 +161,6 @@ public Datum asDatum(int fieldId) { return DatumFactory.createTime(getInt8(fieldId)); case INTERVAL: return getInterval(fieldId); - case INET4: - return DatumFactory.createInet4(getInt4(fieldId)); case PROTOBUF: return getProtobufDatum(fieldId); case NULL_TYPE: diff --git a/tajo-common/src/main/java/org/apache/tajo/tuple/memory/OffHeapRowBlockUtils.java b/tajo-common/src/main/java/org/apache/tajo/tuple/memory/OffHeapRowBlockUtils.java index 3f27763d90..82f19137a1 100644 --- a/tajo-common/src/main/java/org/apache/tajo/tuple/memory/OffHeapRowBlockUtils.java +++ b/tajo-common/src/main/java/org/apache/tajo/tuple/memory/OffHeapRowBlockUtils.java @@ -121,9 +121,6 @@ public static final int compareColumn(UnSafeTuple tuple1, UnSafeTuple tuple2, in case INT4: compare = Ints.compare(tuple1.getInt4(index), tuple2.getInt4(index)); break; - case INET4: - compare = UnsignedInts.compare(tuple1.getInt4(index), tuple2.getInt4(index)); - break; case TIME: case TIMESTAMP: case INT8: @@ -214,9 +211,6 @@ protected void writeField(int colIdx, Tuple tuple, RowWriter writer) { case PROTOBUF: writer.putProtoDatum((ProtobufDatum) tuple.getProtobufDatum(colIdx)); break; - case INET4: - writer.putInet4(tuple.getInt4(colIdx)); - break; case NULL_TYPE: writer.skipField(); break; diff --git a/tajo-common/src/main/java/org/apache/tajo/tuple/memory/OffHeapRowWriter.java b/tajo-common/src/main/java/org/apache/tajo/tuple/memory/OffHeapRowWriter.java index e992aed86e..d555c7931c 100644 --- a/tajo-common/src/main/java/org/apache/tajo/tuple/memory/OffHeapRowWriter.java +++ b/tajo-common/src/main/java/org/apache/tajo/tuple/memory/OffHeapRowWriter.java @@ -294,11 +294,6 @@ public void putInterval(IntervalDatum val) { forwardField(SizeOf.SIZE_OF_INT + SizeOf.SIZE_OF_LONG); } - @Override - public void putInet4(int val) { - putInt4(val); - } - @Override public void putProtoDatum(ProtobufDatum val) { putBlob(val.asByteArray()); diff --git a/tajo-common/src/main/java/org/apache/tajo/tuple/memory/RowWriter.java b/tajo-common/src/main/java/org/apache/tajo/tuple/memory/RowWriter.java index e055ab7e4a..edeb8a75c0 100644 --- a/tajo-common/src/main/java/org/apache/tajo/tuple/memory/RowWriter.java +++ b/tajo-common/src/main/java/org/apache/tajo/tuple/memory/RowWriter.java @@ -79,8 +79,6 @@ public interface RowWriter { void putInterval(IntervalDatum val); - void putInet4(int val); - void putProtoDatum(ProtobufDatum datum); boolean addTuple(Tuple tuple); diff --git a/tajo-common/src/main/java/org/apache/tajo/tuple/memory/UnSafeTuple.java b/tajo-common/src/main/java/org/apache/tajo/tuple/memory/UnSafeTuple.java index dcff801088..4e9ecb4034 100644 --- a/tajo-common/src/main/java/org/apache/tajo/tuple/memory/UnSafeTuple.java +++ b/tajo-common/src/main/java/org/apache/tajo/tuple/memory/UnSafeTuple.java @@ -194,8 +194,6 @@ public Datum asDatum(int fieldId) { return DatumFactory.createTime(getInt8(fieldId)); case INTERVAL: return getInterval(fieldId); - case INET4: - return DatumFactory.createInet4(getInt4(fieldId)); case PROTOBUF: return getProtobufDatum(fieldId); case NULL_TYPE: diff --git a/tajo-common/src/main/java/org/apache/tajo/type/Type.java b/tajo-common/src/main/java/org/apache/tajo/type/Type.java index e1a7180a33..edbe070075 100644 --- a/tajo-common/src/main/java/org/apache/tajo/type/Type.java +++ b/tajo-common/src/main/java/org/apache/tajo/type/Type.java @@ -127,10 +127,6 @@ public static Blob Blob() { return new Blob(); } - public static Inet4 Inet4() { - return new Inet4(); - } - public static Struct Struct(Collection types) { return new Struct(types); } diff --git a/tajo-common/src/main/proto/DataTypes.proto b/tajo-common/src/main/proto/DataTypes.proto index 7cf09d387e..3daaf8d0a8 100644 --- a/tajo-common/src/main/proto/DataTypes.proto +++ b/tajo-common/src/main/proto/DataTypes.proto @@ -67,9 +67,6 @@ enum Type { UDT = 62; // user-defined function PROTOBUF = 63; // protocol buffer type - INET4 = 91; - INET6 = 92; - // array types BOOLEAN_ARRAY = 101; INT1_ARRAY = 102; diff --git a/tajo-common/src/test/java/org/apache/tajo/tuple/memory/TestMemoryRowBlock.java b/tajo-common/src/test/java/org/apache/tajo/tuple/memory/TestMemoryRowBlock.java index 780f97f40a..b6e22ba0f6 100644 --- a/tajo-common/src/test/java/org/apache/tajo/tuple/memory/TestMemoryRowBlock.java +++ b/tajo-common/src/test/java/org/apache/tajo/tuple/memory/TestMemoryRowBlock.java @@ -60,7 +60,6 @@ public class TestMemoryRowBlock { DataType.newBuilder().setType(Type.DATE).build(), DataType.newBuilder().setType(Type.TIME).build(), DataType.newBuilder().setType(Type.INTERVAL).build(), - DataType.newBuilder().setType(Type.INET4).build(), DataType.newBuilder().setType(Type.PROTOBUF).setCode(PrimitiveProtos.StringProto.class.getName()).build() }; } @@ -412,8 +411,7 @@ public static void fillRow(int i, RowWriter builder) { builder.putDate(DatumFactory.createDate("2014-04-16").asInt4() + i); // 8 builder.putTime(DatumFactory.createTime("08:48:00").asInt8() + i); // 9 builder.putInterval(DatumFactory.createInterval((i + 1) + " hours")); // 10 - builder.putInet4(DatumFactory.createInet4("192.168.0.1").asInt4() + i); // 11 - builder.putProtoDatum(new ProtobufDatum(ProtoUtil.convertString(i + ""))); // 12 + builder.putProtoDatum(new ProtobufDatum(ProtoUtil.convertString(i + ""))); // 11 builder.endRow(); } @@ -488,13 +486,7 @@ public static void fillRowBlockWithNull(int i, RowWriter writer) { if (i % 11 == 0) { writer.skipField(); } else { - writer.putInet4(DatumFactory.createInet4("192.168.0.1").asInt4() + i); // 11 - } - - if (i % 12 == 0) { - writer.skipField(); - } else { - writer.putProtoDatum(new ProtobufDatum(ProtoUtil.convertString(i + ""))); // 12 + writer.putProtoDatum(new ProtobufDatum(ProtoUtil.convertString(i + ""))); // 11 } writer.endRow(); @@ -512,8 +504,7 @@ public static void fillVTuple(int i, VTuple tuple) { tuple.put(8, DatumFactory.createDate(DatumFactory.createDate("2014-04-16").asInt4() + i)); // 8 tuple.put(9, DatumFactory.createTime(DatumFactory.createTime("08:48:00").asInt8() + i)); // 9 tuple.put(10, DatumFactory.createInterval((i + 1) + " hours")); // 10 - tuple.put(11, DatumFactory.createInet4(DatumFactory.createInet4("192.168.0.1").asInt4() + i)); // 11 - tuple.put(12, new ProtobufDatum(ProtoUtil.convertString(i + ""))); // 12; + tuple.put(11, new ProtobufDatum(ProtoUtil.convertString(i + ""))); // 11; } public static void validateResults(MemoryRowBlock rowBlock) { @@ -543,8 +534,7 @@ public static void validateTupleResult(int j, Tuple t) { assertEquals(DatumFactory.createDate("2014-04-16").asInt4() + j, t.getInt4(8)); assertEquals(DatumFactory.createTime("08:48:00").asInt8() + j, t.getInt8(9)); assertEquals(DatumFactory.createInterval((j + 1) + " hours"), t.getInterval(10)); - assertEquals(DatumFactory.createInet4("192.168.0.1").asInt4() + j, t.getInt4(11)); - assertEquals(new ProtobufDatum(ProtoUtil.convertString(j + "")), t.getProtobufDatum(12)); + assertEquals(new ProtobufDatum(ProtoUtil.convertString(j + "")), t.getProtobufDatum(11)); } public static void validateNullity(int j, Tuple tuple) { @@ -615,12 +605,6 @@ public static void validateNullity(int j, Tuple tuple) { } if (j % 11 == 0) { - tuple.isBlankOrNull(11); - } else { - assertEquals(DatumFactory.createInet4("192.168.0.1").asInt4() + j, tuple.getInt4(11)); - } - - if (j % 12 == 0) { tuple.isBlankOrNull(12); } else { assertEquals(new ProtobufDatum(ProtoUtil.convertString(j + "")), tuple.getProtobufDatum(12)); diff --git a/tajo-core-tests/src/test/java/org/apache/tajo/engine/codegen/TestEvalCodeGenerator.java b/tajo-core-tests/src/test/java/org/apache/tajo/engine/codegen/TestEvalCodeGenerator.java index adbfd480cf..b05c70b097 100644 --- a/tajo-core-tests/src/test/java/org/apache/tajo/engine/codegen/TestEvalCodeGenerator.java +++ b/tajo-core-tests/src/test/java/org/apache/tajo/engine/codegen/TestEvalCodeGenerator.java @@ -109,11 +109,6 @@ public void testNullHandling() throws TajoException { @Test public void testComparison() throws TajoException { - Schema inetSchema = SchemaBuilder.builder() - .add("addr1", TajoDataTypes.Type.INET4) - .add("addr2", TajoDataTypes.Type.INET4) - .build(); - testSimpleEval("select (1 > null AND false)", new String[] {"f"}); // unknown - false -> false testSimpleEval("select (1::int8 > null) is null", new String[] {"t"}); @@ -130,9 +125,6 @@ public void testComparison() throws TajoException { testEval(schema, "table1", "0,1,2,3,4.5,6.5", "select 1 = col4 from table1;", new String [] {"f"}); testEval(schema, "table1", "0,1,2,3,4.5,6.5", "select 1 = col5 from table1;", new String [] {"f"}); - testEval(inetSchema, "table1", "192.168.0.1,192.168.0.1", "select addr1 = addr2 from table1;", new String[]{"t"}); - testEval(inetSchema, "table1", "192.168.0.1,192.168.0.2", "select addr1 = addr2 from table1;", new String[]{"f"}); - testEval(schema, "table1", "0,1,2,3,4.5,6.5", "select 3 <> col1 from table1;", new String [] {"t"}); testEval(schema, "table1", "0,1,2,3,4.5,6.5", "select 3 <> col2 from table1;", new String [] {"t"}); testEval(schema, "table1", "0,1,2,3,4.5,6.5", "select 3 <> col3 from table1;", new String [] {"f"}); diff --git a/tajo-core-tests/src/test/java/org/apache/tajo/engine/planner/TestUniformRangePartition.java b/tajo-core-tests/src/test/java/org/apache/tajo/engine/planner/TestUniformRangePartition.java index f57f5f2149..fbdc321c94 100644 --- a/tajo-core-tests/src/test/java/org/apache/tajo/engine/planner/TestUniformRangePartition.java +++ b/tajo-core-tests/src/test/java/org/apache/tajo/engine/planner/TestUniformRangePartition.java @@ -844,40 +844,6 @@ public void testIncrementOfFloat8() { assertTrue(1.1d == overflow.getFloat8(2)); } - @Test - public void testIncrementOfInet4() { - Schema schema = SchemaBuilder.builder() - .add("l_orderkey", Type.INET4) - .add("l_linenumber", Type.INET4) - .add("final", Type.INET4) - .build(); - - SortSpec [] sortSpecs = PlannerUtil.schemaToSortSpecs(schema); - - VTuple s = new VTuple(3); - s.put(0, DatumFactory.createInet4("127.0.1.1")); - s.put(1, DatumFactory.createInet4("127.0.0.1")); - s.put(2, DatumFactory.createInet4("128.0.0.253")); - VTuple e = new VTuple(3); - e.put(0, DatumFactory.createInet4("127.0.1.4")); // 4 - e.put(1, DatumFactory.createInet4("127.0.0.2")); // 2 - e.put(2, DatumFactory.createInet4("128.0.0.255")); //x3 = 24 - - TupleRange expected = new TupleRange(sortSpecs, s, e); - - UniformRangePartition partitioner = new UniformRangePartition(expected, sortSpecs); - assertEquals(24, partitioner.getTotalCardinality().longValue()); - - Tuple beforeOverflow = partitioner.increment(s, BigInteger.valueOf(5), 2); - assertTrue("127.0.1.1".equals(beforeOverflow.getText(0))); - assertTrue("127.0.0.2".equals(beforeOverflow.getText(1))); - assertTrue("128.0.0.255".equals(beforeOverflow.getText(2))); - Tuple overflow = partitioner.increment(beforeOverflow, BigInteger.valueOf(1), 2); - assertTrue("127.0.1.2".equals(overflow.getText(0))); - assertTrue("127.0.0.1".equals(overflow.getText(1))); - assertTrue("128.0.0.253".equals(overflow.getText(2))); - } - @Test public void testPartition() { Schema schema = SchemaBuilder.builder() @@ -1125,35 +1091,6 @@ public void testPartitionWithNull() { TupleRange [] ranges = partitioner.partition(10); - TupleRange prev = null; - for (TupleRange r : ranges) { - if (prev != null) { - assertTrue(prev.compareTo(r) < 0); - } - prev = r; - } - } - - @Test - public void testPartitionWithINET4() { - Schema schema = SchemaBuilder.builder() - .add("l_returnflag", Type.INET4) - .add("l_linestatus", Type.INET4) - .build(); - - SortSpec [] sortSpecs = PlannerUtil.schemaToSortSpecs(schema); - - VTuple s = new VTuple(2); - s.put(0, DatumFactory.createInet4("127.0.1.10")); - s.put(1, DatumFactory.createInet4("127.0.2.10")); - VTuple e = new VTuple(2); - e.put(0, DatumFactory.createInet4("127.0.1.20")); - e.put(1, DatumFactory.createInet4("127.0.2.20")); - TupleRange expected = new TupleRange(sortSpecs, s, e); - RangePartitionAlgorithm partitioner - = new UniformRangePartition(expected, sortSpecs, true); - TupleRange [] ranges = partitioner.partition(10); - TupleRange prev = null; for (TupleRange r : ranges) { if (prev != null) { diff --git a/tajo-core-tests/src/test/java/org/apache/tajo/engine/planner/physical/TestRadixSort.java b/tajo-core-tests/src/test/java/org/apache/tajo/engine/planner/physical/TestRadixSort.java index f357379faa..35ddaad621 100644 --- a/tajo-core-tests/src/test/java/org/apache/tajo/engine/planner/physical/TestRadixSort.java +++ b/tajo-core-tests/src/test/java/org/apache/tajo/engine/planner/physical/TestRadixSort.java @@ -70,9 +70,8 @@ public class TestRadixSort { new Column("col3", Type.DATE), new Column("col4", Type.TIMESTAMP), new Column("col5", Type.TIME), - new Column("col6", Type.INET4), - new Column("col7", Type.FLOAT4), - new Column("col8", Type.FLOAT8) + new Column("col6", Type.FLOAT4), + new Column("col7", Type.FLOAT8) }).build(); } @@ -193,7 +192,6 @@ private static Tuple makeRandomTuple(Tuple tuple) { DatumFactory.createDate(Math.abs(random.nextInt())), DatumFactory.createTimestamp(Math.abs(random.nextLong())), DatumFactory.createTime(Math.abs(random.nextLong())), - DatumFactory.createInet4(random.nextInt()), DatumFactory.createFloat4(random.nextFloat()), DatumFactory.createFloat8(random.nextDouble()) }); @@ -221,7 +219,6 @@ private static Tuple makeMaxTuple(Tuple tuple) { DatumFactory.createDate(Integer.MAX_VALUE), DatumFactory.createTimestamp(Long.MAX_VALUE), DatumFactory.createTime(Long.MAX_VALUE), - DatumFactory.createInet4(Integer.MAX_VALUE), DatumFactory.createFloat4(Float.MAX_VALUE), DatumFactory.createFloat8(Double.MAX_VALUE) }); @@ -237,7 +234,6 @@ private static Tuple makeMinTuple(Tuple tuple) { DatumFactory.createDate(0), DatumFactory.createTimestamp(0), DatumFactory.createTime(0), - DatumFactory.createInet4(Integer.MIN_VALUE), DatumFactory.createFloat4(Float.MIN_VALUE), DatumFactory.createFloat8(Double.MIN_VALUE) }); diff --git a/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestCreateTable.java b/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestCreateTable.java index b7196bdfc9..98038ac012 100644 --- a/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestCreateTable.java +++ b/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestCreateTable.java @@ -325,8 +325,6 @@ public final void testNonreservedKeywordTableNames() throws Exception { assertTableExists(createdNames.get(0)); createdNames = executeDDL("table1_ddl.sql", "table1", "float8"); assertTableExists(createdNames.get(0)); - createdNames = executeDDL("table1_ddl.sql", "table1", "inet4"); - assertTableExists(createdNames.get(0)); createdNames = executeDDL("table1_ddl.sql", "table1", "int"); assertTableExists(createdNames.get(0)); createdNames = executeDDL("table1_ddl.sql", "table1", "int1"); diff --git a/tajo-core-tests/src/test/java/org/apache/tajo/engine/util/BenchmarkSort.java b/tajo-core-tests/src/test/java/org/apache/tajo/engine/util/BenchmarkSort.java index d681d119d5..271d94ee80 100644 --- a/tajo-core-tests/src/test/java/org/apache/tajo/engine/util/BenchmarkSort.java +++ b/tajo-core-tests/src/test/java/org/apache/tajo/engine/util/BenchmarkSort.java @@ -103,15 +103,14 @@ public void setup() throws Exception { new Column("col3", Type.DATE), new Column("col4", Type.TIMESTAMP), new Column("col5", Type.TIME), - new Column("col6", Type.INET4), - new Column("col7", Type.FLOAT4), - new Column("col8", Type.FLOAT8), + new Column("col6", Type.FLOAT4), + new Column("col7", Type.FLOAT8), + new Column("col8", Type.INT8), new Column("col9", Type.INT8), new Column("col10", Type.INT8), new Column("col11", Type.INT8), new Column("col12", Type.INT8), new Column("col13", Type.INT8), - new Column("col14", Type.INT8), }).build(); TableMeta employeeMeta = CatalogUtil.newTableMeta("TEXT"); @@ -137,7 +136,6 @@ public void setup() throws Exception { NullDatum.get(), NullDatum.get(), NullDatum.get(), - NullDatum.get(), NullDatum.get() }); } else { @@ -148,7 +146,6 @@ public void setup() throws Exception { DatumFactory.createDate(Math.abs(rnd.nextInt())), DatumFactory.createTimestamp(Math.abs(rnd.nextLong())), DatumFactory.createTime(Math.abs(rnd.nextLong())), - DatumFactory.createInet4(rnd.nextInt()), DatumFactory.createFloat4(rnd.nextFloat()), DatumFactory.createFloat8(rnd.nextDouble()), DatumFactory.createInt8(rnd.nextLong()), diff --git a/tajo-core-tests/src/test/java/org/apache/tajo/engine/util/TestTupleUtil.java b/tajo-core-tests/src/test/java/org/apache/tajo/engine/util/TestTupleUtil.java index dff63c427b..a58744f8f2 100644 --- a/tajo-core-tests/src/test/java/org/apache/tajo/engine/util/TestTupleUtil.java +++ b/tajo-core-tests/src/test/java/org/apache/tajo/engine/util/TestTupleUtil.java @@ -67,7 +67,6 @@ public final void testToBytesAndToTuple() { .add("col7", Type.FLOAT8) .add("col8", Type.TEXT) .add("col9", Type.BLOB) - .add("col10", Type.INET4) .build(); //schema.addColumn("col11", DataType.IPv6); @@ -81,7 +80,6 @@ public final void testToBytesAndToTuple() { DatumFactory.createFloat8(271.9f), DatumFactory.createText("hyunsik"), DatumFactory.createBlob("hyunsik".getBytes()), - DatumFactory.createInet4("192.168.0.1") }); RowStoreEncoder encoder = RowStoreUtil.createEncoder(schema); diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/codegen/EvalCodeGenerator.java b/tajo-core/src/main/java/org/apache/tajo/engine/codegen/EvalCodeGenerator.java index 1bf0d573d4..3e5c511dec 100644 --- a/tajo-core/src/main/java/org/apache/tajo/engine/codegen/EvalCodeGenerator.java +++ b/tajo-core/src/main/java/org/apache/tajo/engine/codegen/EvalCodeGenerator.java @@ -393,7 +393,6 @@ public EvalNode visitField(EvalCodeGenContext context, FieldEval field, Stack avroFields; private DataFileReader dataFileReader; private int[] projectionMap; @@ -82,7 +81,7 @@ public void init() throws IOException { prepareProjection(targets); outTuple = new VTuple(projectionMap.length); - avroSchema = AvroUtil.getAvroSchema(meta, conf); + Schema avroSchema = AvroUtil.getAvroSchema(meta, conf); avroFields = avroSchema.getFields(); DatumReader datumReader = new GenericDatumReader<>(avroSchema); @@ -141,15 +140,13 @@ private Datum convertBytes(Object value, TajoDataTypes.Type tajoType, byte[] bytes = new byte[buffer.capacity()]; buffer.get(bytes, 0, bytes.length); switch (tajoType) { - case INET4: - return DatumFactory.createInet4(bytes); case PROTOBUF: try { ProtobufDatumFactory factory = ProtobufDatumFactory.get(dataType.getCode()); Message.Builder builder = factory.newBuilder(); builder.mergeFrom(bytes); - return factory.createDatum(builder); + return ProtobufDatumFactory.createDatum(builder); } catch (InvalidProtocolBufferException e) { throw new RuntimeException(e); } diff --git a/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/json/JsonLineDeserializer.java b/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/json/JsonLineDeserializer.java index 335f12b596..f35605df17 100644 --- a/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/json/JsonLineDeserializer.java +++ b/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/json/JsonLineDeserializer.java @@ -203,14 +203,6 @@ private void getValue(JSONObject object, output.put(fieldIndex, DatumFactory.createBlob(Base64.decodeBase64((String) jsonObject))); break; } - case INET4: - String inetStr = object.getAsString(fieldName); - if (inetStr != null) { - output.put(fieldIndex, DatumFactory.createInet4(inetStr)); - } else { - output.put(fieldIndex, NullDatum.get()); - } - break; case RECORD: JSONObject nestedObject = (JSONObject) object.get(fieldName); diff --git a/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/json/JsonLineSerializer.java b/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/json/JsonLineSerializer.java index 1885c80ca3..deee6ec1df 100644 --- a/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/json/JsonLineSerializer.java +++ b/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/json/JsonLineSerializer.java @@ -109,7 +109,6 @@ private void putValue(JSONObject json, break; case CHAR: - case INET4: case DATE: case INTERVAL: json.put(fieldName, input.asDatum(fieldIndex).asChars()); diff --git a/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/orc/package-info.java b/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/orc/package-info.java index a987bb9603..9a9f5d609f 100644 --- a/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/orc/package-info.java +++ b/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/orc/package-info.java @@ -67,10 +67,6 @@ * BINARY * * - * INET4 - * INTEGER - * - * * TIMESTAMP * TIMESTAMP * diff --git a/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/parquet/TajoRecordConverter.java b/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/parquet/TajoRecordConverter.java index d3bbed10e5..b770270fe8 100644 --- a/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/parquet/TajoRecordConverter.java +++ b/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/parquet/TajoRecordConverter.java @@ -113,10 +113,6 @@ private Converter newConverter(Column column, Type type, return new FieldFloat4Converter(parent); case FLOAT8: return new FieldFloat8Converter(parent); - case INET4: - return new FieldInet4Converter(parent); - case INET6: - throw new RuntimeException("No converter for INET6"); case TEXT: return new FieldTextConverter(parent); case PROTOBUF: @@ -311,19 +307,6 @@ final public void addDouble(double value) { } } - static final class FieldInet4Converter extends PrimitiveConverter { - private final ParentValueContainer parent; - - public FieldInet4Converter(ParentValueContainer parent) { - this.parent = parent; - } - - @Override - final public void addBinary(Binary value) { - parent.add(DatumFactory.createInet4(value.getBytes())); - } - } - static final class FieldTextConverter extends PrimitiveConverter { private final ParentValueContainer parent; diff --git a/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/parquet/TajoSchemaConverter.java b/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/parquet/TajoSchemaConverter.java index 07196995a8..7c73807152 100644 --- a/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/parquet/TajoSchemaConverter.java +++ b/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/parquet/TajoSchemaConverter.java @@ -183,10 +183,6 @@ private Type convertColumn(Column column) { case BLOB: return primitive(column.getSimpleName(), PrimitiveTypeName.BINARY); - case INET4: - case INET6: - return primitive(column.getSimpleName(), - PrimitiveTypeName.BINARY); default: throw new RuntimeException("Cannot convert Tajo type: " + type); } diff --git a/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/parquet/TajoWriteSupport.java b/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/parquet/TajoWriteSupport.java index e5d73f5131..7c0314fd07 100644 --- a/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/parquet/TajoWriteSupport.java +++ b/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/parquet/TajoWriteSupport.java @@ -142,8 +142,6 @@ private void writeValue(Column column, Tuple tuple, int index) { break; case PROTOBUF: case BLOB: - case INET4: - case INET6: recordConsumer.addBinary(Binary.fromByteArray(tuple.getBytes(index))); break; default: diff --git a/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/parquet/package-info.java b/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/parquet/package-info.java index d7d16b7842..a8eb12d187 100644 --- a/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/parquet/package-info.java +++ b/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/parquet/package-info.java @@ -75,10 +75,6 @@ * BLOB * BINARY * - * - * INET4 - * BINARY - * * * *

diff --git a/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/sequencefile/SequenceFileAppender.java b/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/sequencefile/SequenceFileAppender.java index 2a3e3028a5..2bb3e21961 100644 --- a/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/sequencefile/SequenceFileAppender.java +++ b/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/sequencefile/SequenceFileAppender.java @@ -170,7 +170,6 @@ public void addTuple(Tuple tuple) throws IOException { BytesUtils.writeVLong(os, protobufDatum.asByteArray().length); break; case CHAR: - case INET4: case BLOB: BytesUtils.writeVLong(os, tuple.getBytes(j).length); break; diff --git a/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/sequencefile/SequenceFileScanner.java b/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/sequencefile/SequenceFileScanner.java index 194d6a91a4..b7dc1eca9f 100644 --- a/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/sequencefile/SequenceFileScanner.java +++ b/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/sequencefile/SequenceFileScanner.java @@ -307,7 +307,6 @@ private void parse(Column col, byte[] bytes, int offset) throws break; case BLOB: case PROTOBUF: - case INET4: case CHAR: case TEXT: elementOffset = 1; diff --git a/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/text/TextFieldSerializerDeserializer.java b/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/text/TextFieldSerializerDeserializer.java index 53b6bcda46..b705fd968b 100644 --- a/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/text/TextFieldSerializerDeserializer.java +++ b/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/text/TextFieldSerializerDeserializer.java @@ -115,7 +115,6 @@ public int serialize(int columnIndex, Tuple tuple, OutputStream out, byte[] null case INT8: case FLOAT4: case FLOAT8: - case INET4: case DATE: case INTERVAL: bytes = tuple.getTextBytes(columnIndex); @@ -140,7 +139,6 @@ public int serialize(int columnIndex, Tuple tuple, OutputStream out, byte[] null length = bytes.length; out.write(bytes); break; - case INET6: case BLOB: bytes = Base64.encodeBase64(tuple.getBytes(columnIndex), false); length = bytes.length; @@ -251,10 +249,6 @@ public Datum deserialize(int columnIndex, ByteBuf buf, ByteBuf nullChars) throws } break; } - case INET4: - datum = DatumFactory.createInet4( - decoder.decode(buf.nioBuffer(buf.readerIndex(), buf.readableBytes())).toString()); - break; case BLOB: { byte[] bytes = new byte[buf.readableBytes()]; buf.readBytes(bytes); diff --git a/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/thirdparty/orc/OrcUtils.java b/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/thirdparty/orc/OrcUtils.java index b8d3f52c67..e7648b0d43 100644 --- a/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/thirdparty/orc/OrcUtils.java +++ b/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/thirdparty/orc/OrcUtils.java @@ -83,7 +83,6 @@ public static TypeDescription convertTypeInfo(TypeDesc desc) { case INT2: return TypeDescription.createShort(); case INT4: - case INET4: return TypeDescription.createInt(); case INT8: return TypeDescription.createLong(); diff --git a/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/thirdparty/orc/TreeReaderFactory.java b/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/thirdparty/orc/TreeReaderFactory.java index 6ab630aed1..381d458a70 100644 --- a/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/thirdparty/orc/TreeReaderFactory.java +++ b/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/thirdparty/orc/TreeReaderFactory.java @@ -379,60 +379,6 @@ void skipRows(long items) throws IOException { } } - public static class InetTreeReader extends DatumTreeReader { - protected IntegerReader reader = null; - - InetTreeReader(int columnId) throws IOException { - this(columnId, null, null, null); - } - - protected InetTreeReader(int columnId, InStream present, InStream data, - OrcProto.ColumnEncoding encoding) - throws IOException { - super(columnId, present); - if (data != null && encoding != null) { - checkEncoding(encoding); - this.reader = createIntegerReader(encoding.getKind(), data, true, false); - } - } - - @Override - void checkEncoding(OrcProto.ColumnEncoding encoding) throws IOException { - if ((encoding.getKind() != OrcProto.ColumnEncoding.Kind.DIRECT) && - (encoding.getKind() != OrcProto.ColumnEncoding.Kind.DIRECT_V2)) { - throw new IOException("Unknown encoding " + encoding + " in column " + - columnId); - } - } - - @Override - void startStripe(Map streams, - OrcProto.StripeFooter stripeFooter - ) throws IOException { - super.startStripe(streams, stripeFooter); - org.apache.orc.impl.StreamName name = new org.apache.orc.impl.StreamName(columnId, - OrcProto.Stream.Kind.DATA); - reader = createIntegerReader(stripeFooter.getColumnsList().get(columnId).getKind(), - streams.get(name), true, false); - } - - @Override - void seek(PositionProvider[] index) throws IOException { - seek(index[columnId]); - } - - @Override - Datum next() throws IOException { - super.next(); - return valuePresent ? DatumFactory.createInet4((int) reader.next()) : NullDatum.get(); - } - - @Override - void skipRows(long items) throws IOException { - reader.skip(countNonNulls(items)); - } - } - public static class IntTreeReader extends DatumTreeReader { protected IntegerReader reader = null; @@ -1545,8 +1491,6 @@ public static DatumTreeReader createTreeReader(TimeZone timeZone, return new TimestampTreeReader(timeZone, orcColumnId, skipCorrupt); case DATE: return new DateTreeReader(orcColumnId); - case INET4: - return new InetTreeReader(orcColumnId); // case STRUCT: // return new StructTreeReader(columnId, treeReaderSchema, included, skipCorrupt); default: diff --git a/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/thirdparty/orc/WriterImpl.java b/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/thirdparty/orc/WriterImpl.java index e0ad3d7bed..8f4a825b0a 100644 --- a/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/thirdparty/orc/WriterImpl.java +++ b/tajo-storage/tajo-storage-hdfs/src/main/java/org/apache/tajo/storage/thirdparty/orc/WriterImpl.java @@ -37,7 +37,6 @@ import org.apache.orc.OrcUtils; import org.apache.orc.impl.*; import org.apache.tajo.datum.Datum; -import org.apache.tajo.datum.Inet4Datum; import org.apache.tajo.datum.Int4Datum; import org.apache.tajo.datum.Int8Datum; import org.apache.tajo.storage.Tuple; @@ -962,7 +961,7 @@ void write(Datum datum) throws IOException { super.write(datum); if (datum != null && datum.isNotNull()) { long val; - if (datum instanceof Int4Datum || datum instanceof Inet4Datum) { + if (datum instanceof Int4Datum) { val = datum.asInt4(); } else if (datum instanceof Int8Datum) { val = datum.asInt8(); diff --git a/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/TestDelimitedTextFile.java b/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/TestDelimitedTextFile.java index 29d81977f4..083e5a6348 100644 --- a/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/TestDelimitedTextFile.java +++ b/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/TestDelimitedTextFile.java @@ -57,7 +57,6 @@ public class TestDelimitedTextFile { .add("col7", Type.FLOAT8) .add("col8", Type.TEXT) .add("col9", Type.BLOB) - .add("col10", Type.INET4) .build(); baseTuple = new VTuple(new Datum[] { @@ -70,7 +69,6 @@ public class TestDelimitedTextFile { DatumFactory.createFloat8(271.9d), // 6 DatumFactory.createText("hyunsik"), // 7 DatumFactory.createBlob("hyunsik".getBytes()),// 8 - DatumFactory.createInet4("192.168.0.1"), // 9 }); } diff --git a/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/TestStorages.java b/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/TestStorages.java index bcbb6c3521..6d7808f913 100644 --- a/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/TestStorages.java +++ b/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/TestStorages.java @@ -416,10 +416,9 @@ public void testVariousTypes() throws IOException { .add("col6", Type.FLOAT4) .add("col7", Type.FLOAT8) .add("col8", Type.TEXT) - .add("col9", Type.BLOB) - .add("col10", Type.INET4); + .add("col9", Type.BLOB); if (protoTypeSupport()) { - schemaBld.add("col11", CatalogUtil.newDataType(Type.PROTOBUF, TajoIdProtos.QueryIdProto.class.getName())); + schemaBld.add("col10", CatalogUtil.newDataType(Type.PROTOBUF, TajoIdProtos.QueryIdProto.class.getName())); } Schema schema = schemaBld.build(); @@ -440,7 +439,7 @@ public void testVariousTypes() throws IOException { QueryId queryid = new QueryId("12345", 5); ProtobufDatumFactory factory = ProtobufDatumFactory.get(TajoIdProtos.QueryIdProto.class.getName()); - VTuple tuple = new VTuple(10 + (protoTypeSupport() ? 1 : 0)); + VTuple tuple = new VTuple(9 + (protoTypeSupport() ? 1 : 0)); tuple.put(new Datum[] { DatumFactory.createBool(true), DatumFactory.createChar("hyunsik"), @@ -451,11 +450,10 @@ public void testVariousTypes() throws IOException { DatumFactory.createFloat8(271.9f), DatumFactory.createText("hyunsik"), DatumFactory.createBlob("hyunsik".getBytes()), - DatumFactory.createInet4("192.168.0.1"), }); if (protoTypeSupport()) { - tuple.put(10, factory.createDatum(queryid.getProto())); + tuple.put(9, factory.createDatum(queryid.getProto())); } appender.addTuple(tuple); @@ -487,11 +485,10 @@ public void testNullHandlingTypes() throws IOException { .add("col6", Type.FLOAT4) .add("col7", Type.FLOAT8) .add("col8", Type.TEXT) - .add("col9", Type.BLOB) - .add("col10", Type.INET4); + .add("col9", Type.BLOB); if (protoTypeSupport()) { - schemaBld.add("col11", CatalogUtil.newDataType(Type.PROTOBUF, TajoIdProtos.QueryIdProto.class.getName())); + schemaBld.add("col10", CatalogUtil.newDataType(Type.PROTOBUF, TajoIdProtos.QueryIdProto.class.getName())); } Schema schema = schemaBld.build(); @@ -514,7 +511,7 @@ public void testNullHandlingTypes() throws IOException { QueryId queryid = new QueryId("12345", 5); ProtobufDatumFactory factory = ProtobufDatumFactory.get(TajoIdProtos.QueryIdProto.class.getName()); - int columnNum = 10 + (protoTypeSupport() ? 1 : 0); + int columnNum = 9 + (protoTypeSupport() ? 1 : 0); VTuple seedTuple = new VTuple(columnNum); seedTuple.put(new Datum[]{ DatumFactory.createBool(true), // 0 @@ -526,11 +523,10 @@ public void testNullHandlingTypes() throws IOException { DatumFactory.createFloat8(271.9f), // 7 DatumFactory.createText("hyunsik"), // 8 DatumFactory.createBlob("hyunsik".getBytes()),// 9 - DatumFactory.createInet4("192.168.0.1") // 10 }); if (protoTypeSupport()) { - seedTuple.put(10, factory.createDatum(queryid.getProto())); // 11 + seedTuple.put(9, factory.createDatum(queryid.getProto())); // 10 } // Making tuples with different null column positions @@ -584,11 +580,10 @@ public void testNullHandlingTypesWithProjection() throws IOException { .add("col6", Type.FLOAT4) .add("col7", Type.FLOAT8) .add("col8", Type.TEXT) - .add("col9", Type.BLOB) - .add("col10", Type.INET4); + .add("col9", Type.BLOB); if (protoTypeSupport()) { - schemaBld.add("col11", CatalogUtil.newDataType(Type.PROTOBUF, TajoIdProtos.QueryIdProto.class.getName())); + schemaBld.add("col10", CatalogUtil.newDataType(Type.PROTOBUF, TajoIdProtos.QueryIdProto.class.getName())); } Schema schema = schemaBld.build(); @@ -611,7 +606,7 @@ public void testNullHandlingTypesWithProjection() throws IOException { QueryId queryid = new QueryId("12345", 5); ProtobufDatumFactory factory = ProtobufDatumFactory.get(TajoIdProtos.QueryIdProto.class.getName()); - int columnNum = 10 + (protoTypeSupport() ? 1 : 0); + int columnNum = 9 + (protoTypeSupport() ? 1 : 0); VTuple seedTuple = new VTuple(columnNum); seedTuple.put(new Datum[]{ DatumFactory.createBool(true), // 0 @@ -623,11 +618,10 @@ public void testNullHandlingTypesWithProjection() throws IOException { DatumFactory.createFloat8(271.9f), // 7 DatumFactory.createText("hyunsik"), // 8 DatumFactory.createBlob("hyunsik".getBytes()),// 9 - DatumFactory.createInet4("192.168.0.1") // 10 }); if (protoTypeSupport()) { - seedTuple.put(10, factory.createDatum(queryid.getProto())); // 11 + seedTuple.put(9, factory.createDatum(queryid.getProto())); // 10 } // Making tuples with different null column positions @@ -694,8 +688,7 @@ public void testRCFileTextSerializeDeserialize() throws IOException { .add("col7", Type.FLOAT8) .add("col8", Type.TEXT) .add("col9", Type.BLOB) - .add("col10", Type.INET4) - .add("col11", CatalogUtil.newDataType(Type.PROTOBUF, TajoIdProtos.QueryIdProto.class.getName())) + .add("col10", CatalogUtil.newDataType(Type.PROTOBUF, TajoIdProtos.QueryIdProto.class.getName())) .build(); KeyValueSet options = new KeyValueSet(); @@ -721,7 +714,6 @@ public void testRCFileTextSerializeDeserialize() throws IOException { DatumFactory.createFloat8(271.9f), DatumFactory.createText("jinho"), DatumFactory.createBlob("hyunsik babo".getBytes()), - DatumFactory.createInet4("192.168.0.1"), factory.createDatum(queryid.getProto()) }); appender.addTuple(tuple); @@ -760,8 +752,7 @@ public void testRCFileBinarySerializeDeserialize() throws IOException { .add("col7", Type.FLOAT8) .add("col8", Type.TEXT) .add("col9", Type.BLOB) - .add("col10", Type.INET4) - .add("col11", CatalogUtil.newDataType(Type.PROTOBUF, TajoIdProtos.QueryIdProto.class.getName())) + .add("col10", CatalogUtil.newDataType(Type.PROTOBUF, TajoIdProtos.QueryIdProto.class.getName())) .build(); KeyValueSet options = new KeyValueSet(); @@ -787,7 +778,6 @@ public void testRCFileBinarySerializeDeserialize() throws IOException { DatumFactory.createFloat8(271.9f), DatumFactory.createText("jinho"), DatumFactory.createBlob("hyunsik babo".getBytes()), - DatumFactory.createInet4("192.168.0.1"), factory.createDatum(queryid.getProto()) }); appender.addTuple(tuple); @@ -826,8 +816,7 @@ public void testSequenceFileTextSerializeDeserialize() throws IOException { .add("col7", Type.FLOAT8) .add("col8", Type.TEXT) .add("col9", Type.BLOB) - .add("col10", Type.INET4) - .add("col11", CatalogUtil.newDataType(Type.PROTOBUF, TajoIdProtos.QueryIdProto.class.getName())).build(); + .add("col10", CatalogUtil.newDataType(Type.PROTOBUF, TajoIdProtos.QueryIdProto.class.getName())).build(); KeyValueSet options = new KeyValueSet(); TableMeta meta = CatalogUtil.newTableMeta(dataFormat, options); @@ -851,7 +840,6 @@ public void testSequenceFileTextSerializeDeserialize() throws IOException { DatumFactory.createFloat8(271.9f), DatumFactory.createText("jinho"), DatumFactory.createBlob("hyunsik babo".getBytes()), - DatumFactory.createInet4("192.168.0.1"), ProtobufDatumFactory.createDatum(queryid.getProto()) }); appender.addTuple(tuple); @@ -894,8 +882,7 @@ public void testSequenceFileBinarySerializeDeserialize() throws IOException { .add("col7", Type.FLOAT8) .add("col8", Type.TEXT) .add("col9", Type.BLOB) - .add("col10", Type.INET4) - .add("col11", CatalogUtil.newDataType(Type.PROTOBUF, TajoIdProtos.QueryIdProto.class.getName())) + .add("col10", CatalogUtil.newDataType(Type.PROTOBUF, TajoIdProtos.QueryIdProto.class.getName())) .build(); KeyValueSet options = new KeyValueSet(); @@ -920,7 +907,6 @@ public void testSequenceFileBinarySerializeDeserialize() throws IOException { DatumFactory.createFloat8(271.9f), DatumFactory.createText("jinho"), DatumFactory.createBlob("hyunsik babo".getBytes()), - DatumFactory.createInet4("192.168.0.1"), ProtobufDatumFactory.createDatum(queryid.getProto()) }); appender.addTuple(tuple); diff --git a/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/json/TestJsonSerDe.java b/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/json/TestJsonSerDe.java index 30367c2c3e..74b0d87ec3 100644 --- a/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/json/TestJsonSerDe.java +++ b/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/json/TestJsonSerDe.java @@ -56,8 +56,7 @@ public class TestJsonSerDe { .add("col7", TajoDataTypes.Type.FLOAT8) .add("col8", TajoDataTypes.Type.TEXT) .add("col9", TajoDataTypes.Type.BLOB) - .add("col10", TajoDataTypes.Type.INET4) - .add("col11", TajoDataTypes.Type.NULL_TYPE) + .add("col10", TajoDataTypes.Type.NULL_TYPE) .build(); } @@ -93,8 +92,7 @@ public void testVarioutType() throws IOException { DatumFactory.createFloat8(271.9d), // 6 DatumFactory.createText("hyunsik"), // 7 DatumFactory.createBlob("hyunsik".getBytes()), // 8 - DatumFactory.createInet4("192.168.0.1"), // 9 - NullDatum.get(), // 10 + NullDatum.get(), // 9 }); assertEquals(baseTuple, tuple); diff --git a/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/parquet/TestSchemaConverter.java b/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/parquet/TestSchemaConverter.java index 77b58942c7..488f3f12ff 100644 --- a/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/parquet/TestSchemaConverter.java +++ b/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/parquet/TestSchemaConverter.java @@ -56,7 +56,6 @@ public class TestSchemaConverter { " optional binary mytext (UTF8);\n" + " optional binary myblob;\n" + // NULL_TYPE fields are not encoded. - " optional binary myinet4;\n" + " optional binary myprotobuf;\n" + "}\n"; @@ -72,7 +71,6 @@ private Schema createAllTypesSchema() { .add(new Column("mytext", Type.TEXT)) .add(new Column("myblob", Type.BLOB)) .add(new Column("mynull", Type.NULL_TYPE)) - .add(new Column("myinet4", Type.INET4)) .add(new Column("myprotobuf", Type.PROTOBUF)) .build(); } diff --git a/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/raw/TestDirectRawFile.java b/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/raw/TestDirectRawFile.java index 19e3e95f2f..4e03467f76 100644 --- a/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/raw/TestDirectRawFile.java +++ b/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/raw/TestDirectRawFile.java @@ -140,8 +140,7 @@ public Path getTestDir(FileSystem fs, String dir) throws IOException { .add("col8", TajoDataTypes.Type.DATE) .add("col9", TajoDataTypes.Type.TIME) .add("col10", TajoDataTypes.Type.INTERVAL) - .add("col11", TajoDataTypes.Type.INET4) - .add("col12", + .add("col11", CatalogUtil.newDataType(TajoDataTypes.Type.PROTOBUF, PrimitiveProtos.StringProto.class.getName())) .build(); } @@ -293,8 +292,7 @@ public static void fillRow(int i, RowWriter builder) { builder.putDate(DatumFactory.createDate("2014-04-16").asInt4() + i); // 8 builder.putTime(DatumFactory.createTime("08:48:00").asInt8() + i); // 9 builder.putInterval(DatumFactory.createInterval((i + 1) + " hours")); // 10 - builder.putInet4(DatumFactory.createInet4("192.168.0.1").asInt4() + i); // 11 - builder.putProtoDatum(new ProtobufDatum(ProtoUtil.convertString(i + ""))); // 12 + builder.putProtoDatum(new ProtobufDatum(ProtoUtil.convertString(i + ""))); // 11 builder.endRow(); } @@ -310,8 +308,7 @@ public static void validateTupleResult(int j, Tuple t) { assertEquals(DatumFactory.createDate("2014-04-16").asInt4() + j, t.getInt4(8)); assertEquals(DatumFactory.createTime("08:48:00").asInt8() + j, t.getInt8(9)); assertEquals(DatumFactory.createInterval((j + 1) + " hours"), t.getInterval(10)); - assertEquals(DatumFactory.createInet4("192.168.0.1").asInt4() + j, t.getInt4(11)); - assertEquals(new ProtobufDatum(ProtoUtil.convertString(j + "")), t.getProtobufDatum(12)); + assertEquals(new ProtobufDatum(ProtoUtil.convertString(j + "")), t.getProtobufDatum(11)); } public static void fillRowBlockWithNull(int i, RowWriter writer) { @@ -384,12 +381,6 @@ public static void fillRowBlockWithNull(int i, RowWriter writer) { if (i % 11 == 0) { writer.skipField(); - } else { - writer.putInet4(DatumFactory.createInet4("192.168.0.1").asInt4() + i); // 11 - } - - if (i % 12 == 0) { - writer.skipField(); } else { writer.putProtoDatum(new ProtobufDatum(ProtoUtil.convertString(i + ""))); // 12 } @@ -465,12 +456,6 @@ public static void validateNullity(int j, Tuple tuple) { } if (j % 11 == 0) { - tuple.isBlankOrNull(11); - } else { - assertEquals(DatumFactory.createInet4("192.168.0.1").asInt4() + j, tuple.getInt4(11)); - } - - if (j % 12 == 0) { tuple.isBlankOrNull(12); } else { assertEquals(new ProtobufDatum(ProtoUtil.convertString(j + "")), tuple.getProtobufDatum(12)); From 2dc1a26262b3221569cc35567cf7073ebb3bdf13 Mon Sep 17 00:00:00 2001 From: Jongyoung Park Date: Sat, 23 Apr 2016 12:35:16 +0900 Subject: [PATCH 3/9] TestMemoryRowBlock error fixed --- .../java/org/apache/tajo/tuple/memory/TestMemoryRowBlock.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tajo-common/src/test/java/org/apache/tajo/tuple/memory/TestMemoryRowBlock.java b/tajo-common/src/test/java/org/apache/tajo/tuple/memory/TestMemoryRowBlock.java index b6e22ba0f6..6a9be2e0b6 100644 --- a/tajo-common/src/test/java/org/apache/tajo/tuple/memory/TestMemoryRowBlock.java +++ b/tajo-common/src/test/java/org/apache/tajo/tuple/memory/TestMemoryRowBlock.java @@ -605,9 +605,9 @@ public static void validateNullity(int j, Tuple tuple) { } if (j % 11 == 0) { - tuple.isBlankOrNull(12); + tuple.isBlankOrNull(11); } else { - assertEquals(new ProtobufDatum(ProtoUtil.convertString(j + "")), tuple.getProtobufDatum(12)); + assertEquals(new ProtobufDatum(ProtoUtil.convertString(j + "")), tuple.getProtobufDatum(11)); } } } \ No newline at end of file From 8da4ed8e18dcded146358a668418337a45bbef4e Mon Sep 17 00:00:00 2001 From: Jongyoung Park Date: Sat, 23 Apr 2016 12:52:22 +0900 Subject: [PATCH 4/9] test error fixed --- .../test/java/org/apache/tajo/storage/TestFrameTuple.java | 4 ++-- .../src/test/java/org/apache/tajo/storage/TestLazyTuple.java | 5 ++--- .../java/org/apache/tajo/storage/TestDelimitedTextFile.java | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/tajo-storage/tajo-storage-common/src/test/java/org/apache/tajo/storage/TestFrameTuple.java b/tajo-storage/tajo-storage-common/src/test/java/org/apache/tajo/storage/TestFrameTuple.java index 7f9b63afe1..8a25a8c4d9 100644 --- a/tajo-storage/tajo-storage-common/src/test/java/org/apache/tajo/storage/TestFrameTuple.java +++ b/tajo-storage/tajo-storage-common/src/test/java/org/apache/tajo/storage/TestFrameTuple.java @@ -67,8 +67,8 @@ public void tearDown() throws Exception { @Test public final void testFrameTuple() { Tuple frame = new FrameTuple(tuple1, tuple2); - assertEquals(22, frame.size()); - for (int i = 0; i < 22; i++) { + assertEquals(20, frame.size()); + for (int i = 0; i < frame.size(); i++) { assertTrue(frame.contains(i)); } diff --git a/tajo-storage/tajo-storage-common/src/test/java/org/apache/tajo/storage/TestLazyTuple.java b/tajo-storage/tajo-storage-common/src/test/java/org/apache/tajo/storage/TestLazyTuple.java index fc6b1f1cfe..29c79b329a 100644 --- a/tajo-storage/tajo-storage-common/src/test/java/org/apache/tajo/storage/TestLazyTuple.java +++ b/tajo-storage/tajo-storage-common/src/test/java/org/apache/tajo/storage/TestLazyTuple.java @@ -110,7 +110,6 @@ public void testContain() { assertFalse(t1.contains(8)); assertFalse(t1.contains(9)); assertFalse(t1.contains(10)); - assertFalse(t1.contains(11)); } @Test @@ -119,14 +118,14 @@ public void testPut() { LazyTuple t1 = new LazyTuple(schema, new byte[colNum][], -1); t1.put(0, DatumFactory.createText("str")); t1.put(1, DatumFactory.createInt4(2)); - t1.put(11, DatumFactory.createFloat4(0.76f)); + t1.put(10, DatumFactory.createFloat4(0.76f)); assertTrue(t1.contains(0)); assertTrue(t1.contains(1)); assertEquals(t1.getText(0), "str"); assertEquals(t1.get(1).asInt4(), 2); - assertTrue(t1.get(11).asFloat4() == 0.76f); + assertTrue(t1.get(10).asFloat4() == 0.76f); } @Test diff --git a/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/TestDelimitedTextFile.java b/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/TestDelimitedTextFile.java index 083e5a6348..e1eb4ef425 100644 --- a/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/TestDelimitedTextFile.java +++ b/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/TestDelimitedTextFile.java @@ -116,7 +116,7 @@ public void testIncompleteQuote() throws IOException, CloneNotSupportedException Tuple tuple; int i = 0; while ((tuple = scanner.next()) != null) { - assertEquals("(f,hyunsik\",NULL,NULL,NULL,NULL,0.0,\"hyunsik,hyunsik,NULL)", tuple.toString()); + assertEquals("(f,hyunsik\",NULL,NULL,NULL,NULL,0.0,\"hyunsik,hyunsik)", tuple.toString()); i++; } assertEquals(1, i); From 1ea639de98758f5150f2556dd5dbba954574c6ce Mon Sep 17 00:00:00 2001 From: Jongyoung Park Date: Sat, 23 Apr 2016 17:23:29 +0900 Subject: [PATCH 5/9] refactoring --- .../src/test/java/org/apache/tajo/storage/TestStorages.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/TestStorages.java b/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/TestStorages.java index 6d7808f913..db3287ce21 100644 --- a/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/TestStorages.java +++ b/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/TestStorages.java @@ -437,7 +437,6 @@ public void testVariousTypes() throws IOException { appender.init(); QueryId queryid = new QueryId("12345", 5); - ProtobufDatumFactory factory = ProtobufDatumFactory.get(TajoIdProtos.QueryIdProto.class.getName()); VTuple tuple = new VTuple(9 + (protoTypeSupport() ? 1 : 0)); tuple.put(new Datum[] { @@ -445,7 +444,7 @@ public void testVariousTypes() throws IOException { DatumFactory.createChar("hyunsik"), DatumFactory.createInt2((short) 17), DatumFactory.createInt4(59), - DatumFactory.createInt8(23l), + DatumFactory.createInt8(23L), DatumFactory.createFloat4(77.9f), DatumFactory.createFloat8(271.9f), DatumFactory.createText("hyunsik"), @@ -453,7 +452,7 @@ public void testVariousTypes() throws IOException { }); if (protoTypeSupport()) { - tuple.put(9, factory.createDatum(queryid.getProto())); + tuple.put(9, ProtobufDatumFactory.createDatum(queryid.getProto())); } appender.addTuple(tuple); From 9114ea2fcfe4dffc9bea54a71ada60c2407e2724 Mon Sep 17 00:00:00 2001 From: Jongyoung Park Date: Sat, 23 Apr 2016 17:23:45 +0900 Subject: [PATCH 6/9] Avro schema modified --- .../src/test/resources/dataset/testVariousTypes.avsc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tajo-storage/tajo-storage-hdfs/src/test/resources/dataset/testVariousTypes.avsc b/tajo-storage/tajo-storage-hdfs/src/test/resources/dataset/testVariousTypes.avsc index f1d1368447..0255e00f55 100644 --- a/tajo-storage/tajo-storage-hdfs/src/test/resources/dataset/testVariousTypes.avsc +++ b/tajo-storage/tajo-storage-hdfs/src/test/resources/dataset/testVariousTypes.avsc @@ -11,8 +11,7 @@ { "name": "col6", "type": "float" }, { "name": "col7", "type": "double" }, { "name": "col8", "type": "string" }, - { "name": "col9", "type": "bytes" }, - { "name": "col10", "type": "bytes" } + { "name": "col9", "type": "bytes" } ] } From 4c96f86544fcbf2d39d10a762933f1ce5a7e5bd0 Mon Sep 17 00:00:00 2001 From: Jongyoung Park Date: Sat, 23 Apr 2016 17:32:46 +0900 Subject: [PATCH 7/9] radix sort test fixed --- .../apache/tajo/engine/planner/physical/TestRadixSort.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tajo-core-tests/src/test/java/org/apache/tajo/engine/planner/physical/TestRadixSort.java b/tajo-core-tests/src/test/java/org/apache/tajo/engine/planner/physical/TestRadixSort.java index 35ddaad621..1ccb890ba2 100644 --- a/tajo-core-tests/src/test/java/org/apache/tajo/engine/planner/physical/TestRadixSort.java +++ b/tajo-core-tests/src/test/java/org/apache/tajo/engine/planner/physical/TestRadixSort.java @@ -123,7 +123,7 @@ public static Collection generateParameters() { @Before public void setup() { - List dataTypeList = schema.getRootColumns().stream().map(c -> c.getDataType()).collect(Collectors.toList()); + List dataTypeList = schema.getRootColumns().stream().map(Column::getDataType).collect(Collectors.toList()); tuples = new UnSafeTupleList(dataTypeList.toArray(new DataType[dataTypeList.size()]), tupleNum); // add null and negative numbers @@ -178,7 +178,6 @@ private static Tuple makeNullTuple(Tuple tuple) { NullDatum.get(), NullDatum.get(), NullDatum.get(), - NullDatum.get(), NullDatum.get() }); return tuple; @@ -202,7 +201,7 @@ private static Tuple makeRandomTuple(Tuple tuple) { } } - for (int i = 7; i < 9; i++) { + for (int i = 6; i < 8; i++) { if (random.nextBoolean()) { tuple.put(i, tuple.asDatum(i).multiply(MINUS_ONE)); } From 3b8a7060e1556d0c4f0f3f61545cae4f23b45d41 Mon Sep 17 00:00:00 2001 From: Jongyoung Park Date: Sat, 23 Apr 2016 23:43:45 +0900 Subject: [PATCH 8/9] Delete files related with TestNetTypes --- .../tajo/engine/query/TestNetTypes.java | 102 ------------------ .../queries/TestNetTypes/table1_ddl.sql | 4 - .../queries/TestNetTypes/table2_ddl.sql | 4 - .../queries/TestNetTypes/testGroupby.sql | 8 -- .../queries/TestNetTypes/testGroupby2.sql | 9 -- .../queries/TestNetTypes/testJoin.sql | 1 - .../queries/TestNetTypes/testSelect.sql | 1 - .../queries/TestNetTypes/testSort.sql | 1 - .../queries/TestNetTypes/testSort2.sql | 1 - 9 files changed, 131 deletions(-) delete mode 100644 tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestNetTypes.java delete mode 100644 tajo-core-tests/src/test/resources/queries/TestNetTypes/table1_ddl.sql delete mode 100644 tajo-core-tests/src/test/resources/queries/TestNetTypes/table2_ddl.sql delete mode 100644 tajo-core-tests/src/test/resources/queries/TestNetTypes/testGroupby.sql delete mode 100644 tajo-core-tests/src/test/resources/queries/TestNetTypes/testGroupby2.sql delete mode 100644 tajo-core-tests/src/test/resources/queries/TestNetTypes/testJoin.sql delete mode 100644 tajo-core-tests/src/test/resources/queries/TestNetTypes/testSelect.sql delete mode 100644 tajo-core-tests/src/test/resources/queries/TestNetTypes/testSort.sql delete mode 100644 tajo-core-tests/src/test/resources/queries/TestNetTypes/testSort2.sql diff --git a/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestNetTypes.java b/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestNetTypes.java deleted file mode 100644 index bd8f83049b..0000000000 --- a/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestNetTypes.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.tajo.engine.query; - -import org.apache.tajo.QueryTestCaseBase; -import org.junit.Before; -import org.junit.Test; - -import java.sql.ResultSet; - -public class TestNetTypes extends QueryTestCaseBase { - - @Before - public final void setUp() throws Exception { - if (!testingCluster.isHiveCatalogStoreRunning()) { - executeDDL("table1_ddl.sql", "table1"); - executeDDL("table2_ddl.sql", "table2"); - } - } - - @Test - public final void testSelect() throws Exception { - // Skip all tests when HiveCatalogStore is used. - if (!testingCluster.isHiveCatalogStoreRunning()) { - // select name, addr from table1; - ResultSet res = executeQuery(); - assertResultSet(res); - cleanupQuery(res); - } - } - - @Test - public final void testGroupby() throws Exception { - // Skip all tests when HiveCatalogStore is used. - if (!testingCluster.isHiveCatalogStoreRunning()) { - // select name, addr, count(1) from table1 group by name, addr; - ResultSet res = executeQuery(); - assertResultSet(res); - cleanupQuery(res); - } - } - - @Test - public final void testGroupby2() throws Exception { - // Skip all tests when HiveCatalogStore is used. - if (!testingCluster.isHiveCatalogStoreRunning()) { - // select addr, count(*) from table1 group by addr; - ResultSet res = executeQuery(); - assertResultSet(res); - cleanupQuery(res); - } - } - - @Test - public final void testSort() throws Exception { - // Skip all tests when HiveCatalogStore is used. - if (!testingCluster.isHiveCatalogStoreRunning()) { - // select * from table1 order by addr; - ResultSet res = executeQuery(); - assertResultSet(res); - cleanupQuery(res); - } - } - - @Test - public final void testSort2() throws Exception { - // Skip all tests when HiveCatalogStore is used. - if (!testingCluster.isHiveCatalogStoreRunning()) { - // select addr from table2 order by addr; - ResultSet res = executeQuery(); - assertResultSet(res); - cleanupQuery(res); - } - } - - @Test - public final void testJoin() throws Exception { - // Skip all tests when HiveCatalogStore is used. - if (!testingCluster.isHiveCatalogStoreRunning()) { - // select * from table1 as t1, table2 as t2 where t1.addr = t2.addr; - ResultSet res = executeQuery(); - assertResultSet(res); - cleanupQuery(res); - } - } -} diff --git a/tajo-core-tests/src/test/resources/queries/TestNetTypes/table1_ddl.sql b/tajo-core-tests/src/test/resources/queries/TestNetTypes/table1_ddl.sql deleted file mode 100644 index b4cc87e5f2..0000000000 --- a/tajo-core-tests/src/test/resources/queries/TestNetTypes/table1_ddl.sql +++ /dev/null @@ -1,4 +0,0 @@ --- It is used in TestNetTypes - -create external table IF NOT EXISTS table1 (id int, name text, score float, type text, addr inet4) using text -with ('text.delimiter'='|', 'text.null'='NULL') location ${table.path}; \ No newline at end of file diff --git a/tajo-core-tests/src/test/resources/queries/TestNetTypes/table2_ddl.sql b/tajo-core-tests/src/test/resources/queries/TestNetTypes/table2_ddl.sql deleted file mode 100644 index 40f0464174..0000000000 --- a/tajo-core-tests/src/test/resources/queries/TestNetTypes/table2_ddl.sql +++ /dev/null @@ -1,4 +0,0 @@ --- It is used in TestNetTypes - -create external table IF NOT EXISTS table2 (id int, name text, score float, type text, addr inet4) using text -with ('text.delimiter'='|', 'text.null'='NULL') location ${table.path}; \ No newline at end of file diff --git a/tajo-core-tests/src/test/resources/queries/TestNetTypes/testGroupby.sql b/tajo-core-tests/src/test/resources/queries/TestNetTypes/testGroupby.sql deleted file mode 100644 index 27353a90c6..0000000000 --- a/tajo-core-tests/src/test/resources/queries/TestNetTypes/testGroupby.sql +++ /dev/null @@ -1,8 +0,0 @@ -select - name, addr, count(1) -from - table1 -group by - name, addr -order by - name, addr; \ No newline at end of file diff --git a/tajo-core-tests/src/test/resources/queries/TestNetTypes/testGroupby2.sql b/tajo-core-tests/src/test/resources/queries/TestNetTypes/testGroupby2.sql deleted file mode 100644 index 6c3c357c03..0000000000 --- a/tajo-core-tests/src/test/resources/queries/TestNetTypes/testGroupby2.sql +++ /dev/null @@ -1,9 +0,0 @@ -select - addr, - count(*) -from - table1 -group by - addr -order by - addr; \ No newline at end of file diff --git a/tajo-core-tests/src/test/resources/queries/TestNetTypes/testJoin.sql b/tajo-core-tests/src/test/resources/queries/TestNetTypes/testJoin.sql deleted file mode 100644 index 22c97d5ea2..0000000000 --- a/tajo-core-tests/src/test/resources/queries/TestNetTypes/testJoin.sql +++ /dev/null @@ -1 +0,0 @@ -select t1.*,t2.* from table1 as t1, table2 as t2 where t1.addr = t2.addr order by t1.id, t1.name,t2. name; \ No newline at end of file diff --git a/tajo-core-tests/src/test/resources/queries/TestNetTypes/testSelect.sql b/tajo-core-tests/src/test/resources/queries/TestNetTypes/testSelect.sql deleted file mode 100644 index 1b28f06d25..0000000000 --- a/tajo-core-tests/src/test/resources/queries/TestNetTypes/testSelect.sql +++ /dev/null @@ -1 +0,0 @@ -select name, addr from table1; \ No newline at end of file diff --git a/tajo-core-tests/src/test/resources/queries/TestNetTypes/testSort.sql b/tajo-core-tests/src/test/resources/queries/TestNetTypes/testSort.sql deleted file mode 100644 index 2999a02ae9..0000000000 --- a/tajo-core-tests/src/test/resources/queries/TestNetTypes/testSort.sql +++ /dev/null @@ -1 +0,0 @@ -select * from table1 order by addr; \ No newline at end of file diff --git a/tajo-core-tests/src/test/resources/queries/TestNetTypes/testSort2.sql b/tajo-core-tests/src/test/resources/queries/TestNetTypes/testSort2.sql deleted file mode 100644 index b613d4aa1d..0000000000 --- a/tajo-core-tests/src/test/resources/queries/TestNetTypes/testSort2.sql +++ /dev/null @@ -1 +0,0 @@ -select addr from table2 order by addr; \ No newline at end of file From 513b111d3f1dc643283df2f9f60f400779692631 Mon Sep 17 00:00:00 2001 From: Jongyoung Park Date: Sun, 24 Apr 2016 15:46:10 +0900 Subject: [PATCH 9/9] misc. --- tajo-common/src/main/java/org/apache/tajo/storage/VTuple.java | 3 --- .../test/java/org/apache/tajo/storage/json/TestJsonSerDe.java | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/tajo-common/src/main/java/org/apache/tajo/storage/VTuple.java b/tajo-common/src/main/java/org/apache/tajo/storage/VTuple.java index cee769433e..dc7c15f245 100644 --- a/tajo-common/src/main/java/org/apache/tajo/storage/VTuple.java +++ b/tajo-common/src/main/java/org/apache/tajo/storage/VTuple.java @@ -23,11 +23,8 @@ import org.apache.tajo.datum.Datum; import org.apache.tajo.datum.IntervalDatum; import org.apache.tajo.datum.ProtobufDatum; -import org.apache.tajo.exception.NotImplementedException; -import org.apache.tajo.exception.TajoRuntimeException; import org.apache.tajo.util.datetime.TimeMeta; -import java.net.InetAddress; import java.util.Arrays; public class VTuple implements Tuple, Cloneable { diff --git a/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/json/TestJsonSerDe.java b/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/json/TestJsonSerDe.java index 74b0d87ec3..51269aeaaa 100644 --- a/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/json/TestJsonSerDe.java +++ b/tajo-storage/tajo-storage-hdfs/src/test/java/org/apache/tajo/storage/json/TestJsonSerDe.java @@ -87,7 +87,7 @@ public void testVarioutType() throws IOException { DatumFactory.createChar("hyunsik"), // 1 DatumFactory.createInt2((short) 17), // 2 DatumFactory.createInt4(59), // 3 - DatumFactory.createInt8(23l), // 4 + DatumFactory.createInt8(23L), // 4 DatumFactory.createFloat4(77.9f), // 5 DatumFactory.createFloat8(271.9d), // 6 DatumFactory.createText("hyunsik"), // 7