hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cutt...@apache.org
Subject svn commit: r425654 - in /lucene/hadoop/trunk: ./ src/java/org/apache/hadoop/record/compiler/ src/java/org/apache/hadoop/record/compiler/generated/ src/test/ddl/ src/test/org/apache/hadoop/record/test/
Date Wed, 26 Jul 2006 07:42:02 GMT
Author: cutting
Date: Wed Jul 26 00:42:01 2006
New Revision: 425654

URL: http://svn.apache.org/viewvc?rev=425654&view=rev
Log:
HADOOP-385.  Fix some bugs in record io code generation.  Contributed by Milind.

Modified:
    lucene/hadoop/trunk/CHANGES.txt
    lucene/hadoop/trunk/src/java/org/apache/hadoop/record/compiler/JRecord.java
    lucene/hadoop/trunk/src/java/org/apache/hadoop/record/compiler/generated/RccTokenManager.java
    lucene/hadoop/trunk/src/java/org/apache/hadoop/record/compiler/generated/rcc.jj
    lucene/hadoop/trunk/src/test/ddl/test.jr
    lucene/hadoop/trunk/src/test/org/apache/hadoop/record/test/RecRecord0.java
    lucene/hadoop/trunk/src/test/org/apache/hadoop/record/test/RecRecord1.java
    lucene/hadoop/trunk/src/test/org/apache/hadoop/record/test/TestRecordIO.java

Modified: lucene/hadoop/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/CHANGES.txt?rev=425654&r1=425653&r2=425654&view=diff
==============================================================================
--- lucene/hadoop/trunk/CHANGES.txt (original)
+++ lucene/hadoop/trunk/CHANGES.txt Wed Jul 26 00:42:01 2006
@@ -82,6 +82,9 @@
 23. HADOOP-321.  Refactor DatanodeInfo, in preparation for
     HADOOP-306.  (Konstantin Shvachko & omalley via cutting)
 
+24. HADOOP-385.  Fix some bugs in record io code generation.
+    (Milind Bhandarkar via cutting)
+
 
 Release 0.4.0 - 2006-06-28
 

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/record/compiler/JRecord.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/record/compiler/JRecord.java?rev=425654&r1=425653&r2=425654&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/record/compiler/JRecord.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/record/compiler/JRecord.java Wed Jul 26
00:42:01 2006
@@ -84,8 +84,8 @@
         return "  "+mName+" "+fname+";\n";
     }
     
