Merged r459:490 from hyracks_hadoop_compat_changes branch
git-svn-id: https://hyracks.googlecode.com/svn/trunk@491 123451ca-8445-de46-9d55-352943316053
diff --git a/hyracks/hyracks-examples/hadoop-compat-example/hadoopcompathelper/.classpath b/hyracks/hyracks-examples/hadoop-compat-example/hadoopcompathelper/.classpath
new file mode 100644
index 0000000..1f3c1ff
--- /dev/null
+++ b/hyracks/hyracks-examples/hadoop-compat-example/hadoopcompathelper/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" output="target/classes" path="src/main/java"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
diff --git a/hyracks/hyracks-examples/hadoop-compat-example/hadoopcompathelper/.project b/hyracks/hyracks-examples/hadoop-compat-example/hadoopcompathelper/.project
new file mode 100644
index 0000000..19ce234
--- /dev/null
+++ b/hyracks/hyracks-examples/hadoop-compat-example/hadoopcompathelper/.project
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>texthelper</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.maven.ide.eclipse.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.maven.ide.eclipse.maven2Nature</nature>
+ </natures>
+</projectDescription>
diff --git a/hyracks/hyracks-examples/hadoop-compat-example/hadoopcompathelper/.settings/org.eclipse.jdt.core.prefs b/hyracks/hyracks-examples/hadoop-compat-example/hadoopcompathelper/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..8599738
--- /dev/null
+++ b/hyracks/hyracks-examples/hadoop-compat-example/hadoopcompathelper/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,6 @@
+#Tue Sep 28 14:37:42 PDT 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/hyracks/hyracks-examples/hadoop-compat-example/hadoopcompathelper/.settings/org.maven.ide.eclipse.prefs b/hyracks/hyracks-examples/hadoop-compat-example/hadoopcompathelper/.settings/org.maven.ide.eclipse.prefs
new file mode 100644
index 0000000..4562b1a
--- /dev/null
+++ b/hyracks/hyracks-examples/hadoop-compat-example/hadoopcompathelper/.settings/org.maven.ide.eclipse.prefs
@@ -0,0 +1,9 @@
+#Tue Sep 28 14:37:42 PDT 2010
+activeProfiles=
+eclipse.preferences.version=1
+fullBuildGoals=process-test-resources
+includeModules=false
+resolveWorkspaceProjects=true
+resourceFilterGoals=process-resources resources\:testResources
+skipCompilerPlugin=true
+version=1
diff --git a/hyracks/hyracks-examples/hadoop-compat-example/hadoopcompathelper/pom.xml b/hyracks/hyracks-examples/hadoop-compat-example/hadoopcompathelper/pom.xml
new file mode 100644
index 0000000..49090ce
--- /dev/null
+++ b/hyracks/hyracks-examples/hadoop-compat-example/hadoopcompathelper/pom.xml
@@ -0,0 +1,40 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>edu.uci.ics.hyracks.examples.compat</groupId>
+ <artifactId>hadoopcompathelper</artifactId>
+ <version>0.1.6-SNAPSHOT</version>
+
+ <parent>
+ <groupId>edu.uci.ics.hyracks.examples</groupId>
+ <artifactId>hadoop-compat-example</artifactId>
+ <version>0.1.6-SNAPSHOT</version>
+ </parent>
+
+ <dependencies>
+ <dependency>
+ <groupId>edu.uci.ics.hyracks</groupId>
+ <artifactId>hyracks-dataflow-std</artifactId>
+ <version>0.1.6-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>edu.uci.ics.hyracks</groupId>
+ <artifactId>hyracks-api</artifactId>
+ <version>0.1.6-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.0.2</version>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/hyracks/hyracks-examples/hadoop-compat-example/hadoopcompathelper/src/main/java/edu/uci/ics/hyracks/examples/wordcount/WordCount.java b/hyracks/hyracks-examples/hadoop-compat-example/hadoopcompathelper/src/main/java/edu/uci/ics/hyracks/examples/wordcount/WordCount.java
new file mode 100644
index 0000000..2a6ac3a
--- /dev/null
+++ b/hyracks/hyracks-examples/hadoop-compat-example/hadoopcompathelper/src/main/java/edu/uci/ics/hyracks/examples/wordcount/WordCount.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * 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 from
+ *
+ * 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.uci.ics.hyracks.examples.wordcount;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.Iterator;
+import java.util.StringTokenizer;
+
+import org.apache.hadoop.io.IntWritable;
+import org.apache.hadoop.io.LongWritable;
+import org.apache.hadoop.io.Text;
+import org.apache.hadoop.mapred.MapReduceBase;
+import org.apache.hadoop.mapred.Mapper;
+import org.apache.hadoop.mapred.OutputCollector;
+import org.apache.hadoop.mapred.Reducer;
+import org.apache.hadoop.mapred.Reporter;
+
+public class WordCount implements Serializable {
+ public static class Map extends MapReduceBase implements Mapper<LongWritable, Text, Text, IntWritable>,
+ Serializable {
+
+ private final static IntWritable ONE = new IntWritable(1);
+ private Text word = new Text();
+
+ public void map(LongWritable key, Text value, OutputCollector<Text, IntWritable> output, Reporter reporter)
+ throws IOException {
+ String line = value.toString();
+ StringTokenizer tokenizer = new StringTokenizer(line);
+ while (tokenizer.hasMoreTokens()) {
+ String token = tokenizer.nextToken();
+ word.set(token);
+ output.collect(word, ONE);
+ }
+ }
+ }
+
+ public static class Reduce extends MapReduceBase implements Reducer<Text, IntWritable, Text, IntWritable>,
+ Serializable {
+
+ public void reduce(Text key, Iterator<IntWritable> values, OutputCollector<Text, IntWritable> output,
+ Reporter reporter) throws IOException {
+ int sum = 0;
+ while (values.hasNext()) {
+ sum += values.next().get();
+ }
+ output.collect(key, new IntWritable(sum));
+ }
+ }
+}
\ No newline at end of file