hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r599162 [3/4] - in /lucene/hadoop/trunk/src/contrib/hbase: ./ src/java/org/apache/hadoop/hbase/mapred/ src/java/org/apache/hadoop/hbase/shell/ src/java/org/apache/hadoop/hbase/shell/algebra/ src/java/org/apache/hadoop/hbase/shell/algebra/ge...
Date Wed, 28 Nov 2007 22:10:27 GMT
Added: lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/algebra/generated/TokenMgrError.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/algebra/generated/TokenMgrError.java?rev=599162&view=auto
==============================================================================
--- lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/algebra/generated/TokenMgrError.java
(added)
+++ lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/algebra/generated/TokenMgrError.java
Wed Nov 28 14:10:21 2007
@@ -0,0 +1,133 @@
+/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 3.0 */
+package org.apache.hadoop.hbase.shell.algebra.generated;
+
+public class TokenMgrError extends Error
+{
+   /*
+    * Ordinals for various reasons why an Error of this type can be thrown.
+    */
+
+   /**
+    * Lexical error occured.
+    */
+   static final int LEXICAL_ERROR = 0;
+
+   /**
+    * An attempt wass made to create a second instance of a static token manager.
+    */
+   static final int STATIC_LEXER_ERROR = 1;
+
+   /**
+    * Tried to change to an invalid lexical state.
+    */
+   static final int INVALID_LEXICAL_STATE = 2;
+
+   /**
+    * Detected (and bailed out of) an infinite loop in the token manager.
+    */
+   static final int LOOP_DETECTED = 3;
+
+   /**
+    * Indicates the reason why the exception is thrown. It will have
+    * one of the above 4 values.
+    */
+   int errorCode;
+
+   /**
+    * Replaces unprintable characters by their espaced (or unicode escaped)
+    * equivalents in the given string
+    */
+   protected static final String addEscapes(String str) {
+      StringBuffer retval = new StringBuffer();
+      char ch;
+      for (int i = 0; i < str.length(); i++) {
+        switch (str.charAt(i))
+        {
+           case 0 :
+              continue;
+           case '\b':
+              retval.append("\\b");
+              continue;
+           case '\t':
+              retval.append("\\t");
+              continue;
+           case '\n':
+              retval.append("\\n");
+              continue;
+           case '\f':
+              retval.append("\\f");
+              continue;
+           case '\r':
+              retval.append("\\r");
+              continue;
+           case '\"':
+              retval.append("\\\"");
+              continue;
+           case '\'':
+              retval.append("\\\'");
+              continue;
+           case '\\':
+              retval.append("\\\\");
+              continue;
+           default:
+              if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
+                 String s = "0000" + Integer.toString(ch, 16);
+                 retval.append("\\u" + s.substring(s.length() - 4, s.length()));
+              } else {
+                 retval.append(ch);
+              }
+              continue;
+        }
+      }
+      return retval.toString();
+   }
+
+   /**
+    * Returns a detailed message for the Error when it is thrown by the
+    * token manager to indicate a lexical error.
+    * Parameters : 
+    *    EOFSeen     : indicates if EOF caused the lexicl error
+    *    curLexState : lexical state in which this error occured
+    *    errorLine   : line number when the error occured
+    *    errorColumn : column number when the error occured
+    *    errorAfter  : prefix that was seen before this error occured
+    *    curchar     : the offending character
+    * Note: You can customize the lexical error message by modifying this method.
+    */
+   protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int
errorColumn, String errorAfter, char curChar) {
+      return("Lexical error at line " +
+           errorLine + ", column " +
+           errorColumn + ".  Encountered: " +
+           (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"")
+ " (" + (int)curChar + "), ") +
+           "after : \"" + addEscapes(errorAfter) + "\"");
+   }
+
+   /**
+    * You can also modify the body of this method to customize your error messages.
+    * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not
+    * of end-users concern, so you can return something like : 
+    *
+    *     "Internal Error : Please file a bug report .... "
+    *
+    * from this method for such cases in the release version of your parser.
+    */
+   public String getMessage() {
+      return super.getMessage();
+   }
+
+   /*
+    * Constructors of various flavors follow.
+    */
+
+   public TokenMgrError() {
+   }
+
+   public TokenMgrError(String message, int reason) {
+      super(message);
+      errorCode = reason;
+   }
+
+   public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String
errorAfter, char curChar, int reason) {
+      this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar),
reason);
+   }
+}

Modified: lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/generated/Parser.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/generated/Parser.java?rev=599162&r1=599161&r2=599162&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/generated/Parser.java
(original)
+++ lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/generated/Parser.java
Wed Nov 28 14:10:21 2007
@@ -28,6 +28,8 @@
 import java.io.StringReader;
 import java.io.Reader;
 import java.io.Writer;
