tez-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bi...@apache.org
Subject git commit: TEZ-836. Add ConcatenatedKeyValueInput for vertex groups (Gunther Hagleitner via bikas)
Date Fri, 14 Feb 2014 23:54:42 GMT
Repository: incubator-tez
Updated Branches:
  refs/heads/master 86160fed6 -> 720adc32d


TEZ-836. Add ConcatenatedKeyValueInput for vertex groups (Gunther Hagleitner via bikas)


Project: http://git-wip-us.apache.org/repos/asf/incubator-tez/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tez/commit/720adc32
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tez/tree/720adc32
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tez/diff/720adc32

Branch: refs/heads/master
Commit: 720adc32ddf9d06053a92147f960c3709638830d
Parents: 86160fe
Author: Bikas Saha <bikas@apache.org>
Authored: Fri Feb 14 15:54:30 2014 -0800
Committer: Bikas Saha <bikas@apache.org>
Committed: Fri Feb 14 15:54:30 2014 -0800

----------------------------------------------------------------------
 .../input/ConcatenatedMergedKeyValueInput.java  | 72 ++++++++++++++++++++
 .../input/ConcatenatedMergedKeyValuesInput.java |  4 +-
 2 files changed, 74 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/720adc32/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/input/ConcatenatedMergedKeyValueInput.java
----------------------------------------------------------------------
diff --git a/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/input/ConcatenatedMergedKeyValueInput.java
b/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/input/ConcatenatedMergedKeyValueInput.java
new file mode 100644
index 0000000..004701d
--- /dev/null
+++ b/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/input/ConcatenatedMergedKeyValueInput.java
@@ -0,0 +1,72 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tez.runtime.library.input;
+
+import java.io.IOException;
+
+import org.apache.tez.dag.api.TezUncheckedException;
+import org.apache.tez.runtime.api.MergedLogicalInput;
+import org.apache.tez.runtime.api.Reader;
+import org.apache.tez.runtime.library.api.KeyValueReader;
+
+public class ConcatenatedMergedKeyValueInput extends MergedLogicalInput {
+
+  public class ConcatenatedMergedKeyValueReader implements KeyValueReader {
+    private int currentReaderIndex = 0;
+    private KeyValueReader currentReader;
+    
+    @Override
+    public boolean next() throws IOException {
+      while ((currentReader == null) || !currentReader.next()) {
+        if (currentReaderIndex == getInputs().size()) {
+          return false;
+        }
+        try {
+          Reader reader = getInputs().get(currentReaderIndex).getReader();
+          if (!(reader instanceof KeyValueReader)) {
+            throw new TezUncheckedException("Expected KeyValueReader. "
+                + "Got: " + reader.getClass().getName());
+          }
+          currentReader = (KeyValueReader) reader;
+          currentReaderIndex++;
+        } catch (Exception e) {
+          throw new IOException(e);
+        }
+      }
+      return true;
+    }
+
+    @Override
+    public Object getCurrentKey() throws IOException {
+      return currentReader.getCurrentKey();
+    }
+
+    @Override
+    public Object getCurrentValue() throws IOException {
+      return currentReader.getCurrentValue();
+    }
+    
+  }
+    
+  @Override
+  public Reader getReader() throws Exception {
+    return new ConcatenatedMergedKeyValueReader();
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/720adc32/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/input/ConcatenatedMergedKeyValuesInput.java
----------------------------------------------------------------------
diff --git a/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/input/ConcatenatedMergedKeyValuesInput.java
b/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/input/ConcatenatedMergedKeyValuesInput.java
index bc380e5..29cd490 100644
--- a/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/input/ConcatenatedMergedKeyValuesInput.java
+++ b/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/input/ConcatenatedMergedKeyValuesInput.java
@@ -27,7 +27,7 @@ import org.apache.tez.runtime.library.api.KeyValuesReader;
 
 public class ConcatenatedMergedKeyValuesInput extends MergedLogicalInput {
 
-  public class MergedKeyValuesReader implements KeyValuesReader {
+  public class ConcatenatedMergedKeyValuesReader implements KeyValuesReader {
     private int currentReaderIndex = 0;
     private KeyValuesReader currentReader;
     
@@ -66,7 +66,7 @@ public class ConcatenatedMergedKeyValuesInput extends MergedLogicalInput
{
     
   @Override
   public Reader getReader() throws Exception {
-    return new MergedKeyValuesReader();
+    return new ConcatenatedMergedKeyValuesReader();
   }
 
 }


Mime
View raw message