You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tajo.apache.org by ji...@apache.org on 2016/05/16 02:59:31 UTC
[2/2] tajo git commit: TAJO-2130: Remove inet4 data type.
TAJO-2130: Remove inet4 data type.
Closes #1007
Signed-off-by: Jihoon Son <ji...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/f995e303
Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/f995e303
Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/f995e303
Branch: refs/heads/master
Commit: f995e303b5a82121fbf2ecc16e06541937a17fa1
Parents: 8d2bf40
Author: Jongyoung Park <em...@gmail.com>
Authored: Mon May 16 11:58:50 2016 +0900
Committer: Jihoon Son <ji...@apache.org>
Committed: Mon May 16 11:58:50 2016 +0900
----------------------------------------------------------------------
CHANGES | 3 +
.../main/java/org/apache/tajo/DataTypeUtil.java | 2 -
.../org/apache/tajo/catalog/CatalogUtil.java | 2 -
.../org/apache/tajo/catalog/SchemaUtil.java | 4 -
.../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/datum/Inet4Datum.java | 140 -------------------
.../java/org/apache/tajo/storage/VTuple.java | 20 ---
.../tuple/memory/CompactRowBlockWriter.java | 10 --
.../org/apache/tajo/tuple/memory/HeapTuple.java | 2 -
.../tajo/tuple/memory/OffHeapRowBlockUtils.java | 6 -
.../tajo/tuple/memory/OffHeapRowWriter.java | 5 -
.../org/apache/tajo/tuple/memory/RowWriter.java | 2 -
.../apache/tajo/tuple/memory/UnSafeTuple.java | 2 -
.../main/java/org/apache/tajo/type/Inet4.java | 27 ----
.../main/java/org/apache/tajo/type/Type.java | 1 -
.../java/org/apache/tajo/type/TypeFactory.java | 3 -
tajo-common/src/main/proto/DataTypes.proto | 3 -
.../org/apache/tajo/datum/TestInet4Datum.java | 98 -------------
.../tajo/tuple/memory/TestMemoryRowBlock.java | 26 +---
.../org/apache/tajo/type/TestTypeEncoder.java | 2 -
.../engine/codegen/TestEvalCodeGenerator.java | 8 --
.../planner/TestUniformRangePartition.java | 63 ---------
.../engine/planner/physical/TestRadixSort.java | 13 +-
.../tajo/engine/query/TestCreateTable.java | 2 -
.../apache/tajo/engine/query/TestNetTypes.java | 102 --------------
.../apache/tajo/engine/util/BenchmarkSort.java | 9 +-
.../apache/tajo/engine/util/TestTupleUtil.java | 2 -
.../queries/TestNetTypes/table1_ddl.sql | 4 -
.../queries/TestNetTypes/table2_ddl.sql | 4 -
.../queries/TestNetTypes/testGroupby.sql | 8 --
.../queries/TestNetTypes/testGroupby2.sql | 9 --
.../resources/queries/TestNetTypes/testJoin.sql | 1 -
.../queries/TestNetTypes/testSelect.sql | 1 -
.../resources/queries/TestNetTypes/testSort.sql | 1 -
.../queries/TestNetTypes/testSort2.sql | 1 -
.../tajo/engine/codegen/EvalCodeGenerator.java | 1 -
.../engine/codegen/TajoGeneratorAdapter.java | 9 +-
.../function/geoip/GeoIPCountryInet4.java | 54 -------
.../function/geoip/GeoIPInCountryInet4.java | 61 --------
.../engine/planner/RangePartitionAlgorithm.java | 7 -
.../engine/planner/UniformRangePartition.java | 42 +-----
.../planner/physical/ComparableVector.java | 11 +-
.../planner/physical/ExternalSortExec.java | 3 -
.../tajo/engine/planner/physical/RadixSort.java | 3 -
.../org/apache/tajo/parser/sql/SQLAnalyzer.java | 6 -
.../plan/function/stream/CSVLineSerializer.java | 2 -
.../stream/TextFieldSerializerDeserializer.java | 6 -
.../tajo/plan/verifier/ExprsVerifier.java | 8 --
.../plan/util/TestWritableTypeConverter.java | 10 --
.../org/apache/tajo/parser/sql/SQLLexer.g4 | 2 -
.../org/apache/tajo/parser/sql/SQLParser.g4 | 5 -
.../storage/BinarySerializerDeserializer.java | 5 -
.../org/apache/tajo/storage/RowStoreUtil.java | 16 ---
.../storage/TextSerializerDeserializer.java | 6 -
.../org/apache/tajo/storage/TestFrameTuple.java | 18 ++-
.../org/apache/tajo/storage/TestLazyTuple.java | 14 +-
.../java/org/apache/tajo/storage/RawFile.java | 4 -
.../java/org/apache/tajo/storage/RowFile.java | 13 --
.../apache/tajo/storage/avro/AvroScanner.java | 7 +-
.../tajo/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 -
.../tajo/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 --------
.../tajo/storage/thirdparty/orc/WriterImpl.java | 3 +-
.../tajo/storage/TestDelimitedTextFile.java | 4 +-
.../org/apache/tajo/storage/TestStorages.java | 48 +++----
.../apache/tajo/storage/json/TestJsonSerDe.java | 8 +-
.../storage/parquet/TestSchemaConverter.java | 2 -
.../tajo/storage/raw/TestDirectRawFile.java | 21 +--
.../resources/dataset/testVariousTypes.avsc | 3 +-
80 files changed, 61 insertions(+), 1074 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tajo/blob/f995e303/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 840ba56..182f1d5 100644
--- a/CHANGES
+++ b/CHANGES
@@ -365,6 +365,9 @@ Release 0.12.0 - unreleased
SUB TASKS
+ TAJO-2130: Remove inet4 data type.
+ (Contributed by Jongyoung Park. Committed by jihoon)
+
TAJO-1997: Registering UDF, it needs to check duplication.
(Contributed by Jongyoung Park. Committed by jihoon)
http://git-wip-us.apache.org/repos/asf/tajo/blob/f995e303/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/DataTypeUtil.java
----------------------------------------------------------------------
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 69206aa..4b99d56 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 @@ public class DataTypeUtil {
putAcceptableType(DATE, DATE);
putAcceptableType(TEXT, TEXT);
-
- putAcceptableType(INET4, INET4);
}
public static boolean isUpperCastable(TajoDataTypes.Type define, TajoDataTypes.Type given) {
http://git-wip-us.apache.org/repos/asf/tajo/blob/f995e303/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/CatalogUtil.java
----------------------------------------------------------------------
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 22dd5a4..f15ce03 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 class CatalogUtil {
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
http://git-wip-us.apache.org/repos/asf/tajo/blob/f995e303/tajo-catalog/tajo-catalog-common/src/main/java/org/apache/tajo/catalog/SchemaUtil.java
----------------------------------------------------------------------
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 fc6d353..e77e7f9 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 class SchemaUtil {
return 4;
case FLOAT8:
return 8;
- case INET4:
- return 4;
- case INET6:
- return 16;
case TEXT:
return 256;
case BLOB:
http://git-wip-us.apache.org/repos/asf/tajo/blob/f995e303/tajo-client/src/main/java/org/apache/tajo/storage/RowStoreUtil.java
----------------------------------------------------------------------
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 bc23af8..3618324 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 class RowStoreUtil {
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 class RowStoreUtil {
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 @@ public class RowStoreUtil {
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() + "'"));
http://git-wip-us.apache.org/repos/asf/tajo/blob/f995e303/tajo-common/src/main/java/org/apache/tajo/common/type/TajoTypeUtil.java
----------------------------------------------------------------------
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 ecaeeb1..bbab9de 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 class TajoTypeUtil {
case DATE:
case TIME:
case TIMESTAMP:
- case INET4:
case VARCHAR:
case CHAR:
case TEXT: return false;
http://git-wip-us.apache.org/repos/asf/tajo/blob/f995e303/tajo-common/src/main/java/org/apache/tajo/datum/DatumFactory.java
----------------------------------------------------------------------
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 aac877b..00a8b80 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 class DatumFactory {
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 class DatumFactory {
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 class DatumFactory {
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 class DatumFactory {
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 class DatumFactory {
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:
http://git-wip-us.apache.org/repos/asf/tajo/blob/f995e303/tajo-common/src/main/java/org/apache/tajo/datum/Inet4Datum.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 ab1799b..0000000
--- 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);
- }
-}
http://git-wip-us.apache.org/repos/asf/tajo/blob/f995e303/tajo-common/src/main/java/org/apache/tajo/storage/VTuple.java
----------------------------------------------------------------------
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 0ad7202..dc7c15f 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 @@ package org.apache.tajo.storage;
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 class VTuple implements Tuple, Cloneable {
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();
http://git-wip-us.apache.org/repos/asf/tajo/blob/f995e303/tajo-common/src/main/java/org/apache/tajo/tuple/memory/CompactRowBlockWriter.java
----------------------------------------------------------------------
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 67d5f8c..c74eb75 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
@@ -406,16 +406,6 @@ public class CompactRowBlockWriter implements RowWriter {
}
@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());
}
http://git-wip-us.apache.org/repos/asf/tajo/blob/f995e303/tajo-common/src/main/java/org/apache/tajo/tuple/memory/HeapTuple.java
----------------------------------------------------------------------
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 330b363..1a0c67f 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 class HeapTuple extends ZeroCopyTuple implements Cloneable {
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:
http://git-wip-us.apache.org/repos/asf/tajo/blob/f995e303/tajo-common/src/main/java/org/apache/tajo/tuple/memory/OffHeapRowBlockUtils.java
----------------------------------------------------------------------
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 3f27763..82f1913 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 class OffHeapRowBlockUtils {
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 @@ public class OffHeapRowBlockUtils {
case PROTOBUF:
writer.putProtoDatum((ProtobufDatum) tuple.getProtobufDatum(colIdx));
break;
- case INET4:
- writer.putInet4(tuple.getInt4(colIdx));
- break;
case NULL_TYPE:
writer.skipField();
break;
http://git-wip-us.apache.org/repos/asf/tajo/blob/f995e303/tajo-common/src/main/java/org/apache/tajo/tuple/memory/OffHeapRowWriter.java
----------------------------------------------------------------------
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 e992aed..d555c79 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
@@ -295,11 +295,6 @@ public abstract class OffHeapRowWriter implements RowWriter {
}
@Override
- public void putInet4(int val) {
- putInt4(val);
- }
-
- @Override
public void putProtoDatum(ProtobufDatum val) {
putBlob(val.asByteArray());
}
http://git-wip-us.apache.org/repos/asf/tajo/blob/f995e303/tajo-common/src/main/java/org/apache/tajo/tuple/memory/RowWriter.java
----------------------------------------------------------------------
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 e055ab7..edeb8a7 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);
http://git-wip-us.apache.org/repos/asf/tajo/blob/f995e303/tajo-common/src/main/java/org/apache/tajo/tuple/memory/UnSafeTuple.java
----------------------------------------------------------------------
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 dcff801..4e9ecb4 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 class UnSafeTuple extends ZeroCopyTuple {
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:
http://git-wip-us.apache.org/repos/asf/tajo/blob/f995e303/tajo-common/src/main/java/org/apache/tajo/type/Inet4.java
----------------------------------------------------------------------
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 541841e..0000000
--- 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);
- }
-}
http://git-wip-us.apache.org/repos/asf/tajo/blob/f995e303/tajo-common/src/main/java/org/apache/tajo/type/Type.java
----------------------------------------------------------------------
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 35d666c..5479658 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<TypeProto> {
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;
http://git-wip-us.apache.org/repos/asf/tajo/blob/f995e303/tajo-common/src/main/java/org/apache/tajo/type/TypeFactory.java
----------------------------------------------------------------------
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 e2cf45b..24c46a9 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 class TypeFactory {
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 class TypeFactory {
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,
http://git-wip-us.apache.org/repos/asf/tajo/blob/f995e303/tajo-common/src/main/proto/DataTypes.proto
----------------------------------------------------------------------
diff --git a/tajo-common/src/main/proto/DataTypes.proto b/tajo-common/src/main/proto/DataTypes.proto
index 360f595..ed1d065 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;
http://git-wip-us.apache.org/repos/asf/tajo/blob/f995e303/tajo-common/src/test/java/org/apache/tajo/datum/TestInet4Datum.java
----------------------------------------------------------------------
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 14ebc7c..0000000
--- 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());
- }
-}
http://git-wip-us.apache.org/repos/asf/tajo/blob/f995e303/tajo-common/src/test/java/org/apache/tajo/tuple/memory/TestMemoryRowBlock.java
----------------------------------------------------------------------
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 780f97f..6a9be2e 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 class TestMemoryRowBlock {
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 class TestMemoryRowBlock {
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 class TestMemoryRowBlock {
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 class TestMemoryRowBlock {
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 class TestMemoryRowBlock {
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
http://git-wip-us.apache.org/repos/asf/tajo/blob/f995e303/tajo-common/src/test/java/org/apache/tajo/type/TestTypeEncoder.java
----------------------------------------------------------------------
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 abd427a..44d2084 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.Bool;
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 abstract class TestTypeEncoder {
assertSerialize(Float8);
assertSerialize(Text);
assertSerialize(Blob);
- assertSerialize(Inet4);
}
@Test
http://git-wip-us.apache.org/repos/asf/tajo/blob/f995e303/tajo-core-tests/src/test/java/org/apache/tajo/engine/codegen/TestEvalCodeGenerator.java
----------------------------------------------------------------------
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 27ad24b..035ed72 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 class TestEvalCodeGenerator extends ExprTestBase {
@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 class TestEvalCodeGenerator extends ExprTestBase {
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"});
http://git-wip-us.apache.org/repos/asf/tajo/blob/f995e303/tajo-core-tests/src/test/java/org/apache/tajo/engine/planner/TestUniformRangePartition.java
----------------------------------------------------------------------
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 f57f5f2..fbdc321 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
@@ -845,40 +845,6 @@ public class TestUniformRangePartition {
}
@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()
.add("l_returnflag", Type.TEXT)
@@ -1133,33 +1099,4 @@ public class TestUniformRangePartition {
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) {
- assertTrue(prev.compareTo(r) < 0);
- }
- prev = r;
- }
- }
}
http://git-wip-us.apache.org/repos/asf/tajo/blob/f995e303/tajo-core-tests/src/test/java/org/apache/tajo/engine/planner/physical/TestRadixSort.java
----------------------------------------------------------------------
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 ed5c3f8..ce17ff0 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 class TestRadixSort {
@Before
public void setup() {
- List<DataType> dataTypeList = schema.getRootColumns().stream().map(c -> c.getDataType()).collect(Collectors.toList());
+ List<DataType> 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 @@ public class TestRadixSort {
NullDatum.get(),
NullDatum.get(),
NullDatum.get(),
- NullDatum.get(),
NullDatum.get()
});
return tuple;
@@ -195,7 +193,6 @@ public class TestRadixSort {
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 @@ public class TestRadixSort {
}
}
- 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 @@ public class TestRadixSort {
//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 @@ public class TestRadixSort {
DatumFactory.createDate(0),
DatumFactory.createTimestamp(0),
DatumFactory.createTime(0),
- DatumFactory.createInet4(Integer.MIN_VALUE),
DatumFactory.createFloat4(Float.MIN_VALUE),
DatumFactory.createFloat8(Double.MIN_VALUE)
});
http://git-wip-us.apache.org/repos/asf/tajo/blob/f995e303/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestCreateTable.java
----------------------------------------------------------------------
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 3aee9bf..cdef490 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 class TestCreateTable extends QueryTestCaseBase {
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");
http://git-wip-us.apache.org/repos/asf/tajo/blob/f995e303/tajo-core-tests/src/test/java/org/apache/tajo/engine/query/TestNetTypes.java
----------------------------------------------------------------------
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 bd8f830..0000000
--- 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);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/tajo/blob/f995e303/tajo-core-tests/src/test/java/org/apache/tajo/engine/util/BenchmarkSort.java
----------------------------------------------------------------------
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 2c67a2d..7732b28 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 class BenchmarkSort {
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 class BenchmarkSort {
NullDatum.get(),
NullDatum.get(),
NullDatum.get(),
- NullDatum.get(),
NullDatum.get()
});
} else {
@@ -142,7 +140,6 @@ public class BenchmarkSort {
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()),
http://git-wip-us.apache.org/repos/asf/tajo/blob/f995e303/tajo-core-tests/src/test/java/org/apache/tajo/engine/util/TestTupleUtil.java
----------------------------------------------------------------------
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 dff63c4..a58744f 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 class TestTupleUtil {
.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 class TestTupleUtil {
DatumFactory.createFloat8(271.9f),
DatumFactory.createText("hyunsik"),
DatumFactory.createBlob("hyunsik".getBytes()),
- DatumFactory.createInet4("192.168.0.1")
});
RowStoreEncoder encoder = RowStoreUtil.createEncoder(schema);
http://git-wip-us.apache.org/repos/asf/tajo/blob/f995e303/tajo-core-tests/src/test/resources/queries/TestNetTypes/table1_ddl.sql
----------------------------------------------------------------------
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 b4cc87e..0000000
--- 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
http://git-wip-us.apache.org/repos/asf/tajo/blob/f995e303/tajo-core-tests/src/test/resources/queries/TestNetTypes/table2_ddl.sql
----------------------------------------------------------------------
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 40f0464..0000000
--- 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
http://git-wip-us.apache.org/repos/asf/tajo/blob/f995e303/tajo-core-tests/src/test/resources/queries/TestNetTypes/testGroupby.sql
----------------------------------------------------------------------
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 27353a9..0000000
--- 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
http://git-wip-us.apache.org/repos/asf/tajo/blob/f995e303/tajo-core-tests/src/test/resources/queries/TestNetTypes/testGroupby2.sql
----------------------------------------------------------------------
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 6c3c357..0000000
--- 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
http://git-wip-us.apache.org/repos/asf/tajo/blob/f995e303/tajo-core-tests/src/test/resources/queries/TestNetTypes/testJoin.sql
----------------------------------------------------------------------
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 22c97d5..0000000
--- 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
http://git-wip-us.apache.org/repos/asf/tajo/blob/f995e303/tajo-core-tests/src/test/resources/queries/TestNetTypes/testSelect.sql
----------------------------------------------------------------------
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 1b28f06..0000000
--- 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
http://git-wip-us.apache.org/repos/asf/tajo/blob/f995e303/tajo-core-tests/src/test/resources/queries/TestNetTypes/testSort.sql
----------------------------------------------------------------------
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 2999a02..0000000
--- 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
http://git-wip-us.apache.org/repos/asf/tajo/blob/f995e303/tajo-core-tests/src/test/resources/queries/TestNetTypes/testSort2.sql
----------------------------------------------------------------------
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 b613d4a..0000000
--- 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
http://git-wip-us.apache.org/repos/asf/tajo/blob/f995e303/tajo-core/src/main/java/org/apache/tajo/engine/codegen/EvalCodeGenerator.java
----------------------------------------------------------------------
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 981370b..146c5f3 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 class EvalCodeGenerator extends SimpleEvalNodeVisitor<EvalCodeGenContext>
case INT2:
case INT4:
case DATE:
- case INET4:
methodName = "getInt4";
returnType = int.class;
paramTypes = new Class [] {int.class};
http://git-wip-us.apache.org/repos/asf/tajo/blob/f995e303/tajo-core/src/main/java/org/apache/tajo/engine/codegen/TajoGeneratorAdapter.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/codegen/TajoGeneratorAdapter.java b/tajo-core/src/main/java/org/apache/tajo/engine/codegen/TajoGeneratorAdapter.java
index d11701b..4a8d89c 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/codegen/TajoGeneratorAdapter.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/codegen/TajoGeneratorAdapter.java
@@ -163,7 +163,7 @@ class TajoGeneratorAdapter {
public static boolean isJVMInternalInt(org.apache.tajo.type.Type type) {
final TajoDataTypes.Type baseType = type.kind();
- return baseType == BOOLEAN || baseType == INT1 || baseType == INT2 || baseType == INT4 || baseType== INET4;
+ return baseType == BOOLEAN || baseType == INT1 || baseType == INT2 || baseType == INT4;
}
public static int getWordSize(org.apache.tajo.type.Type type) {
@@ -289,7 +289,6 @@ class TajoGeneratorAdapter {
case INT1:
case INT2:
case INT4:
- case INET4:
methodvisitor.visitVarInsn(Opcodes.ILOAD, idx);
break;
case INT8:
@@ -715,11 +714,6 @@ class TajoGeneratorAdapter {
returnType = null;
paramTypes = null;
break;
- case INET4:
- convertMethod = "createInet4";
- returnType = Inet4Datum.class;
- paramTypes = new Class[] {int.class};
- break;
default:
throw new RuntimeException("Unsupported type: " + type);
}
@@ -902,7 +896,6 @@ class TajoGeneratorAdapter {
case INT1:
case INT2:
case INT4:
- case INET4:
methodvisitor.visitVarInsn(Opcodes.ISTORE, varId);
break;
case TIME:
http://git-wip-us.apache.org/repos/asf/tajo/blob/f995e303/tajo-core/src/main/java/org/apache/tajo/engine/function/geoip/GeoIPCountryInet4.java
----------------------------------------------------------------------
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 8e69766..0000000
--- 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)));
- }
-}
http://git-wip-us.apache.org/repos/asf/tajo/blob/f995e303/tajo-core/src/main/java/org/apache/tajo/engine/function/geoip/GeoIPInCountryInet4.java
----------------------------------------------------------------------
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 9167356..0000000
--- 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));
- }
-}
http://git-wip-us.apache.org/repos/asf/tajo/blob/f995e303/tajo-core/src/main/java/org/apache/tajo/engine/planner/RangePartitionAlgorithm.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/planner/RangePartitionAlgorithm.java b/tajo-core/src/main/java/org/apache/tajo/engine/planner/RangePartitionAlgorithm.java
index 840561f..9c04a1a 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/planner/RangePartitionAlgorithm.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/planner/RangePartitionAlgorithm.java
@@ -171,13 +171,6 @@ public abstract class RangePartitionAlgorithm {
columnCard = BigInteger.valueOf(start.getInt4(i) - end.getInt4(i));
}
break;
- case INET4:
- if (isAscending) {
- columnCard = BigInteger.valueOf(end.getInt4(i) - start.getInt4(i));
- } else {
- columnCard = BigInteger.valueOf(start.getInt4(i) - end.getInt4(i));
- }
- break;
default:
throw new UnsupportedOperationException(dataType + " is not supported yet");
}
http://git-wip-us.apache.org/repos/asf/tajo/blob/f995e303/tajo-core/src/main/java/org/apache/tajo/engine/planner/UniformRangePartition.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/planner/UniformRangePartition.java b/tajo-core/src/main/java/org/apache/tajo/engine/planner/UniformRangePartition.java
index 0b8199f..d9b8148 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/planner/UniformRangePartition.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/planner/UniformRangePartition.java
@@ -328,25 +328,6 @@ public class UniformRangePartition extends RangePartitionAlgorithm {
}
}
}
- case INET4: {
- int candidateIntVal;
- byte[] candidateBytesVal = new byte[4];
- if (sortSpecs[colId].isAscending()) {
- candidateIntVal = incDecimal.intValue() + tuple.getInt4(i);
- if (candidateIntVal - incDecimal.intValue() != tuple.getInt4(i)) {
- return true;
- }
- Bytes.putInt(candidateBytesVal, 0, candidateIntVal);
- return Bytes.compareTo(mergedRange.getEnd().getBytes(colId), candidateBytesVal) < 0;
- } else {
- candidateIntVal = tuple.getInt4(i) - incDecimal.intValue();
- if (candidateIntVal + incDecimal.intValue() != tuple.getInt4(i)) {
- return true;
- }
- Bytes.putInt(candidateBytesVal, 0, candidateIntVal);
- return Bytes.compareTo(candidateBytesVal, mergedRange.getEnd().getBytes(colId)) < 0;
- }
- }
}
return overflow;
}
@@ -376,8 +357,7 @@ public class UniformRangePartition extends RangePartitionAlgorithm {
}
case TIME:
case TIMESTAMP:
- case INT8:
- case INET4: {
+ case INT8: {
long candidate = last.getInt8(colId) + inc;
long end = mergedRange.getEnd().getInt8(colId);
reminder = candidate - end;
@@ -667,26 +647,6 @@ public class UniformRangePartition extends RangePartitionAlgorithm {
}
}
break;
- case INET4:
- byte[] ipBytes;
- if (overflowFlag[i]) {
- ipBytes = mergedRange.getStart().getBytes(i);
- assert ipBytes.length == 4;
- end.put(i, DatumFactory.createInet4(ipBytes));
- } else {
- if (sortSpecs[i].isAscending()) {
- int lastVal = last.getInt4(i) + incs[i].intValue();
- ipBytes = new byte[4];
- Bytes.putInt(ipBytes, 0, lastVal);
- end.put(i, DatumFactory.createInet4(ipBytes));
- } else {
- int lastVal = last.getInt4(i) - incs[i].intValue();
- ipBytes = new byte[4];
- Bytes.putInt(ipBytes, 0, lastVal);
- end.put(i, DatumFactory.createInet4(ipBytes));
- }
- }
- break;
default:
throw new UnsupportedOperationException(column.getDataType() + " is not supported yet");
}
http://git-wip-us.apache.org/repos/asf/tajo/blob/f995e303/tajo-core/src/main/java/org/apache/tajo/engine/planner/physical/ComparableVector.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/planner/physical/ComparableVector.java b/tajo-core/src/main/java/org/apache/tajo/engine/planner/physical/ComparableVector.java
index d1be572..3c78a64 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/planner/physical/ComparableVector.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/planner/physical/ComparableVector.java
@@ -203,8 +203,7 @@ public class ComparableVector {
case INT1:
case INT2: keys[i] = tuple.getInt2(field); break;
case INT4:
- case DATE:
- case INET4: keys[i] = tuple.getInt4(field); break;
+ case DATE: keys[i] = tuple.getInt4(field); break;
case INT8:
case TIME:
case TIMESTAMP: keys[i] = tuple.getInt8(field); break;
@@ -262,8 +261,7 @@ public class ComparableVector {
case INT1:
case INT2: if ((Short)keys[i] != tuple.getInt2(field)) return false; continue;
case INT4:
- case DATE:
- case INET4: if ((Integer)keys[i] != tuple.getInt4(field)) return false; continue;
+ case DATE: if ((Integer)keys[i] != tuple.getInt4(field)) return false; continue;
case INT8:
case TIME:
case TIMESTAMP: if ((Long)keys[i] != tuple.getInt8(field)) return false; continue;
@@ -311,7 +309,6 @@ public class ComparableVector {
case INT2: return DatumFactory.createInt2((Short) keys[i]);
case INT4: return DatumFactory.createInt4((Integer) keys[i]);
case DATE: return DatumFactory.createDate((Integer) keys[i]);
- case INET4: return DatumFactory.createInet4((Integer) keys[i]);
case INT8: return DatumFactory.createInt8((Long) keys[i]);
case TIME: return DatumFactory.createTime((Long) keys[i]);
case TIMESTAMP: return DatumFactory.createTimestamp((Long) keys[i]);
@@ -351,7 +348,6 @@ public class ComparableVector {
case FLOAT4: return 5;
case FLOAT8: return 6;
case TEXT: case CHAR: case BLOB: return 7;
- case INET4: return 8;
case NULL_TYPE: return -1;
default:
throw new TajoRuntimeException(new UnsupportedException("data type '" + type.name() + "'"));
@@ -383,7 +379,6 @@ public class ComparableVector {
case TEXT: return TupleType.TEXT;
case CHAR: return TupleType.CHAR;
case BLOB: return TupleType.BLOB;
- case INET4: return TupleType.INET4;
case NULL_TYPE: return TupleType.NULL_TYPE;
default: return TupleType.DATUM;
}
@@ -398,7 +393,7 @@ public class ComparableVector {
}
private static enum TupleType {
- NULL_TYPE, BOOLEAN, BIT, INT1, INT2, INT4, DATE, INET4, INT8, TIME, TIMESTAMP,
+ NULL_TYPE, BOOLEAN, BIT, INT1, INT2, INT4, DATE, INT8, TIME, TIMESTAMP,
FLOAT4, FLOAT8, TEXT, CHAR, BLOB, DATUM
}
}
http://git-wip-us.apache.org/repos/asf/tajo/blob/f995e303/tajo-core/src/main/java/org/apache/tajo/engine/planner/physical/ExternalSortExec.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/planner/physical/ExternalSortExec.java b/tajo-core/src/main/java/org/apache/tajo/engine/planner/physical/ExternalSortExec.java
index ae16667..3d2de28 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/planner/physical/ExternalSortExec.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/planner/physical/ExternalSortExec.java
@@ -1071,9 +1071,6 @@ public class ExternalSortExec extends SortExec {
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:
http://git-wip-us.apache.org/repos/asf/tajo/blob/f995e303/tajo-core/src/main/java/org/apache/tajo/engine/planner/physical/RadixSort.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/engine/planner/physical/RadixSort.java b/tajo-core/src/main/java/org/apache/tajo/engine/planner/physical/RadixSort.java
index e804941..780ef54 100644
--- a/tajo-core/src/main/java/org/apache/tajo/engine/planner/physical/RadixSort.java
+++ b/tajo-core/src/main/java/org/apache/tajo/engine/planner/physical/RadixSort.java
@@ -162,7 +162,6 @@ public class RadixSort {
case FLOAT8:
return true;
case DATE:
- case INET4:
return false;
default:
throw new TajoInternalError(new UnsupportedException(type.name()));
@@ -884,8 +883,6 @@ public class RadixSort {
case INT8:
case FLOAT8:
return 8;
- case INET4:
- return 4;
case DATE:
return 4;
case TIME:
http://git-wip-us.apache.org/repos/asf/tajo/blob/f995e303/tajo-core/src/main/java/org/apache/tajo/parser/sql/SQLAnalyzer.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/main/java/org/apache/tajo/parser/sql/SQLAnalyzer.java b/tajo-core/src/main/java/org/apache/tajo/parser/sql/SQLAnalyzer.java
index 5c9a9db..6ffe65b 100644
--- a/tajo-core/src/main/java/org/apache/tajo/parser/sql/SQLAnalyzer.java
+++ b/tajo-core/src/main/java/org/apache/tajo/parser/sql/SQLAnalyzer.java
@@ -1607,15 +1607,9 @@ public class SQLAnalyzer extends SQLParserBaseVisitor<Expr> {
typeDefinition = new DataTypeExpr(Type.BINARY.name());
}
-
if (checkIfExist(binaryType.type_length())) {
typeDefinition.setLengthOrPrecision(Integer.parseInt(binaryType.type_length().NUMBER().getText()));
}
-
- // inet
- } else if (checkIfExist(predefined_type.network_type())) {
- typeDefinition = new DataTypeExpr(Type.INET4.name());
-
} else if (checkIfExist(predefined_type.complex_type())) {
Complex_typeContext complexType = predefined_type.complex_type();
http://git-wip-us.apache.org/repos/asf/tajo/blob/f995e303/tajo-plan/src/main/java/org/apache/tajo/plan/function/stream/CSVLineSerializer.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/function/stream/CSVLineSerializer.java b/tajo-plan/src/main/java/org/apache/tajo/plan/function/stream/CSVLineSerializer.java
index 08874fd..9371b36 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/function/stream/CSVLineSerializer.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/function/stream/CSVLineSerializer.java
@@ -139,8 +139,6 @@ public class CSVLineSerializer extends TextLineSerializer {
case TIMESTAMP:
return "T";
case BLOB:
- case INET4:
- case INET6:
return "A";
default:
throw new TajoRuntimeException(new UnsupportedException("data type '" + val.type().name() + "'"));
http://git-wip-us.apache.org/repos/asf/tajo/blob/f995e303/tajo-plan/src/main/java/org/apache/tajo/plan/function/stream/TextFieldSerializerDeserializer.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/function/stream/TextFieldSerializerDeserializer.java b/tajo-plan/src/main/java/org/apache/tajo/plan/function/stream/TextFieldSerializerDeserializer.java
index 9638634..7bcb694 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/function/stream/TextFieldSerializerDeserializer.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/function/stream/TextFieldSerializerDeserializer.java
@@ -105,7 +105,6 @@ public class TextFieldSerializerDeserializer implements FieldSerializerDeseriali
case INT8:
case FLOAT4:
case FLOAT8:
- case INET4:
case DATE:
case INTERVAL:
bytes = datum.asTextBytes();
@@ -123,7 +122,6 @@ public class TextFieldSerializerDeserializer implements FieldSerializerDeseriali
length = bytes.length;
out.write(bytes);
break;
- case INET6:
case BLOB:
bytes = Base64.encodeBase64(datum.asByteArray(), false);
length = bytes.length;
@@ -229,10 +227,6 @@ public class TextFieldSerializerDeserializer implements FieldSerializerDeseriali
}
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);
http://git-wip-us.apache.org/repos/asf/tajo/blob/f995e303/tajo-plan/src/main/java/org/apache/tajo/plan/verifier/ExprsVerifier.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/main/java/org/apache/tajo/plan/verifier/ExprsVerifier.java b/tajo-plan/src/main/java/org/apache/tajo/plan/verifier/ExprsVerifier.java
index 1cf3f9c..ef10444 100644
--- a/tajo-plan/src/main/java/org/apache/tajo/plan/verifier/ExprsVerifier.java
+++ b/tajo-plan/src/main/java/org/apache/tajo/plan/verifier/ExprsVerifier.java
@@ -74,10 +74,6 @@ public class ExprsVerifier extends BasicEvalNodeVisitor<VerificationState, EvalN
return true;
}
- if (checkNetworkType(dataType1) && checkNetworkType(dataType2)) {
- return true;
- }
-
return false;
}
@@ -178,10 +174,6 @@ public class ExprsVerifier extends BasicEvalNodeVisitor<VerificationState, EvalN
}
}
- private static boolean checkNetworkType(org.apache.tajo.type.Type dataType) {
- return dataType.kind() == INET4 || dataType.kind() == INET6;
- }
-
private static boolean checkIntType(org.apache.tajo.type.Type dataType) {
int typeNumber = dataType.kind().getNumber();
return INT1.getNumber() < typeNumber && typeNumber <= INT8.getNumber();
http://git-wip-us.apache.org/repos/asf/tajo/blob/f995e303/tajo-plan/src/test/java/org/apache/tajo/plan/util/TestWritableTypeConverter.java
----------------------------------------------------------------------
diff --git a/tajo-plan/src/test/java/org/apache/tajo/plan/util/TestWritableTypeConverter.java b/tajo-plan/src/test/java/org/apache/tajo/plan/util/TestWritableTypeConverter.java
index 306cbe3..4cb7e09 100644
--- a/tajo-plan/src/test/java/org/apache/tajo/plan/util/TestWritableTypeConverter.java
+++ b/tajo-plan/src/test/java/org/apache/tajo/plan/util/TestWritableTypeConverter.java
@@ -23,7 +23,6 @@ import org.apache.hadoop.hive.serde2.io.TimestampWritable;
import org.apache.hadoop.io.Writable;
import org.apache.tajo.datum.DateDatum;
import org.apache.tajo.datum.Datum;
-import org.apache.tajo.datum.Inet4Datum;
import org.apache.tajo.datum.TimestampDatum;
import org.apache.tajo.exception.NotImplementedException;
import org.apache.tajo.exception.TajoRuntimeException;
@@ -83,14 +82,5 @@ public class TestWritableTypeConverter {
} catch (Exception e) {
assertEquals(UnsupportedDataTypeException.class, e.getClass());
}
-
- try {
- WritableTypeConverter.convertDatum2Writable(new Inet4Datum("11.11.11.11"));
- } catch (Exception e) {
- assertEquals(TajoRuntimeException.class, e.getClass());
-
- TajoRuntimeException runtimeException = (TajoRuntimeException)e;
- assertEquals(NotImplementedException.class, runtimeException.getCause().getClass());
- }
}
}
http://git-wip-us.apache.org/repos/asf/tajo/blob/f995e303/tajo-sql-parser/src/main/antlr4/org/apache/tajo/parser/sql/SQLLexer.g4
----------------------------------------------------------------------
diff --git a/tajo-sql-parser/src/main/antlr4/org/apache/tajo/parser/sql/SQLLexer.g4 b/tajo-sql-parser/src/main/antlr4/org/apache/tajo/parser/sql/SQLLexer.g4
index db2bfda..93601cc 100644
--- a/tajo-sql-parser/src/main/antlr4/org/apache/tajo/parser/sql/SQLLexer.g4
+++ b/tajo-sql-parser/src/main/antlr4/org/apache/tajo/parser/sql/SQLLexer.g4
@@ -381,8 +381,6 @@ VARBINARY : V A R B I N A R Y;
BLOB : B L O B;
BYTEA : B Y T E A; // alias for BLOB
-INET4 : I N E T '4';
-
// complex types
ARRAY : A R R A Y;
MAP : M A P;
http://git-wip-us.apache.org/repos/asf/tajo/blob/f995e303/tajo-sql-parser/src/main/antlr4/org/apache/tajo/parser/sql/SQLParser.g4
----------------------------------------------------------------------
diff --git a/tajo-sql-parser/src/main/antlr4/org/apache/tajo/parser/sql/SQLParser.g4 b/tajo-sql-parser/src/main/antlr4/org/apache/tajo/parser/sql/SQLParser.g4
index b76b5d9..213024c 100644
--- a/tajo-sql-parser/src/main/antlr4/org/apache/tajo/parser/sql/SQLParser.g4
+++ b/tajo-sql-parser/src/main/antlr4/org/apache/tajo/parser/sql/SQLParser.g4
@@ -441,7 +441,6 @@ predefined_type
| datetime_type
| bit_type
| binary_type
- | network_type
| complex_type
;
@@ -534,10 +533,6 @@ binary_type
| VARBINARY type_length?
;
-network_type
- : INET4
- ;
-
complex_type
: array_type
| record_type
http://git-wip-us.apache.org/repos/asf/tajo/blob/f995e303/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/BinarySerializerDeserializer.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/BinarySerializerDeserializer.java b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/BinarySerializerDeserializer.java
index 51dfba5..057faee 100644
--- a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/BinarySerializerDeserializer.java
+++ b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/BinarySerializerDeserializer.java
@@ -93,8 +93,6 @@ public class BinarySerializerDeserializer implements SerializerDeserializer {
break;
}
case BLOB:
- case INET4:
- case INET6:
bytes = tuple.getBytes(index);
length = bytes.length;
out.write(bytes, 0, length);
@@ -163,9 +161,6 @@ public class BinarySerializerDeserializer implements SerializerDeserializer {
bytes, offset, length);
break;
}
- case INET4:
- datum = DatumFactory.createInet4(bytes, offset, length);
- break;
case BLOB:
datum = DatumFactory.createBlob(bytes, offset, length);
break;
http://git-wip-us.apache.org/repos/asf/tajo/blob/f995e303/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/RowStoreUtil.java
----------------------------------------------------------------------
diff --git a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/RowStoreUtil.java b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/RowStoreUtil.java
index 8ca55cc..c8474b1 100644
--- a/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/RowStoreUtil.java
+++ b/tajo-storage/tajo-storage-common/src/main/java/org/apache/tajo/storage/RowStoreUtil.java
@@ -149,11 +149,6 @@ public class RowStoreUtil {
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 '" + type.getType().name() + "'"));
@@ -249,13 +244,6 @@ public class RowStoreUtil {
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() + "'"));
@@ -314,10 +302,6 @@ public class RowStoreUtil {
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() + "'"));