+import java.net.URLEncoder;
+import java.io.UnsupportedEncodingException;
 
 import org.apache.hadoop.hbase.shell.*;
 
@@ -38,6 +40,7 @@
   private String QueryString;
   private TableFormatter formatter;
   private Writer out;
+  private String secondR;
 
   public Parser(final String query, final Writer o, final TableFormatter f) {
     this((Reader)(new StringReader(query)));
@@ -72,7 +75,9 @@
     case SELECT:
     case ENABLE:
     case DISABLE:
-    case 62:
+    case SAVE:
+    case ID:
+    case 69:
       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
       case HELP:
       case ALTER:
@@ -90,13 +95,15 @@
       case SELECT:
       case ENABLE:
       case DISABLE:
+      case SAVE:
+      case ID:
         statement = cmdStatement();
         break;
       default:
         jj_la1[0] = jj_gen;
         ;
       }
-      jj_consume_token(62);
+      jj_consume_token(69);
       break;
     case 0:
       jj_consume_token(0);
@@ -159,6 +166,12 @@
     case JAR:
       cmd = jarCommand();
       break;
+    case ID:
+      cmd = substituteCommand();
+      break;
+    case SAVE:
+      cmd = saveCommand();
+      break;
     default:
       jj_la1[2] = jj_gen;
       jj_consume_token(-1);
@@ -251,6 +264,8 @@
     case INSERT:
     case DELETE:
     case SELECT:
+    case SAVE:
+    case GROUP:
     case ID:
       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
       case SHOW:
@@ -289,6 +304,12 @@
       case JAR:
         t = jj_consume_token(JAR);
         break;
+      case GROUP:
+        t = jj_consume_token(GROUP);
+        break;
+      case SAVE:
+        t = jj_consume_token(SAVE);
+        break;
       case ID:
         t = jj_consume_token(ID);
         break;
@@ -316,7 +337,7 @@
     case ID:
     case QUOTED_IDENTIFIER:
     case STRING_LITERAL:
-      argument = Identifier();
+      argument = identifier();
       break;
     default:
       jj_la1[8] = jj_gen;
@@ -342,7 +363,7 @@
       jj_consume_token(-1);
       throw new ParseException();
     }
-    argument = Identifier();
+    argument = identifier();
     desc.setArgument(argument);
     {if (true) return desc;}
     throw new Error("Missing return statement in function");
@@ -461,10 +482,10 @@
   String column = null;
     jj_consume_token(CREATE);
     jj_consume_token(TABLE);
-    table = Identifier();
+    table = identifier();
     createCommand.setTable(table);
     jj_consume_token(LPAREN);
-    column = Identifier();
+    column = identifier();
     columnSpec = ColumnSpec();
     createCommand.addColumnSpec(column, columnSpec);
     label_4:
@@ -478,7 +499,7 @@
         break label_4;
       }
       jj_consume_token(COMMA);
-      column = Identifier();
+      column = identifier();
       columnSpec = ColumnSpec();
         createCommand.addColumnSpec(column, columnSpec);
     }
@@ -494,11 +515,11 @@
   Map<String, Object> columnSpec = null;
     jj_consume_token(ALTER);
     jj_consume_token(TABLE);
-    table = Identifier();
+    table = identifier();
     alterCommand.setTable(table);
     if (jj_2_1(2)) {
       jj_consume_token(ADD);
-      column = Identifier();
+      column = identifier();
       columnSpec = ColumnSpec();
          alterCommand.setOperationType(AlterCommand.OperationType.ADD);
          alterCommand.addColumnSpec(column, columnSpec);
@@ -508,7 +529,7 @@
         jj_consume_token(ADD);
         jj_consume_token(LPAREN);
       alterCommand.setOperationType(AlterCommand.OperationType.ADD);
-        column = Identifier();
+        column = identifier();
         columnSpec = ColumnSpec();
       alterCommand.addColumnSpec(column, columnSpec);
         label_5:
@@ -522,7 +543,7 @@
             break label_5;
           }
           jj_consume_token(COMMA);
-          column = Identifier();
+          column = identifier();
           columnSpec = ColumnSpec();
           alterCommand.addColumnSpec(column, columnSpec);
         }
@@ -530,13 +551,13 @@
         break;
       case DROP:
         jj_consume_token(DROP);
-        column = Identifier();
+        column = identifier();
       alterCommand.setOperationType(AlterCommand.OperationType.DROP);
       alterCommand.setColumn(column);
         break;
       case CHANGE:
         jj_consume_token(CHANGE);
-        column = Identifier();
+        column = identifier();
         columnSpec = ColumnSpec();
       alterCommand.setOperationType(AlterCommand.OperationType.CHANGE);
       alterCommand.addColumnSpec(column, columnSpec);
