Author: daijy
Date: Thu Jan 14 23:38:09 2010
New Revision: 899475

URL: http://svn.apache.org/viewvc?rev=899475&view=rev
Log:
PIG-1185: Data bags do not close spill files after using iterator to read tuples

Modified:
    hadoop/pig/branches/branch-0.6/CHANGES.txt
    hadoop/pig/branches/branch-0.6/src/org/apache/pig/data/DefaultDataBag.java
    hadoop/pig/branches/branch-0.6/src/org/apache/pig/data/DistinctDataBag.java
    
hadoop/pig/branches/branch-0.6/src/org/apache/pig/data/InternalDistinctBag.java
    
hadoop/pig/branches/branch-0.6/src/org/apache/pig/data/InternalSortedBag.java
    hadoop/pig/branches/branch-0.6/src/org/apache/pig/data/SortedDataBag.java

Modified: hadoop/pig/branches/branch-0.6/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/pig/branches/branch-0.6/CHANGES.txt?rev=899475&r1=899474&r2=899475&view=diff
==============================================================================
--- hadoop/pig/branches/branch-0.6/CHANGES.txt (original)
+++ hadoop/pig/branches/branch-0.6/CHANGES.txt Thu Jan 14 23:38:09 2010
@@ -265,6 +265,9 @@
 PIG-1180: Piggybank should compile even if we only have
 "pig-withouthadoop.jar" but no "pig.jar" in the pig home directory (daijy)
 
+PIG-1185: Data bags do not close spill files after using iterator to read
+tuples (yinghe via daijy)
+
 Release 0.5.0
 
 INCOMPATIBLE CHANGES

Modified: 
hadoop/pig/branches/branch-0.6/src/org/apache/pig/data/DefaultDataBag.java
URL: 
http://svn.apache.org/viewvc/hadoop/pig/branches/branch-0.6/src/org/apache/pig/data/DefaultDataBag.java?rev=899475&r1=899474&r2=899475&view=diff
==============================================================================
--- hadoop/pig/branches/branch-0.6/src/org/apache/pig/data/DefaultDataBag.java 
(original)
+++ hadoop/pig/branches/branch-0.6/src/org/apache/pig/data/DefaultDataBag.java 
Thu Jan 14 23:38:09 2010
@@ -239,6 +239,11 @@
                 } catch (EOFException eof) {
                     // Fall through to the next case where we find the
                     // next file, or go to memory
+                    try {
+                        mIn.close();
+                    }catch(IOException e) {
+                        log.warn("Failed to close spill file.", e);
+                    }
                 } catch (IOException ioe) {
                     String msg = "Unable to read our spill file."; 
                     log.fatal(msg, ioe);

Modified: 
hadoop/pig/branches/branch-0.6/src/org/apache/pig/data/DistinctDataBag.java
URL: 
http://svn.apache.org/viewvc/hadoop/pig/branches/branch-0.6/src/org/apache/pig/data/DistinctDataBag.java?rev=899475&r1=899474&r2=899475&view=diff
==============================================================================
--- hadoop/pig/branches/branch-0.6/src/org/apache/pig/data/DistinctDataBag.java 
(original)
+++ hadoop/pig/branches/branch-0.6/src/org/apache/pig/data/DistinctDataBag.java 
Thu Jan 14 23:38:09 2010
@@ -430,6 +430,11 @@
                         // Out of tuples in this file.  Set our slot in the
                         // array to null so we don't keep trying to read from
                         // this file.
+                        try {
+                            in.close();
+                        }catch(IOException e) {
+                            log.warn("Failed to close spill file.", e);
+                        }
                         mStreams.set(fileNum, null);
                         return;
                     } catch (IOException ioe) {
@@ -518,6 +523,7 @@
                             t.write(out);
                         }
                         out.flush();
