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 69206aa996..4b99d5646c 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 @@ -70,8 +70,6 @@ private static void putAcceptableType(TajoDataTypes.Type given, TajoDataTypes.Ty putAcceptableType(DATE, DATE); putAcceptableType(TEXT, TEXT); - - putAcceptableType(INET4, INET4); } public static boolean isUpperCastable(TajoDataTypes.Type define, TajoDataTypes.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 22dd5a4850..f15ce030a0 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 @@ -739,8 +739,6 @@ public enum Direction { TUtil.putToNestedMap(OPERATION_CASTING_MAP, Type.INTERVAL, Type.DATE, Type.TIMESTAMP); TUtil.putToNestedMap(CASTING_DIRECTION_MAP, Type.INTERVAL, Type.DATE, Direction.RHS); - - 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 fc6d3538d9..e77e7f9cb4 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-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 aac877b9f6..00a8b80065 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); @@ -386,22 +380,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); } @@ -445,8 +423,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/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/storage/VTuple.java b/tajo-common/src/main/java/org/apache/tajo/storage/VTuple.java index 0ad7202527..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 @@ -21,14 +21,10 @@ 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; -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 { @@ -177,22 +173,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/Inet4.java b/tajo-common/src/main/java/org/apache/tajo/type/Inet4.java deleted file mode 100644 index 541841ec07..0000000000 --- a/tajo-common/src/main/java/org/apache/tajo/type/Inet4.java +++ /dev/null @@ -1,27 +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 static org.apache.tajo.common.TajoDataTypes.Type.INET4; - -public class Inet4 extends Type { - public Inet4() { - super(INET4); - } -} 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 35d666c712..5479658e37 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 @@ -50,7 +50,6 @@ public abstract class Type implements Cloneable, ProtoObject { public static final Interval Interval = new Interval(); public static final Text Text = new Text(); public static final Blob Blob = new Blob(); - public static final Inet4 Inet4 = new Inet4(); protected TajoDataTypes.Type kind; diff --git a/tajo-common/src/main/java/org/apache/tajo/type/TypeFactory.java b/tajo-common/src/main/java/org/apache/tajo/type/TypeFactory.java index e2cf45b00f..24c46a9e14 100644 --- a/tajo-common/src/main/java/org/apache/tajo/type/TypeFactory.java +++ b/tajo-common/src/main/java/org/apache/tajo/type/TypeFactory.java @@ -70,8 +70,6 @@ public static Type create(TajoDataTypes.Type baseType) { return Type.Text; case BLOB: return Type.Blob; - case INET4: - return Type.Inet4; case RECORD: // for better exception throw new TajoRuntimeException(new NotImplementedException("record projection")); @@ -156,7 +154,6 @@ public static Type create(TajoDataTypes.Type baseType, case TIMESTAMP: return Type.Timestamp; case INTERVAL: return Type.Interval; case BLOB: return Type.Blob; - case INET4: return Type.Inet4; case ARRAY: { Assert.assertCondition(typeParams.size() == 1, diff --git a/tajo-common/src/main/proto/DataTypes.proto b/tajo-common/src/main/proto/DataTypes.proto index 360f59516b..ed1d065696 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/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-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..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 @@ -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) { @@ -617,13 +607,7 @@ 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)); + assertEquals(new ProtobufDatum(ProtoUtil.convertString(j + "")), tuple.getProtobufDatum(11)); } } } \ No newline at end of file diff --git a/tajo-common/src/test/java/org/apache/tajo/type/TestTypeEncoder.java b/tajo-common/src/test/java/org/apache/tajo/type/TestTypeEncoder.java index abd427a3ff..44d20845d0 100644 --- a/tajo-common/src/test/java/org/apache/tajo/type/TestTypeEncoder.java +++ b/tajo-common/src/test/java/org/apache/tajo/type/TestTypeEncoder.java @@ -34,7 +34,6 @@ import static org.apache.tajo.type.Type.Char; import static org.apache.tajo.type.Type.Float4; import static org.apache.tajo.type.Type.Float8; -import static org.apache.tajo.type.Type.Inet4; import static org.apache.tajo.type.Type.Int1; import static org.apache.tajo.type.Type.Int2; import static org.apache.tajo.type.Type.Int4; @@ -68,7 +67,6 @@ public final void testTypesWithoutParams() { assertSerialize(Float8); assertSerialize(Text); assertSerialize(Blob); - assertSerialize(Inet4); } @Test 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 27ad24b386..035ed721f9 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 ed5c3f8382..ce17ff0771 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 @@ -72,9 +72,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(); } @@ -126,7 +125,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 @@ -181,7 +180,6 @@ private static Tuple makeNullTuple(Tuple tuple) { NullDatum.get(), NullDatum.get(), NullDatum.get(), - NullDatum.get(), NullDatum.get() }); return tuple; @@ -195,7 +193,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()) }); @@ -206,7 +203,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)); } @@ -226,7 +223,6 @@ private static Tuple makeMaxTuple(Tuple tuple) { //DateTimeUtil.toJulianDate(JULIAN_MAXYEAR, 1, 1) DateTimeUtil.toJulianTimestamp(DateTimeConstants.JULIAN_MAXYEAR / 20, 1, 1, 0, 0, 0, 0)), DatumFactory.createTime(Long.MAX_VALUE), - DatumFactory.createInet4(Integer.MAX_VALUE), DatumFactory.createFloat4(Float.MAX_VALUE), DatumFactory.createFloat8(Double.MAX_VALUE) }); @@ -242,7 +238,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 3aee9bff8e..cdef49063b 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 @@ -326,8 +326,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/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/java/org/apache/tajo/engine/util/BenchmarkSort.java b/tajo-core-tests/src/test/java/org/apache/tajo/engine/util/BenchmarkSort.java index 2c67a2da19..7732b2858c 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 @@ -97,15 +97,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(BuiltinStorages.TEXT, conf); @@ -131,7 +130,6 @@ public void setup() throws Exception { NullDatum.get(), NullDatum.get(), NullDatum.get(), - NullDatum.get(), NullDatum.get() }); } else { @@ -142,7 +140,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-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 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 981370b83b..146c5f3ba6 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 @@ -391,7 +391,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 5e35239a84..caee46cfe5 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 @@ -194,14 +194,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 9d145737f4..ab5af05f12 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 @@ -107,7 +107,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 c41f1074b9..7c5b0918c4 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 @@ -114,10 +114,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 DATE: return new FieldDateConverter(parent); case TEXT: @@ -314,19 +310,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 FieldDateConverter 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 9fa9428f17..c4d413010c 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 @@ -187,10 +187,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 f65b52b483..2009b10e5f 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 @@ -147,8 +147,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 f1600c0677..1ca30996d1 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); @@ -135,7 +134,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; @@ -237,10 +235,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 b22254dd84..3099779b64 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 @@ -378,60 +378,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; @@ -1541,8 +1487,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 1ff32b88d6..5dedc2eae8 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; @@ -964,7 +963,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 0c8695c749..ad7df24984 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 @@ -59,7 +59,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[] { @@ -72,7 +71,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 }); } @@ -120,7 +118,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); 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 d8d77754f3..3e363406be 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 @@ -414,13 +414,12 @@ 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 (dateTypeSupport()) { - schemaBld.add("col11", Type.DATE); + schemaBld.add("col10", Type.DATE); } if (protoTypeSupport()) { - schemaBld.add("col12", CatalogUtil.newDataType(Type.PROTOBUF, TajoIdProtos.QueryIdProto.class.getName())); + schemaBld.add("col11", CatalogUtil.newDataType(Type.PROTOBUF, TajoIdProtos.QueryIdProto.class.getName())); } Schema schema = schemaBld.build(); @@ -438,7 +437,7 @@ public void testVariousTypes() throws IOException { QueryId queryid = new QueryId("12345", 5); - VTuple tuple = new VTuple(10 + (dateTypeSupport() ? 1 : 0) + (protoTypeSupport() ? 1 : 0)); + VTuple tuple = new VTuple(9 + (dateTypeSupport() ? 1 : 0) + (protoTypeSupport() ? 1 : 0)); tuple.put(new Datum[] { DatumFactory.createBool(true), DatumFactory.createChar("hyunsik"), @@ -449,10 +448,9 @@ public void testVariousTypes() throws IOException { DatumFactory.createFloat8(271.9f), DatumFactory.createText("hyunsik"), DatumFactory.createBlob("hyunsik".getBytes()), - DatumFactory.createInet4("192.168.0.1"), }); - short currentIdx = 10; + short currentIdx = 9; if (dateTypeSupport()) { tuple.put(currentIdx, DatumFactory.createDate(2016, 6, 28)); @@ -492,11 +490,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(); @@ -517,7 +514,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 @@ -529,11 +526,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 @@ -587,11 +583,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(); @@ -612,7 +607,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 @@ -624,11 +619,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 @@ -695,8 +689,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(); TableMeta meta = CatalogUtil.newTableMeta(dataFormat, conf); @@ -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(); TableMeta meta = CatalogUtil.newTableMeta(dataFormat, conf); @@ -786,7 +777,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); @@ -825,8 +815,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(); TableMeta meta = CatalogUtil.newTableMeta(dataFormat, conf); meta.putProperty(StorageConstants.SEQUENCEFILE_SERDE, TextSerializerDeserializer.class.getName()); @@ -849,7 +838,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); @@ -892,8 +880,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(); TableMeta meta = CatalogUtil.newTableMeta(dataFormat, conf); @@ -917,7 +904,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 8cf45861be..a4d424b554 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 @@ -57,8 +57,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(); } @@ -89,13 +88,12 @@ 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 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 569438e1f5..395b159db1 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)); 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" } ] }