@@ -556,7 +577,7 @@
   List<String> tableList = null;
     jj_consume_token(DROP);
     jj_consume_token(TABLE);
-    tableList = TableList();
+    tableList = tableList();
      drop.setTableList(tableList);
      {if (true) return drop;}
     throw new Error("Missing return statement in function");
@@ -570,7 +591,7 @@
   Token t = null;
     jj_consume_token(INSERT);
     jj_consume_token(INTO);
-    table = Identifier();
+    table = identifier();
      in.setTable(table);
     columnfamilies = getColumns();
      in.setColumnfamilies(columnfamilies);
@@ -603,10 +624,10 @@
   Token t = null;
   String table = null;
     jj_consume_token(DELETE);
-    columnList = ColumnList();
+    columnList = columnList();
     deleteCommand.setColumnList(columnList);
     jj_consume_token(FROM);
-    table = Identifier();
+    table = identifier();
     deleteCommand.setTable(table);
     jj_consume_token(WHERE);
     jj_consume_token(ROW);
@@ -637,9 +658,9 @@
   String tableName = null;
   int limit;
     jj_consume_token(SELECT);
-    columns = ColumnList();
+    columns = columnList();
     jj_consume_token(FROM);
-    tableName = Identifier();
+    tableName = identifier();
      select.setColumns(columns);
      select.setTable(tableName);
     switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
@@ -712,7 +733,7 @@
   EnableCommand enableCommand = new EnableCommand(this.out);
   String table = null;
     jj_consume_token(ENABLE);
-    table = Identifier();
+    table = identifier();
     enableCommand.setTable(table);
     {if (true) return enableCommand;}
     throw new Error("Missing return statement in function");
@@ -722,7 +743,7 @@
   DisableCommand disableCommand = new DisableCommand(this.out);
   String table = null;
     jj_consume_token(DISABLE);
-    table = Identifier();
+    table = identifier();
     disableCommand.setTable(table);
     {if (true) return disableCommand;}
     throw new Error("Missing return statement in function");
@@ -735,8 +756,104 @@
     throw new Error("Missing return statement in function");
   }
 
-////////////////////////////////////////////////
-// Utility expansion units...
+  final public SubstituteCommand substituteCommand() throws ParseException {
+  Token key = null;
+  Token chainKey = null;
+  Token operation = null;
+  String tableName = null;
+  String condition = "";
+  List<String> notInList = new ArrayList<String>();
+  SubstituteCommand substitute = new SubstituteCommand(this.out);
+  Token extendedKey = null;
+    key = jj_consume_token(ID);
+    jj_consume_token(EQUALS);
+    substitute.setKey(key.image.toString());
+    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+    case ID:
+      chainKey = jj_consume_token(ID);
+      jj_consume_token(DOT);
+      substitute.setChainKey(chainKey.image.toString());
+      operation = jj_consume_token(ID);
+      substitute.setOperation(operation.image.toString());
+      jj_consume_token(LPAREN);
+      String operationType = operation.image.toLowerCase();
+      if(operationType.equals("projection")) {
+        List<String> columnList = columnList();
+        for (int i = 0; i < columnList.size(); i++) {
+          condition += appendIndicator(columnList.get(i)) + " ";
+        }
+
+      } else {
+        condition = booleanTerm();
+      }
+
+      substitute.setCondition(condition);
+      jj_consume_token(RPAREN);
+      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+      case AND:
+        jj_consume_token(AND);
+        extendedKey = jj_consume_token(ID);
+        String eKey = extendedKey.image.toString();
+        String cKey = chainKey.image.toString();
+        substitute.setCondition(condition);
+        if (secondR.equals(eKey)) {
+          substitute.resetVariableRelation(eKey, cKey);
+        } else {
+          substitute.resetVariableRelation(cKey, eKey);
+        }
+        break;
+      default:
+        jj_la1[24] = jj_gen;
+        ;
+      }
+      break;
+    case TABLE:
+      jj_consume_token(TABLE);
+      jj_consume_token(LPAREN);
+      tableName = identifier();
+      substitute.setInput(tableName);
+      jj_consume_token(RPAREN);
+      break;
+    case GROUP:
+      operation = jj_consume_token(GROUP);
+      chainKey = jj_consume_token(ID);
+      jj_consume_token(BY);
+      jj_consume_token(LPAREN);
+        List<String> columnList = columnList();
+        for (int i = 0; i < columnList.size(); i++) {
+          condition += appendIndicator(columnList.get(i));
+        }
+      jj_consume_token(RPAREN);
+      substitute.setChainKey(chainKey.image.toString());
+      substitute.setOperation(operation.image.toString());
+      substitute.setCondition(condition);
+      break;
+    default:
+      jj_la1[25] = jj_gen;
+      jj_consume_token(-1);
+      throw new ParseException();
+    }
+    {if (true) return substitute;}
+    throw new Error("Missing return statement in function");
+  }
+
+  final public SaveCommand saveCommand() throws ParseException {
+  Token t = null;
+  String tableName;
+  SaveCommand save = new SaveCommand(this.out);
+    jj_consume_token(SAVE);
+    t = jj_consume_token(ID);
+    save.setStatement(t.image.toString());
+    jj_consume_token(INTO);
+    jj_consume_token(TABLE);
+    jj_consume_token(LPAREN);
+    tableName = identifier();
+                             save.setOutput(tableName);
+    jj_consume_token(RPAREN);
+    {if (true) return save;}
+    throw new Error("Missing return statement in function");
+  }
+
   final public List<String> getLiteralValues() throws ParseException {
   List<String> values = new ArrayList<String>();
   String literal = null;
@@ -753,7 +870,7 @@
         ;
         break;
       default:
-        jj_la1[24] = jj_gen;
+        jj_la1[26] = jj_gen;
         break label_6;
       }
       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
