This is an automated email from the ASF dual-hosted git repository.

jeongyoon pushed a commit to branch skew_exp
in repository https://gitbox.apache.org/repos/asf/incubator-nemo.git

commit 3943919f5bbc58f2cfaa147d3dd7171b0974b178
Author: sanha <[email protected]>
AuthorDate: Tue Mar 13 18:55:20 2018 +0900

    limit external bytes
---
 .../java/edu/snu/nemo/common/coder/BytesCoder.java | 93 +++++++++-------------
 .../ir/edge/executionproperty/AsBytesProperty.java |  4 +
 .../executionproperty/PartitionerProperty.java     |  3 +-
 .../compiler/frontend/beam/BeamKeyExtractor.java   |  2 +-
 .../annotating/SailfishEdgePartitionerPass.java    | 52 ++++++++++++
 .../pass/compiletime/composite/SailfishPass.java   |  6 +-
 .../executor/bytetransfer/ByteInputContext.java    | 12 ++-
 .../executor/bytetransfer/FrameDecoder.java        |  4 +-
 .../runtime/executor/data/BlockManagerWorker.java  | 29 ++++++-
 .../snu/nemo/runtime/executor/data/DataUtil.java   | 17 ++--
 .../runtime/executor/data/LimitedInputStream.java  | 37 ++++++++-
 .../runtime/executor/data/SerializerManager.java   |  4 +-
 .../runtime/executor/data/block/FileBlock.java     |  3 +-
 .../data/block/NonSerializedMemoryBlock.java       | 10 +--
 .../executor/data/block/SerializedMemoryBlock.java | 13 ++-
 .../data/partitioner/IncrementPartitioner.java     | 28 ++++---
 .../executor/data/stores/AbstractBlockStore.java   | 13 ---
 .../runtime/executor/data/stores/BlockStore.java   | 12 ---
 .../runtime/executor/data/stores/MemoryStore.java  |  9 ++-
 .../runtime/executor/datatransfer/InputReader.java | 31 +++++++-
 .../executor/datatransfer/OutputWriter.java        | 24 +++++-
 .../compiletime/composite/SailfishPassTest.java    |  2 +
 .../snu/nemo/tests/runtime/RuntimeTestUtil.java    |  2 +-
 .../runtime/executor/data/BlockStoreTest.java      |  6 +-
 .../executor/datatransfer/DataTransferTest.java    |  2 +
 25 files changed, 277 insertions(+), 141 deletions(-)

diff --git a/common/src/main/java/edu/snu/nemo/common/coder/BytesCoder.java 
b/common/src/main/java/edu/snu/nemo/common/coder/BytesCoder.java
index 48d275f..c5a43db 100644
--- a/common/src/main/java/edu/snu/nemo/common/coder/BytesCoder.java
+++ b/common/src/main/java/edu/snu/nemo/common/coder/BytesCoder.java
@@ -15,12 +15,16 @@
  */
 package edu.snu.nemo.common.coder;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import java.io.*;
 
 /**
  * A {@link Coder} which is used for an array of bytes.
  */
