You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pig.apache.org by ol...@apache.org on 2008/06/26 02:16:16 UTC
svn commit: r671696 - in /incubator/pig/trunk: CHANGES.txt
src/org/apache/pig/impl/streaming/ExecutableManager.java
test/org/apache/pig/test/TestStreaming.java
Author: olga
Date: Wed Jun 25 17:16:16 2008
New Revision: 671696
URL: http://svn.apache.org/viewvc?rev=671696&view=rev
Log:
PIG-243: make unit tests work under windows
Modified:
incubator/pig/trunk/CHANGES.txt
incubator/pig/trunk/src/org/apache/pig/impl/streaming/ExecutableManager.java
incubator/pig/trunk/test/org/apache/pig/test/TestStreaming.java
Modified: incubator/pig/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/pig/trunk/CHANGES.txt?rev=671696&r1=671695&r2=671696&view=diff
==============================================================================
--- incubator/pig/trunk/CHANGES.txt (original)
+++ incubator/pig/trunk/CHANGES.txt Wed Jun 25 17:16:16 2008
@@ -301,17 +301,19 @@
PIG-236: Fix properties so that values specified via the
command line (-D) are not ignored (pkamath via gates).
- PIG-198: integration with hadoop 17
+ PIG-198: integration with hadoop 17 (acmurthy via olgan)
- PIG-85: allowing control characters as delimiters for PigStorage
+ PIG-85: allowing control characters as delimiters for PigStorage (pi_song
+ via olgan)
- PIG-250: disabling speculative execution
+ PIG-250: disabling speculative execution (olgan)
PIG-250: re-enabling speculative execution and fixing the failure
+ (acmurthy via olgan)
- PIG-85: memory optimization
+ PIG-85: memory optimization (pi_song via olgan)
- PIG-243: Fixing unit tests on windows
+ PIG-243: Fixing unit tests on windows (daijy via olgan)
PIG-198: Fixed pig script to pick up hadoop 17 instead of 15 (pi_song via gates).
@@ -324,4 +326,8 @@
PIG-255: make non-default constructors work for algebraic functions
(ajaygarg via olgan)
+ PIG-272: problem with streaming and intermediate store (acmurthy via olgan)
+
+ PIG-243: make unit tests work on windows (daijy via olgan)
+
PIG-271: added tutorial to SVN (olgan)
Modified: incubator/pig/trunk/src/org/apache/pig/impl/streaming/ExecutableManager.java
URL: http://svn.apache.org/viewvc/incubator/pig/trunk/src/org/apache/pig/impl/streaming/ExecutableManager.java?rev=671696&r1=671695&r2=671696&view=diff
==============================================================================
--- incubator/pig/trunk/src/org/apache/pig/impl/streaming/ExecutableManager.java (original)
+++ incubator/pig/trunk/src/org/apache/pig/impl/streaming/ExecutableManager.java Wed Jun 25 17:16:16 2008
@@ -214,6 +214,46 @@
}
/**
+ * Convert path from Windows convention to Unix convention. Invoked under cygwin.
+ *
+ * @param path path in Windows convention
+ * @return path in Unix convention, null if fail
+ */
+ private String parseCygPath(String path)
+ {
+ String[] command = new String[] {"cygpath", "-u", path};
+ Process p=null;
+ try {
+ p = Runtime.getRuntime().exec(command);
+ }
+ catch (IOException e)
+ {
+ return null;
+ }
+ int exitVal=0;
+ try {
+ exitVal = p.waitFor();
+ }
+ catch (InterruptedException e)
+ {
+ return null;
+ }
+ if (exitVal!=0)
+ return null;
+ String line=null;
+ try {
+ InputStreamReader isr = new InputStreamReader(p.getInputStream());
+ BufferedReader br = new BufferedReader(isr);
+ line = br.readLine();
+ }
+ catch (IOException e)
+ {
+ return null;
+ }
+ return line;
+ }
+
+ /**
* Set up the run-time environment of the managed process.
*
* @param pb {@link ProcessBuilder} used to exec the process
@@ -226,6 +266,15 @@
File dir = pb.directory();
String cwd = (dir != null) ?
dir.getAbsolutePath() : System.getProperty("user.dir");
+
+ if (System.getProperty("os.name").toUpperCase().startsWith("WINDOWS"))
+ {
+ String unixCwd = parseCygPath(cwd);
+ if (unixCwd==null)
+ throw new RuntimeException("Can not convert Windows path to Unix path under cygwin");
+ cwd = unixCwd;
+ }
+
String envPath = env.get(PATH);
if (envPath == null) {
envPath = cwd;
Modified: incubator/pig/trunk/test/org/apache/pig/test/TestStreaming.java
URL: http://svn.apache.org/viewvc/incubator/pig/trunk/test/org/apache/pig/test/TestStreaming.java?rev=671696&r1=671695&r2=671696&view=diff
==============================================================================
--- incubator/pig/trunk/test/org/apache/pig/test/TestStreaming.java (original)
+++ incubator/pig/trunk/test/org/apache/pig/test/TestStreaming.java Wed Jun 25 17:16:16 2008
@@ -220,12 +220,12 @@
// Pig query to run
pigServer.registerQuery(
"define CMD1 `" + command1.getName() + " foo` " +
- "ship ('" + command1 + "') " +
+ "ship ('" + Util.encodeEscape(command1.toString()) + "') " +
"input('foo' using " + PigStorage.class.getName() + "(',')) " +
"stderr();");
pigServer.registerQuery(
"define CMD2 `" + command2.getName() + " bar` " +
- "ship ('" + command2 + "') " +
+ "ship ('" + Util.encodeEscape(command2.toString()) + "') " +
"input('bar' using " + PigStorage.class.getName() + "(',')) " +
"stderr();");
pigServer.registerQuery("IP = load 'file:" + Util.encodeEscape(input.toString()) + "' using " +
@@ -360,7 +360,7 @@
// Pig query to run
pigServer.registerQuery(
"define CMD `" + command.getName() + " foo bar` " +
- "ship ('" + command + "') " +
+ "ship ('" + Util.encodeEscape(command.toString()) + "') " +
"output('foo' using " + PigStorage.class.getName() + "(','), " +
"'bar' using " + PigStorage.class.getName() + "(',')) " +
"stderr();");
@@ -424,7 +424,7 @@
// Pig query to run
pigServer.registerQuery(
"define CMD `" + command.getName() + " foo bar foobar` " +
- "ship ('" + command + "') " +
+ "ship ('" + Util.encodeEscape(command.toString()) + "') " +
"input('foo' using " + PigStorage.class.getName() + "(',')) " +
"output('bar', " +
"'foobar' using " + PigStorage.class.getName() + "(',')) " +