@@ -776,14 +893,14 @@
           jj_consume_token(QUOTED_IDENTIFIER);
           break;
         default:
-          jj_la1[25] = jj_gen;
+          jj_la1[27] = jj_gen;
           jj_consume_token(-1);
           throw new ParseException();
         }
        values.removeAll(values);
         break;
       default:
-        jj_la1[26] = jj_gen;
+        jj_la1[28] = jj_gen;
         jj_consume_token(-1);
         throw new ParseException();
       }
@@ -803,7 +920,7 @@
       s = jj_consume_token(QUOTED_IDENTIFIER);
       break;
     default:
-      jj_la1[27] = jj_gen;
+      jj_la1[29] = jj_gen;
       jj_consume_token(-1);
       throw new ParseException();
     }
@@ -812,45 +929,24 @@
     throw new Error("Missing return statement in function");
   }
 
-  final public List<String> getColumns() throws ParseException {
-  List<String> values = new ArrayList<String>();
-  String literal = null;
-    jj_consume_token(LPAREN);
-   literal = getColumn();
- if(literal != null) values.add(literal);
-    label_7:
-    while (true) {
-      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
-      case COMMA:
-        ;
-        break;
-      default:
-        jj_la1[28] = jj_gen;
-        break label_7;
-      }
-      jj_consume_token(COMMA);
-        literal = getColumn();
-        if(literal != null) values.add(literal);
-    }
-    jj_consume_token(RPAREN);
-     {if (true) return values;}
-    throw new Error("Missing return statement in function");
-  }
-
   final public String getColumn() throws ParseException {
   Token col;
     switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
     case ASTERISK:
     case ID:
+    case INTEGER_LITERAL:
       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
       case ID:
         col = jj_consume_token(ID);
         break;
+      case INTEGER_LITERAL:
+        col = jj_consume_token(INTEGER_LITERAL);
+        break;
       case ASTERISK:
         col = jj_consume_token(ASTERISK);
         break;
       default:
-        jj_la1[29] = jj_gen;
+        jj_la1[30] = jj_gen;
         jj_consume_token(-1);
         throw new ParseException();
       }
@@ -866,24 +962,49 @@
         col = jj_consume_token(STRING_LITERAL);
         break;
       default:
-        jj_la1[30] = jj_gen;
+        jj_la1[31] = jj_gen;
         jj_consume_token(-1);
         throw new ParseException();
       }
         {if (true) return col.image.substring(1,col.image.toString().length() - 1);}
       break;
     default:
-      jj_la1[31] = jj_gen;
+      jj_la1[32] = jj_gen;
       jj_consume_token(-1);
       throw new ParseException();
     }
     throw new Error("Missing return statement in function");
   }
 
-  final public List<String> TableList() throws ParseException {
+  final public List<String> getColumns() throws ParseException {
+  List<String> values = new ArrayList<String>();
+  String literal = null;
+    jj_consume_token(LPAREN);
+   literal = getColumn();
+ if(literal != null) values.add(literal);
+    label_7:
+    while (true) {
+      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+      case COMMA:
+        ;
+        break;
+      default:
+        jj_la1[33] = jj_gen;
+        break label_7;
+      }
+      jj_consume_token(COMMA);
+        literal = getColumn();
+        if(literal != null) values.add(literal);
+    }
+    jj_consume_token(RPAREN);
+     {if (true) return values;}
+    throw new Error("Missing return statement in function");
+  }
+
+  final public List<String> tableList() throws ParseException {
   List<String> tableList = new ArrayList<String>();
   String table = null;
-    table = Identifier();
+    table = identifier();
                          tableList.add(table);
     label_8:
     while (true) {
@@ -892,18 +1013,18 @@
         ;
         break;
       default:
-        jj_la1[32] = jj_gen;
+        jj_la1[34] = jj_gen;
         break label_8;
       }
       jj_consume_token(COMMA);
-      table = Identifier();
+      table = identifier();
       tableList.add(table);
     }
     {if (true) return tableList;}
     throw new Error("Missing return statement in function");
   }
 