-    public String genJavaDecl (String fname) {
-        return "  private "+mName+" "+fname+";\n";
+    public String genJavaReadMethod(String fname, String tag) {
+        return genJavaReadWrapper(fname, tag, false);
     }
     
     public String genJavaReadWrapper(String fname, String tag, boolean decl) {
@@ -320,7 +320,7 @@
         jj.write("    deserialize(archive, \"\");\n");
         jj.write("  }\n");
         
-        jj.write("  private boolean validate() {\n");
+        jj.write("  public boolean validate() {\n");
         jj.write("    if (bs_.cardinality() != bs_.length()) return false;\n");
         for (Iterator i = mFields.iterator(); i.hasNext(); fIdx++) {
             JField jf = (JField) i.next();

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/record/compiler/generated/RccTokenManager.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/record/compiler/generated/RccTokenManager.java?rev=425654&r1=425653&r2=425654&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/record/compiler/generated/RccTokenManager.java
(original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/record/compiler/generated/RccTokenManager.java
Wed Jul 26 00:42:01 2006
@@ -31,7 +31,7 @@
   public  void setDebugStream(java.io.PrintStream ds) { debugStream = ds; }
 private final int jjMoveStringLiteralDfa0_1()
 {
-   return jjMoveNfa_1(1, 0);
+   return jjMoveNfa_1(0, 0);
 }
 private final void jjCheckNAdd(int state)
 {
@@ -67,7 +67,7 @@
 {
    int[] nextStates;
    int startsAt = 0;
-   jjnewStateCnt = 5;
+   jjnewStateCnt = 3;
    int i = 1;
    jjstateSet[0] = startState;
    int j, kind = 0x7fffffff;
@@ -82,32 +82,22 @@
          {
             switch(jjstateSet[--i])
             {
-               case 1:
+               case 0:
                   if ((0x2400L & l) != 0L)
                   {
                      if (kind > 6)
                         kind = 6;
                   }
-                  else if (curChar == 47)
-                     jjstateSet[jjnewStateCnt++] = 0;
                   if (curChar == 13)
-                     jjstateSet[jjnewStateCnt++] = 3;
-                  break;
-               case 0:
-                  if (curChar == 47 && kind > 6)
-                     kind = 6;
+                     jjstateSet[jjnewStateCnt++] = 1;
                   break;
-               case 2:
-                  if ((0x2400L & l) != 0L && kind > 6)
-                     kind = 6;
-                  break;
-               case 3:
+               case 1:
                   if (curChar == 10 && kind > 6)
                      kind = 6;
                   break;
-               case 4:
+               case 2:
                   if (curChar == 13)
-                     jjstateSet[jjnewStateCnt++] = 3;
+                     jjstateSet[jjnewStateCnt++] = 1;
                   break;
                default : break;
             }
@@ -143,7 +133,7 @@
          kind = 0x7fffffff;
       }
       ++curPos;
-      if ((i = jjnewStateCnt) == (startsAt = 5 - (jjnewStateCnt = startsAt)))
+      if ((i = jjnewStateCnt) == (startsAt = 3 - (jjnewStateCnt = startsAt)))
          return curPos;
       try { curChar = input_stream.readChar(); }
       catch(java.io.IOException e) { return curPos; }

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/record/compiler/generated/rcc.jj
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/record/compiler/generated/rcc.jj?rev=425654&r1=425653&r2=425654&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/record/compiler/generated/rcc.jj (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/record/compiler/generated/rcc.jj Wed Jul
26 00:42:01 2006
@@ -108,7 +108,7 @@
 
 <WithinOneLineComment> SPECIAL_TOKEN :
 {
-  <("//" | "\n" | "\r" | "\r\n" )> : DEFAULT
+  <("\n" | "\r" | "\r\n" )> : DEFAULT
 }
 
 <WithinOneLineComment> MORE :

Modified: lucene/hadoop/trunk/src/test/ddl/test.jr
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/test/ddl/test.jr?rev=425654&r1=425653&r2=425654&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/test/ddl/test.jr (original)
+++ lucene/hadoop/trunk/src/test/ddl/test.jr Wed Jul 26 00:42:01 2006
@@ -8,12 +8,14 @@
         byte            ByteVal;
         int             IntVal;
         long            LongVal;
-        float           FloatVal;
-        double          DoubleVal;
-        ustring         StringVal;
-        buffer          BufferVal;
+        float           FloatVal; // testing inline comment
+        double          DoubleVal; /* testing comment */
+        ustring         StringVal; /* testing multi-line
+                                    * comment */
+        buffer          BufferVal; // testing another // inline comment 
         vector<ustring> VectorVal;
         map<ustring,ustring>   MapVal;
+        RecRecord0      RecordVal;
     }
 }
 

Modified: lucene/hadoop/trunk/src/test/org/apache/hadoop/record/test/RecRecord0.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/test/org/apache/hadoop/record/test/RecRecord0.java?rev=425654&r1=425653&r2=425654&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/test/org/apache/hadoop/record/test/RecRecord0.java (original)
+++ lucene/hadoop/trunk/src/test/org/apache/hadoop/record/test/RecRecord0.java Wed Jul 26
00:42:01 2006
@@ -56,7 +56,7 @@
     org.apache.hadoop.record.BinaryInputArchive archive = new org.apache.hadoop.record.BinaryInputArchive(in);
     deserialize(archive, "");
   }
-  private boolean validate() {
+  public boolean validate() {
     if (bs_.cardinality() != bs_.length()) return false;
     return true;
 }

Modified: lucene/hadoop/trunk/src/test/org/apache/hadoop/record/test/RecRecord1.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/test/org/apache/hadoop/record/test/RecRecord1.java?rev=425654&r1=425653&r2=425654&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/test/org/apache/hadoop/record/test/RecRecord1.java (original)
+++ lucene/hadoop/trunk/src/test/org/apache/hadoop/record/test/RecRecord1.java Wed Jul 26
00:42:01 2006
@@ -12,10 +12,11 @@
   private java.io.ByteArrayOutputStream mBufferVal;
   private java.util.ArrayList mVectorVal;
   private java.util.TreeMap mMapVal;
+  private org.apache.hadoop.record.test.RecRecord0 mRecordVal;
   private java.util.BitSet bs_;
   public RecRecord1() {
-    bs_ = new java.util.BitSet(11);
-    bs_.set(10);
+    bs_ = new java.util.BitSet(12);
+    bs_.set(11);
   }
   public RecRecord1(
         boolean m0,
@@ -27,9 +28,10 @@
         String m6,
         java.io.ByteArrayOutputStream m7,
         java.util.ArrayList m8,
-        java.util.TreeMap m9) {
-    bs_ = new java.util.BitSet(11);
-    bs_.set(10);
+        java.util.TreeMap m9,
+        org.apache.hadoop.record.test.RecRecord0 m10) {
+    bs_ = new java.util.BitSet(12);
+    bs_.set(11);
     mBoolVal=m0; bs_.set(0);
     mByteVal=m1; bs_.set(1);
     mIntVal=m2; bs_.set(2);
@@ -40,6 +42,7 @@
     mBufferVal=m7; bs_.set(7);
     mVectorVal=m8; bs_.set(8);
     mMapVal=m9; bs_.set(9);
+    mRecordVal=m10; bs_.set(10);
   }
   public boolean getBoolVal() {
     return mBoolVal;
@@ -101,6 +104,12 @@
   public void setMapVal(java.util.TreeMap m_) {
     mMapVal=m_; bs_.set(9);
   }
+  public org.apache.hadoop.record.test.RecRecord0 getRecordVal() {
+    return mRecordVal;
+  }
+  public void setRecordVal(org.apache.hadoop.record.test.RecRecord0 m_) {
+    mRecordVal=m_; bs_.set(10);
+  }
   public void serialize(org.apache.hadoop.record.OutputArchive a_, String tag) throws java.io.IOException
{
     if (!validate()) throw new java.io.IOException("All fields not set:");
     a_.startRecord(this,tag);
@@ -143,6 +152,8 @@
       a_.endMap(mMapVal,"MapVal");
     }
     bs_.clear(9);
+    a_.writeRecord(mRecordVal,"RecordVal");
+    bs_.clear(10);
     a_.endRecord(this,tag);
   }
   public void deserialize(org.apache.hadoop.record.InputArchive a_, String tag) throws java.io.IOException
{
@@ -187,6 +198,9 @@
     a_.endMap("MapVal");
     }
     bs_.set(9);
+    mRecordVal= new org.apache.hadoop.record.test.RecRecord0();
+    a_.readRecord(mRecordVal,"RecordVal");
+    bs_.set(10);
     a_.endRecord(tag);
 }
   public String toString() {
@@ -225,6 +239,7 @@
       }
       a_.endMap(mMapVal,"MapVal");
     }
+    a_.writeRecord(mRecordVal,"RecordVal");
       a_.endRecord(this,"");
       return new String(s.toByteArray(), "UTF-8");
     } catch (Throwable ex) {
@@ -240,8 +255,9 @@
     org.apache.hadoop.record.BinaryInputArchive archive = new org.apache.hadoop.record.BinaryInputArchive(in);
     deserialize(archive, "");
   }
-  private boolean validate() {
+  public boolean validate() {
     if (bs_.cardinality() != bs_.length()) return false;
+    if (!mRecordVal.validate()) return false;
     return true;
 }
   public int compareTo (Object peer_) throws ClassCastException {
@@ -267,6 +283,8 @@
     if (ret != 0) return ret;
     if (ret != 0) return ret;
     if (ret != 0) return ret;
+    ret = mRecordVal.compareTo(peer.mRecordVal);
+    if (ret != 0) return ret;
      return ret;
   }
   public boolean equals(Object peer_) {
@@ -298,6 +316,8 @@
     if (!ret) return ret;
     ret = mMapVal.equals(peer.mMapVal);
     if (!ret) return ret;
+    ret = mRecordVal.equals(peer.mRecordVal);
+    if (!ret) return ret;
      return ret;
   }
   public int hashCode() {
@@ -323,9 +343,11 @@
     result = 37*result + ret;
     ret = mMapVal.hashCode();
     result = 37*result + ret;
+    ret = mRecordVal.hashCode();
+    result = 37*result + ret;
     return result;
   }
   public static String signature() {
-    return "LRecRecord1(zbilfdsB[s]{ss})";
+    return "LRecRecord1(zbilfdsB[s]{ss}LRecRecord0(s))";
   }
 }

Modified: lucene/hadoop/trunk/src/test/org/apache/hadoop/record/test/TestRecordIO.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/test/org/apache/hadoop/record/test/TestRecordIO.java?rev=425654&r1=425653&r2=425654&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/test/org/apache/hadoop/record/test/TestRecordIO.java (original)
+++ lucene/hadoop/trunk/src/test/org/apache/hadoop/record/test/TestRecordIO.java Wed Jul 26
00:42:01 2006
@@ -60,6 +60,9 @@
             r1.setBufferVal(new ByteArrayOutputStream(20));
             r1.setVectorVal(new ArrayList());
             r1.setMapVal(new TreeMap());
+            RecRecord0 r0 = new RecRecord0();
+            r0.setStringVal("other random text");
+            r1.setRecordVal(r0);
             out.write(r1);
             ostream.close();
             FileInputStream istream = new FileInputStream(tmpfile);
@@ -91,6 +94,9 @@
             r1.setBufferVal(new ByteArrayOutputStream(20));
             r1.setVectorVal(new ArrayList());
             r1.setMapVal(new TreeMap());
+            RecRecord0 r0 = new RecRecord0();
+            r0.setStringVal("other random text");
+            r1.setRecordVal(r0);
             out.write(r1);
             ostream.close();
             FileInputStream istream = new FileInputStream(tmpfile);
@@ -122,6 +128,9 @@
             r1.setBufferVal(new ByteArrayOutputStream(20));
             r1.setVectorVal(new ArrayList());
             r1.setMapVal(new TreeMap());
+            RecRecord0 r0 = new RecRecord0();
+            r0.setStringVal("other random text");
+            r1.setRecordVal(r0);
             out.write(r1);
             ostream.close();
             FileInputStream istream = new FileInputStream(tmpfile);



Mime
View raw message