-public final class BytesCoder implements Coder<BytesCoder.BytesWrapper> {
+public final class BytesCoder implements Coder<byte[]> {
+  private static final Logger LOG = 
LoggerFactory.getLogger(BytesCoder.class.getName());
 
   /**
    * Constructor.
@@ -28,69 +32,46 @@ public final class BytesCoder implements 
Coder<BytesCoder.BytesWrapper> {
   public BytesCoder() {
   }
 
+  /**
+   * The array of bytes to write has to have the exact length to write.
+   * @see Coder#encode(Object, OutputStream).
+   */
   @Override
-  public void encode(final BytesWrapper value, final OutputStream outStream) 
throws IOException {
-    try (final DataOutputStream dataOutputStream = new 
DataOutputStream(outStream)) {
-      dataOutputStream.writeInt(value.getLength()); // Write the size of this 
byte array.
-      dataOutputStream.writeLong(value.getElementsTotal()); // Write the 
number of elements in this byte array.
-      dataOutputStream.write(value.getBytes());
-    }
+  public void encode(final byte[] value, final OutputStream outStream) throws 
IOException {
+    outStream.write(value);
   }
 
   @Override
-  public BytesWrapper decode(final InputStream inStream) throws IOException {
-    // If the inStream is closed well in upper level, it is okay to not close 
this stream
-    // because the DataInputStream itself will not contain any extra 
information.
-    // (when we close this stream, the inStream will be closed together.)
-    final DataInputStream dataInputStream = new DataInputStream(inStream);
-    final int bytesToRead = dataInputStream.readInt();
-    final long elementsTotal = dataInputStream.readLong();
-    final byte[] bytes = new byte[bytesToRead]; // Read the size of this byte 
array.
-    final int readBytes = dataInputStream.read(bytes);
-    if (bytesToRead != readBytes) {
-      throw new IOException("Have to read " + bytesToRead + " but read only " 
+ readBytes + " bytes.");
+  public byte[] decode(final InputStream inStream) throws IOException {
+    //LOG.warn("InputStream#available() might not exactly represent the number 
of bytes to read. "
+    //    + "Please use decode(int, InputStream) method with explicit 
length.");
+    //return this.decode(inStream.available(), inStream);
+    final int lengthToRead = inStream.available();
+    final byte[] bytes = new byte[lengthToRead]; // Read the size of this byte 
array.
+    final int readBytes = inStream.read(bytes);
+    if (lengthToRead != readBytes) {
+      throw new IOException("Have to read " + lengthToRead + " but read only " 
+ readBytes + " bytes.");
     }
-    return new BytesWrapper(elementsTotal, bytes);
+    return bytes;
   }
 
   /**
-   * A wrapper class for an array of bytes.
+   * Decodes the a value from the given input stream.
+   * It have to be able to decode the given stream consequently by calling 
this method repeatedly.
+   * Because there are many elements in the input stream, the stream should 
not be closed.
+   *
+   * @param lengthToRead the length to read.
+   * @param inStream     the stream from which bytes are read.
+   * @return the decoded bytes.
+   * @throws IOException if fail to decode
    */
-  public final class BytesWrapper {
-    private long elementsTotal;
-    private byte[] bytes;
-
-    /**
-     * Constructor.
-     *
-     * @param elementsTotal the total number of elements in this array of 
bytes.
-     * @param bytes         the array of bytes.
-     */
-    public BytesWrapper(final long elementsTotal,
-                        final byte[] bytes) {
-      this.elementsTotal = elementsTotal;
-      this.bytes = bytes;
-    }
-
-    /**
-     * @return the length of the byte array.
-     */
-    public int getLength() {
-      return bytes.length;
-    }
-
-    /**
-     * @return the total number of elements in the byte array.
-     */
-    public long getElementsTotal() {
-      return elementsTotal;
+  /*public byte[] decode(final int lengthToRead,
+                       final InputStream inStream) throws IOException {
+    final byte[] bytes = new byte[lengthToRead]; // Read the size of this byte 
array.
+    final int readBytes = inStream.read(bytes);
+    if (lengthToRead != readBytes) {
+      throw new IOException("Have to read " + lengthToRead + " but read only " 
+ readBytes + " bytes.");
     }
-
-    /**
-     * @return the wrapped byte array.
-     */
-    public byte[] getBytes() {
-      return bytes;
-    }
-  }
+    return bytes;
+  }*/
 }
diff --git 
a/common/src/main/java/edu/snu/nemo/common/ir/edge/executionproperty/AsBytesProperty.java
 
b/common/src/main/java/edu/snu/nemo/common/ir/edge/executionproperty/AsBytesProperty.java
index 13ab03c..6cd1ddc 100644
--- 
a/common/src/main/java/edu/snu/nemo/common/ir/edge/executionproperty/AsBytesProperty.java
+++ 
b/common/src/main/java/edu/snu/nemo/common/ir/edge/executionproperty/AsBytesProperty.java
@@ -44,6 +44,10 @@ public final class AsBytesProperty extends 
ExecutionProperty<AsBytesProperty.Val
    * Possible values of AsBytes ExecutionProperty.
    * When an edge is annotated as Write(or Read)AsBytes,
    * the writing (reading) Task writes (reads) data as arrays of bytes, 
instead of (de)serialized form.
+   * If a data read as bytes, each element will be a serialized bytes of a 
partition.
+   * Because of this, each element should be written to a partition 
respectively,
+   * through partitioner like increment partitioner. (During this, the key of 
each partition can be changed.)
+   * This bytes should be written as bytes also to restore it's contents.
    */
   public enum Value {
     ReadAsBytes,
diff --git 
a/common/src/main/java/edu/snu/nemo/common/ir/edge/executionproperty/PartitionerProperty.java
 
b/common/src/main/java/edu/snu/nemo/common/ir/edge/executionproperty/PartitionerProperty.java
index 08e607a..11d1e3c 100644
--- 
a/common/src/main/java/edu/snu/nemo/common/ir/edge/executionproperty/PartitionerProperty.java
+++ 
b/common/src/main/java/edu/snu/nemo/common/ir/edge/executionproperty/PartitionerProperty.java
@@ -44,6 +44,7 @@ public final class PartitionerProperty extends 
ExecutionProperty<PartitionerProp
   public enum Value {
     DataSkewHashPartitioner,
     HashPartitioner,
-    IntactPartitioner
+    IntactPartitioner,
+    IncrementPartitioner
   }
 }
diff --git 
a/compiler/frontend/beam/src/main/java/edu/snu/nemo/compiler/frontend/beam/BeamKeyExtractor.java
 
b/compiler/frontend/beam/src/main/java/edu/snu/nemo/compiler/frontend/beam/BeamKeyExtractor.java
index 18df509..48366e6 100644
--- 
a/compiler/frontend/beam/src/main/java/edu/snu/nemo/compiler/frontend/beam/BeamKeyExtractor.java
+++ 
b/compiler/frontend/beam/src/main/java/edu/snu/nemo/compiler/frontend/beam/BeamKeyExtractor.java
@@ -22,7 +22,7 @@ import org.apache.beam.sdk.values.KV;
  * Extracts the key from a KV element.
  * For non-KV elements, the elements themselves become the key.
  */
-final class BeamKeyExtractor implements KeyExtractor {
+public final class BeamKeyExtractor implements KeyExtractor {
   @Override
   public Object extractKey(final Object element) {
     if (element instanceof KV) {
diff --git 
a/compiler/optimizer/src/main/java/edu/snu/nemo/compiler/optimizer/pass/compiletime/annotating/SailfishEdgePartitionerPass.java
 
b/compiler/optimizer/src/main/java/edu/snu/nemo/compiler/optimizer/pass/compiletime/annotating/SailfishEdgePartitionerPass.java
new file mode 100644
index 0000000..3b51f9f
--- /dev/null
+++ 
b/compiler/optimizer/src/main/java/edu/snu/nemo/compiler/optimizer/pass/compiletime/annotating/SailfishEdgePartitionerPass.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2017 Seoul National University
+ *
+ * Licensed 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 edu.snu.nemo.compiler.optimizer.pass.compiletime.annotating;
+
+import edu.snu.nemo.common.dag.DAG;
+import edu.snu.nemo.common.ir.edge.IREdge;
+import edu.snu.nemo.common.ir.edge.executionproperty.AsBytesProperty;
+import edu.snu.nemo.common.ir.edge.executionproperty.PartitionerProperty;
+import edu.snu.nemo.common.ir.executionproperty.ExecutionProperty;
+import edu.snu.nemo.common.ir.vertex.IRVertex;
+
+import java.util.Collections;
+
+/**
+ * A pass to support Sailfish-like shuffle by tagging edges.
+ * This pass handles the AsBytes ExecutionProperty,
+ * which makes {@link edu.snu.nemo.common.ir.vertex.transform.RelayTransform} 
to read and write data as bytes.
+ */
+public final class SailfishEdgePartitionerPass extends AnnotatingPass {
+  /**
+   * Default constructor.
+   */
+  public SailfishEdgePartitionerPass() {
+    super(ExecutionProperty.Key.Partitioner, 
Collections.singleton(ExecutionProperty.Key.AsBytes));
+  }
+
+  @Override
+  public DAG<IRVertex, IREdge> apply(final DAG<IRVertex, IREdge> dag) {
+    dag.getVertices().forEach(vertex -> {
+      dag.getIncomingEdgesOf(vertex).forEach(irEdge -> {
+        if 
(AsBytesProperty.Value.WriteAsBytes.equals(irEdge.getProperty(ExecutionProperty.Key.AsBytes))
+            || 
AsBytesProperty.Value.ReadWriteAsBytes.equals(irEdge.getProperty(ExecutionProperty.Key.AsBytes)))
 {
+          
irEdge.setProperty(PartitionerProperty.of(PartitionerProperty.Value.IncrementPartitioner));
+        }
+      });
+    });
+    return dag;
+  }
+}
diff --git 
a/compiler/optimizer/src/main/java/edu/snu/nemo/compiler/optimizer/pass/compiletime/composite/SailfishPass.java
 
b/compiler/optimizer/src/main/java/edu/snu/nemo/compiler/optimizer/pass/compiletime/composite/SailfishPass.java
index 2d0acdb..fa08eae 100644
--- 
a/compiler/optimizer/src/main/java/edu/snu/nemo/compiler/optimizer/pass/compiletime/composite/SailfishPass.java
+++ 
b/compiler/optimizer/src/main/java/edu/snu/nemo/compiler/optimizer/pass/compiletime/composite/SailfishPass.java
@@ -15,10 +15,7 @@
  */
 package edu.snu.nemo.compiler.optimizer.pass.compiletime.composite;
 
-import 
edu.snu.nemo.compiler.optimizer.pass.compiletime.annotating.SailfishEdgeAsBytesPass;
-import 
edu.snu.nemo.compiler.optimizer.pass.compiletime.annotating.SailfishEdgeDataFlowModelPass;
-import 
edu.snu.nemo.compiler.optimizer.pass.compiletime.annotating.SailfishEdgeDataStorePass;
-import 
edu.snu.nemo.compiler.optimizer.pass.compiletime.annotating.SailfishEdgeUsedDataHandlingPass;
+import edu.snu.nemo.compiler.optimizer.pass.compiletime.annotating.*;
 import 
edu.snu.nemo.compiler.optimizer.pass.compiletime.reshaping.SailfishRelayReshapingPass;
 
 import java.util.Arrays;
@@ -36,6 +33,7 @@ public final class SailfishPass extends CompositePass {
         new SailfishEdgeDataFlowModelPass(),
         new SailfishEdgeDataStorePass(),
         new SailfishEdgeAsBytesPass(),
+        new SailfishEdgePartitionerPass(),
         new SailfishEdgeUsedDataHandlingPass()
     ));
   }
diff --git 
a/runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/bytetransfer/ByteInputContext.java
 
b/runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/bytetransfer/ByteInputContext.java
index e3dc30e..d2fdab0 100644
--- 
a/runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/bytetransfer/ByteInputContext.java
+++ 
b/runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/bytetransfer/ByteInputContext.java
@@ -15,6 +15,7 @@
  */
 package edu.snu.nemo.runtime.executor.bytetransfer;
 
+import edu.snu.nemo.runtime.executor.data.LimitedInputStream;
 import io.netty.buffer.ByteBuf;
 
 import javax.annotation.Nullable;
@@ -27,7 +28,7 @@ import java.util.concurrent.CompletableFuture;
  * Container for multiple input streams. Represents a transfer context on 
receiver-side.
  *
  * <h3>Thread safety:</h3>
- * <p>Methods with default access modifier, namely {@link #onNewStream()}, 
{@link #onByteBuf(ByteBuf)},
+ * <p>Methods with default access modifier, namely {@link #onNewStream(int)}, 
{@link #onByteBuf(ByteBuf)},
  * {@link #onContextClose()}, are not thread-safe, since they are called by a 
single Netty event loop.</p>
  * <p>Public methods are thread safe,
  * although the execution order may not be linearized if they were called from 
different threads.</p>
@@ -35,7 +36,7 @@ import java.util.concurrent.CompletableFuture;
 public final class ByteInputContext extends ByteTransferContext {
 
   private final CompletableFuture<Iterator<InputStream>> completedFuture = new 
CompletableFuture<>();
-  private final ClosableBlockingQueue<ByteBufInputStream> byteBufInputStreams 
= new ClosableBlockingQueue<>();
+  private final ClosableBlockingQueue<LimitedInputStream> byteBufInputStreams 
= new ClosableBlockingQueue<>();
   private volatile ByteBufInputStream currentByteBufInputStream = null;
 
   private final Iterator<InputStream> inputStreams = new 
Iterator<InputStream>() {
@@ -91,13 +92,15 @@ public final class ByteInputContext extends 
ByteTransferContext {
 
   /**
    * Called when a punctuation for sub-stream incarnation is detected.
+   *
+   * @param lengthToRead the size of the new stream.
    */
-  void onNewStream() {
+  void onNewStream(final int lengthToRead) {
     if (currentByteBufInputStream != null) {
       currentByteBufInputStream.byteBufQueue.close();
     }
     currentByteBufInputStream = new ByteBufInputStream();
-    byteBufInputStreams.put(currentByteBufInputStream);
+    byteBufInputStreams.put(new LimitedInputStream(currentByteBufInputStream, 
lengthToRead));
   }
 
   /**
@@ -145,6 +148,7 @@ public final class ByteInputContext extends 
ByteTransferContext {
   private static final class ByteBufInputStream extends InputStream {
 
     private final ClosableBlockingQueue<ByteBuf> byteBufQueue = new 
ClosableBlockingQueue<>();
+    private int readByteCount = 0;
 
     @Override
     public int read() throws IOException {
diff --git 
a/runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/bytetransfer/FrameDecoder.java
 
b/runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/bytetransfer/FrameDecoder.java
index 0df3661..bea0506 100644
--- 
a/runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/bytetransfer/FrameDecoder.java
+++ 
b/runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/bytetransfer/FrameDecoder.java
@@ -86,6 +86,8 @@ final class FrameDecoder extends ByteToMessageDecoder {
    */
   private boolean isLastFrame;
 
+  private long dataFrameLengthTotal = 0;
+
   FrameDecoder(final ContextManager contextManager) {
     this.contextManager = contextManager;
   }
@@ -148,7 +150,7 @@ final class FrameDecoder extends ByteToMessageDecoder {
             ctx.channel().localAddress(), ctx.channel().remoteAddress()));
       }
       if (newSubStreamFlag) {
-        inputContext.onNewStream();
+        inputContext.onNewStream((int) length); // TODO #?: refactor? 
InputStream#available() return int.
       }
       if (dataBodyBytesToRead == 0) {
         onDataFrameEnd();
diff --git 
a/runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/data/BlockManagerWorker.java
 
b/runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/data/BlockManagerWorker.java
index 13d1866..ded05ce 100644
--- 
a/runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/data/BlockManagerWorker.java
+++ 
b/runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/data/BlockManagerWorker.java
@@ -39,6 +39,7 @@ import 
edu.snu.nemo.runtime.executor.data.partition.NonSerializedPartition;
 import edu.snu.nemo.runtime.executor.data.partition.SerializedPartition;
 import edu.snu.nemo.runtime.executor.data.stores.BlockStore;
 import edu.snu.nemo.runtime.executor.data.stores.*;
+import edu.snu.nemo.runtime.executor.data.streamchainer.Serializer;
 import org.apache.commons.lang3.SerializationUtils;
 import org.apache.reef.tang.annotations.Parameter;
 
@@ -119,8 +120,27 @@ public final class BlockManagerWorker {
    */
   public Block createBlock(final String blockId,
                            final DataStoreProperty.Value blockStore) throws 
BlockWriteException {
+    return this.createBlock(blockId, blockStore, false, false);
+  }
+
+  /**
+   * Creates a new block.
+   * If write (or read) as bytes is enabled, data written to (read from) the 
block does not (de)serialized.
+   *
+   * @param blockId      the ID of the block to create.
+   * @param blockStore   the store to place the block.
+   * @param readAsBytes  whether read data as arrays of bytes or not.
+   * @param writeAsBytes whether write data as arrays of bytes or not.
+   * @return the created block.
+   * @throws BlockWriteException for any error occurred while trying to create 
a block.
+   *
+   */
+  public Block createBlock(final String blockId,
+                           final DataStoreProperty.Value blockStore,
+                           final boolean readAsBytes,
+                           final boolean writeAsBytes) throws 
BlockWriteException {
     final BlockStore store = getBlockStore(blockStore);
-    return store.createBlock(blockId);
+    return store.createBlock(blockId, readAsBytes, writeAsBytes);
   }
 
   /**
@@ -176,6 +196,7 @@ public final class BlockManagerWorker {
    *
    * @param blockId       of the block.
    * @param runtimeEdgeId id of the runtime edge that corresponds to the block.
+   * @param readAsBytes   whether read data as arrays of bytes or not.
    * @param blockStore    for the data storage.
    * @param keyRange      the key range descriptor
    * @return the {@link CompletableFuture} of the block.
@@ -183,6 +204,7 @@ public final class BlockManagerWorker {
   public CompletableFuture<DataUtil.IteratorWithNumBytes> queryBlock(
       final String blockId,
       final String runtimeEdgeId,
+      final boolean readAsBytes,
       final DataStoreProperty.Value blockStore,
       final KeyRange keyRange) {
     // Let's see if a remote worker has it
@@ -223,6 +245,8 @@ public final class BlockManagerWorker {
         // Block resides in the evaluator
         return retrieveDataFromBlock(blockId, blockStore, keyRange);
       } else {
+        final Serializer serializerToUse = readAsBytes
+            ? SerializerManager.getAsBytesSerializer() : 
serializerManager.getSerializer(runtimeEdgeId);
         final ByteTransferContextDescriptor descriptor = 
ByteTransferContextDescriptor.newBuilder()
             .setBlockId(blockId)
             .setBlockStore(convertBlockStore(blockStore))
@@ -231,8 +255,7 @@ public final class BlockManagerWorker {
             .build();
         return byteTransfer.newInputContext(targetExecutorId, 
descriptor.toByteArray())
             .thenCompose(context -> context.getCompletedFuture())
-            .thenApply(streams -> new DataUtil.InputStreamIterator(streams,
-                serializerManager.getSerializer(runtimeEdgeId)));
+            .thenApply(streams -> new DataUtil.InputStreamIterator(streams, 
serializerToUse));
       }
     });
   }
diff --git 
a/runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/data/DataUtil.java
 
b/runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/data/DataUtil.java
index 87aeeef..0196a1f 100644
--- 
a/runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/data/DataUtil.java
+++ 
b/runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/data/DataUtil.java
@@ -133,10 +133,11 @@ public final class DataUtil {
     final List<NonSerializedPartition<K>> nonSerializedPartitions = new 
ArrayList<>();
     for (final SerializedPartition<K> partitionToConvert : 
partitionsToConvert) {
       final K key = partitionToConvert.getKey();
-      try (final ByteArrayInputStream byteArrayInputStream =
-               new ByteArrayInputStream(partitionToConvert.getData())) {
+      final int lengthToRead = partitionToConvert.getLength();
+      try (final LimitedInputStream limitedInputStream =
+               new LimitedInputStream(new 
ByteArrayInputStream(partitionToConvert.getData()), lengthToRead)) {
         final NonSerializedPartition<K> deserializePartition = 
deserializePartition(
-            partitionToConvert.getLength(), serializer, key, 
byteArrayInputStream);
+            partitionToConvert.getLength(), serializer, key, 
limitedInputStream);
         nonSerializedPartitions.add(deserializePartition);
       }
     }
@@ -196,6 +197,7 @@ public final class DataUtil {
     private final Iterator<InputStream> inputStreams;
     private final Serializer<T> serializer;
     private final int limit;
+    //private final boolean asBytes;
 
     private volatile CountingInputStream serializedCountingStream = null;
     private volatile CountingInputStream encodedCountingStream = null;
@@ -207,6 +209,7 @@ public final class DataUtil {
 
     /**
      * Construct {@link Iterator} from {@link InputStream} and {@link Coder}.
+     * This constructor will be used when this streams came from external 
executor.
      *
      * @param inputStreams the streams to read data from.
      * @param serializer   the serializer.
@@ -217,14 +220,16 @@ public final class DataUtil {
       this.serializer = serializer;
       // -1 means no limit.
       this.limit = -1;
+      //this.asBytes = serializer.getCoder() instanceof BytesCoder;
     }
 
     /**
      * Construct {@link Iterator} from {@link InputStream} and {@link Coder}.
+     * This constructor will be used when this streams came from local store.
      *
      * @param inputStreams the streams to read data from.
      * @param serializer   the serializer.
-     * @param limit        the maximum bytes from the {@link InputStream}.
+     * @param limit        the maximum (serialized) bytes from the {@link 
InputStream}.
      */
     public InputStreamIterator(
         final Iterator<InputStream> inputStreams,
@@ -236,6 +241,7 @@ public final class DataUtil {
       this.inputStreams = inputStreams;
       this.serializer = serializer;
       this.limit = limit;
+      //this.asBytes = false; // It is okay to use
     }
 
     @Override
@@ -246,7 +252,8 @@ public final class DataUtil {
       if (cannotContinueDecoding) {
         return false;
       }
-      if (limit != -1 && limit == numSerializedBytes) {
+      final int currentStreamCount = serializedCountingStream == null ? 0 : 
(int) serializedCountingStream.getCount();
+      if (limit != -1 && limit == numSerializedBytes + currentStreamCount) {
         cannotContinueDecoding = true;
         return false;
       }
diff --git 
a/runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/data/LimitedInputStream.java
 
b/runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/data/LimitedInputStream.java
index c87424f..74659df 100644
--- 
a/runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/data/LimitedInputStream.java
+++ 
b/runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/data/LimitedInputStream.java
@@ -25,7 +25,7 @@ import java.io.InputStream;
  */
 public final class LimitedInputStream extends InputStream {
   private final InputStream in;
-  private long limit;
+  private int limit;
 
   /**
    * Constructor.
@@ -33,7 +33,7 @@ public final class LimitedInputStream extends InputStream {
    * @param in    {@link InputStream} that should be limited.
    * @param limit bytes to limit.
    */
-  public LimitedInputStream(final InputStream in, final long limit) {
+  public LimitedInputStream(final InputStream in, final int limit) {
     this.in = in;
     this.limit = limit;
   }
@@ -47,4 +47,37 @@ public final class LimitedInputStream extends InputStream {
       return -1;
     }
   }
+
+  @Override
+  public int read(final byte[] b) throws IOException {
+    if (limit > 0) {
+      final int readBytes = in.read(b);
+      if (readBytes > 0) {
+        limit -= readBytes;
+      }
+
+      return readBytes;
+    } else {
+      return -1;
+    }
+  }
+
+  @Override
+  public int read(final byte[] b, final int off, final int len) throws 
IOException {
+    if (limit > 0) {
+      final int readBytes = in.read(b, off, len);
+      if (readBytes > 0) {
+        limit -= readBytes;
+      }
+
+      return readBytes;
+    } else {
+      return -1;
+    }
+  }
+
+  @Override
+  public int available() {
+    return limit;
+  }
 }
diff --git 
a/runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/data/SerializerManager.java
 
b/runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/data/SerializerManager.java
index 3138278..0cf2ceb 100644
--- 
a/runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/data/SerializerManager.java
+++ 
b/runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/data/SerializerManager.java
@@ -38,7 +38,7 @@ import java.util.concurrent.ConcurrentMap;
  */
 public final class SerializerManager {
   private static final Logger LOG = 
LoggerFactory.getLogger(SerializerManager.class.getName());
-  private static final Serializer<BytesCoder.BytesWrapper> AS_BYTES_SERIALIZER 
=
+  private static final Serializer<byte[]> AS_BYTES_SERIALIZER =
       new Serializer<>(new BytesCoder(), Collections.emptyList());
   private final ConcurrentMap<String, Serializer> runtimeEdgeIdToSerializer = 
new ConcurrentHashMap<>();
 
@@ -93,7 +93,7 @@ public final class SerializerManager {
   /**
    * @return a serializer which just converts between ByteStream and array of 
bytes.
    */
-  public static Serializer<BytesCoder.BytesWrapper> getAsBytesSerializer() {
+  public static Serializer<byte[]> getAsBytesSerializer() {
     return AS_BYTES_SERIALIZER;
   }
 }
diff --git 
a/runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/data/block/FileBlock.java
 
b/runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/data/block/FileBlock.java
index 4e64245..2e22eb0 100644
--- 
a/runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/data/block/FileBlock.java
+++ 
b/runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/data/block/FileBlock.java
@@ -189,8 +189,7 @@ public final class FileBlock<K extends Serializable> 
implements Block<K> {
               // reading input from chained compression InputStream.
               // Plus, this stream must be not closed to prevent to close the 
filtered file partition.
               final int length = partitionMetadata.getPartitionSize();
-              final LimitedInputStream limitedInputStream =
-                  new LimitedInputStream(fileStream, length);
+              final LimitedInputStream limitedInputStream = new 
LimitedInputStream(fileStream, length);
               final NonSerializedPartition<K> deserializePartition =
                   DataUtil.deserializePartition(length, serializerToUse, key, 
limitedInputStream);
               deserializedPartitions.add(deserializePartition);
diff --git 
a/runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/data/block/NonSerializedMemoryBlock.java
 
b/runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/data/block/NonSerializedMemoryBlock.java
index 113a347..1694e19 100644
--- 
a/runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/data/block/NonSerializedMemoryBlock.java
+++ 
b/runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/data/block/NonSerializedMemoryBlock.java
@@ -41,8 +41,6 @@ public final class NonSerializedMemoryBlock<K extends 
Serializable> implements B
   private final List<NonSerializedPartition<K>> nonSerializedPartitions;
   private final Map<K, NonSerializedPartition<K>> nonCommittedPartitionsMap;
   private final Serializer serializer;
-  private final boolean readAsBytes;
-  private final boolean writeAsBytes;
   private volatile boolean committed;
 
   /**
@@ -51,19 +49,13 @@ public final class NonSerializedMemoryBlock<K extends 
Serializable> implements B
    *
    * @param blockId      the ID of this block.
    * @param serializer   the {@link Serializer}.
-   * @param readAsBytes  whether read data from this block as arrays of bytes 
or not.
-   * @param writeAsBytes whether write data to this block as arrays of bytes 
or not.
    */
   public NonSerializedMemoryBlock(final String blockId,
-                                  final Serializer serializer,
-                                  final boolean readAsBytes,
-                                  final boolean writeAsBytes) {
+                                  final Serializer serializer) {
     this.id = blockId;
     this.nonSerializedPartitions = new ArrayList<>();
     this.nonCommittedPartitionsMap = new HashMap<>();
     this.serializer = serializer;
-    this.readAsBytes = readAsBytes;
-    this.writeAsBytes = writeAsBytes;
     this.committed = false;
   }
 
diff --git 
a/runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/data/block/SerializedMemoryBlock.java
 
b/runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/data/block/SerializedMemoryBlock.java
index 2630b26..21926ed 100644
--- 
a/runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/data/block/SerializedMemoryBlock.java
+++ 
b/runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/data/block/SerializedMemoryBlock.java
@@ -19,6 +19,7 @@ import edu.snu.nemo.common.exception.BlockFetchException;
 import edu.snu.nemo.common.exception.BlockWriteException;
 import edu.snu.nemo.runtime.common.data.KeyRange;
 import edu.snu.nemo.runtime.executor.data.DataUtil;
+import edu.snu.nemo.runtime.executor.data.SerializerManager;
 import edu.snu.nemo.runtime.executor.data.partition.NonSerializedPartition;
 import edu.snu.nemo.runtime.executor.data.partition.SerializedPartition;
 import edu.snu.nemo.runtime.executor.data.streamchainer.Serializer;
@@ -83,9 +84,11 @@ public final class SerializedMemoryBlock<K extends 
Serializable> implements Bloc
       throw new BlockWriteException(new Throwable("The partition is already 
committed!"));
     } else {
       try {
+        final Serializer serializerToUse = writeAsBytes
+            ? SerializerManager.getAsBytesSerializer() : serializer;
         SerializedPartition<K> partition = nonCommittedPartitionsMap.get(key);
         if (partition == null) {
-          partition = new SerializedPartition<>(key, serializer);
+          partition = new SerializedPartition<>(key, serializerToUse);
           nonCommittedPartitionsMap.put(key, partition);
         }
         partition.write(element);
@@ -107,8 +110,10 @@ public final class SerializedMemoryBlock<K extends 
Serializable> implements Bloc
   public void writePartitions(final Iterable<NonSerializedPartition<K>> 
partitions) throws BlockWriteException {
     if (!committed) {
       try {
+        final Serializer serializerToUse = writeAsBytes
+            ? SerializerManager.getAsBytesSerializer() : serializer;
         final Iterable<SerializedPartition<K>> convertedPartitions = 
DataUtil.convertToSerPartitions(
-            serializer, partitions);
+            serializerToUse, partitions);
         writeSerializedPartitions(convertedPartitions);
       } catch (final IOException e) {
         throw new BlockWriteException(e);
@@ -147,7 +152,9 @@ public final class SerializedMemoryBlock<K extends 
Serializable> implements Bloc
   @Override
   public Iterable<NonSerializedPartition<K>> readPartitions(final KeyRange 
keyRange) throws BlockFetchException {
     try {
-      return DataUtil.convertToNonSerPartitions(serializer, 
readSerializedPartitions(keyRange));
+      final Serializer serializerToUse = readAsBytes
+          ? SerializerManager.getAsBytesSerializer() : serializer;
+      return DataUtil.convertToNonSerPartitions(serializerToUse, 
readSerializedPartitions(keyRange));
     } catch (final IOException e) {
       throw new BlockFetchException(e);
     }
diff --git 
a/compiler/frontend/beam/src/main/java/edu/snu/nemo/compiler/frontend/beam/BeamKeyExtractor.java
 
b/runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/data/partitioner/IncrementPartitioner.java
similarity index 51%
copy from 
compiler/frontend/beam/src/main/java/edu/snu/nemo/compiler/frontend/beam/BeamKeyExtractor.java
copy to 
runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/data/partitioner/IncrementPartitioner.java
index 18df509..a967aeb 100644
--- 
a/compiler/frontend/beam/src/main/java/edu/snu/nemo/compiler/frontend/beam/BeamKeyExtractor.java
+++ 
b/runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/data/partitioner/IncrementPartitioner.java
@@ -13,22 +13,26 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package edu.snu.nemo.compiler.frontend.beam;
+package edu.snu.nemo.runtime.executor.data.partitioner;
 
-import edu.snu.nemo.common.KeyExtractor;
-import org.apache.beam.sdk.values.KV;
+import java.util.concurrent.atomic.AtomicInteger;
 
 /**
- * Extracts the key from a KV element.
- * For non-KV elements, the elements themselves become the key.
+ * An implementation of {@link Partitioner} which assigns a key per an output 
data from a source task.
+ * WARNING: This partitioner should be used for very specific case such as 
AsBytes write.
  */
-final class BeamKeyExtractor implements KeyExtractor {
+public final class IncrementPartitioner implements Partitioner<Integer> {
+  private final AtomicInteger key;
+
+  /**
+   * Constructor.
+   */
+  public IncrementPartitioner() {
+    this.key = new AtomicInteger();
+  }
+
   @Override
-  public Object extractKey(final Object element) {
-    if (element instanceof KV) {
-      return ((KV) element).getKey();
-    } else {
-      return element;
-    }
+  public Integer partition(final Object element) {
+    return key.getAndIncrement();
   }
 }
diff --git 
a/runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/data/stores/AbstractBlockStore.java
 
b/runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/data/stores/AbstractBlockStore.java
index 4c73ee3..880ab1a 100644
--- 
a/runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/data/stores/AbstractBlockStore.java
+++ 
b/runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/data/stores/AbstractBlockStore.java
@@ -17,7 +17,6 @@ package edu.snu.nemo.runtime.executor.data.stores;
 
 import edu.snu.nemo.runtime.common.RuntimeIdGenerator;
 import edu.snu.nemo.runtime.executor.data.SerializerManager;
-import edu.snu.nemo.runtime.executor.data.block.Block;
 import edu.snu.nemo.runtime.executor.data.streamchainer.Serializer;
 
 /**
@@ -36,18 +35,6 @@ public abstract class AbstractBlockStore implements 
BlockStore {
   }
 
   /**
-   * Creates a new block.
-   *
-   * @param blockId the ID of the block to create.
-   * @return the created block.
-   * @see BlockStore#createBlock(String).
-   */
-  @Override
-  public final Block createBlock(final String blockId) {
-    return createBlock(blockId, false, false);
-  }
-
-  /**
    * Gets data coder for a block from the {@link SerializerManager}.
    *
    * @param blockId the ID of the block to get the coder.
diff --git 
a/runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/data/stores/BlockStore.java
 
b/runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/data/stores/BlockStore.java
index 1648778..8801032 100644
--- 
a/runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/data/stores/BlockStore.java
+++ 
b/runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/data/stores/BlockStore.java
@@ -25,18 +25,6 @@ import java.util.Optional;
  * Interface for {@link edu.snu.nemo.runtime.executor.data.block.Block} 
placement.
  */
 public interface BlockStore {
-  /**
-   * Creates a new block.
-   * A stale data created by previous failed task should be handled during the 
creation of new block.
-   *
-   * @param blockId the ID of the block to create.
-   * @return the created block.
-   * @throws BlockWriteException for any error occurred while trying to create 
a block.
-   *                             (This exception will be thrown to the 
scheduler
-   *                             through {@link 
edu.snu.nemo.runtime.executor.Executor} and
-   *                             have to be handled by the scheduler with 
fault tolerance mechanism.)
-   */
-  Block createBlock(String blockId) throws BlockWriteException;
 
   /**
    * Creates a new block.
diff --git 
a/runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/data/stores/MemoryStore.java
 
b/runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/data/stores/MemoryStore.java
index bd608d3..5d0587b 100644
--- 
a/runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/data/stores/MemoryStore.java
+++ 
b/runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/data/stores/MemoryStore.java
@@ -43,13 +43,18 @@ public final class MemoryStore extends LocalBlockStore {
 
   /**
    * @see BlockStore#createBlock(String, boolean, boolean).
+   * @throws BlockWriteException if fail to create.
    */
   @Override
   public Block createBlock(final String blockId,
                            final boolean readAsBytes,
-                           final boolean writeAsBytes) {
+                           final boolean writeAsBytes) throws 
BlockWriteException {
+    if (readAsBytes || writeAsBytes) {
+      throw new BlockWriteException(new Throwable(
+          "Read/WriteAsBytes is not supported in " + 
MemoryStore.class.getName()));
+    }
     final Serializer serializer = getSerializerFromWorker(blockId);
-    return new NonSerializedMemoryBlock(blockId, serializer, readAsBytes, 
writeAsBytes);
+    return new NonSerializedMemoryBlock(blockId, serializer);
   }
 
   /**
diff --git 
a/runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/datatransfer/InputReader.java
 
b/runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/datatransfer/InputReader.java
index 9032b80..3751df3 100644
--- 
a/runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/datatransfer/InputReader.java
+++ 
b/runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/datatransfer/InputReader.java
@@ -16,6 +16,8 @@
 package edu.snu.nemo.runtime.executor.datatransfer;
 
 import com.google.common.annotations.VisibleForTesting;
+import edu.snu.nemo.common.exception.UnsupportedPartitionerException;
+import edu.snu.nemo.common.ir.edge.executionproperty.AsBytesProperty;
 import 
edu.snu.nemo.common.ir.edge.executionproperty.DataCommunicationPatternProperty;
 import edu.snu.nemo.common.ir.edge.executionproperty.DataStoreProperty;
 import 
edu.snu.nemo.common.ir.edge.executionproperty.DuplicateEdgeGroupPropertyValue;
@@ -46,6 +48,7 @@ import java.util.stream.StreamSupport;
  */
 public final class InputReader extends DataTransfer {
   private final int dstTaskIndex;
+  private final boolean readAsBytes;
   private final BlockManagerWorker blockManagerWorker;
 
   /**
@@ -59,13 +62,33 @@ public final class InputReader extends DataTransfer {
                      // TODO #717: Remove nullable.
                      // (If the source is not an IR vertex, do not make 
InputReader.)
                      @Nullable final IRVertex srcVertex, // null if the source 
vertex is not an IR vertex.
-                     final RuntimeEdge runtimeEdge,
+                     final RuntimeEdge<?> runtimeEdge,
                      final BlockManagerWorker blockManagerWorker) {
     super(runtimeEdge.getId());
     this.dstTaskIndex = dstTaskIndex;
     this.srcVertex = srcVertex;
     this.runtimeEdge = runtimeEdge;
     this.blockManagerWorker = blockManagerWorker;
+
+    final AsBytesProperty.Value asBytesPropertyValue = 
runtimeEdge.getProperty(ExecutionProperty.Key.AsBytes);
+    if (asBytesPropertyValue == null) {
+      this.readAsBytes = false;
+    } else {
+      switch (asBytesPropertyValue) {
+        case ReadAsBytes:
+          this.readAsBytes = true;
+          break;
+        case WriteAsBytes:
+          this.readAsBytes = false;
+          break;
+        case ReadWriteAsBytes:
+          this.readAsBytes = true;
+          break;
+        default:
+          throw new UnsupportedPartitionerException(
+              new Throwable("AsBytes " + asBytesPropertyValue + " is not 
supported."));
+      }
+    }
   }
 
   /**
@@ -93,7 +116,7 @@ public final class InputReader extends DataTransfer {
 
   private CompletableFuture<DataUtil.IteratorWithNumBytes> readOneToOne() {
     final String blockId = getBlockId(dstTaskIndex);
-    return blockManagerWorker.queryBlock(blockId, getId(),
+    return blockManagerWorker.queryBlock(blockId, getId(), readAsBytes,
         (DataStoreProperty.Value) 
runtimeEdge.getProperty(ExecutionProperty.Key.DataStore),
         HashRange.all());
   }
@@ -104,7 +127,7 @@ public final class InputReader extends DataTransfer {
     final List<CompletableFuture<DataUtil.IteratorWithNumBytes>> futures = new 
ArrayList<>();
     for (int srcTaskIdx = 0; srcTaskIdx < numSrcTasks; srcTaskIdx++) {
       final String blockId = getBlockId(srcTaskIdx);
-      futures.add(blockManagerWorker.queryBlock(blockId, getId(),
+      futures.add(blockManagerWorker.queryBlock(blockId, getId(), readAsBytes,
           (DataStoreProperty.Value) 
runtimeEdge.getProperty(ExecutionProperty.Key.DataStore),
           HashRange.all()));
     }
@@ -131,7 +154,7 @@ public final class InputReader extends DataTransfer {
     for (int srcTaskIdx = 0; srcTaskIdx < numSrcTasks; srcTaskIdx++) {
       final String blockId = getBlockId(srcTaskIdx);
       futures.add(
-          blockManagerWorker.queryBlock(blockId, getId(),
+          blockManagerWorker.queryBlock(blockId, getId(), readAsBytes,
               (DataStoreProperty.Value) 
runtimeEdge.getProperty(ExecutionProperty.Key.DataStore),
               hashRangeToRead));
     }
diff --git 
a/runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/datatransfer/OutputWriter.java
 
b/runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/datatransfer/OutputWriter.java
index 8be9ab9..73cdc4c 100644
--- 
a/runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/datatransfer/OutputWriter.java
+++ 
b/runtime/executor/src/main/java/edu/snu/nemo/runtime/executor/datatransfer/OutputWriter.java
@@ -83,11 +83,33 @@ public final class OutputWriter extends DataTransfer 
implements AutoCloseable {
       case DataSkewHashPartitioner:
         this.partitioner = new DataSkewHashPartitioner(hashRangeMultiplier, 
dstParallelism, keyExtractor);
         break;
+      case IncrementPartitioner:
+        this.partitioner = new IncrementPartitioner();
+        break;
       default:
         throw new UnsupportedPartitionerException(
             new Throwable("Partitioner " + partitionerPropertyValue + " is not 
supported."));
     }
-    blockToWrite = blockManagerWorker.createBlock(blockId, blockStoreValue);
+
+    final AsBytesProperty.Value asBytesPropertyValue = 
runtimeEdge.getProperty(ExecutionProperty.Key.AsBytes);
+    if (asBytesPropertyValue == null) {
+      blockToWrite = blockManagerWorker.createBlock(blockId, blockStoreValue);
+    } else {
+      switch (asBytesPropertyValue) {
+        case ReadAsBytes:
+          blockToWrite = blockManagerWorker.createBlock(blockId, 
blockStoreValue, true, false);
+          break;
+        case WriteAsBytes:
+          blockToWrite = blockManagerWorker.createBlock(blockId, 
blockStoreValue, false, true);
+          break;
+        case ReadWriteAsBytes:
+          blockToWrite = blockManagerWorker.createBlock(blockId, 
blockStoreValue, true, true);
+          break;
+        default:
+          throw new UnsupportedPartitionerException(
+              new Throwable("AsBytes " + asBytesPropertyValue + " is not 
supported."));
+      }
+    }
   }
 
   /**
diff --git 
a/tests/src/test/java/edu/snu/nemo/tests/compiler/optimizer/pass/compiletime/composite/SailfishPassTest.java
 
b/tests/src/test/java/edu/snu/nemo/tests/compiler/optimizer/pass/compiletime/composite/SailfishPassTest.java
index 5c6bcb9..abe14d5 100644
--- 
a/tests/src/test/java/edu/snu/nemo/tests/compiler/optimizer/pass/compiletime/composite/SailfishPassTest.java
+++ 
b/tests/src/test/java/edu/snu/nemo/tests/compiler/optimizer/pass/compiletime/composite/SailfishPassTest.java
@@ -78,6 +78,8 @@ public class SailfishPassTest {
               edgeFromMerger.getProperty(ExecutionProperty.Key.DataStore));
           assertEquals(AsBytesProperty.Value.WriteAsBytes,
               edgeFromMerger.getProperty(ExecutionProperty.Key.AsBytes));
+          assertEquals(PartitionerProperty.Value.IncrementPartitioner,
+              edgeFromMerger.getProperty(ExecutionProperty.Key.Partitioner));
         });
       } else {
         // Non merger vertex.
diff --git 
a/tests/src/test/java/edu/snu/nemo/tests/runtime/RuntimeTestUtil.java 
b/tests/src/test/java/edu/snu/nemo/tests/runtime/RuntimeTestUtil.java
index b4f411a..9e94016 100644
--- a/tests/src/test/java/edu/snu/nemo/tests/runtime/RuntimeTestUtil.java
+++ b/tests/src/test/java/edu/snu/nemo/tests/runtime/RuntimeTestUtil.java
@@ -145,7 +145,7 @@ public final class RuntimeTestUtil {
    * @return the list of elements.
    */
   public static List getRangedNumList(final int start,
-                                               final int end) {
+                                      final int end) {
     final List numList = new ArrayList<>(end - start);
     IntStream.range(start, end).forEach(number -> numList.add(KV.of(number, 
number)));
     return numList;
diff --git 
a/tests/src/test/java/edu/snu/nemo/tests/runtime/executor/data/BlockStoreTest.java
 
b/tests/src/test/java/edu/snu/nemo/tests/runtime/executor/data/BlockStoreTest.java
index 6905d2c..ac4e715 100644
--- 
a/tests/src/test/java/edu/snu/nemo/tests/runtime/executor/data/BlockStoreTest.java
+++ 
b/tests/src/test/java/edu/snu/nemo/tests/runtime/executor/data/BlockStoreTest.java
@@ -320,7 +320,7 @@ public final class BlockStoreTest {
           public Boolean call() {
             try {
               final String blockId = blockIdList.get(writeTaskIdx);
-              final Block block = writerSideStore.createBlock(blockId);
+              final Block block = writerSideStore.createBlock(blockId, false, 
false);
               for (final NonSerializedPartition<Integer> partition : 
partitionsPerBlock.get(writeTaskIdx)) {
                 final Iterable data = partition.getData();
                 data.forEach(element -> block.write(partition.getKey(), 
element));
@@ -415,7 +415,7 @@ public final class BlockStoreTest {
       @Override
       public Boolean call() {
         try {
-          final Block block = writerSideStore.createBlock(concBlockId);
+          final Block block = writerSideStore.createBlock(concBlockId, false, 
false);
           final Iterable data = concBlockPartition.getData();
           data.forEach(element -> block.write(concBlockPartition.getKey(), 
element));
           block.commit();
@@ -502,7 +502,7 @@ public final class BlockStoreTest {
           public Boolean call() {
             try {
               final String blockId = hashedBlockIdList.get(writeTaskIdx);
-              final Block block = writerSideStore.createBlock(blockId);
+              final Block block = writerSideStore.createBlock(blockId, false, 
false);
               for (final NonSerializedPartition<Integer> partition : 
hashedBlockPartitionList.get(writeTaskIdx)) {
                 final Iterable data = partition.getData();
                 data.forEach(element -> block.write(partition.getKey(), 
element));
diff --git 
a/tests/src/test/java/edu/snu/nemo/tests/runtime/executor/datatransfer/DataTransferTest.java
 
b/tests/src/test/java/edu/snu/nemo/tests/runtime/executor/datatransfer/DataTransferTest.java
index 0d1b611..8cd6476 100644
--- 
a/tests/src/test/java/edu/snu/nemo/tests/runtime/executor/datatransfer/DataTransferTest.java
+++ 
b/tests/src/test/java/edu/snu/nemo/tests/runtime/executor/datatransfer/DataTransferTest.java
@@ -22,6 +22,7 @@ import 
edu.snu.nemo.common.ir.executionproperty.ExecutionProperty;
 import edu.snu.nemo.common.ir.vertex.SourceVertex;
 import edu.snu.nemo.common.ir.vertex.IRVertex;
 import edu.snu.nemo.common.ir.vertex.executionproperty.ParallelismProperty;
+import edu.snu.nemo.compiler.frontend.beam.BeamKeyExtractor;
 import edu.snu.nemo.compiler.optimizer.examples.EmptyComponents;
 import edu.snu.nemo.conf.JobConf;
 import edu.snu.nemo.common.Pair;
@@ -317,6 +318,7 @@ public final class DataTransferTest {
     final ExecutionPropertyMap edgeProperties = 
dummyIREdge.getExecutionProperties();
     edgeProperties.put(DataCommunicationPatternProperty.of(commPattern));
     
edgeProperties.put(PartitionerProperty.of(PartitionerProperty.Value.HashPartitioner));
+    edgeProperties.put(KeyExtractorProperty.of(new BeamKeyExtractor()));
 
     edgeProperties.put(DataStoreProperty.of(store));
     
edgeProperties.put(UsedDataHandlingProperty.of(UsedDataHandlingProperty.Value.Keep));

-- 
To stop receiving notification emails like this one, please contact
[email protected].

Reply via email to