-  final public List<String> ColumnList() throws ParseException {
+  final public List<String> columnList() throws ParseException {
   List<String> columnList = new ArrayList<String>();
   String column = null;
     column = getColumn();
@@ -919,7 +1040,7 @@
         ;
         break;
       default:
-        jj_la1[33] = jj_gen;
+        jj_la1[35] = jj_gen;
         break label_9;
       }
       jj_consume_token(COMMA);
@@ -937,7 +1058,7 @@
     throw new Error("Missing return statement in function");
   }
 
-  final public String Identifier() throws ParseException {
+  final public String identifier() throws ParseException {
   Token t = null;
     switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
     case ID:
@@ -954,20 +1075,254 @@
         t = jj_consume_token(STRING_LITERAL);
         break;
       default:
-        jj_la1[34] = jj_gen;
+        jj_la1[36] = jj_gen;
         jj_consume_token(-1);
         throw new ParseException();
       }
        {if (true) return t.image.substring(1,t.image.toString().length() - 1);}
       break;
     default:
-      jj_la1[35] = jj_gen;
+      jj_la1[37] = jj_gen;
       jj_consume_token(-1);
       throw new ParseException();
     }
     throw new Error("Missing return statement in function");
   }
 
+  final public String booleanTerm() throws ParseException {
+  String query = "";
+  String tmp = null;
+  String joinTerm = null;
+  String connector = null;
+    query = booleanTerms();
+    if(query.endsWith(".ROW")) {
+      joinTerm = query;
+      query = "";
+    }
+    label_10:
+    while (true) {
+      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+      case AND:
+      case OR:
+        ;
+        break;
+      default:
+        jj_la1[38] = jj_gen;
+        break label_10;
+      }
+      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+      case AND:
+        jj_consume_token(AND);
+               connector = " AND ";
+        break;
+      case OR:
+        jj_consume_token(OR);
+                connector = " OR ";
+        break;
+      default:
+        jj_la1[39] = jj_gen;
+        jj_consume_token(-1);
+        throw new ParseException();
+      }
+      tmp = booleanTerms();
+     if(tmp.endsWith(".ROW")) {
+      joinTerm = tmp;
+     } else {
+       if(!query.equals(""))
+         query += connector;
+        query += tmp;
+     }
+    }
+    if(joinTerm != null) {
+      {if (true) return joinTerm + " BOOL " + query;}
+    } else {
+      {if (true) return query;}
+    }
+    throw new Error("Missing return statement in function");
+  }
+
+  final public String booleanTerms() throws ParseException {
+  Token tSearchName, tComparand;
+  List<String> inList = new ArrayList<String>();
+  String searchName=null,comparator=null,comparand=null;
+  Token joinColumn = null;
+  Token joinKey = null;
+  String result = null;
+    tSearchName = jj_consume_token(ID);
+                       searchName = tSearchName.image.toString();
+    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+    case DOT:
+      jj_consume_token(DOT);
+      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+      case ID:
+        joinColumn = jj_consume_token(ID);
+          searchName += "." + joinColumn.image.toString();
+        break;
+      case ROW:
+        jj_consume_token(ROW);
+          secondR = searchName;
+          searchName += ".ROW";
+        break;
+      default:
+        jj_la1[40] = jj_gen;
+        jj_consume_token(-1);
+        throw new ParseException();
+      }
+      break;
+    default:
+      jj_la1[41] = jj_gen;
+      ;
+    }
+    comparator = getComparator();
+    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+    case INTEGER_LITERAL:
+      tComparand = jj_consume_token(INTEGER_LITERAL);
+        comparand = tComparand.image.toString();
+      break;
+    case STRING_LITERAL:
+      tComparand = jj_consume_token(STRING_LITERAL);
+        comparand = tComparand.image.substring(1,tComparand.image.length() - 1);
+      break;
+    case ID:
+      tComparand = jj_consume_token(ID);
+       comparand = tComparand.image.toString();
+      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+      case DOT:
+        jj_consume_token(DOT);
+        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+        case ROW:
+          jj_consume_token(ROW);
+            secondR = comparand;
+            comparand += ".ROW";
+          break;
+        case ID:
+          joinColumn = jj_consume_token(ID);
+            comparand += "." + joinColumn.image.toString();
+          break;
+        default:
+          jj_la1[42] = jj_gen;
+          jj_consume_token(-1);
+          throw new ParseException();
+        }
+        break;
+      default:
+        jj_la1[43] = jj_gen;
+        ;
+      }
+      break;
+    case LPAREN:
+      inList = getColumns();
+      if(comparator == null) {
+        comparator = "==";
+      }
+      comparand = "";
+      try{
+        for(int i=0; i<inList.size(); i++) {
+          comparand += URLEncoder.encode(inList.get(i), "UTF-8");
+          if(inList.size() != (i+1)) { comparand += "|"; }
+        }
+      } catch (UnsupportedEncodingException e) {
+          e.printStackTrace();
+      }
+      break;
+    default:
+      jj_la1[44] = jj_gen;
+      jj_consume_token(-1);
+      throw new ParseException();
+    }
+    if(searchName.endsWith(".ROW")) {
+      result = appendIndicator(comparand)
+      + " " + comparator + " " + searchName;
+    } else {
+      result = appendIndicator(searchName)
+      + " " + comparator + " " + comparand;
+    }
+
+     {if (true) return result;}
+    throw new Error("Missing return statement in function");
+  }
+
+  final public String getComparator() throws ParseException {
+  Token t = null;
+  String comparator = null;
+    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+    case LCOMP:
+      t = jj_consume_token(LCOMP);
+          comparator = t.image.toString();
+      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+      case EQUALS:
+        jj_consume_token(EQUALS);
+                  comparator += "=";
+        break;
+      default:
+        jj_la1[45] = jj_gen;
+        ;
+      }
+      break;
+    case RCOMP:
+      t = jj_consume_token(RCOMP);
+          comparator = t.image.toString();
+      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+      case EQUALS:
+        jj_consume_token(EQUALS);
+                  comparator += "=";
+        break;
+      default:
+        jj_la1[46] = jj_gen;
+        ;
+      }
+      break;
+    case EQUALS:
+      t = jj_consume_token(EQUALS);
+          comparator = t.image.toString();
+      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+      case LCOMP:
+        jj_consume_token(LCOMP);
+                 comparator = ">" + comparator;
+        break;
+      default:
+        jj_la1[47] = jj_gen;
+        ;
+      }
+      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+      case RCOMP:
+        jj_consume_token(RCOMP);
+                 comparator = "<" + comparator;
+        break;
+      default:
+        jj_la1[48] = jj_gen;
+        ;
+      }
+      break;
+    case NOTEQUAL:
+      t = jj_consume_token(NOTEQUAL);
+          comparator = t.image.toString();
+      break;
+    case NOT:
+      jj_consume_token(NOT);
+      jj_consume_token(IN);
+          comparator = "!!";
+      break;
+    case IN:
+      jj_consume_token(IN);
+          comparator = "==";
+      break;
+    default:
+      jj_la1[49] = jj_gen;
+      jj_consume_token(-1);
+      throw new ParseException();
+    }
+    {if (true) return comparator;}
+    throw new Error("Missing return statement in function");
+  }
+
+  final public String appendIndicator(String columnName) throws ParseException {
+  String column = columnName;
+     {if (true) return (!column.endsWith(":") && column.indexOf(":") == -1)
+     ? column + ":" : column;}
+    throw new Error("Missing return statement in function");
+  }
+
   final private boolean jj_2_1(int xla) {
     jj_la = xla; jj_lastpos = jj_scanpos = token;
     try { return !jj_3_1(); }
@@ -975,34 +1330,34 @@
     finally { jj_save(0, xla); }
   }
 
