You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tajo.apache.org by hy...@apache.org on 2013/05/09 07:38:34 UTC
[02/11] TAJO-57: Recognize Parser and Catalog Standard SQL data
types. (hyunsik)
http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/c1c6f83e/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/reader/LongReader.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/reader/LongReader.java b/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/reader/LongReader.java
deleted file mode 100644
index 3c4b96e..0000000
--- a/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/reader/LongReader.java
+++ /dev/null
@@ -1,37 +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 tajo.storage.hcfile.reader;
-
-import tajo.datum.Datum;
-import tajo.datum.DatumFactory;
-
-import java.io.IOException;
-import java.nio.ByteBuffer;
-
-public class LongReader extends TypeReader {
-
- @Override
- public Datum read(ByteBuffer buffer) throws IOException {
- if (buffer.hasRemaining()) {
- return DatumFactory.createLong(buffer.getLong());
- } else {
- return null;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/c1c6f83e/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/reader/Reader.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/reader/Reader.java b/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/reader/Reader.java
deleted file mode 100644
index a9ab3aa..0000000
--- a/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/reader/Reader.java
+++ /dev/null
@@ -1,32 +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 tajo.storage.hcfile.reader;
-
-import tajo.storage.hcfile.BlockMeta;
-import tajo.storage.hcfile.UpdatableBlock;
-
-import java.io.Closeable;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-
-public interface Reader extends Closeable {
-
- UpdatableBlock read(BlockMeta meta, ByteBuffer buffer) throws IOException;
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/c1c6f83e/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/reader/ShortReader.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/reader/ShortReader.java b/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/reader/ShortReader.java
deleted file mode 100644
index 7c1bf98..0000000
--- a/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/reader/ShortReader.java
+++ /dev/null
@@ -1,37 +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 tajo.storage.hcfile.reader;
-
-import tajo.datum.Datum;
-import tajo.datum.DatumFactory;
-
-import java.io.IOException;
-import java.nio.ByteBuffer;
-
-public class ShortReader extends TypeReader {
-
- @Override
- public Datum read(ByteBuffer buffer) throws IOException {
- if (buffer.hasRemaining()) {
- return DatumFactory.createShort(buffer.getShort());
- }else {
- return null;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/c1c6f83e/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/reader/String2Reader.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/reader/String2Reader.java b/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/reader/String2Reader.java
deleted file mode 100644
index 7407d49..0000000
--- a/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/reader/String2Reader.java
+++ /dev/null
@@ -1,39 +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 tajo.storage.hcfile.reader;
-
-import tajo.datum.Datum;
-import tajo.datum.DatumFactory;
-
-import java.io.IOException;
-import java.nio.ByteBuffer;
-
-public class String2Reader extends TypeReader {
- @Override
- public Datum read(ByteBuffer buffer) throws IOException {
- if (buffer.hasRemaining()) {
- int size = buffer.getInt();
- byte[] rawBytes = new byte[size];
- buffer.get(rawBytes);
- return DatumFactory.createString2(rawBytes);
- } else {
- return null;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/c1c6f83e/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/reader/StringReader.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/reader/StringReader.java b/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/reader/StringReader.java
deleted file mode 100644
index 5043018..0000000
--- a/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/reader/StringReader.java
+++ /dev/null
@@ -1,40 +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 tajo.storage.hcfile.reader;
-
-import tajo.datum.Datum;
-import tajo.datum.DatumFactory;
-
-import java.io.IOException;
-import java.nio.ByteBuffer;
-
-public class StringReader extends TypeReader {
-
- @Override
- public Datum read(ByteBuffer buffer) throws IOException {
- if (buffer.hasRemaining()) {
- int size = buffer.getInt();
- byte[] rawBytes = new byte[size];
- buffer.get(rawBytes);
- return DatumFactory.createString(rawBytes);
- } else {
- return null;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/c1c6f83e/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/reader/TypeReader.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/reader/TypeReader.java b/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/reader/TypeReader.java
deleted file mode 100644
index e9cf356..0000000
--- a/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/reader/TypeReader.java
+++ /dev/null
@@ -1,69 +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 tajo.storage.hcfile.reader;
-
-import tajo.catalog.proto.CatalogProtos.DataType;
-import tajo.datum.Datum;
-import tajo.storage.exception.UnknownDataTypeException;
-
-import java.io.IOException;
-import java.nio.ByteBuffer;
-
-public abstract class TypeReader {
-
- public static TypeReader get(DataType type)
- throws IOException, UnknownDataTypeException {
-
- switch (type) {
- case BOOLEAN:
- case BYTE:
- return new ByteReader();
- case CHAR:
- return new CharReader();
- case BYTES:
- return new BytesReader();
- case SHORT:
- return new ShortReader();
- case INT:
- return new IntReader();
- case LONG:
- return new LongReader();
- case FLOAT:
- return new FloatReader();
- case DOUBLE:
- return new DoubleReader();
- case STRING2:
- return new String2Reader();
- case STRING:
- return new StringReader();
- case IPv4:
- return new IPv4Reader();
- case ARRAY:
- return new ArrayReader();
- default:
- throw new UnknownDataTypeException(type.name());
- }
- }
-
- public abstract Datum read(ByteBuffer buffer) throws IOException;
-
- public void close() throws IOException {
-
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/c1c6f83e/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/writer/ArrayWriter.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/writer/ArrayWriter.java b/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/writer/ArrayWriter.java
deleted file mode 100644
index 526f746..0000000
--- a/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/writer/ArrayWriter.java
+++ /dev/null
@@ -1,41 +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 tajo.storage.hcfile.writer;
-
-import org.apache.hadoop.fs.FSDataOutputStream;
-import tajo.datum.ArrayDatum;
-import tajo.datum.Datum;
-
-import java.io.IOException;
-
-public class ArrayWriter extends TypeWriter {
-
- public ArrayWriter(FSDataOutputStream out) {
- super(out);
- }
-
- @Override
- public void write(Datum data) throws IOException {
- ArrayDatum array = (ArrayDatum) data;
- String json = array.toJSON();
- byte[] jsonBytes = json.getBytes();
- out.writeInt(jsonBytes.length);
- out.write(jsonBytes);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/c1c6f83e/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/writer/ByteWriter.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/writer/ByteWriter.java b/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/writer/ByteWriter.java
deleted file mode 100644
index e7b84e4..0000000
--- a/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/writer/ByteWriter.java
+++ /dev/null
@@ -1,36 +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 tajo.storage.hcfile.writer;
-
-import org.apache.hadoop.fs.FSDataOutputStream;
-import tajo.datum.Datum;
-
-import java.io.IOException;
-
-public class ByteWriter extends TypeWriter {
-
- public ByteWriter(FSDataOutputStream out) {
- super(out);
- }
-
- @Override
- public void write(Datum data) throws IOException {
- out.write(data.asByte());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/c1c6f83e/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/writer/BytesWriter.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/writer/BytesWriter.java b/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/writer/BytesWriter.java
deleted file mode 100644
index 3835a3f..0000000
--- a/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/writer/BytesWriter.java
+++ /dev/null
@@ -1,38 +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 tajo.storage.hcfile.writer;
-
-import org.apache.hadoop.fs.FSDataOutputStream;
-import tajo.datum.Datum;
-
-import java.io.IOException;
-
-public class BytesWriter extends TypeWriter {
-
- public BytesWriter(FSDataOutputStream out) {
- super(out);
- }
-
- @Override
- public void write(Datum data) throws IOException {
- byte[] rawBytes = data.asByteArray();
- out.writeInt(rawBytes.length);
- out.write(rawBytes);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/c1c6f83e/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/writer/CharWriter.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/writer/CharWriter.java b/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/writer/CharWriter.java
deleted file mode 100644
index b1b365c..0000000
--- a/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/writer/CharWriter.java
+++ /dev/null
@@ -1,36 +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 tajo.storage.hcfile.writer;
-
-import org.apache.hadoop.fs.FSDataOutputStream;
-import tajo.datum.Datum;
-
-import java.io.IOException;
-
-public class CharWriter extends TypeWriter {
-
- public CharWriter(FSDataOutputStream out) {
- super(out);
- }
-
- @Override
- public void write(Datum data) throws IOException {
- out.write(data.asByte());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/c1c6f83e/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/writer/DoubleWriter.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/writer/DoubleWriter.java b/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/writer/DoubleWriter.java
deleted file mode 100644
index 13c4dff..0000000
--- a/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/writer/DoubleWriter.java
+++ /dev/null
@@ -1,36 +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 tajo.storage.hcfile.writer;
-
-import org.apache.hadoop.fs.FSDataOutputStream;
-import tajo.datum.Datum;
-
-import java.io.IOException;
-
-public class DoubleWriter extends TypeWriter {
-
- public DoubleWriter(FSDataOutputStream out) {
- super(out);
- }
-
- @Override
- public void write(Datum data) throws IOException {
- out.writeDouble(data.asDouble());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/c1c6f83e/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/writer/FloatWriter.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/writer/FloatWriter.java b/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/writer/FloatWriter.java
deleted file mode 100644
index 72fc77f..0000000
--- a/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/writer/FloatWriter.java
+++ /dev/null
@@ -1,36 +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 tajo.storage.hcfile.writer;
-
-import org.apache.hadoop.fs.FSDataOutputStream;
-import tajo.datum.Datum;
-
-import java.io.IOException;
-
-public class FloatWriter extends TypeWriter {
-
- public FloatWriter(FSDataOutputStream out) {
- super(out);
- }
-
- @Override
- public void write(Datum data) throws IOException {
- out.writeFloat(data.asFloat());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/c1c6f83e/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/writer/IntWriter.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/writer/IntWriter.java b/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/writer/IntWriter.java
deleted file mode 100644
index 676e815..0000000
--- a/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/writer/IntWriter.java
+++ /dev/null
@@ -1,36 +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 tajo.storage.hcfile.writer;
-
-import org.apache.hadoop.fs.FSDataOutputStream;
-import tajo.datum.Datum;
-
-import java.io.IOException;
-
-public class IntWriter extends TypeWriter {
-
- public IntWriter(FSDataOutputStream out) {
- super(out);
- }
-
- @Override
- public void write(Datum data) throws IOException {
- out.writeInt(data.asInt());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/c1c6f83e/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/writer/LongWriter.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/writer/LongWriter.java b/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/writer/LongWriter.java
deleted file mode 100644
index 2e1c3f2..0000000
--- a/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/writer/LongWriter.java
+++ /dev/null
@@ -1,36 +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 tajo.storage.hcfile.writer;
-
-import org.apache.hadoop.fs.FSDataOutputStream;
-import tajo.datum.Datum;
-
-import java.io.IOException;
-
-public class LongWriter extends TypeWriter {
-
- public LongWriter(FSDataOutputStream out) {
- super(out);
- }
-
- @Override
- public void write(Datum data) throws IOException {
- out.writeLong(data.asLong());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/c1c6f83e/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/writer/ShortWriter.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/writer/ShortWriter.java b/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/writer/ShortWriter.java
deleted file mode 100644
index 5868456..0000000
--- a/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/writer/ShortWriter.java
+++ /dev/null
@@ -1,36 +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 tajo.storage.hcfile.writer;
-
-import org.apache.hadoop.fs.FSDataOutputStream;
-import tajo.datum.Datum;
-
-import java.io.IOException;
-
-public class ShortWriter extends TypeWriter {
-
- public ShortWriter(FSDataOutputStream out) {
- super(out);
- }
-
- @Override
- public void write(Datum data) throws IOException {
- out.writeShort(data.asShort());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/c1c6f83e/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/writer/TypeWriter.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/writer/TypeWriter.java b/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/writer/TypeWriter.java
deleted file mode 100644
index 4f1f20a..0000000
--- a/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/writer/TypeWriter.java
+++ /dev/null
@@ -1,90 +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 tajo.storage.hcfile.writer;
-
-import org.apache.hadoop.fs.FSDataOutputStream;
-import tajo.catalog.proto.CatalogProtos.DataType;
-import tajo.datum.Datum;
-import tajo.storage.exception.UnknownDataTypeException;
-
-import java.io.IOException;
-
-public abstract class TypeWriter {
-
- protected final FSDataOutputStream out;
-
- public static TypeWriter get(FSDataOutputStream out,
- DataType type)
- throws IOException, UnknownDataTypeException {
-
- switch (type) {
- case BOOLEAN :
- case BYTE :
- return new ByteWriter(out);
-
- case CHAR :
- return new CharWriter(out);
-
- case SHORT :
- return new ShortWriter(out);
-
- case INT :
- return new IntWriter(out);
-
- case LONG :
- return new LongWriter(out);
-
- case FLOAT :
- return new FloatWriter(out);
-
- case DOUBLE:
- return new DoubleWriter(out);
-
- case STRING2:
- case STRING:
- case BYTES:
- case IPv4:
- return new BytesWriter(out);
-
- case ARRAY:
- return new ArrayWriter(out);
-
- default:
- throw new UnknownDataTypeException(type.toString());
- }
- }
-
- protected TypeWriter(FSDataOutputStream out) {
- this.out = out;
- }
-
- public FSDataOutputStream getOutputStream() {
- return this.out;
- }
-
- public abstract void write(Datum data) throws IOException;
-
- public long getPos() throws IOException {
- return out.getPos();
- }
-
- public void close() throws IOException {
-
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/c1c6f83e/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/writer/Writer.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/writer/Writer.java b/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/writer/Writer.java
deleted file mode 100644
index ed0bb3e..0000000
--- a/tajo-core/tajo-core-storage/src/main/java/tajo/storage/hcfile/writer/Writer.java
+++ /dev/null
@@ -1,31 +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 tajo.storage.hcfile.writer;
-
-import tajo.storage.hcfile.Block;
-
-import java.io.Closeable;
-import java.io.IOException;
-
-public interface Writer extends Closeable {
-
- void write(Block block) throws IOException;
-
- long getPos() throws IOException;
-}
http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/c1c6f83e/tajo-core/tajo-core-storage/src/main/java/tajo/storage/rcfile/RCFileWrapper.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-storage/src/main/java/tajo/storage/rcfile/RCFileWrapper.java b/tajo-core/tajo-core-storage/src/main/java/tajo/storage/rcfile/RCFileWrapper.java
index e04cd52..2018992 100644
--- a/tajo-core/tajo-core-storage/src/main/java/tajo/storage/rcfile/RCFileWrapper.java
+++ b/tajo-core/tajo-core-storage/src/main/java/tajo/storage/rcfile/RCFileWrapper.java
@@ -94,24 +94,23 @@ public class RCFileWrapper {
byteRef.set(i, cu);
} else {
col = schema.getColumn(i);
- switch (col.getDataType()) {
+ switch (col.getDataType().getType()) {
case BOOLEAN:
- case BYTE:
- case CHAR:
+ case BIT:
cu = new BytesRefWritable(t.get(i).asByteArray(), 0, 1);
byteRef.set(i, cu);
break;
- case SHORT:
- case INT:
- case LONG:
- case FLOAT:
- case DOUBLE:
- case STRING:
- case STRING2:
- case BYTES:
- case IPv4:
- case IPv6:
+ case CHAR:
+ case INT2:
+ case INT4:
+ case INT8:
+ case FLOAT4:
+ case FLOAT8:
+ case TEXT:
+ case BLOB:
+ case INET4:
+ case INET6:
bytes = t.get(i).asByteArray();
cu = new BytesRefWritable(bytes, 0, bytes.length);
byteRef.set(i, cu);
@@ -241,69 +240,69 @@ public class RCFileWrapper {
if (column.get(tid).getLength() == 0) {
tuple.put(tid, DatumFactory.createNullDatum());
} else {
- switch (targets[i].getDataType()) {
+ switch (targets[i].getDataType().getType()) {
case BOOLEAN:
tuple.put(tid,
DatumFactory.createBool(column.get(tid).getBytesCopy()[0]));
break;
- case BYTE:
+ case BIT:
tuple.put(tid,
- DatumFactory.createByte(column.get(tid).getBytesCopy()[0]));
+ DatumFactory.createBit(column.get(tid).getBytesCopy()[0]));
break;
case CHAR:
tuple.put(tid,
DatumFactory.createChar(column.get(tid).getBytesCopy()[0]));
break;
- case SHORT:
+ case INT2:
tuple.put(tid,
- DatumFactory.createShort(Bytes.toShort(
+ DatumFactory.createInt2(Bytes.toShort(
column.get(tid).getBytesCopy())));
break;
- case INT:
+ case INT4:
tuple.put(tid,
- DatumFactory.createInt(Bytes.toInt(
+ DatumFactory.createInt4(Bytes.toInt(
column.get(tid).getBytesCopy())));
break;
- case LONG:
+ case INT8:
tuple.put(tid,
- DatumFactory.createLong(Bytes.toLong(
+ DatumFactory.createInt8(Bytes.toLong(
column.get(tid).getBytesCopy())));
break;
- case FLOAT:
+ case FLOAT4:
tuple.put(tid,
- DatumFactory.createFloat(Bytes.toFloat(
+ DatumFactory.createFloat4(Bytes.toFloat(
column.get(tid).getBytesCopy())));
break;
- case DOUBLE:
+ case FLOAT8:
tuple.put(tid,
- DatumFactory.createDouble(Bytes.toDouble(
+ DatumFactory.createFloat8(Bytes.toDouble(
column.get(tid).getBytesCopy())));
break;
- case IPv4:
+ case INET4:
tuple.put(tid,
- DatumFactory.createIPv4(column.get(tid).getBytesCopy()));
+ DatumFactory.createInet4(column.get(tid).getBytesCopy()));
break;
- case STRING:
- tuple.put(tid,
- DatumFactory.createString(
- Bytes.toString(column.get(tid).getBytesCopy())));
- break;
+// case STRING:
+// tuple.put(tid,
+// DatumFactory.createText(
+// Bytes.toString(column.get(tid).getBytesCopy())));
+// break;
- case STRING2:
+ case TEXT:
tuple.put(tid,
- DatumFactory.createString2(
+ DatumFactory.createText(
column.get(tid).getBytesCopy()));
break;
- case BYTES:
+ case BLOB:
tuple.put(tid,
- DatumFactory.createBytes(column.get(tid).getBytesCopy()));
+ DatumFactory.createBlob(column.get(tid).getBytesCopy()));
break;
default:
http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/c1c6f83e/tajo-core/tajo-core-storage/src/main/java/tajo/storage/trevni/TrevniAppender.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-storage/src/main/java/tajo/storage/trevni/TrevniAppender.java b/tajo-core/tajo-core-storage/src/main/java/tajo/storage/trevni/TrevniAppender.java
index e7b30df..60bc11e 100644
--- a/tajo-core/tajo-core-storage/src/main/java/tajo/storage/trevni/TrevniAppender.java
+++ b/tajo-core/tajo-core-storage/src/main/java/tajo/storage/trevni/TrevniAppender.java
@@ -30,6 +30,7 @@ import org.apache.trevni.ValueType;
import tajo.catalog.Column;
import tajo.catalog.TableMeta;
import tajo.catalog.statistics.TableStat;
+import tajo.common.TajoDataTypes.Type;
import tajo.storage.FileAppender;
import tajo.storage.TableStatistics;
import tajo.storage.Tuple;
@@ -37,8 +38,6 @@ import tajo.storage.Tuple;
import java.io.FileNotFoundException;
import java.io.IOException;
-import static tajo.catalog.proto.CatalogProtos.DataType;
-
public class TrevniAppender extends FileAppender {
private FileSystem fs;
private ColumnFileWriter writer;
@@ -65,7 +64,7 @@ public class TrevniAppender extends FileAppender {
int i = 0;
for (Column column : meta.getSchema().getColumns()) {
trevniMetas[i++] = new ColumnMetaData(column.getColumnName(),
- getType(column.getDataType()));
+ getType(column.getDataType().getType()));
}
writer = new ColumnFileWriter(createFileMeta(), trevniMetas);
@@ -83,35 +82,34 @@ public class TrevniAppender extends FileAppender {
.setChecksum("null");
}
- private static ValueType getType(DataType type) {
+ private static ValueType getType(Type type) {
switch (type) {
case BOOLEAN:
return ValueType.INT;
- case BYTE:
+ case BIT:
return ValueType.INT;
case CHAR:
return ValueType.INT;
- case SHORT:
+ case INT2:
return ValueType.INT;
- case INT:
+ case INT4:
return ValueType.INT;
- case LONG:
+ case INT8:
return ValueType.LONG;
- case FLOAT:
+ case FLOAT4:
return ValueType.FLOAT;
- case DOUBLE:
+ case FLOAT8:
return ValueType.DOUBLE;
- case STRING:
- case STRING2:
+ case TEXT:
return ValueType.STRING;
- case BYTES:
+ case BLOB:
return ValueType.BYTES;
- case IPv4:
+ case INET4:
return ValueType.BYTES;
- case IPv6:
+ case INET6:
return ValueType.BYTES;
case ARRAY:
- return ValueType.STRING;
+ return ValueType.BYTES;
default:
return null;
}
@@ -133,35 +131,34 @@ public class TrevniAppender extends FileAppender {
if (!t.isNull(i)) {
col = schema.getColumn(i);
- switch (col.getDataType()) {
+ switch (col.getDataType().getType()) {
case BOOLEAN:
- case BYTE:
+ case BIT:
case CHAR:
- case SHORT:
- case INT:
- writer.writeValue(t.get(i).asInt(), i);
+ case INT2:
+ case INT4:
+ writer.writeValue(t.get(i).asInt4(), i);
break;
- case LONG:
- writer.writeValue(t.get(i).asLong(), i);
+ case INT8:
+ writer.writeValue(t.get(i).asInt8(), i);
break;
- case FLOAT:
- writer.writeValue(t.get(i).asFloat(), i);
+ case FLOAT4:
+ writer.writeValue(t.get(i).asFloat4(), i);
break;
- case DOUBLE:
- writer.writeValue(t.get(i).asDouble(), i);
+ case FLOAT8:
+ writer.writeValue(t.get(i).asFloat8(), i);
break;
- case STRING:
- case STRING2:
+ case TEXT:
writer.writeValue(t.get(i).asChars(), i);
break;
- case IPv4:
- case IPv6:
+ case INET4:
+ case INET6:
writer.writeValue(t.get(i).asByteArray(), i);
break;
case ARRAY:
writer.writeValue(t.get(i).asChars(), i);
break;
- case BYTES:
+ case BLOB:
writer.writeValue(t.get(i).asByteArray(), i);
default:
break;
http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/c1c6f83e/tajo-core/tajo-core-storage/src/main/java/tajo/storage/trevni/TrevniScanner.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-storage/src/main/java/tajo/storage/trevni/TrevniScanner.java b/tajo-core/tajo-core-storage/src/main/java/tajo/storage/trevni/TrevniScanner.java
index 6fb05bd..9c0a5ed 100644
--- a/tajo-core/tajo-core-storage/src/main/java/tajo/storage/trevni/TrevniScanner.java
+++ b/tajo-core/tajo-core-storage/src/main/java/tajo/storage/trevni/TrevniScanner.java
@@ -24,7 +24,7 @@ import org.apache.trevni.ColumnValues;
import org.apache.trevni.avro.HadoopInput;
import tajo.catalog.Column;
import tajo.catalog.TableMeta;
-import tajo.datum.BytesDatum;
+import tajo.datum.BlobDatum;
import tajo.datum.DatumFactory;
import tajo.storage.FileScanner;
import tajo.storage.Fragment;
@@ -83,62 +83,62 @@ public class TrevniScanner extends FileScanner {
for (int i = 0; i < projectionMap.length; i++) {
tid = projectionMap[i];
columns[i].startRow();
- switch (schema.getColumn(tid).getDataType()) {
+ switch (schema.getColumn(tid).getDataType().getType()) {
case BOOLEAN:
tuple.put(tid,
DatumFactory.createBool(((Integer)columns[i].nextValue()).byteValue()));
break;
- case BYTE:
+ case BIT:
tuple.put(tid,
- DatumFactory.createByte(((Integer)columns[i].nextValue()).byteValue()));
+ DatumFactory.createBit(((Integer) columns[i].nextValue()).byteValue()));
break;
case CHAR:
tuple.put(tid,
DatumFactory.createChar(((Integer)columns[i].nextValue()).byteValue()));
break;
- case SHORT:
+ case INT2:
tuple.put(tid,
- DatumFactory.createShort(((Integer)columns[i].nextValue()).shortValue()));
+ DatumFactory.createInt2(((Integer) columns[i].nextValue()).shortValue()));
break;
- case INT:
+ case INT4:
tuple.put(tid,
- DatumFactory.createInt((Integer)columns[i].nextValue()));
+ DatumFactory.createInt4((Integer) columns[i].nextValue()));
break;
- case LONG:
+ case INT8:
tuple.put(tid,
- DatumFactory.createLong((Long)columns[i].nextValue()));
+ DatumFactory.createInt8((Long) columns[i].nextValue()));
break;
- case FLOAT:
+ case FLOAT4:
tuple.put(tid,
- DatumFactory.createFloat((Float)columns[i].nextValue()));
+ DatumFactory.createFloat4((Float) columns[i].nextValue()));
break;
- case DOUBLE:
+ case FLOAT8:
tuple.put(tid,
- DatumFactory.createDouble((Double)columns[i].nextValue()));
+ DatumFactory.createFloat8((Double) columns[i].nextValue()));
break;
- case IPv4:
+ case INET4:
tuple.put(tid,
- DatumFactory.createIPv4(((ByteBuffer) columns[i].nextValue()).array()));
+ DatumFactory.createInet4(((ByteBuffer) columns[i].nextValue()).array()));
break;
- case STRING:
- tuple.put(tid,
- DatumFactory.createString((String) columns[i].nextValue()));
- break;
+// case TEXT:
+// tuple.put(tid,
+// DatumFactory.createText((String) columns[i].nextValue()));
+// break;
- case STRING2:
+ case TEXT:
tuple.put(tid,
- DatumFactory.createString2((String) columns[i].nextValue()));
+ DatumFactory.createText((String) columns[i].nextValue()));
break;
- case BYTES:
+ case BLOB:
tuple.put(tid,
- new BytesDatum(((ByteBuffer) columns[i].nextValue())));
+ new BlobDatum(((ByteBuffer) columns[i].nextValue())));
break;
default:
http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/c1c6f83e/tajo-core/tajo-core-storage/src/main/proto/CatalogProtos.proto
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-storage/src/main/proto/CatalogProtos.proto b/tajo-core/tajo-core-storage/src/main/proto/CatalogProtos.proto
index 3910520..efb975e 100644
--- a/tajo-core/tajo-core-storage/src/main/proto/CatalogProtos.proto
+++ b/tajo-core/tajo-core-storage/src/main/proto/CatalogProtos.proto
@@ -22,33 +22,12 @@ option optimize_for = SPEED;
option java_generic_services = false;
option java_generate_equals_and_hash = true;
-enum DataType {
- BOOLEAN = 0;
- BYTE = 1;
- CHAR = 2;
- BYTES = 3;
- SHORT = 4;
- INT = 5;
- BIGINT = 6;
- LONG = 7;
- FLOAT = 8;
- DOUBLE = 9;
- BIGDECIMAL = 10;
- STRING = 11;
- DATE = 12;
- IPv4 = 13;
- IPv6 = 14;
- NULL = 15;
- ANY = 16;
- ALL = 17;
- ARRAY = 18;
- STRING2 = 19;
-}
+import "DataTypes.proto";
enum StoreType {
- MEM = 0;
- CSV = 1;
- RAW = 2;
+ MEM = 0;
+ CSV = 1;
+ RAW = 2;
RCFILE = 3;
ROWFILE = 4;
HCFILE = 5;
@@ -56,147 +35,147 @@ enum StoreType {
}
enum OrderType {
- ORDER_NONE = 0;
- ASC = 1;
- DSC = 2;
+ ORDER_NONE = 0;
+ ASC = 1;
+ DSC = 2;
}
enum CompressType {
- COMP_NONE = 0;
- NULL_SUPPRESS = 1;
- RUN_LENGTH = 2;
- BIT_VECTOR = 3;
- DICTIONARY = 4;
- SNAPPY = 5;
- LZ = 6;
+ COMP_NONE = 0;
+ NULL_SUPPRESS = 1;
+ RUN_LENGTH = 2;
+ BIT_VECTOR = 3;
+ DICTIONARY = 4;
+ SNAPPY = 5;
+ LZ = 6;
}
message ColumnMetaProto {
- required DataType dataType = 1;
- required bool compressed = 2;
- required bool sorted = 3;
- required bool contiguous = 4;
- required StoreType storeType = 5;
- required CompressType compType = 6;
- required int64 startRid = 7;
- required int32 recordNum = 8;
- required int32 offsetToIndex = 9;
+ required DataType dataType = 1;
+ required bool compressed = 2;
+ required bool sorted = 3;
+ required bool contiguous = 4;
+ required StoreType storeType = 5;
+ required CompressType compType = 6;
+ required int64 startRid = 7;
+ required int32 recordNum = 8;
+ required int32 offsetToIndex = 9;
}
message ColumnProto {
- required string columnName = 1;
- required DataType dataType = 2;
+ required string columnName = 1;
+ required DataType dataType = 2;
}
message SchemaProto {
- repeated ColumnProto fields = 1;
+ repeated ColumnProto fields = 1;
}
message KeyValueProto {
- required string key = 1;
- required string value = 2;
+ required string key = 1;
+ required string value = 2;
}
message KeyValueSetProto {
- repeated KeyValueProto keyval = 1;
+ repeated KeyValueProto keyval = 1;
}
message TabletProto {
- required string id = 1;
- required string path = 2;
- required int64 startOffset = 3;
- required int64 length = 4;
- required TableProto meta = 5;
- optional TableStatProto stat = 6;
+ required string id = 1;
+ required string path = 2;
+ required int64 startOffset = 3;
+ required int64 length = 4;
+ required TableProto meta = 5;
+ optional TableStatProto stat = 6;
optional bool distCached = 7 [default = false];
}
message TableProto {
- required SchemaProto schema = 1;
- required StoreType storeType = 2;
- required KeyValueSetProto params = 3;
- optional TableStatProto stat = 4;
+ required SchemaProto schema = 1;
+ required StoreType storeType = 2;
+ required KeyValueSetProto params = 3;
+ optional TableStatProto stat = 4;
}
message TableDescProto {
- required string id = 1;
- required string path = 2;
- required TableProto meta = 3;
+ required string id = 1;
+ required string path = 2;
+ required TableProto meta = 3;
}
enum FunctionType {
- GENERAL = 0;
- AGGREGATION = 1;
+ GENERAL = 0;
+ AGGREGATION = 1;
}
message FunctionDescProto {
- required string signature = 1;
- required string className = 2;
- required FunctionType type = 3;
- repeated DataType parameterTypes = 4;
- required DataType returnType = 5;
+ required string signature = 1;
+ required string className = 2;
+ required FunctionType type = 3;
+ repeated Type parameterTypes = 4;
+ required Type returnType = 5;
}
message IndexDescProto {
- required string name = 1;
- required string tableId = 2;
- required ColumnProto column = 3;
- required IndexMethod indexMethod = 4;
- optional bool isUnique = 5 [default = false];
- optional bool isClustered = 6 [default = false];
- optional bool isAscending = 7 [default = false];
+ required string name = 1;
+ required string tableId = 2;
+ required ColumnProto column = 3;
+ required IndexMethod indexMethod = 4;
+ optional bool isUnique = 5 [default = false];
+ optional bool isClustered = 6 [default = false];
+ optional bool isAscending = 7 [default = false];
}
enum IndexMethod {
- TWO_LEVEL_BIN_TREE = 0;
- BTREE = 1;
- HASH = 2;
- BITMAP = 3;
+ TWO_LEVEL_BIN_TREE = 0;
+ BTREE = 1;
+ HASH = 2;
+ BITMAP = 3;
}
message GetAllTableNamesResponse {
- repeated string tableName = 1;
+ repeated string tableName = 1;
}
message GetIndexRequest {
- required string tableName = 1;
- required string columnName = 2;
+ required string tableName = 1;
+ required string columnName = 2;
}
message GetFunctionsResponse {
- repeated FunctionDescProto functionDesc = 1;
+ repeated FunctionDescProto functionDesc = 1;
}
message UnregisterFunctionRequest {
- required string signature = 1;
- repeated DataType parameterTypes = 2;
+ required string signature = 1;
+ repeated Type parameterTypes = 2;
}
message GetFunctionMetaRequest {
- required string signature = 1;
- repeated DataType parameterTypes = 2;
+ required string signature = 1;
+ repeated Type parameterTypes = 2;
}
message ContainFunctionRequest {
- required string signature = 1;
- repeated DataType parameterTypes = 2;
+ required string signature = 1;
+ repeated Type parameterTypes = 2;
}
message TableStatProto {
- required int64 numRows = 1;
- required int64 numBytes = 2;
- optional int32 numBlocks = 3;
- optional int32 numPartitions = 4;
- optional int64 avgRows = 5;
- repeated ColumnStatProto colStat = 6;
+ required int64 numRows = 1;
+ required int64 numBytes = 2;
+ optional int32 numBlocks = 3;
+ optional int32 numPartitions = 4;
+ optional int64 avgRows = 5;
+ repeated ColumnStatProto colStat = 6;
}
message ColumnStatProto {
- required ColumnProto column = 1;
- optional int64 numDistVal = 2;
- optional int64 numNulls = 3;
- optional bytes minValue = 4;
- optional bytes maxValue = 5;
+ required ColumnProto column = 1;
+ optional int64 numDistVal = 2;
+ optional int64 numNulls = 3;
+ optional bytes minValue = 4;
+ optional bytes maxValue = 5;
}
enum StatType {
@@ -229,4 +208,4 @@ message SortSpecProto {
required int32 sortColumnId = 1;
optional bool ascending = 2 [default = true];
optional bool nullFirst = 3 [default = false];
-}
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/c1c6f83e/tajo-core/tajo-core-storage/src/test/java/tajo/storage/TestFrameTuple.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-storage/src/test/java/tajo/storage/TestFrameTuple.java b/tajo-core/tajo-core-storage/src/test/java/tajo/storage/TestFrameTuple.java
index 7287c6f..318b1d7 100644
--- a/tajo-core/tajo-core-storage/src/test/java/tajo/storage/TestFrameTuple.java
+++ b/tajo-core/tajo-core-storage/src/test/java/tajo/storage/TestFrameTuple.java
@@ -36,31 +36,31 @@ public class TestFrameTuple {
tuple1 = new VTuple(11);
tuple1.put(new Datum[] {
DatumFactory.createBool(true),
- DatumFactory.createByte((byte) 0x99),
+ DatumFactory.createBit((byte) 0x99),
DatumFactory.createChar('9'),
- DatumFactory.createShort((short) 17),
- DatumFactory.createInt(59),
- DatumFactory.createLong(23l),
- DatumFactory.createFloat(77.9f),
- DatumFactory.createDouble(271.9f),
- DatumFactory.createString("hyunsik"),
- DatumFactory.createBytes("hyunsik".getBytes()),
- DatumFactory.createIPv4("192.168.0.1")
+ DatumFactory.createInt2((short) 17),
+ DatumFactory.createInt4(59),
+ DatumFactory.createInt8(23l),
+ DatumFactory.createFloat4(77.9f),
+ DatumFactory.createFloat8(271.9f),
+ DatumFactory.createText("hyunsik"),
+ DatumFactory.createBlob("hyunsik".getBytes()),
+ DatumFactory.createInet4("192.168.0.1")
});
tuple2 = new VTuple(11);
tuple2.put(new Datum[] {
DatumFactory.createBool(true),
- DatumFactory.createByte((byte) 0x99),
+ DatumFactory.createBit((byte) 0x99),
DatumFactory.createChar('9'),
- DatumFactory.createShort((short) 17),
- DatumFactory.createInt(59),
- DatumFactory.createLong(23l),
- DatumFactory.createFloat(77.9f),
- DatumFactory.createDouble(271.9f),
- DatumFactory.createString("hyunsik"),
- DatumFactory.createBytes("hyunsik".getBytes()),
- DatumFactory.createIPv4("192.168.0.1")
+ DatumFactory.createInt2((short) 17),
+ DatumFactory.createInt4(59),
+ DatumFactory.createInt8(23l),
+ DatumFactory.createFloat4(77.9f),
+ DatumFactory.createFloat8(271.9f),
+ DatumFactory.createText("hyunsik"),
+ DatumFactory.createBlob("hyunsik".getBytes()),
+ DatumFactory.createInet4("192.168.0.1")
});
}
@@ -76,9 +76,9 @@ public class TestFrameTuple {
assertTrue(frame.contains(i));
}
- assertEquals(DatumFactory.createLong(23l), frame.get(5));
- assertEquals(DatumFactory.createLong(23l), frame.get(16));
- assertEquals(DatumFactory.createIPv4("192.168.0.1"), frame.get(10));
- assertEquals(DatumFactory.createIPv4("192.168.0.1"), frame.get(21));
+ assertEquals(DatumFactory.createInt8(23l), frame.get(5));
+ assertEquals(DatumFactory.createInt8(23l), frame.get(16));
+ assertEquals(DatumFactory.createInet4("192.168.0.1"), frame.get(10));
+ assertEquals(DatumFactory.createInet4("192.168.0.1"), frame.get(21));
}
}
http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/c1c6f83e/tajo-core/tajo-core-storage/src/test/java/tajo/storage/TestMergeScanner.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-storage/src/test/java/tajo/storage/TestMergeScanner.java b/tajo-core/tajo-core-storage/src/test/java/tajo/storage/TestMergeScanner.java
index 7688a1d..40d368e 100644
--- a/tajo-core/tajo-core-storage/src/test/java/tajo/storage/TestMergeScanner.java
+++ b/tajo-core/tajo-core-storage/src/test/java/tajo/storage/TestMergeScanner.java
@@ -26,13 +26,13 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
+import tajo.catalog.CatalogUtil;
import tajo.catalog.Options;
import tajo.catalog.Schema;
-import tajo.catalog.TCatUtil;
import tajo.catalog.TableMeta;
-import tajo.catalog.proto.CatalogProtos.DataType;
import tajo.catalog.proto.CatalogProtos.StoreType;
import tajo.catalog.statistics.TableStat;
+import tajo.common.TajoDataTypes.Type;
import tajo.conf.TajoConf;
import tajo.conf.TajoConf.ConfVars;
import tajo.datum.DatumFactory;
@@ -83,13 +83,13 @@ public class TestMergeScanner {
@Test
public void testMultipleFiles() throws IOException {
Schema schema = new Schema();
- schema.addColumn("id", DataType.INT);
- schema.addColumn("file", DataType.STRING);
- schema.addColumn("name", DataType.STRING);
- schema.addColumn("age", DataType.LONG);
+ schema.addColumn("id", Type.INT4);
+ schema.addColumn("file", Type.TEXT);
+ schema.addColumn("name", Type.TEXT);
+ schema.addColumn("age", Type.INT8);
Options options = new Options();
- TableMeta meta = TCatUtil.newTableMeta(schema, storeType, options);
+ TableMeta meta = CatalogUtil.newTableMeta(schema, storeType, options);
Path table1Path = new Path(testDir, storeType + "_1.data");
Appender appender1 = StorageManager.getAppender(conf, meta, table1Path);
@@ -100,10 +100,10 @@ public class TestMergeScanner {
for(int i = 0; i < tupleNum; i++) {
vTuple = new VTuple(4);
- vTuple.put(0, DatumFactory.createInt(i+1));
- vTuple.put(1, DatumFactory.createString("hyunsik"));
- vTuple.put(2, DatumFactory.createString("jihoon"));
- vTuple.put(3, DatumFactory.createLong(25l));
+ vTuple.put(0, DatumFactory.createInt4(i + 1));
+ vTuple.put(1, DatumFactory.createText("hyunsik"));
+ vTuple.put(2, DatumFactory.createText("jihoon"));
+ vTuple.put(3, DatumFactory.createInt8(25l));
appender1.addTuple(vTuple);
}
appender1.close();
@@ -120,10 +120,10 @@ public class TestMergeScanner {
for(int i = 0; i < tupleNum; i++) {
vTuple = new VTuple(4);
- vTuple.put(0, DatumFactory.createInt(i+1));
- vTuple.put(1, DatumFactory.createString("hyunsik"));
- vTuple.put(2, DatumFactory.createString("jihoon"));
- vTuple.put(3, DatumFactory.createLong(25l));
+ vTuple.put(0, DatumFactory.createInt4(i + 1));
+ vTuple.put(1, DatumFactory.createText("hyunsik"));
+ vTuple.put(2, DatumFactory.createText("jihoon"));
+ vTuple.put(3, DatumFactory.createInt8(25l));
appender2.addTuple(vTuple);
}
appender2.close();
http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/c1c6f83e/tajo-core/tajo-core-storage/src/test/java/tajo/storage/TestStorageManager.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-storage/src/test/java/tajo/storage/TestStorageManager.java b/tajo-core/tajo-core-storage/src/test/java/tajo/storage/TestStorageManager.java
index 00215a0..dab6705 100644
--- a/tajo-core/tajo-core-storage/src/test/java/tajo/storage/TestStorageManager.java
+++ b/tajo-core/tajo-core-storage/src/test/java/tajo/storage/TestStorageManager.java
@@ -23,11 +23,11 @@ import org.apache.hadoop.fs.Path;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
+import tajo.catalog.CatalogUtil;
import tajo.catalog.Schema;
-import tajo.catalog.TCatUtil;
import tajo.catalog.TableMeta;
-import tajo.catalog.proto.CatalogProtos.DataType;
import tajo.catalog.proto.CatalogProtos.StoreType;
+import tajo.common.TajoDataTypes.Type;
import tajo.conf.TajoConf;
import tajo.datum.Datum;
import tajo.datum.DatumFactory;
@@ -58,19 +58,19 @@ public class TestStorageManager {
@Test
public final void testGetScannerAndAppender() throws IOException {
Schema schema = new Schema();
- schema.addColumn("id",DataType.INT);
- schema.addColumn("age",DataType.INT);
- schema.addColumn("name",DataType.STRING);
+ schema.addColumn("id", Type.INT4);
+ schema.addColumn("age",Type.INT4);
+ schema.addColumn("name",Type.TEXT);
- TableMeta meta = TCatUtil.newTableMeta(schema, StoreType.CSV);
+ TableMeta meta = CatalogUtil.newTableMeta(schema, StoreType.CSV);
Tuple[] tuples = new Tuple[4];
for(int i=0; i < tuples.length; i++) {
tuples[i] = new VTuple(3);
tuples[i].put(new Datum[] {
- DatumFactory.createInt(i),
- DatumFactory.createInt(i+32),
- DatumFactory.createString("name"+i)});
+ DatumFactory.createInt4(i),
+ DatumFactory.createInt4(i + 32),
+ DatumFactory.createText("name" + i)});
}
Path path = StorageUtil.concatPath(testDir, "testGetScannerAndAppender", "table.csv");
http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/c1c6f83e/tajo-core/tajo-core-storage/src/test/java/tajo/storage/TestStorages.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-storage/src/test/java/tajo/storage/TestStorages.java b/tajo-core/tajo-core-storage/src/test/java/tajo/storage/TestStorages.java
index d351edf..d5c2b38 100644
--- a/tajo-core/tajo-core-storage/src/test/java/tajo/storage/TestStorages.java
+++ b/tajo-core/tajo-core-storage/src/test/java/tajo/storage/TestStorages.java
@@ -24,13 +24,13 @@ import org.apache.hadoop.fs.Path;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
+import tajo.catalog.CatalogUtil;
import tajo.catalog.Options;
import tajo.catalog.Schema;
-import tajo.catalog.TCatUtil;
import tajo.catalog.TableMeta;
-import tajo.catalog.proto.CatalogProtos.DataType;
import tajo.catalog.proto.CatalogProtos.StoreType;
import tajo.catalog.statistics.TableStat;
+import tajo.common.TajoDataTypes.Type;
import tajo.conf.TajoConf;
import tajo.datum.Datum;
import tajo.datum.DatumFactory;
@@ -85,10 +85,10 @@ public class TestStorages {
public void testSplitable() throws IOException {
if (splitable) {
Schema schema = new Schema();
- schema.addColumn("id", DataType.INT);
- schema.addColumn("age", DataType.LONG);
+ schema.addColumn("id", Type.INT4);
+ schema.addColumn("age", Type.INT8);
- TableMeta meta = TCatUtil.newTableMeta(schema, storeType);
+ TableMeta meta = CatalogUtil.newTableMeta(schema, storeType);
Path tablePath = new Path(testDir, "Splitable.data");
Appender appender = StorageManager.getAppender(conf, meta, tablePath);
appender.enableStats();
@@ -98,8 +98,8 @@ public class TestStorages {
for(int i = 0; i < tupleNum; i++) {
vTuple = new VTuple(2);
- vTuple.put(0, DatumFactory.createInt(i+1));
- vTuple.put(1, DatumFactory.createLong(25l));
+ vTuple.put(0, DatumFactory.createInt4(i + 1));
+ vTuple.put(1, DatumFactory.createInt8(25l));
appender.addTuple(vTuple);
}
appender.close();
@@ -138,11 +138,11 @@ public class TestStorages {
@Test
public void testProjection() throws IOException {
Schema schema = new Schema();
- schema.addColumn("id", DataType.INT);
- schema.addColumn("age", DataType.LONG);
- schema.addColumn("score", DataType.FLOAT);
+ schema.addColumn("id", Type.INT4);
+ schema.addColumn("age", Type.INT8);
+ schema.addColumn("score", Type.FLOAT4);
- TableMeta meta = TCatUtil.newTableMeta(schema, storeType);
+ TableMeta meta = CatalogUtil.newTableMeta(schema, storeType);
Path tablePath = new Path(testDir, "testProjection.data");
Appender appender = StorageManager.getAppender(conf, meta, tablePath);
@@ -152,9 +152,9 @@ public class TestStorages {
for(int i = 0; i < tupleNum; i++) {
vTuple = new VTuple(3);
- vTuple.put(0, DatumFactory.createInt(i+1));
- vTuple.put(1, DatumFactory.createLong(i+2));
- vTuple.put(2, DatumFactory.createFloat(i + 3));
+ vTuple.put(0, DatumFactory.createInt4(i + 1));
+ vTuple.put(1, DatumFactory.createInt8(i + 2));
+ vTuple.put(2, DatumFactory.createFloat4(i + 3));
appender.addTuple(vTuple);
}
appender.close();
@@ -163,8 +163,8 @@ public class TestStorages {
Fragment fragment = new Fragment("testReadAndWrite", tablePath, meta, 0, status.getLen(), null);
Schema target = new Schema();
- target.addColumn("age", DataType.LONG);
- target.addColumn("score", DataType.FLOAT);
+ target.addColumn("age", Type.INT8);
+ target.addColumn("score", Type.FLOAT4);
Scanner scanner = StorageManager.getScanner(conf, meta, fragment, target);
scanner.init();
int tupleCnt = 0;
@@ -173,8 +173,8 @@ public class TestStorages {
if (storeType == StoreType.RCFILE || storeType == StoreType.TREVNI) {
assertNull(tuple.get(0));
}
- assertEquals(DatumFactory.createLong(tupleCnt + 2), tuple.getLong(1));
- assertEquals(DatumFactory.createFloat(tupleCnt + 3), tuple.getFloat(2));
+ assertEquals(DatumFactory.createInt8(tupleCnt + 2), tuple.getLong(1));
+ assertEquals(DatumFactory.createFloat4(tupleCnt + 3), tuple.getFloat(2));
tupleCnt++;
}
scanner.close();
@@ -185,40 +185,39 @@ public class TestStorages {
@Test
public void testVariousTypes() throws IOException {
Schema schema = new Schema();
- schema.addColumn("col1", DataType.BOOLEAN);
- schema.addColumn("col2", DataType.BYTE);
- schema.addColumn("col3", DataType.CHAR);
- schema.addColumn("col4", DataType.SHORT);
- schema.addColumn("col5", DataType.INT);
- schema.addColumn("col6", DataType.LONG);
- schema.addColumn("col7", DataType.FLOAT);
- schema.addColumn("col8", DataType.DOUBLE);
- schema.addColumn("col9", DataType.STRING);
- schema.addColumn("col10", DataType.BYTES);
- schema.addColumn("col11", DataType.IPv4);
- schema.addColumn("col12", DataType.STRING2);
+ schema.addColumn("col1", Type.BOOLEAN);
+ schema.addColumn("col2", Type.BIT);
+ schema.addColumn("col3", Type.CHAR);
+ schema.addColumn("col4", Type.INT2);
+ schema.addColumn("col5", Type.INT4);
+ schema.addColumn("col6", Type.INT8);
+ schema.addColumn("col7", Type.FLOAT4);
+ schema.addColumn("col8", Type.FLOAT8);
+ schema.addColumn("col9", Type.TEXT);
+ schema.addColumn("col10", Type.BLOB);
+ schema.addColumn("col11", Type.INET4);
Options options = new Options();
- TableMeta meta = TCatUtil.newTableMeta(schema, storeType, options);
+ TableMeta meta = CatalogUtil.newTableMeta(schema, storeType, options);
Path tablePath = new Path(testDir, "testVariousTypes.data");
Appender appender = StorageManager.getAppender(conf, meta, tablePath);
appender.init();
- Tuple tuple = new VTuple(12);
+ Tuple tuple = new VTuple(11);
tuple.put(new Datum[] {
DatumFactory.createBool(true),
- DatumFactory.createByte((byte) 0x99),
+ DatumFactory.createBit((byte) 0x99),
DatumFactory.createChar('7'),
- DatumFactory.createShort((short) 17),
- DatumFactory.createInt(59),
- DatumFactory.createLong(23l),
- DatumFactory.createFloat(77.9f),
- DatumFactory.createDouble(271.9f),
- DatumFactory.createString("hyunsik"),
- DatumFactory.createBytes("hyunsik".getBytes()),
- DatumFactory.createIPv4("192.168.0.1"),
- DatumFactory.createString2("hyunsik")
+ DatumFactory.createInt2((short) 17),
+ DatumFactory.createInt4(59),
+ DatumFactory.createInt8(23l),
+ DatumFactory.createFloat4(77.9f),
+ DatumFactory.createFloat8(271.9f),
+ DatumFactory.createText("hyunsik"),
+ DatumFactory.createBlob("hyunsik".getBytes()),
+ DatumFactory.createInet4("192.168.0.1"),
+ DatumFactory.createText("hyunsik")
});
appender.addTuple(tuple);
appender.flush();
http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/c1c6f83e/tajo-core/tajo-core-storage/src/test/java/tajo/storage/TestTupleComparator.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-storage/src/test/java/tajo/storage/TestTupleComparator.java b/tajo-core/tajo-core-storage/src/test/java/tajo/storage/TestTupleComparator.java
index e37b3e5..af8d6d5 100644
--- a/tajo-core/tajo-core-storage/src/test/java/tajo/storage/TestTupleComparator.java
+++ b/tajo-core/tajo-core-storage/src/test/java/tajo/storage/TestTupleComparator.java
@@ -23,7 +23,7 @@ import org.junit.Before;
import org.junit.Test;
import tajo.catalog.Schema;
import tajo.catalog.SortSpec;
-import tajo.catalog.proto.CatalogProtos.DataType;
+import tajo.common.TajoDataTypes.Type;
import tajo.datum.Datum;
import tajo.datum.DatumFactory;
@@ -42,29 +42,29 @@ public class TestTupleComparator {
@Test
public final void testCompare() {
Schema schema = new Schema();
- schema.addColumn("col1", DataType.INT);
- schema.addColumn("col2", DataType.INT);
- schema.addColumn("col3", DataType.INT);
- schema.addColumn("col4", DataType.INT);
- schema.addColumn("col5", DataType.STRING);
+ schema.addColumn("col1", Type.INT4);
+ schema.addColumn("col2", Type.INT4);
+ schema.addColumn("col3", Type.INT4);
+ schema.addColumn("col4", Type.INT4);
+ schema.addColumn("col5", Type.TEXT);
Tuple tuple1 = new VTuple(5);
Tuple tuple2 = new VTuple(5);
tuple1.put(
new Datum[] {
- DatumFactory.createInt(9),
- DatumFactory.createInt(3),
- DatumFactory.createInt(33),
- DatumFactory.createInt(4),
- DatumFactory.createString("abc")});
+ DatumFactory.createInt4(9),
+ DatumFactory.createInt4(3),
+ DatumFactory.createInt4(33),
+ DatumFactory.createInt4(4),
+ DatumFactory.createText("abc")});
tuple2.put(
new Datum[] {
- DatumFactory.createInt(1),
- DatumFactory.createInt(25),
- DatumFactory.createInt(109),
- DatumFactory.createInt(4),
- DatumFactory.createString("abd")});
+ DatumFactory.createInt4(1),
+ DatumFactory.createInt4(25),
+ DatumFactory.createInt4(109),
+ DatumFactory.createInt4(4),
+ DatumFactory.createText("abd")});
SortSpec sortKey1 = new SortSpec(schema.getColumn("col4"), true, false);
SortSpec sortKey2 = new SortSpec(schema.getColumn("col5"), true, false);
http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/c1c6f83e/tajo-core/tajo-core-storage/src/test/java/tajo/storage/TestVTuple.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-storage/src/test/java/tajo/storage/TestVTuple.java b/tajo-core/tajo-core-storage/src/test/java/tajo/storage/TestVTuple.java
index cebbae7..18faf88 100644
--- a/tajo-core/tajo-core-storage/src/test/java/tajo/storage/TestVTuple.java
+++ b/tajo-core/tajo-core-storage/src/test/java/tajo/storage/TestVTuple.java
@@ -38,11 +38,11 @@ public class TestVTuple {
@Test
public void testContain() {
VTuple t1 = new VTuple(260);
- t1.put(0, DatumFactory.createInt(1));
- t1.put(1, DatumFactory.createInt(1));
- t1.put(27, DatumFactory.createInt(1));
- t1.put(96, DatumFactory.createInt(1));
- t1.put(257, DatumFactory.createInt(1));
+ t1.put(0, DatumFactory.createInt4(1));
+ t1.put(1, DatumFactory.createInt4(1));
+ t1.put(27, DatumFactory.createInt4(1));
+ t1.put(96, DatumFactory.createInt4(1));
+ t1.put(257, DatumFactory.createInt4(1));
assertTrue(t1.contains(0));
assertTrue(t1.contains(1));
@@ -60,36 +60,37 @@ public class TestVTuple {
@Test
public void testPut() {
VTuple t1 = new VTuple(260);
- t1.put(0, DatumFactory.createString("str"));
- t1.put(1, DatumFactory.createInt(2));
- t1.put(257, DatumFactory.createFloat(0.76f));
+ t1.put(0, DatumFactory.createText("str"));
+ t1.put(1, DatumFactory.createInt4(2));
+ t1.put(257, DatumFactory.createFloat4(0.76f));
assertTrue(t1.contains(0));
assertTrue(t1.contains(1));
assertEquals(t1.getString(0).toString(),"str");
- assertEquals(t1.getInt(1).asInt(),2);
- assertTrue(t1.getFloat(257).asFloat() == 0.76f);
+ assertEquals(t1.getInt(1).asInt4(),2);
+ assertTrue(t1.getFloat(257).asFloat4() == 0.76f);
}
-
+
+ @Test
public void testEquals() {
Tuple t1 = new VTuple(5);
Tuple t2 = new VTuple(5);
- t1.put(0, DatumFactory.createInt(1));
- t1.put(1, DatumFactory.createInt(2));
- t1.put(3, DatumFactory.createInt(2));
+ t1.put(0, DatumFactory.createInt4(1));
+ t1.put(1, DatumFactory.createInt4(2));
+ t1.put(3, DatumFactory.createInt4(2));
- t2.put(0, DatumFactory.createInt(1));
- t2.put(1, DatumFactory.createInt(2));
- t2.put(3, DatumFactory.createInt(2));
+ t2.put(0, DatumFactory.createInt4(1));
+ t2.put(1, DatumFactory.createInt4(2));
+ t2.put(3, DatumFactory.createInt4(2));
assertEquals(t1,t2);
Tuple t3 = new VTuple(5);
- t2.put(0, DatumFactory.createInt(1));
- t2.put(1, DatumFactory.createInt(2));
- t2.put(4, DatumFactory.createInt(2));
+ t2.put(0, DatumFactory.createInt4(1));
+ t2.put(1, DatumFactory.createInt4(2));
+ t2.put(4, DatumFactory.createInt4(2));
assertNotSame(t1,t3);
}
@@ -99,22 +100,22 @@ public class TestVTuple {
Tuple t1 = new VTuple(5);
Tuple t2 = new VTuple(5);
- t1.put(0, DatumFactory.createInt(1));
- t1.put(1, DatumFactory.createInt(2));
- t1.put(3, DatumFactory.createInt(2));
- t1.put(4, DatumFactory.createString("hyunsik"));
+ t1.put(0, DatumFactory.createInt4(1));
+ t1.put(1, DatumFactory.createInt4(2));
+ t1.put(3, DatumFactory.createInt4(2));
+ t1.put(4, DatumFactory.createText("hyunsik"));
- t2.put(0, DatumFactory.createInt(1));
- t2.put(1, DatumFactory.createInt(2));
- t2.put(3, DatumFactory.createInt(2));
- t2.put(4, DatumFactory.createString("hyunsik"));
+ t2.put(0, DatumFactory.createInt4(1));
+ t2.put(1, DatumFactory.createInt4(2));
+ t2.put(3, DatumFactory.createInt4(2));
+ t2.put(4, DatumFactory.createText("hyunsik"));
assertEquals(t1.hashCode(),t2.hashCode());
Tuple t3 = new VTuple(5);
- t3.put(0, DatumFactory.createInt(1));
- t3.put(1, DatumFactory.createInt(2));
- t3.put(4, DatumFactory.createInt(2));
+ t3.put(0, DatumFactory.createInt4(1));
+ t3.put(1, DatumFactory.createInt4(2));
+ t3.put(4, DatumFactory.createInt4(2));
assertNotSame(t1.hashCode(),t3.hashCode());
}
@@ -123,18 +124,18 @@ public class TestVTuple {
public void testPutTuple() {
Tuple t1 = new VTuple(5);
- t1.put(0, DatumFactory.createInt(1));
- t1.put(1, DatumFactory.createInt(2));
- t1.put(2, DatumFactory.createInt(3));
+ t1.put(0, DatumFactory.createInt4(1));
+ t1.put(1, DatumFactory.createInt4(2));
+ t1.put(2, DatumFactory.createInt4(3));
Tuple t2 = new VTuple(2);
- t2.put(0, DatumFactory.createInt(4));
- t2.put(1, DatumFactory.createInt(5));
+ t2.put(0, DatumFactory.createInt4(4));
+ t2.put(1, DatumFactory.createInt4(5));
t1.put(3, t2);
for (int i = 0; i < 5; i++) {
- assertEquals(i+1, t1.get(i).asInt());
+ assertEquals(i+1, t1.get(i).asInt4());
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/c1c6f83e/tajo-core/tajo-core-storage/src/test/java/tajo/storage/hcfile/IndexTest.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-storage/src/test/java/tajo/storage/hcfile/IndexTest.java b/tajo-core/tajo-core-storage/src/test/java/tajo/storage/hcfile/IndexTest.java
deleted file mode 100644
index 0299a0e..0000000
--- a/tajo-core/tajo-core-storage/src/test/java/tajo/storage/hcfile/IndexTest.java
+++ /dev/null
@@ -1,66 +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 tajo.storage.hcfile;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-public class IndexTest {
-
- @Test
- public void test() {
- Index<Integer> index = new Index<Integer>();
- index.add(new IndexItem(3, 400));
- index.add(new IndexItem(0, 100));
- index.add(new IndexItem(6, 700));
- index.add(new IndexItem(1, 200));
- index.sort();
-
- IndexItem<Integer> result = index.get(0);
- assertEquals(0, result.getRid());
- result = index.get(1);
- assertEquals(1, result.getRid());
- result = index.get(2);
- assertEquals(3, result.getRid());
- result = index.get(3);
- assertEquals(6, result.getRid());
-
- result = index.searchExact(0);
- assertNotNull(result);
- assertEquals(0, result.getRid());
- assertEquals(100, result.getValue().intValue());
-
- result = index.searchLargestSmallerThan(5);
- assertNotNull(result);
- assertEquals(3, result.getRid());
- assertEquals(400, result.getValue().intValue());
-
- result = index.searchLargestSmallerThan(3);
- assertNotNull(result);
- assertEquals(3, result.getRid());
- assertEquals(400, result.getValue().intValue());
-
- result = index.searchSmallestLargerThan(5);
- assertNotNull(result);
- assertEquals(6, result.getRid());
- assertEquals(700, result.getValue().intValue());
- }
-}