Repository: tajo Updated Branches: refs/heads/master 6dac6a5b8 -> 85b7031aa
http://git-wip-us.apache.org/repos/asf/tajo/blob/85b7031a/tajo-common/src/test/java/org/apache/tajo/util/TestStringUtil.java ---------------------------------------------------------------------- diff --git a/tajo-common/src/test/java/org/apache/tajo/util/TestStringUtil.java b/tajo-common/src/test/java/org/apache/tajo/util/TestStringUtil.java index 5c13f8f..6c732c7 100644 --- a/tajo-common/src/test/java/org/apache/tajo/util/TestStringUtil.java +++ b/tajo-common/src/test/java/org/apache/tajo/util/TestStringUtil.java @@ -22,8 +22,7 @@ import org.apache.commons.lang.CharUtils; import org.apache.commons.lang.StringEscapeUtils; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.*; public class TestStringUtil { @@ -89,4 +88,41 @@ public class TestStringUtil { assertEquals("\\u0020", StringUtils.unicodeEscapedDelimiter(spaceDelimiter)); assertEquals(spaceDelimiter, StringEscapeUtils.unescapeJava(StringUtils.unicodeEscapedDelimiter(spaceDelimiter))); } + + @Test + public void testAsciiBytes() { + String asciiText = "abcde 12345 ABCDE"; + assertArrayEquals(asciiText.getBytes(), BytesUtils.toASCIIBytes(asciiText.toCharArray())); + } + + @Test + public void testSplitBytes() { + String text = "abcde|12345|ABCDE"; + char separatorChar = '|'; + + String[] textArray = org.apache.commons.lang.StringUtils.splitPreserveAllTokens(text, separatorChar); + byte[][] bytesArray = BytesUtils.splitPreserveAllTokens(text.getBytes(), separatorChar); + + assertEquals(textArray.length, bytesArray.length); + for (int i = 0; i < textArray.length; i++){ + assertArrayEquals(textArray[i].getBytes(), bytesArray[i]); + } + } + + @Test + public void testSplitProjectionBytes() { + String text = "abcde|12345|ABCDE"; + int[] target = new int[]{ 1 }; + char separatorChar = '|'; + + String[] textArray = org.apache.commons.lang.StringUtils.splitPreserveAllTokens(text, separatorChar); + byte[][] bytesArray = BytesUtils.splitPreserveAllTokens(text.getBytes(), separatorChar, target); + + assertEquals(textArray.length, bytesArray.length); + + assertNull(bytesArray[0]); + assertNotNull(bytesArray[1]); + assertArrayEquals(textArray[1].getBytes(), bytesArray[1]); + assertNull(bytesArray[2]); + } } http://git-wip-us.apache.org/repos/asf/tajo/blob/85b7031a/tajo-core/src/test/java/org/apache/tajo/engine/eval/ExprTestBase.java ---------------------------------------------------------------------- diff --git a/tajo-core/src/test/java/org/apache/tajo/engine/eval/ExprTestBase.java b/tajo-core/src/test/java/org/apache/tajo/engine/eval/ExprTestBase.java index 0742a80..ad80ddf 100644 --- a/tajo-core/src/test/java/org/apache/tajo/engine/eval/ExprTestBase.java +++ b/tajo-core/src/test/java/org/apache/tajo/engine/eval/ExprTestBase.java @@ -38,10 +38,10 @@ import org.apache.tajo.master.session.Session; import org.apache.tajo.storage.LazyTuple; import org.apache.tajo.storage.Tuple; import org.apache.tajo.storage.VTuple; -import org.apache.tajo.util.Bytes; +import org.apache.tajo.util.BytesUtils; import org.apache.tajo.util.CommonTestingUtil; -import org.apache.tajo.util.datetime.DateTimeUtil; import org.apache.tajo.util.KeyValueSet; +import org.apache.tajo.util.datetime.DateTimeUtil; import org.junit.AfterClass; import org.junit.BeforeClass; @@ -170,7 +170,7 @@ public class ExprTestBase { } lazyTuple = - new LazyTuple(inputSchema, Bytes.splitPreserveAllTokens(csvTuple.getBytes(), delimiter, targetIdx),0); + new LazyTuple(inputSchema, BytesUtils.splitPreserveAllTokens(csvTuple.getBytes(), delimiter, targetIdx),0); vtuple = new VTuple(inputSchema.size()); for (int i = 0; i < inputSchema.size(); i++) { // If null value occurs, null datum is manually inserted to an input tuple. http://git-wip-us.apache.org/repos/asf/tajo/blob/85b7031a/tajo-storage/src/main/java/org/apache/tajo/storage/CSVFile.java ---------------------------------------------------------------------- diff --git a/tajo-storage/src/main/java/org/apache/tajo/storage/CSVFile.java b/tajo-storage/src/main/java/org/apache/tajo/storage/CSVFile.java index 17b9229..8e26ec6 100644 --- a/tajo-storage/src/main/java/org/apache/tajo/storage/CSVFile.java +++ b/tajo-storage/src/main/java/org/apache/tajo/storage/CSVFile.java @@ -40,7 +40,7 @@ import org.apache.tajo.storage.compress.CodecPool; import org.apache.tajo.storage.exception.AlreadyExistsStorageException; import org.apache.tajo.storage.fragment.FileFragment; import org.apache.tajo.storage.rcfile.NonSyncByteArrayOutputStream; -import org.apache.tajo.util.Bytes; +import org.apache.tajo.util.BytesUtils; import java.io.*; import java.util.ArrayList; @@ -466,8 +466,8 @@ public class CSVFile { offset = fileOffsets.get(currentIdx); } - byte[][] cells = Bytes.splitPreserveAllTokens(buffer.getData(), startOffsets.get(currentIdx), - rowLengthList.get(currentIdx), delimiter, targetColumnIndexes); + byte[][] cells = BytesUtils.splitPreserveAllTokens(buffer.getData(), startOffsets.get(currentIdx), + rowLengthList.get(currentIdx), delimiter, targetColumnIndexes); currentIdx++; return new LazyTuple(schema, cells, offset, nullChars, serde); } catch (Throwable t) { http://git-wip-us.apache.org/repos/asf/tajo/blob/85b7031a/tajo-storage/src/main/java/org/apache/tajo/storage/RowFile.java ---------------------------------------------------------------------- diff --git a/tajo-storage/src/main/java/org/apache/tajo/storage/RowFile.java b/tajo-storage/src/main/java/org/apache/tajo/storage/RowFile.java index 2068260..db36771 100644 --- a/tajo-storage/src/main/java/org/apache/tajo/storage/RowFile.java +++ b/tajo-storage/src/main/java/org/apache/tajo/storage/RowFile.java @@ -35,7 +35,6 @@ import org.apache.tajo.datum.DatumFactory; import org.apache.tajo.storage.exception.AlreadyExistsStorageException; import org.apache.tajo.storage.fragment.FileFragment; import org.apache.tajo.util.BitArray; -import org.apache.tajo.util.Bytes; import java.io.FileNotFoundException; import java.io.IOException; @@ -121,7 +120,7 @@ public class RowFile { private void readHeader() throws IOException { SYNC_INTERVAL = in.readInt(); - Bytes.readFully(in, this.sync, 0, SYNC_HASH_SIZE); + StorageUtil.readFully(in, this.sync, 0, SYNC_HASH_SIZE); } /** http://git-wip-us.apache.org/repos/asf/tajo/blob/85b7031a/tajo-storage/src/main/java/org/apache/tajo/storage/StorageUtil.java ---------------------------------------------------------------------- diff --git a/tajo-storage/src/main/java/org/apache/tajo/storage/StorageUtil.java b/tajo-storage/src/main/java/org/apache/tajo/storage/StorageUtil.java index 95bb96f..5b2d711 100644 --- a/tajo-storage/src/main/java/org/apache/tajo/storage/StorageUtil.java +++ b/tajo-storage/src/main/java/org/apache/tajo/storage/StorageUtil.java @@ -32,7 +32,10 @@ import org.apache.tajo.util.KeyValueSet; import parquet.hadoop.ParquetOutputFormat; import sun.nio.ch.DirectBuffer; +import java.io.DataInput; +import java.io.EOFException; import java.io.IOException; +import java.io.InputStream; import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.List; @@ -199,4 +202,42 @@ public class StorageUtil extends StorageConstants { } } } + + public static int readFully(InputStream is, byte[] buffer, int offset, int length) + throws IOException { + int nread = 0; + while (nread < length) { + int nbytes = is.read(buffer, offset + nread, length - nread); + if (nbytes < 0) { + return nread > 0 ? nread : nbytes; + } + nread += nbytes; + } + return nread; + } + + /** + * Similar to readFully(). Skips bytes in a loop. + * @param in The DataInput to skip bytes from + * @param len number of bytes to skip. + * @throws java.io.IOException if it could not skip requested number of bytes + * for any reason (including EOF) + */ + public static void skipFully(DataInput in, int len) throws IOException { + int amt = len; + while (amt > 0) { + long ret = in.skipBytes(amt); + if (ret == 0) { + // skip may return 0 even if we're not at EOF. Luckily, we can + // use the read() method to figure out if we're at the end. + int b = in.readByte(); + if (b == -1) { + throw new EOFException( "Premature EOF from inputStream after " + + "skipping " + (len - amt) + " byte(s)."); + } + ret = 1; + } + amt -= ret; + } + } } http://git-wip-us.apache.org/repos/asf/tajo/blob/85b7031a/tajo-storage/src/main/java/org/apache/tajo/storage/TextSerializerDeserializer.java ---------------------------------------------------------------------- diff --git a/tajo-storage/src/main/java/org/apache/tajo/storage/TextSerializerDeserializer.java b/tajo-storage/src/main/java/org/apache/tajo/storage/TextSerializerDeserializer.java index ad732c7..d2ccdc7 100644 --- a/tajo-storage/src/main/java/org/apache/tajo/storage/TextSerializerDeserializer.java +++ b/tajo-storage/src/main/java/org/apache/tajo/storage/TextSerializerDeserializer.java @@ -26,6 +26,7 @@ import org.apache.tajo.conf.TajoConf; import org.apache.tajo.datum.*; import org.apache.tajo.datum.protobuf.ProtobufJsonFormat; import org.apache.tajo.util.Bytes; +import org.apache.tajo.util.NumberUtil; import java.io.IOException; import java.io.OutputStream; @@ -132,11 +133,11 @@ public class TextSerializerDeserializer implements SerializerDeserializer { case INT1: case INT2: datum = isNull(bytes, offset, length, nullCharacters) ? NullDatum.get() - : DatumFactory.createInt2((short) Bytes.parseInt(bytes, offset, length)); + : DatumFactory.createInt2((short) NumberUtil.parseInt(bytes, offset, length)); break; case INT4: datum = isNull(bytes, offset, length, nullCharacters) ? NullDatum.get() - : DatumFactory.createInt4(Bytes.parseInt(bytes, offset, length)); + : DatumFactory.createInt4(NumberUtil.parseInt(bytes, offset, length)); break; case INT8: datum = isNull(bytes, offset, length, nullCharacters) ? NullDatum.get() @@ -148,7 +149,7 @@ public class TextSerializerDeserializer implements SerializerDeserializer { break; case FLOAT8: datum = isNull(bytes, offset, length, nullCharacters) ? NullDatum.get() - : DatumFactory.createFloat8(Bytes.parseDouble(bytes, offset, length)); + : DatumFactory.createFloat8(NumberUtil.parseDouble(bytes, offset, length)); break; case TEXT: { byte[] chars = new byte[length]; http://git-wip-us.apache.org/repos/asf/tajo/blob/85b7031a/tajo-storage/src/main/java/org/apache/tajo/storage/index/bst/BSTIndex.java ---------------------------------------------------------------------- diff --git a/tajo-storage/src/main/java/org/apache/tajo/storage/index/bst/BSTIndex.java b/tajo-storage/src/main/java/org/apache/tajo/storage/index/bst/BSTIndex.java index a7a144b..5d43bd5 100644 --- a/tajo-storage/src/main/java/org/apache/tajo/storage/index/bst/BSTIndex.java +++ b/tajo-storage/src/main/java/org/apache/tajo/storage/index/bst/BSTIndex.java @@ -30,12 +30,12 @@ import org.apache.tajo.catalog.proto.CatalogProtos.SchemaProto; import org.apache.tajo.storage.RowStoreUtil; import org.apache.tajo.storage.RowStoreUtil.RowStoreDecoder; import org.apache.tajo.storage.RowStoreUtil.RowStoreEncoder; +import org.apache.tajo.storage.StorageUtil; import org.apache.tajo.storage.Tuple; import org.apache.tajo.storage.TupleComparator; import org.apache.tajo.storage.index.IndexMethod; import org.apache.tajo.storage.index.IndexWriter; import org.apache.tajo.storage.index.OrderIndexReader; -import org.apache.tajo.util.Bytes; import java.io.Closeable; import java.io.FileNotFoundException; @@ -335,7 +335,7 @@ public class BSTIndex implements IndexMethod { // schema int schemaByteSize = indexIn.readInt(); byte [] schemaBytes = new byte[schemaByteSize]; - Bytes.readFully(indexIn, schemaBytes, 0, schemaByteSize); + StorageUtil.readFully(indexIn, schemaBytes, 0, schemaByteSize); SchemaProto.Builder builder = SchemaProto.newBuilder(); builder.mergeFrom(schemaBytes); @@ -346,7 +346,7 @@ public class BSTIndex implements IndexMethod { // comparator int compByteSize = indexIn.readInt(); byte [] compBytes = new byte[compByteSize]; - Bytes.readFully(indexIn, compBytes, 0, compByteSize); + StorageUtil.readFully(indexIn, compBytes, 0, compByteSize); TupleComparatorProto.Builder compProto = TupleComparatorProto.newBuilder(); compProto.mergeFrom(compBytes); @@ -358,11 +358,11 @@ public class BSTIndex implements IndexMethod { this.entryNum = indexIn.readInt(); if (entryNum > 0) { // if there is no any entry, do not read firstKey/lastKey values byte [] minBytes = new byte[indexIn.readInt()]; - Bytes.readFully(indexIn, minBytes, 0, minBytes.length); + StorageUtil.readFully(indexIn, minBytes, 0, minBytes.length); this.firstKey = rowStoreDecoder.toTuple(minBytes); byte [] maxBytes = new byte[indexIn.readInt()]; - Bytes.readFully(indexIn, maxBytes, 0, maxBytes.length); + StorageUtil.readFully(indexIn, maxBytes, 0, maxBytes.length); this.lastKey = rowStoreDecoder.toTuple(maxBytes); } } @@ -484,7 +484,7 @@ public class BSTIndex implements IndexMethod { for (int i = 0; i < entryNum; i++) { counter++; buf = new byte[in.readInt()]; - Bytes.readFully(in, buf, 0, buf.length); + StorageUtil.readFully(in, buf, 0, buf.length); dataSubIndex[i] = rowStoreDecoder.toTuple(buf); int offsetNum = in.readInt(); @@ -506,7 +506,7 @@ public class BSTIndex implements IndexMethod { byte[] buf; for (int i = 0; i < counter; i++) { buf = new byte[in.readInt()]; - Bytes.readFully(in, buf, 0, buf.length); + StorageUtil.readFully(in, buf, 0, buf.length); dataSubIndex[i] = rowStoreDecoder.toTuple(buf); int offsetNum = in.readInt(); @@ -535,7 +535,7 @@ public class BSTIndex implements IndexMethod { byte[] buf; for (int i = 0; i < entryNum; i++) { buf = new byte[in.readInt()]; - Bytes.readFully(in, buf, 0, buf.length); + StorageUtil.readFully(in, buf, 0, buf.length); keyTuple = rowStoreDecoder.toTuple(buf); dataIndex[i] = keyTuple; this.offsetIndex[i] = in.readLong(); http://git-wip-us.apache.org/repos/asf/tajo/blob/85b7031a/tajo-storage/src/main/java/org/apache/tajo/storage/rcfile/RCFile.java ---------------------------------------------------------------------- diff --git a/tajo-storage/src/main/java/org/apache/tajo/storage/rcfile/RCFile.java b/tajo-storage/src/main/java/org/apache/tajo/storage/rcfile/RCFile.java index 4cc37b3..78498c7 100644 --- a/tajo-storage/src/main/java/org/apache/tajo/storage/rcfile/RCFile.java +++ b/tajo-storage/src/main/java/org/apache/tajo/storage/rcfile/RCFile.java @@ -39,7 +39,6 @@ import org.apache.tajo.datum.Datum; import org.apache.tajo.datum.NullDatum; import org.apache.tajo.storage.*; import org.apache.tajo.storage.fragment.FileFragment; -import org.apache.tajo.util.Bytes; import java.io.Closeable; import java.io.*; @@ -489,7 +488,7 @@ public class RCFile { } if (skipTotal != 0) { - Bytes.skipFully(in, skipTotal); + StorageUtil.skipFully(in, skipTotal); skipTotal = 0; } @@ -528,7 +527,7 @@ public class RCFile { } if (skipTotal != 0) { - Bytes.skipFully(in, skipTotal); + StorageUtil.skipFully(in, skipTotal); } } http://git-wip-us.apache.org/repos/asf/tajo/blob/85b7031a/tajo-storage/src/main/java/org/apache/tajo/storage/sequencefile/SequenceFileAppender.java ---------------------------------------------------------------------- diff --git a/tajo-storage/src/main/java/org/apache/tajo/storage/sequencefile/SequenceFileAppender.java b/tajo-storage/src/main/java/org/apache/tajo/storage/sequencefile/SequenceFileAppender.java index 9eb1b2d..b150a9a 100644 --- a/tajo-storage/src/main/java/org/apache/tajo/storage/sequencefile/SequenceFileAppender.java +++ b/tajo-storage/src/main/java/org/apache/tajo/storage/sequencefile/SequenceFileAppender.java @@ -43,7 +43,7 @@ import org.apache.tajo.datum.ProtobufDatum; import org.apache.tajo.storage.*; import org.apache.tajo.storage.exception.AlreadyExistsStorageException; import org.apache.tajo.storage.rcfile.NonSyncByteArrayOutputStream; -import org.apache.tajo.util.Bytes; +import org.apache.tajo.util.BytesUtils; import java.io.FileNotFoundException; import java.io.IOException; @@ -177,16 +177,16 @@ public class SequenceFileAppender extends FileAppender { switch (schema.getColumn(j).getDataType().getType()) { case TEXT: - Bytes.writeVLong(os, datum.asTextBytes().length); + BytesUtils.writeVLong(os, datum.asTextBytes().length); break; case PROTOBUF: ProtobufDatum protobufDatum = (ProtobufDatum) datum; - Bytes.writeVLong(os, protobufDatum.asByteArray().length); + BytesUtils.writeVLong(os, protobufDatum.asByteArray().length); break; case CHAR: case INET4: case BLOB: - Bytes.writeVLong(os, datum.asByteArray().length); + BytesUtils.writeVLong(os, datum.asByteArray().length); break; default: } http://git-wip-us.apache.org/repos/asf/tajo/blob/85b7031a/tajo-storage/src/main/java/org/apache/tajo/storage/sequencefile/SequenceFileScanner.java ---------------------------------------------------------------------- diff --git a/tajo-storage/src/main/java/org/apache/tajo/storage/sequencefile/SequenceFileScanner.java b/tajo-storage/src/main/java/org/apache/tajo/storage/sequencefile/SequenceFileScanner.java index ccf3d9e..32d1d57 100644 --- a/tajo-storage/src/main/java/org/apache/tajo/storage/sequencefile/SequenceFileScanner.java +++ b/tajo-storage/src/main/java/org/apache/tajo/storage/sequencefile/SequenceFileScanner.java @@ -36,7 +36,7 @@ import org.apache.tajo.datum.Datum; import org.apache.tajo.datum.NullDatum; import org.apache.tajo.storage.*; import org.apache.tajo.storage.fragment.FileFragment; -import org.apache.tajo.util.Bytes; +import org.apache.tajo.util.BytesUtils; import java.io.IOException; @@ -164,7 +164,7 @@ public class SequenceFileScanner extends FileScanner { } else { Text text = new Text(); reader.getCurrentValue(text); - cells = Bytes.splitPreserveAllTokens(text.getBytes(), delimiter, projectionMap); + cells = BytesUtils.splitPreserveAllTokens(text.getBytes(), delimiter, projectionMap); totalBytes += (long)text.getBytes().length; tuple = new LazyTuple(schema, cells, 0, nullChars, serde); } http://git-wip-us.apache.org/repos/asf/tajo/blob/85b7031a/tajo-storage/src/main/java/org/apache/tajo/storage/v2/CSVFileScanner.java ---------------------------------------------------------------------- diff --git a/tajo-storage/src/main/java/org/apache/tajo/storage/v2/CSVFileScanner.java b/tajo-storage/src/main/java/org/apache/tajo/storage/v2/CSVFileScanner.java index 19209bd..e15ca6e 100644 --- a/tajo-storage/src/main/java/org/apache/tajo/storage/v2/CSVFileScanner.java +++ b/tajo-storage/src/main/java/org/apache/tajo/storage/v2/CSVFileScanner.java @@ -31,7 +31,7 @@ import org.apache.tajo.storage.LazyTuple; import org.apache.tajo.storage.Tuple; import org.apache.tajo.storage.compress.CodecPool; import org.apache.tajo.storage.fragment.FileFragment; -import org.apache.tajo.util.Bytes; +import org.apache.tajo.util.BytesUtils; import java.io.DataInputStream; import java.io.IOException; @@ -221,10 +221,10 @@ public class CSVFileScanner extends FileScannerV2 { if (prevTailLen == 0) { tail = new byte[0]; - tuples = Bytes.splitPreserveAllTokens(buf, rbyte, (char) LF); + tuples = BytesUtils.splitPreserveAllTokens(buf, rbyte, (char) LF); } else { byte[] lastRow = ArrayUtils.addAll(tail, buf); - tuples = Bytes.splitPreserveAllTokens(lastRow, rbyte + tail.length, (char) LF); + tuples = BytesUtils.splitPreserveAllTokens(lastRow, rbyte + tail.length, (char) LF); tail = null; } @@ -294,7 +294,7 @@ public class CSVFileScanner extends FileScannerV2 { offset = this.tupleOffsets[currentIdx]; } - byte[][] cells = Bytes.splitPreserveAllTokens(tuples[currentIdx++], delimiter, targetColumnIndexes); + byte[][] cells = BytesUtils.splitPreserveAllTokens(tuples[currentIdx++], delimiter, targetColumnIndexes); return new LazyTuple(schema, cells, offset); } catch (Throwable t) { LOG.error(t.getMessage(), t); http://git-wip-us.apache.org/repos/asf/tajo/blob/85b7031a/tajo-storage/src/main/java/org/apache/tajo/storage/v2/RCFile.java ---------------------------------------------------------------------- diff --git a/tajo-storage/src/main/java/org/apache/tajo/storage/v2/RCFile.java b/tajo-storage/src/main/java/org/apache/tajo/storage/v2/RCFile.java index 47dce74..ac58598 100644 --- a/tajo-storage/src/main/java/org/apache/tajo/storage/v2/RCFile.java +++ b/tajo-storage/src/main/java/org/apache/tajo/storage/v2/RCFile.java @@ -29,8 +29,8 @@ import org.apache.hadoop.io.compress.*; import org.apache.hadoop.util.Progressable; import org.apache.hadoop.util.ReflectionUtils; import org.apache.tajo.conf.TajoConf; +import org.apache.tajo.storage.StorageUtil; import org.apache.tajo.storage.rcfile.*; -import org.apache.tajo.util.Bytes; import java.io.*; import java.rmi.server.UID; @@ -485,7 +485,7 @@ public class RCFile { } if (skipTotal != 0) { - Bytes.skipFully(in, skipTotal); + StorageUtil.skipFully(in, skipTotal); skipTotal = 0; } @@ -512,7 +512,7 @@ public class RCFile { } if (skipTotal != 0) { - Bytes.skipFully(in, skipTotal); + StorageUtil.skipFully(in, skipTotal); } } http://git-wip-us.apache.org/repos/asf/tajo/blob/85b7031a/tajo-storage/src/test/java/org/apache/tajo/storage/TestLazyTuple.java ---------------------------------------------------------------------- diff --git a/tajo-storage/src/test/java/org/apache/tajo/storage/TestLazyTuple.java b/tajo-storage/src/test/java/org/apache/tajo/storage/TestLazyTuple.java index cb2f7a6..c6149f7 100644 --- a/tajo-storage/src/test/java/org/apache/tajo/storage/TestLazyTuple.java +++ b/tajo-storage/src/test/java/org/apache/tajo/storage/TestLazyTuple.java @@ -23,7 +23,7 @@ import org.apache.tajo.catalog.Schema; import org.apache.tajo.common.TajoDataTypes; import org.apache.tajo.datum.DatumFactory; import org.apache.tajo.datum.NullDatum; -import org.apache.tajo.util.Bytes; +import org.apache.tajo.util.BytesUtils; import org.junit.Before; import org.junit.Test; @@ -69,7 +69,7 @@ public class TestLazyTuple { sb.append(DatumFactory.createInet4("192.168.0.1")).append('|'); sb.append(new String(nullbytes)).append('|'); sb.append(NullDatum.get()); - textRow = Bytes.splitPreserveAllTokens(sb.toString().getBytes(), '|'); + textRow = BytesUtils.splitPreserveAllTokens(sb.toString().getBytes(), '|'); serde = new TextSerializerDeserializer(); } @@ -220,7 +220,7 @@ public class TestLazyTuple { @Test public void testInvalidNumber() { - byte[][] bytes = Bytes.splitPreserveAllTokens(" 1| |2 ||".getBytes(), '|'); + byte[][] bytes = BytesUtils.splitPreserveAllTokens(" 1| |2 ||".getBytes(), '|'); Schema schema = new Schema(); schema.addColumn("col1", TajoDataTypes.Type.INT2); schema.addColumn("col2", TajoDataTypes.Type.INT4);