-  final private boolean jj_3R_12() {
-    Token xsp;
-    xsp = jj_scanpos;
-    if (jj_scan_token(60)) {
-    jj_scanpos = xsp;
-    if (jj_scan_token(61)) return true;
-    }
+  final private boolean jj_3_1() {
+    if (jj_scan_token(ADD)) return true;
+    if (jj_3R_11()) return true;
     return false;
   }
 
   final private boolean jj_3R_11() {
-    if (jj_scan_token(ID)) return true;
+    Token xsp;
+    xsp = jj_scanpos;
+    if (jj_3R_12()) {
+    jj_scanpos = xsp;
+    if (jj_3R_13()) return true;
+    }
     return false;
   }
 
-  final private boolean jj_3R_10() {
+  final private boolean jj_3R_13() {
     Token xsp;
     xsp = jj_scanpos;
-    if (jj_3R_11()) {
+    if (jj_scan_token(67)) {
     jj_scanpos = xsp;
-    if (jj_3R_12()) return true;
+    if (jj_scan_token(68)) return true;
     }
     return false;
   }
 
-  final private boolean jj_3_1() {
-    if (jj_scan_token(ADD)) return true;
-    if (jj_3R_10()) return true;
+  final private boolean jj_3R_12() {
+    if (jj_scan_token(ID)) return true;
     return false;
   }
 
@@ -1015,18 +1370,23 @@
   public boolean lookingAhead = false;
   private boolean jj_semLA;
   private int jj_gen;
-  final private int[] jj_la1 = new int[36];
+  final private int[] jj_la1 = new int[50];
   static private int[] jj_la1_0;
   static private int[] jj_la1_1;
+  static private int[] jj_la1_2;
   static {
       jj_la1_0();
       jj_la1_1();
+      jj_la1_2();
    }
    private static void jj_la1_0() {
-      jj_la1_0 = new int[] {0x79ffe0,0x79ffe1,0x79ffe0,0x0,0x0,0x0,0x19fbc0,0x19fbc0,0x0,0x600,0x0,0x0,0x0,0x0,0x0,0x0,0x1000,0x0,0x0,0x1800000,0x1800000,0x20000000,0x40000000,0x80000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,};
+      jj_la1_0 = new int[] {0x79ffe0,0x79ffe1,0x79ffe0,0x0,0x0,0x0,0x19fbc0,0x19fbc0,0x0,0x600,0x0,0x0,0x0,0x0,0x0,0x0,0x1000,0x0,0x0,0x1800000,0x1800000,0x20000000,0x40000000,0x80000000,0x0,0x40000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4000000,0x0,0x4000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,};
    }
    private static void jj_la1_1() {
-      jj_la1_1 = new int[] {0x0,0x40000000,0x0,0x1000000,0x3000000,0x3000000,0x1000000,0x1000000,0x31000000,0x0,0x398e00,0x7000,0x70000,0x398e00,0x4,0x4,0xc00000,0x30000000,0x30000000,0x0,0x0,0x0,0x0,0x0,0x31000004,0x31000000,0x31000004,0x30000000,0x4,0x1000100,0x30000000,0x31000100,0x4,0x4,0x30000000,0x31000000,};
+      jj_la1_1 = new int[] {0x90000000,0x90000000,0x90000000,0x80000000,0x80000000,0x80000000,0xb0000000,0xb0000000,0x80000000,0x0,0x398e000,0x70000,0x700000,0x398e000,0x4,0x4,0xc000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0xa0000000,0x80000004,0x80000000,0x80000004,0x0,0x80001000,0x0,0x80001000,0x4,0x4,0x4,0x0,0x80000000,0x3,0x3,0x80000000,0x8,0x80000000,0x8,0x80000010,0x40,0x40,0x80,0x100,0xfc0,};
+   }
+   private static void jj_la1_2() {
+      jj_la1_2 = new int[] {0x0,0x20,0x0,0x0,0x1,0x1,0x0,0x0,0x18,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x18,0x18,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x18,0x18,0x18,0x18,0x1,0x18,0x19,0x0,0x0,0x0,0x18,0x18,0x0,0x0,0x0,0x0,0x0,0x0,0x11,0x0,0x0,0x0,0x0,0x0,};
    }
   final private JJCalls[] jj_2_rtns = new JJCalls[1];
   private boolean jj_rescan = false;
@@ -1041,7 +1401,7 @@
     token = new Token();
     jj_ntk = -1;
     jj_gen = 0;
-    for (int i = 0; i < 36; i++) jj_la1[i] = -1;
+    for (int i = 0; i < 50; i++) jj_la1[i] = -1;
     for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
   }
 
@@ -1054,7 +1414,7 @@
     token = new Token();
     jj_ntk = -1;
     jj_gen = 0;
-    for (int i = 0; i < 36; i++) jj_la1[i] = -1;
+    for (int i = 0; i < 50; i++) jj_la1[i] = -1;
     for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
   }
 
@@ -1064,7 +1424,7 @@
     token = new Token();
     jj_ntk = -1;
     jj_gen = 0;
-    for (int i = 0; i < 36; i++) jj_la1[i] = -1;
+    for (int i = 0; i < 50; i++) jj_la1[i] = -1;
     for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
   }
 
@@ -1074,7 +1434,7 @@
     token = new Token();
     jj_ntk = -1;
     jj_gen = 0;
-    for (int i = 0; i < 36; i++) jj_la1[i] = -1;
+    for (int i = 0; i < 50; i++) jj_la1[i] = -1;
     for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
   }
 