+                        out.close();
                     } catch (IOException ioe) {
                         String msg = "Unable to find our spill file.";
                         log.fatal(msg, ioe);

Modified: 
hadoop/pig/branches/branch-0.6/src/org/apache/pig/data/InternalDistinctBag.java
URL: 
http://svn.apache.org/viewvc/hadoop/pig/branches/branch-0.6/src/org/apache/pig/data/InternalDistinctBag.java?rev=899475&r1=899474&r2=899475&view=diff
==============================================================================
--- 
hadoop/pig/branches/branch-0.6/src/org/apache/pig/data/InternalDistinctBag.java 
(original)
+++ 
hadoop/pig/branches/branch-0.6/src/org/apache/pig/data/InternalDistinctBag.java 
Thu Jan 14 23:38:09 2010
@@ -406,6 +406,11 @@
                         // Out of tuples in this file.  Set our slot in the
                         // array to null so we don't keep trying to read from
                         // this file.
+                        try {
+                            in.close();
+                        }catch(IOException e) {
+                            log.warn("Failed to close spill file.", e);
+                        }
                         mStreams.set(fileNum, null);
                         return;
                     } catch (IOException ioe) {
@@ -494,6 +499,7 @@
                             t.write(out);
                         }
                         out.flush();
+                        out.close();
                     } catch (IOException ioe) {
                         String msg = "Unable to find our spill file.";
                         log.fatal(msg, ioe);

Modified: 
hadoop/pig/branches/branch-0.6/src/org/apache/pig/data/InternalSortedBag.java
URL: 
http://svn.apache.org/viewvc/hadoop/pig/branches/branch-0.6/src/org/apache/pig/data/InternalSortedBag.java?rev=899475&r1=899474&r2=899475&view=diff
==============================================================================
--- 
hadoop/pig/branches/branch-0.6/src/org/apache/pig/data/InternalSortedBag.java 
(original)
+++ 
hadoop/pig/branches/branch-0.6/src/org/apache/pig/data/InternalSortedBag.java 
Thu Jan 14 23:38:09 2010
@@ -401,6 +401,11 @@
                     // Out of tuples in this file.  Set our slot in the
                     // array to null so we don't keep trying to read from
                     // this file.
+                    try {
+                        in.close();
+                    }catch(IOException e) {
+                        log.warn("Failed to close spill file.", e);
+                    }
                     mStreams.set(fileNum, null);
                 } catch (IOException ioe) {
                     String msg = "Unable to find our spill file.";
@@ -485,6 +490,7 @@
                             t.write(out);
                         }
                         out.flush();
+                        out.close();
                     } catch (IOException ioe) {
                         String msg = "Unable to find our spill file.";
                         log.fatal(msg, ioe);

Modified: 
hadoop/pig/branches/branch-0.6/src/org/apache/pig/data/SortedDataBag.java
URL: 
http://svn.apache.org/viewvc/hadoop/pig/branches/branch-0.6/src/org/apache/pig/data/SortedDataBag.java?rev=899475&r1=899474&r2=899475&view=diff
==============================================================================
--- hadoop/pig/branches/branch-0.6/src/org/apache/pig/data/SortedDataBag.java 
(original)
+++ hadoop/pig/branches/branch-0.6/src/org/apache/pig/data/SortedDataBag.java 
Thu Jan 14 23:38:09 2010
@@ -393,6 +393,11 @@
                     // Out of tuples in this file.  Set our slot in the
                     // array to null so we don't keep trying to read from
                     // this file.
+                    try {
+                        in.close();
+                    }catch(IOException e) {
+                        log.warn("Failed to close spill file.", e);
+                    }                  
                     mStreams.set(fileNum, null);
                 } catch (IOException ioe) {
                     String msg = "Unable to find our spill file.";
@@ -477,6 +482,7 @@
                             t.write(out);
                         }
                         out.flush();
+                        out.close();
                     } catch (IOException ioe) {
                         String msg = "Unable to find our spill file.";
                         log.fatal(msg, ioe);


Reply via email to