@@ -1083,7 +1443,7 @@
     token = new Token();
     jj_ntk = -1;
     jj_gen = 0;
-    for (int i = 0; i < 36; i++) jj_la1[i] = -1;
+    for (int i = 0; i < 50; i++) jj_la1[i] = -1;
     for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
   }
 
@@ -1092,7 +1452,7 @@
     token = new Token();
     jj_ntk = -1;
     jj_gen = 0;
-    for (int i = 0; i < 36; i++) jj_la1[i] = -1;
+    for (int i = 0; i < 50; i++) jj_la1[i] = -1;
     for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
   }
 
@@ -1203,15 +1563,15 @@
 
   public ParseException generateParseException() {
     jj_expentries.removeAllElements();
-    boolean[] la1tokens = new boolean[63];
-    for (int i = 0; i < 63; i++) {
+    boolean[] la1tokens = new boolean[70];
+    for (int i = 0; i < 70; i++) {
       la1tokens[i] = false;
     }
     if (jj_kind >= 0) {
       la1tokens[jj_kind] = true;
       jj_kind = -1;
     }
-    for (int i = 0; i < 36; i++) {
+    for (int i = 0; i < 50; i++) {
       if (jj_la1[i] == jj_gen) {
         for (int j = 0; j < 32; j++) {
           if ((jj_la1_0[i] & (1<<j)) != 0) {
@@ -1220,10 +1580,13 @@
           if ((jj_la1_1[i] & (1<<j)) != 0) {
             la1tokens[32+j] = true;
           }
+          if ((jj_la1_2[i] & (1<<j)) != 0) {
+            la1tokens[64+j] = true;
+          }
         }
       }
     }
-    for (int i = 0; i < 63; i++) {
+    for (int i = 0; i < 70; i++) {
       if (la1tokens[i]) {
         jj_expentry = new int[1];
         jj_expentry[0] = i;

Modified: lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/generated/ParserConstants.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/generated/ParserConstants.java?rev=599162&r1=599161&r2=599162&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/generated/ParserConstants.java
(original)
+++ lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/generated/ParserConstants.java
Wed Nov 28 14:10:21 2007
@@ -38,29 +38,36 @@
   int LPAREN = 36;
   int RPAREN = 37;
   int EQUALS = 38;
-  int NOTEQUAL = 39;
-  int ASTERISK = 40;
-  int MAX_VERSIONS = 41;
-  int MAX_LENGTH = 42;
-  int COMPRESSION = 43;
-  int NONE = 44;
-  int BLOCK = 45;
-  int RECORD = 46;
-  int IN_MEMORY = 47;
-  int BLOOMFILTER = 48;
-  int COUNTING_BLOOMFILTER = 49;
-  int RETOUCHED_BLOOMFILTER = 50;
-  int VECTOR_SIZE = 51;
-  int NUM_HASH = 52;
-  int NUM_ENTRIES = 53;
-  int ADD = 54;
-  int CHANGE = 55;
-  int ID = 56;
-  int INTEGER_LITERAL = 57;
-  int FLOATING_POINT_LITERAL = 58;
-  int EXPONENT = 59;
-  int QUOTED_IDENTIFIER = 60;
-  int STRING_LITERAL = 61;
+  int LCOMP = 39;
+  int RCOMP = 40;
+  int NOT = 41;
+  int IN = 42;
+  int NOTEQUAL = 43;
+  int ASTERISK = 44;
+  int MAX_VERSIONS = 45;
+  int MAX_LENGTH = 46;
+  int COMPRESSION = 47;
+  int NONE = 48;
+  int BLOCK = 49;
+  int RECORD = 50;
+  int IN_MEMORY = 51;
+  int BLOOMFILTER = 52;
+  int COUNTING_BLOOMFILTER = 53;
+  int RETOUCHED_BLOOMFILTER = 54;
+  int VECTOR_SIZE = 55;
+  int NUM_HASH = 56;
+  int NUM_ENTRIES = 57;
+  int ADD = 58;
+  int CHANGE = 59;
+  int SAVE = 60;
+  int GROUP = 61;
+  int BY = 62;
+  int ID = 63;
+  int INTEGER_LITERAL = 64;
+  int FLOATING_POINT_LITERAL = 65;
+  int EXPONENT = 66;
+  int QUOTED_IDENTIFIER = 67;
+  int STRING_LITERAL = 68;
 
   int DEFAULT = 0;
 
@@ -104,7 +111,11 @@
     "\"(\"",
     "\")\"",
     "\"=\"",
-    "\"<>\"",
+    "\">\"",
+    "\"<\"",
+    "\"not\"",
+    "\"in\"",
+    "\"!=\"",
     "\"*\"",
     "\"max_versions\"",
     "\"max_length\"",
@@ -121,6 +132,9 @@
     "\"num_entries\"",
     "\"add\"",
     "\"change\"",
+    "\"save\"",
+    "\"group\"",
+    "\"by\"",
     "<ID>",
     "<INTEGER_LITERAL>",
     "<FLOATING_POINT_LITERAL>",



Mime
View raw message