Index: src/contrib/hbase/src/test/org/apache/hadoop/hbase/shell/TestHBaseShell.java
===================================================================
--- src/contrib/hbase/src/test/org/apache/hadoop/hbase/shell/TestHBaseShell.java (revision 574788)
+++ src/contrib/hbase/src/test/org/apache/hadoop/hbase/shell/TestHBaseShell.java (working copy)
@@ -27,11 +27,119 @@
* Tests for HBase shell
*/
public class TestHBaseShell extends TestCase {
- /** test parsing */
- public void testParse() {
- String queryString1 = "SELECT test_table WHERE row='row_key' and " +
- "column='column_key';";
- new Parser(queryString1);
-
+ protected final Log LOG = LogFactory.getLog(this.getClass().getName());
+ private ByteArrayOutputStream baos;
+ private HBaseAdmin admin;
+
+ public TestHBaseShell() {
+ super(1 /*One region server only*/);
}
+
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+ // Capture System.out so we can grep for stuff in it. Have to do it once
+ // only because ConsoleTable sets up STDOUT in a static initialization
+ this.baos = new ByteArrayOutputStream();
+ System.setOut(new PrintStream(this.baos));
+ this.admin = new HBaseAdmin(this.conf);
+ }
+
+ /**
+ * Create and then drop a table.
+ * Tests also that I can use single or double quotes around table and
+ * column family names.
+ * @throws Exception
+ */
+ public void REMOVEtestCreateDeleteTable() throws Exception {
+ final String tableName = getName();
+ final String columnFamily = tableName;
+ // Create table
+ createTable("create table " + tableName + " (" + columnFamily + ");",
+ tableName, columnFamily);
+ // Try describe
+ runCommand("describe " + tableName + ";");
+ // Try describe with single quotes
+ runCommand("describe '" + tableName + "';");
+ // Try describe with double-quotes
+ runCommand("describe \"" + tableName + "\";");
+ // Try dropping the table.
+ dropTable("drop table " + tableName + ";", tableName);
+ // Use double-quotes creating table.
+ final String dblQuoteSuffix = "DblQuote";
+ final String dblQuotedTableName = tableName + dblQuoteSuffix;
+ createTable("create table \"" + dblQuotedTableName + "\" (" +
+ columnFamily + ");", dblQuotedTableName, columnFamily);
+ // Use single-quotes creating table.
+ final String sglQuoteSuffix = "SglQuote";
+ final String snglQuotedTableName = tableName + sglQuoteSuffix;
+ createTable("create table '" + snglQuotedTableName + "' (" +
+ columnFamily + ");", snglQuotedTableName, columnFamily);
+ // Use double-quotes around columnfamily name.
+ final String dblQuotedColumnFamily = columnFamily + dblQuoteSuffix;
+ String tmpTableName = tableName + dblQuotedColumnFamily;
+ createTable("create table " + tmpTableName + " (\"" +
+ dblQuotedColumnFamily + "\");", tmpTableName,
+ dblQuotedColumnFamily);
+ // Use single-quotes around columnfamily name.
+ final String sglQuotedColumnFamily = columnFamily + sglQuoteSuffix;
+ tmpTableName = tableName + sglQuotedColumnFamily;
+ createTable("create table " + tmpTableName + " ('" +
+ sglQuotedColumnFamily + "');", tmpTableName, sglQuotedColumnFamily);
+ }
+
+ public void testInsertSelectDelete() throws Exception {
+ final String tableName = getName();
+ final String columnFamily = tableName;
+ createTable("create table " + tableName + " (" + columnFamily + ");",
+ tableName, columnFamily);
+ runCommand("insert into " + tableName + " (" + columnFamily +
+ ") values ('" + columnFamily + "') where row='" + columnFamily + "';");
+ runCommand("insert into " + tableName + " (" + columnFamily +
+ ") values ('" + columnFamily + "') where row=\"" + columnFamily + "\";");
+ }
+
+ private void createTable(final String cmdStr, final String tableName,
+ final String columnFamily)
+ throws ParseException, IOException {
+ // Run create command.
+ runCommand(cmdStr);
+ // Assert table was created.
+ assertTrue(this.admin.tableExists(new Text(tableName)));
+ HTableDescriptor [] tables = this.admin.listTables();
+ HTableDescriptor td = null;
+ for (int i = 0; i < tables.length; i++) {
+ if (tableName.equals(tables[i].getName().toString())) {
+ td = tables[i];
+ }
+ }
+ assertNotNull(td);
+ assertTrue(td.hasFamily(new Text(columnFamily + ":")));
+ }
+
+ private void dropTable(final String cmdStr, final String tableName)
+ throws ParseException, IOException {
+ runCommand(cmdStr);
+ // Assert its gone
+ HTableDescriptor [] tables = this.admin.listTables();
+ for (int i = 0; i < tables.length; i++) {
+ assertNotSame(tableName, tables[i].getName().toString());
+ }
+ }
+
+ private ReturnMsg runCommand(final String cmdStr)
+ throws ParseException, UnsupportedEncodingException {
+ LOG.info("Running command: " + cmdStr);
+ Parser parser = new Parser(cmdStr);
+ Command cmd = parser.terminatedCommand();
+ ReturnMsg rm = cmd.execute(this.conf);
+ dumpStdout();
+ return rm;
+ }
+
+ private void dumpStdout() throws UnsupportedEncodingException {
+ LOG.info("STDOUT: " +
+ new String(this.baos.toByteArray(), HConstants.UTF8_ENCODING));
+ this.baos.reset();
+ }
}
Index: src/contrib/hbase/src/test/org/apache/hadoop/hbase/shell/TestConsoleTable.java
===================================================================
--- src/contrib/hbase/src/test/org/apache/hadoop/hbase/shell/TestConsoleTable.java (revision 0)
+++ src/contrib/hbase/src/test/org/apache/hadoop/hbase/shell/TestConsoleTable.java (revision 0)
@@ -0,0 +1,35 @@
+/**
+ * Copyright 2007 The Apache Software Foundation
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 at
+ *
+ * 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 org.apache.hadoop.hbase.shell;
+
+import junit.framework.TestCase;
+
+/**
+ * Test the console table class
+ * TODO: Console table needs fixing.
+ */
+public class TestConsoleTable extends TestCase {
+ public void testPrintLine() {
+ ConsoleTable.printLine(0, "smallkey", "smallcolumn", "smallcelldata");
+ ConsoleTable.printLine(0, "a large key too big for column", "smallcolumn",
+ "smallcelldata");
+ ConsoleTable.printLine(0, "smallkey", "smallcolumn", "smallcelldata");
+ }
+}
Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/Shell.java
===================================================================
--- src/contrib/hbase/src/java/org/apache/hadoop/hbase/Shell.java (revision 574788)
+++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/Shell.java (working copy)
@@ -34,14 +34,14 @@
/**
* An hbase shell.
*
- * @see HBaseShell
+ * @see HbaseShell
*/
public class Shell {
/** audible keyboard bells */
public static final boolean DEFAULT_BELL_ENABLED = true;
- /** Main method
- *
+ /**
+ * Main method
* @param args not used
* @throws IOException
*/
@@ -92,7 +92,7 @@
/** Return the string of prompt start string */
private static String getPrompt(final StringBuilder queryStr) {
- return (queryStr.toString().equals("")) ? "HBase > " : " --> ";
+ return (queryStr.toString().equals("")) ? "Hbase > " : " --> ";
}
/**
Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/DeleteCommand.java
===================================================================
--- src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/DeleteCommand.java (revision 574788)
+++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/DeleteCommand.java (working copy)
@@ -20,64 +20,90 @@
package org.apache.hadoop.hbase.shell;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.List;
-import java.util.Map;
-import java.util.Set;
import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.HBaseAdmin;
import org.apache.hadoop.hbase.HTable;
import org.apache.hadoop.io.Text;
+/**
+ * Deletes values from tables.
+ */
public class DeleteCommand extends BasicCommand {
- private Text table;
- private Map> condition;
+ private String tableName;
+ private String rowKey;
+ private List columnList;
public ReturnMsg execute(Configuration conf) {
- if (this.table == null || condition == null)
- return new ReturnMsg(0, "Syntax error : Please check 'Delete' syntax.");
+ if (columnList == null) {
+ throw new IllegalArgumentException("Column list is null");
+ }
try {
- HTable table = new HTable(conf, this.table);
- long lockId = table.startUpdate(getRow());
+ HBaseAdmin admin = new HBaseAdmin(conf);
+ HTable hTable = new HTable(conf, new Text(tableName));
+ long lockID = hTable.startUpdate(new Text(rowKey));
- if (getColumn() != null) {
- table.delete(lockId, getColumn());
- } else {
- Set keySet = table.getRow(getRow()).keySet();
- Text[] columnKey = keySet.toArray(new Text[keySet.size()]);
-
- for (int i = 0; i < columnKey.length; i++) {
- table.delete(lockId, columnKey[i]);
- }
+ for (Text column : getColumnList(admin, hTable)) {
+ hTable.delete(lockID, new Text(column));
}
- table.commit(lockId);
+ hTable.commit(lockID);
- return new ReturnMsg(1, "1 deleted successfully. ");
+ return new ReturnMsg(1, "Column(s) deleted successfully.");
} catch (IOException e) {
- return new ReturnMsg(0, "error msg : " + e.toString());
+ String[] msg = e.getMessage().split("[\n]");
+ return new ReturnMsg(0, msg[0]);
}
}
public void setTable(String table) {
- this.table = new Text(table);
+ this.tableName = table;
}
- public void setCondition(Map> cond) {
- this.condition = cond;
+ public void setRow(String row) {
+ this.rowKey = row;
}
- public Text getRow() {
- return new Text(this.condition.get("row").get(1));
+ /**
+ * Sets the column list.
+ * @param columnList
+ */
+ public void setColumnList(List columnList) {
+ this.columnList = columnList;
}
- public Text getColumn() {
- if (this.condition.containsKey("column")) {
- return new Text(this.condition.get("column").get(1));
- } else {
- return null;
+ /**
+ * @param admin
+ * @param hTable
+ * @return return the column list.
+ */
+ public Text[] getColumnList(HBaseAdmin admin, HTable hTable) {
+ Text[] columns = null;
+
+ try {
+ if (this.columnList.contains("*")) {
+ columns = hTable.getRow(new Text(this.rowKey)).keySet().toArray(new Text[] {});
+ } else {
+ List tmpList = new ArrayList();
+ for (int i = 0; i < this.columnList.size(); i++) {
+ Text column = null;
+ if (this.columnList.get(i).contains(":"))
+ column = new Text(this.columnList.get(i));
+ else
+ column = new Text(this.columnList.get(i) + ":");
+
+ tmpList.add(column);
+ }
+ columns = tmpList.toArray(new Text[] {});
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
}
+ return columns;
}
}
Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/DisableCommand.java
===================================================================
--- src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/DisableCommand.java (revision 0)
+++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/DisableCommand.java (revision 0)
@@ -0,0 +1,52 @@
+/**
+ * Copyright 2007 The Apache Software Foundation
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 at
+ *
+ * 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 org.apache.hadoop.hbase.shell;
+
+import java.io.IOException;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.HBaseAdmin;
+import org.apache.hadoop.io.Text;
+
+/**
+ * Disables tables.
+ */
+public class DisableCommand extends BasicCommand {
+
+ private String tableName;
+
+ public ReturnMsg execute(Configuration conf) {
+ assert tableName != null;
+
+ try {
+ HBaseAdmin admin = new HBaseAdmin(conf);
+ admin.disableTable(new Text(tableName));
+
+ return new ReturnMsg(1, "Table disabled successfully.");
+ } catch (IOException e) {
+ String[] msg = e.getMessage().split("[\n]");
+ return new ReturnMsg(0, msg[0]);
+ }
+ }
+
+ public void setTable(String table) {
+ this.tableName = table;
+ }
+}
\ No newline at end of file
Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/CreateCommand.java
===================================================================
--- src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/CreateCommand.java (revision 574788)
+++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/CreateCommand.java (working copy)
@@ -19,60 +19,59 @@
*/
package org.apache.hadoop.hbase.shell;
-import java.io.IOException;
-import java.util.List;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseAdmin;
import org.apache.hadoop.hbase.HColumnDescriptor;
-import org.apache.hadoop.hbase.HConnection;
-import org.apache.hadoop.hbase.HConnectionManager;
import org.apache.hadoop.hbase.HTableDescriptor;
-import org.apache.hadoop.io.Text;
-public class CreateCommand extends BasicCommand {
+/**
+ * Creates tables.
+ */
+public class CreateCommand extends SchemaModificationCommand {
- private Text table;
- private List columnfamilies;
- @SuppressWarnings("unused")
- private int limit;
+ private String tableName;
+ private Map> columnSpecMap =
+ new HashMap>();
public ReturnMsg execute(Configuration conf) {
- if (this.table == null || this.columnfamilies == null)
- return new ReturnMsg(0, "Syntax error : Please check 'Create' syntax.");
-
try {
- HConnection conn = HConnectionManager.getConnection(conf);
HBaseAdmin admin = new HBaseAdmin(conf);
-
- if (conn.tableExists(this.table)) {
- return new ReturnMsg(0, "Table was already exsits.");
+ HTableDescriptor tableDesc = new HTableDescriptor(tableName);
+ HColumnDescriptor columnDesc = null;
+ Set columns = columnSpecMap.keySet();
+ for (String column : columns) {
+ columnDesc = getColumnDescriptor(column, columnSpecMap.get(column));
+ tableDesc.addFamily(columnDesc);
}
- HTableDescriptor desc = new HTableDescriptor(this.table.toString());
- for (int i = 0; i < this.columnfamilies.size(); i++) {
- String columnFamily = columnfamilies.get(i);
- if (columnFamily.lastIndexOf(':') == (columnFamily.length() - 1)) {
- columnFamily = columnFamily.substring(0, columnFamily.length() - 1);
- }
- desc.addFamily(new HColumnDescriptor(columnFamily + FAMILY_INDICATOR));
- }
- admin.createTable(desc);
- return new ReturnMsg(1, "Table created successfully.");
- } catch (IOException e) {
- return new ReturnMsg(0, "error msg : " + e.toString());
+
+ System.out.println("Creating table... Please wait.");
+
+ admin.createTable(tableDesc);
+ return new ReturnMsg(0, "Table created successfully.");
}
+ catch (Exception e) {
+ return new ReturnMsg(0, extractErrMsg(e));
+ }
}
+ /**
+ * Sets the table to be created.
+ * @param table Table to be created
+ */
public void setTable(String table) {
- this.table = new Text(table);
+ this.tableName = table;
}
- public void setColumnfamilies(List columnfamilies) {
- this.columnfamilies = columnfamilies;
+ /**
+ * Adds a column specification.
+ * @param columnSpec Column specification
+ */
+ public void addColumnSpec(String column, Map columnSpec) {
+ columnSpecMap.put(column, columnSpec);
}
-
- public void setLimit(int limit) {
- this.limit = limit;
- }
}
Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/InsertCommand.java
===================================================================
--- src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/InsertCommand.java (revision 574788)
+++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/InsertCommand.java (working copy)
@@ -27,15 +27,18 @@
import org.apache.hadoop.hbase.HTable;
import org.apache.hadoop.io.Text;
+/**
+ * Inserts values into tables.
+ */
public class InsertCommand extends BasicCommand {
- private Text table;
+ private Text tableName;
private List columnfamilies;
private List values;
- private Map> condition;
+ private String rowKey;
public ReturnMsg execute(Configuration conf) {
- if (this.table == null || this.values == null || this.condition == null)
+ if (this.tableName == null || this.values == null || this.rowKey == null)
return new ReturnMsg(0, "Syntax error : Please check 'Insert' syntax.");
if (this.columnfamilies.size() != this.values.size())
@@ -43,12 +46,16 @@
"Mismatch between values list and columnfamilies list");
try {
- HTable table = new HTable(conf, this.table);
+ HTable table = new HTable(conf, this.tableName);
long lockId = table.startUpdate(getRow());
for (int i = 0; i < this.values.size(); i++) {
- table.put(lockId, getColumn(i), getValue(i));
-
+ Text column = null;
+ if(getColumn(i).toString().contains(":"))
+ column = getColumn(i);
+ else
+ column = new Text(getColumn(i) + ":");
+ table.put(lockId, column, getValue(i));
}
table.commit(lockId);
@@ -60,7 +67,7 @@
}
public void setTable(String table) {
- this.table = new Text(table);
+ this.tableName = new Text(table);
}
public void setColumnfamilies(List columnfamilies) {
@@ -71,12 +78,12 @@
this.values = values;
}
- public void setCondition(Map> cond) {
- this.condition = cond;
+ public void setRow(String row) {
+ this.rowKey = row;
}
public Text getRow() {
- return new Text(this.condition.get("row").get(1));
+ return new Text(this.rowKey);
}
public Text getColumn(int i) {
@@ -86,4 +93,5 @@
public byte[] getValue(int i) {
return this.values.get(i).getBytes();
}
+
}
Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/DropCommand.java
===================================================================
--- src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/DropCommand.java (revision 574788)
+++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/DropCommand.java (working copy)
@@ -20,31 +20,40 @@
package org.apache.hadoop.hbase.shell;
import java.io.IOException;
+import java.util.List;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseAdmin;
import org.apache.hadoop.io.Text;
+/**
+ * Drops tables.
+ */
public class DropCommand extends BasicCommand {
- private Text table;
+ private List tableList;
public ReturnMsg execute(Configuration conf) {
- if (this.table == null)
- return new ReturnMsg(0, "Syntax error : Please check 'Drop' syntax.");
-
+ if (tableList == null) {
+ throw new IllegalArgumentException("List of tables is null");
+ }
+
try {
HBaseAdmin admin = new HBaseAdmin(conf);
- admin.deleteTable(this.table);
- return new ReturnMsg(1, "Table droped successfully.");
+ for (String table : tableList) {
+ System.out.println("Dropping " + table + "... Please wait.");
+ admin.deleteTable(new Text(table));
+ }
+
+ return new ReturnMsg(1, "Table(s) dropped successfully.");
} catch (IOException e) {
- return new ReturnMsg(0, "error msg : " + e.toString());
+ return new ReturnMsg(0, extractErrMsg(e));
}
}
- public void setArgument(String table) {
- this.table = new Text(table);
+ public void setTableList(List tableList) {
+ this.tableList = tableList;
}
}
Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/HelpContents.java
===================================================================
--- src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/HelpContents.java (revision 574788)
+++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/HelpContents.java (working copy)
@@ -30,36 +30,77 @@
public static Map extends String, ? extends String[]> Load() {
Map load = new HashMap();
- load.put("SHOW", new String[] { "List all tables.", "SHOW TABLES;" });
+ String columnName = "column_name: "
+ + "\n\t column_family_name"
+ + "\n\t| column_family_name:column_label_name";
+ String columnList = "{ column_name, [, column_name] ... | *}";
+
+ load.put("SHOW", new String[] {"List all available tables", "SHOW TABLES;"});
+
load.put("FS", new String[] { "Hadoop FsShell operations.",
"FS -copyFromLocal /home/user/backup.dat fs/user/backup;" });
- load.put("CLEAR", new String[] {"Clear the screen.", "CLEAR;"} );
- load.put("DESCRIBE", new String[] { "Describe a table's columnfamilies.",
- "DESCRIBE ;" });
+
+ load.put("CLEAR", new String[] {"Clear the screen", "CLEAR;"} );
+
+ load.put("DESCRIBE", new String[] { "Print information about tables",
+ "[DESCRIBE|DESC] table_name;" });
+
load.put("CREATE", new String[] {
- "Create a table",
- "CREATE "
- + "\n\t COLUMNFAMILIES('cf_name1'[, 'cf_name2', ...]);"
- + "\n [LIMIT=versions_limit];" });
+ "Create tables",
+ "CREATE TABLE table_name"
+ + "\n\t(column_family_spec [, column_family_spec] ...);"
+ + "\n\n"
+ + "column_family_spec:"
+ + "\n\tcolumn_family_name"
+ + "\n\t[MAX_VERSIONS=n]"
+ + "\n\t[MAX_LENGTH=n]"
+ + "\n\t[COMPRESSION=NONE|RECORD|BLOCK]"
+ + "\n\t[IN_MEMORY]"
+ + "\n\t[BLOOMFILTER=NONE|BLOOM|COUNTING|RETOUCHED VECTOR_SIZE=n NUM_HASH=n]"
+ });
+
load.put("DROP", new String[] {
- "Drop columnfamilie(s) from a table or drop table(s)",
- "DROP table_name1[, table_name2, ...] | cf_name1[, cf_name2, ...];" });
+ "Drop tables",
+ "DROP TABLE table_name [, table_name] ...;" });
+
load.put("INSERT", new String[] {
- "Insert row into table",
- "INSERT " + "\n\t('column_name1'[, 'column_name2', ...])"
- + "\n\t VALUES('entry1'[, 'entry2', ...])"
- + "\n WHERE row='row_key';" });
+ "Insert values into tables",
+ "INSERT INTO table_name"
+ + "\n\t(colmn_name, ...) VALUES ('value', ...)"
+ + "\n\tWHERE row='row_key';"
+ + "\n\n" + columnName
+ });
+
load.put("DELETE", new String[] {
- "Delete cell or row in table.",
- "DELETE " + "\n\t WHERE row='row_key;"
- + "\n [AND column='column_name'];" });
+ "Delete a subset of the data in a table",
+ "DELETE " + columnList
+ + "\n\tFROM table_name"
+ + "\n\tWHERE row='row-key';"
+ + "\n\n"
+ + columnName
+ });
+
load.put("SELECT",
new String[] {
- "Select values from a table",
- "SELECT " + "\n\t [WHERE row='row_key']"
- + "\n [AND column='column_name'];"
- + "\n [AND time='timestamp'];"
- + "\n [LIMIT=versions_limit];" });
+ "Select values from tables",
+ "SELECT " + columnList + " FROM table_name"
+ + "\n\t[WHERE row='row_key' | STARTING FROM 'row-key']"
+ + "\n\t[NUM_VERSIONS = version_count]"
+ + "\n\t[TIMESTAMP 'timestamp']"
+ + "\n\t[LIMIT = row_count]"
+ + "\n\t[INTO FILE 'file_name'];"
+ });
+
+ load.put("ALTER",
+ new String[] {
+ "Alter the structure of a table",
+ "ALTER TABLE table_name"
+ + "\n\t ADD column_spec"
+ + "\n\t| ADD (column_spec, column_spec, ...)"
+ + "\n\t| DROP column_family_name"
+ + "\n\t| CHANGE column_spec;"
+ });
+
load.put("EXIT", new String[] { "Exit shell", "EXIT;" });
return load;
Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/AlterCommand.java
===================================================================
--- src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/AlterCommand.java (revision 0)
+++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/AlterCommand.java (revision 0)
@@ -0,0 +1,127 @@
+/**
+ * Copyright 2007 The Apache Software Foundation
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 at
+ *
+ * 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 org.apache.hadoop.hbase.shell;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.HBaseAdmin;
+import org.apache.hadoop.hbase.HColumnDescriptor;
+import org.apache.hadoop.io.Text;
+
+/**
+ * Alters tables.
+ */
+public class AlterCommand extends SchemaModificationCommand {
+
+ public enum OperationType {ADD, DROP, CHANGE, NOOP}
+ private OperationType operationType = OperationType.NOOP;
+ private Map> columnSpecMap =
+ new HashMap>();
+ private String table;
+ private String column; // column to be dropped
+
+ public ReturnMsg execute(Configuration conf) {
+ try {
+ HBaseAdmin admin = new HBaseAdmin(conf);
+ Set columns = null;
+ HColumnDescriptor columnDesc = null;
+ switch (operationType) {
+ case ADD:
+ disableTable(admin, table);
+ columns = columnSpecMap.keySet();
+ for (String c : columns) {
+ columnDesc = getColumnDescriptor(c, columnSpecMap.get(c));
+ System.out.println("Adding " + c + " to " + table +
+ "... Please wait.");
+ admin.addColumn(new Text(table), columnDesc);
+ }
+ enableTable(admin, table);
+ break;
+ case DROP:
+ disableTable(admin, table);
+ System.out.println("Dropping " + column + " from " + table +
+ "... Please wait.");
+ column = appendDelimiter(column);
+ admin.deleteColumn(new Text(table), new Text(column));
+ enableTable(admin, table);
+ break;
+ case CHANGE:
+ // Not yet supported
+ return new ReturnMsg(0, "" + operationType + " is not yet supported.");
+ case NOOP:
+ return new ReturnMsg(0, "Invalid operation type.");
+ }
+ return new ReturnMsg(0, "Table altered successfully.");
+ } catch (Exception e) {
+ return new ReturnMsg(0, extractErrMsg(e));
+ }
+ }
+
+ private void disableTable(HBaseAdmin admin, String t) throws IOException {
+ System.out.println("Disabling " + t + "... Please wait.");
+ admin.disableTable(new Text(t));
+ }
+
+ private void enableTable(HBaseAdmin admin, String t) throws IOException {
+ System.out.println("Enabling " + t + "... Please wait.");
+ admin.enableTable(new Text(t));
+ }
+
+ /**
+ * Sets the table to be altered.
+ *
+ * @param t Table to be altered.
+ */
+ public void setTable(String t) {
+ this.table = t;
+ }
+
+ /**
+ * Adds a column specification.
+ *
+ * @param columnSpec Column specification
+ */
+ public void addColumnSpec(String c, Map columnSpec) {
+ columnSpecMap.put(c, columnSpec);
+ }
+
+ /**
+ * Sets the column to be dropped. Only applicable to the DROP operation.
+ *
+ * @param c Column to be dropped.
+ */
+ public void setColumn(String c) {
+ this.column = c;
+ }
+
+ /**
+ * Sets the operation type of this alteration.
+ *
+ * @param operationType Operation type
+ * @see OperationType
+ */
+ public void setOperationType(OperationType operationType) {
+ this.operationType = operationType;
+ }
+}
\ No newline at end of file
Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/FsCommand.java
===================================================================
--- src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/FsCommand.java (revision 574788)
+++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/FsCommand.java (working copy)
@@ -25,10 +25,13 @@
import org.apache.hadoop.fs.FsShell;
import org.apache.hadoop.util.ToolRunner;
+/**
+ * Run hadoop filesystem commands.
+ */
public class FsCommand extends BasicCommand {
private List query;
- public ReturnMsg execute(Configuration conf) {
+ public ReturnMsg execute(@SuppressWarnings("unused") Configuration conf) {
FsShell shell = new FsShell();
try {
ToolRunner.run(shell, getQuery());
Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/ExitCommand.java
===================================================================
--- src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/ExitCommand.java (revision 574788)
+++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/ExitCommand.java (working copy)
@@ -23,7 +23,9 @@
public class ExitCommand extends BasicCommand {
- public ReturnMsg execute(Configuration conf) {
+ public ReturnMsg execute(@SuppressWarnings("unused") Configuration conf) {
+ // TOD: Is this the best way to exit? Would be a problem if shell is run
+ // inside another program -- St.Ack 09/11/2007
System.exit(1);
return null;
}
Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/ConsoleTable.java
===================================================================
--- src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/ConsoleTable.java (revision 574788)
+++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/ConsoleTable.java (working copy)
@@ -20,45 +20,35 @@
package org.apache.hadoop.hbase.shell;
import java.io.PrintStream;
-import java.io.UnsupportedEncodingException;
/**
* Manufactures console table, but stupid.
*/
public class ConsoleTable {
+
private static PrintStream out;
- static {
- try {
- out = new PrintStream(System.out, true, "UTF-8");
- } catch (UnsupportedEncodingException e) {
- e.printStackTrace();
- }
- }
+ private static final String sBar = "+------+----------------------+";
+ private static final String lBar = "----------------------+----------------------+";
public static void printHead(String name) {
- out.println("+------+----------------------+");
+ out.println(sBar);
out.print("| No. | ");
- out.printf("%-20s", name);
- out.println(" |");
+ printCell(name, " |", true);
}
public static void printFoot() {
- out.println("+------+----------------------+");
+ out.println(sBar);
out.println();
}
public static void printTable(int count, String name) {
- out.println("+------+----------------------+");
-
+ out.println(sBar);
if (name.length() > 20) {
int interval = 20;
-
out.print("| ");
- out.printf("%-4s", count + 1);
+ out.printf("%-4s", Integer.valueOf(count + 1));
out.print(" | ");
- out.printf("%-20s", name.substring(0, interval));
- out.println(" |");
-
+ printCell(name.substring(0, interval), " |", true);
for (int i = 0; i < name.length() / interval; i++) {
out.print("| ");
out.printf("%-4s", "");
@@ -66,64 +56,42 @@
int end = ((interval * i) + interval + interval);
if (end > name.length()) {
- out.printf("%-20s", name.substring(end - interval,
- name.length()));
+ printCell(name.substring(end - interval, name.length()), " |", true);
} else {
- out.printf("%-20s", name.substring(end - interval, end));
+ printCell(name.substring(end - interval, end), " |", true);
}
- out.println(" |");
}
-
} else {
out.print("| ");
- out.printf("%-4s", count + 1);
+ out.printf("%-4s", Integer.valueOf(count + 1));
out.print(" | ");
- out.printf("%-20s", name);
- out.println(" |");
+ printCell(name, " |", true);
}
}
public static void selectHead() {
- out.println("+------+----------------------+" +
- "----------------------+----------------------+");
+ out.println(sBar + lBar);
out.print("| No. | ");
- out.printf("%-20s", "Row");
- out.printf(" | ");
- out.printf("%-20s", "Column");
- out.printf(" | ");
- out.printf("%-20s", "Cell");
- out.println(" | ");
+ printCell("Row", " | ", false);
+ printCell("Column", " | ", false);
+ printCell("Cell", " | ", true);
}
public static void printLine(int count, String key, String column,
String cellData) {
- out.println("+------+----------------------+" +
- "----------------------+----------------------+");
-
+ out.println(sBar + lBar);
if (key.length() > 20 || column.length() > 20 || cellData.length() > 20) {
int interval = 20;
out.print("| ");
- out.printf("%-4s", count + 1);
+ out.printf("%-4s", Integer.valueOf(count + 1));
out.print(" | ");
- if (key.length() > 20)
- out.printf("%-20s", key.substring(0, interval));
- else
- out.printf("%-20s", key);
- out.print(" | ");
- if (column.length() > 20)
- out.printf("%-20s", column.substring(0, interval));
- else
- out.printf("%-20s", column);
- out.print(" | ");
- if (cellData.length() > 20)
- out.printf("%-20s", cellData.substring(0, interval));
- else
- out.printf("%-20s", cellData);
- out.println(" |");
- // out.println(getBiggerInt(new int[]{ 3, 1, 9}));
+ printLongCell(key, interval);
+ printLongCell(column, interval);
+ printLongCell(cellData, interval);
+
int biggerStrLength = getBiggerInt(new int[] { key.length(),
- column.length(), cellData.length() });
+ column.length(), cellData.length() });
for (int i = 0; i < (biggerStrLength / interval); i++) {
out.print("| ");
@@ -132,58 +100,50 @@
int end = ((interval * i) + interval + interval);
- if (end > key.length()) {
- if (key.length() > interval && end - interval < key.length()) {
- out.printf("%-20s", key.substring(end - interval,
- key.length()));
- } else {
- out.printf("%-20s", "");
- }
- } else {
- out.printf("%-20s", key.substring(end - interval, end));
- }
-
- out.print(" | ");
-
- if (end > column.length()) {
- if (column.length() > interval && end - interval < column.length()) {
- out.printf("%-20s", column.substring(end - interval,
- column.length()));
- } else {
- out.printf("%-20s", "");
- }
- } else {
- out.printf("%-20s", column.substring(end - interval, end));
- }
-
- out.print(" | ");
- if (end > cellData.length()) {
- if (cellData.length() > interval &&
- end - interval < cellData.length()) {
- out.printf("%-20s",
- cellData.substring(end - interval, cellData.length()));
- } else {
- out.printf("%-20s", "");
- }
- } else {
- out.printf("%-20s", cellData.substring(end - interval, end));
- }
- out.println(" |");
+ printLongCellData(key, end, interval, false);
+ printLongCellData(column, end, interval, false);
+ printLongCellData(cellData, end, interval, false);
}
-
} else {
out.print("| ");
- out.printf("%-4s", count + 1);
+ out.printf("%-4s", Integer.valueOf(count + 1));
out.print(" | ");
- out.printf("%-20s", key);
- out.print(" | ");
- out.printf("%-20s", column);
- out.print(" | ");
- out.printf("%-20s", cellData);
- out.println(" |");
+ printCell(key, " | ", false);
+ printCell(column, " | ", false);
+ printCell(cellData, " |", true);
}
}
+ private static void printLongCellData(String key, int end, int interval,
+ boolean newLine) {
+ if (end > key.length()) {
+ if (key.length() > interval && end - interval < key.length()) {
+ out.printf("%-20s", key.substring(end - interval, key.length()));
+ } else {
+ out.printf("%-20s", "");
+ }
+ } else {
+ out.printf("%-20s", key.substring(end - interval, end));
+ }
+ out.print(" | ");
+ if (newLine)
+ out.println();
+ }
+
+ private static void printLongCell(String iKey, int interval) {
+ if (iKey.length() > 20)
+ printCell(iKey.substring(0, interval), " | ", true);
+ else
+ printCell(iKey, " | ", true);
+ }
+
+ private static void printCell(String data, String end, boolean newLine) {
+ out.printf("%-20s", data);
+ out.printf(end);
+ if (newLine)
+ out.println();
+ }
+
public static int getBiggerInt(int[] integers) {
int result = -1;
for (int i = 0; i < integers.length; i++) {
@@ -195,8 +155,7 @@
}
public static void selectFoot() {
- out.println("+------+----------------------+" +
- "----------------------+----------------------+");
+ out.println(sBar + lBar);
out.println();
}
Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/DescCommand.java
===================================================================
--- src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/DescCommand.java (revision 574788)
+++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/DescCommand.java (working copy)
@@ -27,26 +27,27 @@
import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.io.Text;
+/**
+ * Prints information about tables.
+ */
public class DescCommand extends BasicCommand {
- private Text table;
+ private Text tableName;
public ReturnMsg execute(Configuration conf) {
- if (this.table == null)
+ if (this.tableName == null)
return new ReturnMsg(0, "Syntax error : Please check 'Describe' syntax.");
try {
HConnection conn = HConnectionManager.getConnection(conf);
-
- if (!conn.tableExists(this.table)) {
+ if (!conn.tableExists(this.tableName)) {
return new ReturnMsg(0, "Table not found.");
}
HTableDescriptor[] tables = conn.listTables();
Text[] columns = null;
-
for (int i = 0; i < tables.length; i++) {
- if (tables[i].getName().equals(this.table)) {
+ if (tables[i].getName().equals(this.tableName)) {
columns = tables[i].families().keySet().toArray(new Text[] {});
}
}
@@ -65,7 +66,7 @@
}
public void setArgument(String table) {
- this.table = new Text(table);
+ this.tableName = new Text(table);
}
}
Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/generated/ParserTokenManager.java
===================================================================
--- src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/generated/ParserTokenManager.java (revision 574788)
+++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/generated/ParserTokenManager.java (working copy)
@@ -1,4 +1,5 @@
/* Generated By:JavaCC: Do not edit this line. ParserTokenManager.java */
+package org.apache.hadoop.hbase.shell.generated;
/**
* Copyright 2007 The Apache Software Foundation
*
@@ -18,7 +19,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.hadoop.hbase.shell.generated;
+
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -36,125 +37,195 @@
switch (pos)
{
case 0:
- if ((active0 & 0x1ffffe0L) != 0L)
+ if ((active0 & 0x400000000L) != 0L)
+ return 31;
+ if ((active0 & 0x7fff01ffffffe0L) != 0L)
{
- jjmatchedKind = 32;
- return 13;
+ jjmatchedKind = 55;
+ return 0;
}
- if ((active0 & 0x84000000L) != 0L)
- return 1;
return -1;
case 1:
- if ((active0 & 0x1000800L) != 0L)
- return 13;
- if ((active0 & 0xfff7e0L) != 0L)
+ if ((active0 & 0x100002000L) != 0L)
+ return 0;
+ if ((active0 & 0x7fff00ffffdfe0L) != 0L)
{
- jjmatchedKind = 32;
+ jjmatchedKind = 55;
jjmatchedPos = 1;
- return 13;
+ return 0;
}
return -1;
case 2:
- if ((active0 & 0x810000L) != 0L)
- return 13;
- if ((active0 & 0x7ef7e0L) != 0L)
+ if ((active0 & 0x20000082000000L) != 0L)
+ return 0;
+ if ((active0 & 0x5fff007dffdfe0L) != 0L)
{
- jjmatchedKind = 32;
+ jjmatchedKind = 55;
jjmatchedPos = 2;
- return 13;
+ return 0;
}
return -1;
case 3:
- if ((active0 & 0x7ae340L) != 0L)
+ if ((active0 & 0x80001015720L) != 0L)
+ return 0;
+ if ((active0 & 0x5ff7007cfe88c0L) != 0L)
{
- jjmatchedKind = 32;
- jjmatchedPos = 3;
- return 13;
+ if (jjmatchedPos != 3)
+ {
+ jjmatchedKind = 55;
+ jjmatchedPos = 3;
+ }
+ return 0;
}
- if ((active0 & 0x414a0L) != 0L)
- return 13;
return -1;
case 4:
- if ((active0 & 0x600040L) != 0L)
- return 13;
- if ((active0 & 0x1ae300L) != 0L)
+ if ((active0 & 0x1000408200c0L) != 0L)
+ return 0;
+ if ((active0 & 0x5fe7003c7c8a00L) != 0L)
{
- jjmatchedKind = 32;
+ jjmatchedKind = 55;
jjmatchedPos = 4;
- return 13;
+ return 0;
}
return -1;
case 5:
- if ((active0 & 0x1ae200L) != 0L)
- return 13;
- if ((active0 & 0x100L) != 0L)
+ if ((active0 & 0x402000041c8800L) != 0L)
+ return 0;
+ if ((active0 & 0x1fc70038600200L) != 0L)
{
- if (jjmatchedPos != 5)
- {
- jjmatchedKind = 32;
- jjmatchedPos = 5;
- }
- return 13;
+ jjmatchedKind = 55;
+ jjmatchedPos = 5;
+ return 0;
}
return -1;
case 6:
- if ((active0 & 0x100100L) != 0L)
+ if ((active0 & 0x200000L) != 0L)
+ return 0;
+ if ((active0 & 0x1fc70038400200L) != 0L)
{
- jjmatchedKind = 32;
+ jjmatchedKind = 55;
jjmatchedPos = 6;
- return 13;
+ return 0;
}
return -1;
case 7:
- if ((active0 & 0x100L) != 0L)
- return 13;
- if ((active0 & 0x100000L) != 0L)
+ if ((active0 & 0x8000000400200L) != 0L)
+ return 0;
+ if ((active0 & 0x17c70038000000L) != 0L)
{
- jjmatchedKind = 32;
+ jjmatchedKind = 55;
jjmatchedPos = 7;
- return 13;
+ return 0;
}
return -1;
case 8:
- if ((active0 & 0x100000L) != 0L)
+ if ((active0 & 0x400010000000L) != 0L)
+ return 0;
+ if ((active0 & 0x17870028000000L) != 0L)
{
- jjmatchedKind = 32;
+ jjmatchedKind = 55;
jjmatchedPos = 8;
- return 13;
+ return 0;
}
return -1;
case 9:
- if ((active0 & 0x100000L) != 0L)
+ if ((active0 & 0x20000000000L) != 0L)
+ return 0;
+ if ((active0 & 0x17850028000000L) != 0L)
{
- jjmatchedKind = 32;
+ jjmatchedKind = 55;
jjmatchedPos = 9;
- return 13;
+ return 0;
}
return -1;
case 10:
- if ((active0 & 0x100000L) != 0L)
+ if ((active0 & 0x14840000000000L) != 0L)
+ return 0;
+ if ((active0 & 0x3010028000000L) != 0L)
{
- jjmatchedKind = 32;
+ jjmatchedKind = 55;
jjmatchedPos = 10;
- return 13;
+ return 0;
}
return -1;
case 11:
- if ((active0 & 0x100000L) != 0L)
+ if ((active0 & 0x10020000000L) != 0L)
+ return 0;
+ if ((active0 & 0x3000008000000L) != 0L)
{
- jjmatchedKind = 32;
+ jjmatchedKind = 55;
jjmatchedPos = 11;
- return 13;
+ return 0;
}
return -1;
case 12:
- if ((active0 & 0x100000L) != 0L)
+ if ((active0 & 0x3000008000000L) != 0L)
{
- jjmatchedKind = 32;
+ jjmatchedKind = 55;
jjmatchedPos = 12;
- return 13;
+ return 0;
}
return -1;
+ case 13:
+ if ((active0 & 0x8000000L) != 0L)
+ return 0;
+ if ((active0 & 0x3000000000000L) != 0L)
+ {
+ jjmatchedKind = 55;
+ jjmatchedPos = 13;
+ return 0;
+ }
+ return -1;
+ case 14:
+ if ((active0 & 0x3000000000000L) != 0L)
+ {
+ jjmatchedKind = 55;
+ jjmatchedPos = 14;
+ return 0;
+ }
+ return -1;
+ case 15:
+ if ((active0 & 0x3000000000000L) != 0L)
+ {
+ jjmatchedKind = 55;
+ jjmatchedPos = 15;
+ return 0;
+ }
+ return -1;
+ case 16:
+ if ((active0 & 0x3000000000000L) != 0L)
+ {
+ jjmatchedKind = 55;
+ jjmatchedPos = 16;
+ return 0;
+ }
+ return -1;
+ case 17:
+ if ((active0 & 0x3000000000000L) != 0L)
+ {
+ jjmatchedKind = 55;
+ jjmatchedPos = 17;
+ return 0;
+ }
+ return -1;
+ case 18:
+ if ((active0 & 0x3000000000000L) != 0L)
+ {
+ jjmatchedKind = 55;
+ jjmatchedPos = 18;
+ return 0;
+ }
+ return -1;
+ case 19:
+ if ((active0 & 0x2000000000000L) != 0L)
+ {
+ jjmatchedKind = 55;
+ jjmatchedPos = 19;
+ return 0;
+ }
+ if ((active0 & 0x1000000000000L) != 0L)
+ return 0;
+ return -1;
default :
return -1;
}
@@ -182,65 +253,74 @@
switch(curChar)
{
case 40:
- return jjStopAtPos(0, 27);
+ return jjStopAtPos(0, 35);
case 41:
- return jjStopAtPos(0, 28);
+ return jjStopAtPos(0, 36);
+ case 42:
+ return jjStopAtPos(0, 39);
case 44:
- return jjStopAtPos(0, 25);
- case 45:
- return jjStartNfaWithStates_0(0, 31, 1);
+ return jjStopAtPos(0, 33);
case 46:
- return jjStartNfaWithStates_0(0, 26, 1);
+ return jjStartNfaWithStates_0(0, 34, 31);
case 59:
- return jjStopAtPos(0, 37);
+ return jjStopAtPos(0, 61);
case 60:
- return jjMoveStringLiteralDfa1_0(0x40000000L);
+ return jjMoveStringLiteralDfa1_0(0x4000000000L);
case 61:
- return jjStopAtPos(0, 29);
+ return jjStopAtPos(0, 37);
case 65:
case 97:
- return jjMoveStringLiteralDfa1_0(0x800000L);
+ return jjMoveStringLiteralDfa1_0(0x20000080000040L);
+ case 66:
+ case 98:
+ return jjMoveStringLiteralDfa1_0(0x900000000000L);
case 67:
case 99:
- return jjMoveStringLiteralDfa1_0(0x120240L);
+ return jjMoveStringLiteralDfa1_0(0x41040008000880L);
case 68:
case 100:
- return jjMoveStringLiteralDfa1_0(0x4500L);
+ return jjMoveStringLiteralDfa1_0(0x241600L);
case 69:
case 101:
- return jjMoveStringLiteralDfa1_0(0x1000L);
+ return jjMoveStringLiteralDfa1_0(0x104000L);
case 70:
case 102:
- return jjMoveStringLiteralDfa1_0(0x800L);
+ return jjMoveStringLiteralDfa1_0(0x1002000L);
case 72:
case 104:
return jjMoveStringLiteralDfa1_0(0x20L);
case 73:
case 105:
- return jjMoveStringLiteralDfa1_0(0x2000L);
+ return jjMoveStringLiteralDfa1_0(0x400000018000L);
case 76:
case 108:
- return jjMoveStringLiteralDfa1_0(0x400000L);
+ return jjMoveStringLiteralDfa1_0(0x40000000L);
+ case 77:
+ case 109:
+ return jjMoveStringLiteralDfa1_0(0x30000000000L);
+ case 78:
+ case 110:
+ return jjMoveStringLiteralDfa1_0(0x18080020000000L);
case 79:
case 111:
- return jjMoveStringLiteralDfa1_0(0x1000000L);
+ return jjMoveStringLiteralDfa1_0(0x100000000L);
case 82:
case 114:
- return jjMoveStringLiteralDfa1_0(0x10000L);
+ return jjMoveStringLiteralDfa1_0(0x2200002000000L);
case 83:
case 115:
- return jjMoveStringLiteralDfa1_0(0x8080L);
+ return jjMoveStringLiteralDfa1_0(0x480100L);
case 84:
case 116:
- return jjMoveStringLiteralDfa1_0(0x40000L);
+ return jjMoveStringLiteralDfa1_0(0x10020000L);
case 86:
case 118:
- return jjMoveStringLiteralDfa1_0(0x80000L);
+ return jjMoveStringLiteralDfa1_0(0x4000004000000L);
case 87:
case 119:
- return jjMoveStringLiteralDfa1_0(0x200000L);
+ return jjMoveStringLiteralDfa1_0(0x800000L);
default :
- return jjMoveNfa_0(0, 0);
+ return jjMoveNfa_0(1, 0);
}
}
private final int jjMoveStringLiteralDfa1_0(long active0)
@@ -253,43 +333,52 @@
switch(curChar)
{
case 62:
- if ((active0 & 0x40000000L) != 0L)
- return jjStopAtPos(1, 30);
+ if ((active0 & 0x4000000000L) != 0L)
+ return jjStopAtPos(1, 38);
break;
case 65:
case 97:
- return jjMoveStringLiteralDfa2_0(active0, 0x80000L);
+ return jjMoveStringLiteralDfa2_0(active0, 0x30004020000L);
+ case 68:
+ case 100:
+ return jjMoveStringLiteralDfa2_0(active0, 0x20000000000000L);
case 69:
case 101:
- return jjMoveStringLiteralDfa2_0(active0, 0xc120L);
+ return jjMoveStringLiteralDfa2_0(active0, 0x62000000c0620L);
case 72:
case 104:
- return jjMoveStringLiteralDfa2_0(active0, 0x200080L);
+ return jjMoveStringLiteralDfa2_0(active0, 0x40000000800100L);
case 73:
case 105:
- return jjMoveStringLiteralDfa2_0(active0, 0x440000L);
+ return jjMoveStringLiteralDfa2_0(active0, 0x50200000L);
case 76:
case 108:
- return jjMoveStringLiteralDfa2_0(active0, 0x40L);
+ return jjMoveStringLiteralDfa2_0(active0, 0x9000000000c0L);
case 78:
case 110:
- return jjMoveStringLiteralDfa2_0(active0, 0x802000L);
+ return jjMoveStringLiteralDfa2_0(active0, 0x400080118000L);
case 79:
case 111:
- return jjMoveStringLiteralDfa2_0(active0, 0x130000L);
+ return jjMoveStringLiteralDfa2_0(active0, 0x10c000a000000L);
case 82:
case 114:
- if ((active0 & 0x1000000L) != 0L)
- return jjStartNfaWithStates_0(1, 24, 13);
- return jjMoveStringLiteralDfa2_0(active0, 0x600L);
+ if ((active0 & 0x100000000L) != 0L)
+ return jjStartNfaWithStates_0(1, 32, 0);
+ return jjMoveStringLiteralDfa2_0(active0, 0x1001800L);
case 83:
case 115:
- if ((active0 & 0x800L) != 0L)
- return jjStartNfaWithStates_0(1, 11, 13);
+ if ((active0 & 0x2000L) != 0L)
+ return jjStartNfaWithStates_0(1, 13, 0);
break;
+ case 84:
+ case 116:
+ return jjMoveStringLiteralDfa2_0(active0, 0x400000L);
+ case 85:
+ case 117:
+ return jjMoveStringLiteralDfa2_0(active0, 0x18000020000000L);
case 88:
case 120:
- return jjMoveStringLiteralDfa2_0(active0, 0x1000L);
+ return jjMoveStringLiteralDfa2_0(active0, 0x4000L);
default :
break;
}
@@ -306,34 +395,59 @@
}
switch(curChar)
{
+ case 95:
+ return jjMoveStringLiteralDfa3_0(active0, 0x400000000000L);
+ case 65:
+ case 97:
+ return jjMoveStringLiteralDfa3_0(active0, 0x40000000500000L);
+ case 66:
+ case 98:
+ return jjMoveStringLiteralDfa3_0(active0, 0x20000L);
+ case 67:
+ case 99:
+ return jjMoveStringLiteralDfa3_0(active0, 0x4200000000000L);
case 68:
case 100:
- if ((active0 & 0x800000L) != 0L)
- return jjStartNfaWithStates_0(2, 23, 13);
+ if ((active0 & 0x80000000L) != 0L)
+ return jjStartNfaWithStates_0(2, 31, 0);
+ else if ((active0 & 0x20000000000000L) != 0L)
+ return jjStartNfaWithStates_0(2, 53, 0);
break;
case 69:
case 101:
- return jjMoveStringLiteralDfa3_0(active0, 0x200240L);
+ return jjMoveStringLiteralDfa3_0(active0, 0x800880L);
case 73:
case 105:
- return jjMoveStringLiteralDfa3_0(active0, 0x1000L);
+ return jjMoveStringLiteralDfa3_0(active0, 0x4000L);
case 76:
case 108:
- return jjMoveStringLiteralDfa3_0(active0, 0x1ac020L);
+ return jjMoveStringLiteralDfa3_0(active0, 0xc0c0020L);
case 77:
case 109:
- return jjMoveStringLiteralDfa3_0(active0, 0x440000L);
+ return jjMoveStringLiteralDfa3_0(active0, 0x18040070000000L);
+ case 78:
+ case 110:
+ return jjMoveStringLiteralDfa3_0(active0, 0x80000000000L);
case 79:
case 111:
- return jjMoveStringLiteralDfa3_0(active0, 0x480L);
+ return jjMoveStringLiteralDfa3_0(active0, 0x900001001100L);
case 83:
case 115:
- return jjMoveStringLiteralDfa3_0(active0, 0x2100L);
+ return jjMoveStringLiteralDfa3_0(active0, 0x208600L);
+ case 84:
+ case 116:
+ return jjMoveStringLiteralDfa3_0(active0, 0x2000000010040L);
+ case 85:
+ case 117:
+ return jjMoveStringLiteralDfa3_0(active0, 0x1000000000000L);
case 87:
case 119:
- if ((active0 & 0x10000L) != 0L)
- return jjStartNfaWithStates_0(2, 16, 13);
+ if ((active0 & 0x2000000L) != 0L)
+ return jjStartNfaWithStates_0(2, 25, 0);
break;
+ case 88:
+ case 120:
+ return jjMoveStringLiteralDfa3_0(active0, 0x30000000000L);
default :
break;
}
@@ -350,42 +464,68 @@
}
switch(curChar)
{
+ case 95:
+ return jjMoveStringLiteralDfa4_0(active0, 0x18030020000000L);
case 65:
case 97:
- return jjMoveStringLiteralDfa4_0(active0, 0x240L);
+ return jjMoveStringLiteralDfa4_0(active0, 0x200880L);
+ case 66:
+ case 98:
+ return jjMoveStringLiteralDfa4_0(active0, 0x100000L);
case 67:
case 99:
- return jjMoveStringLiteralDfa4_0(active0, 0x100L);
+ if ((active0 & 0x400L) != 0L)
+ {
+ jjmatchedKind = 10;
+ jjmatchedPos = 3;
+ }
+ return jjMoveStringLiteralDfa4_0(active0, 0x100000000200L);
case 69:
case 101:
- if ((active0 & 0x40000L) != 0L)
- return jjStartNfaWithStates_0(3, 18, 13);
- return jjMoveStringLiteralDfa4_0(active0, 0xe000L);
+ if ((active0 & 0x80000000000L) != 0L)
+ return jjStartNfaWithStates_0(3, 43, 0);
+ return jjMoveStringLiteralDfa4_0(active0, 0x100c8040L);
case 73:
case 105:
- return jjMoveStringLiteralDfa4_0(active0, 0x400000L);
+ return jjMoveStringLiteralDfa4_0(active0, 0x40000000L);
+ case 76:
+ case 108:
+ return jjMoveStringLiteralDfa4_0(active0, 0x20000L);
+ case 77:
+ case 109:
+ if ((active0 & 0x1000000L) != 0L)
+ return jjStartNfaWithStates_0(3, 24, 0);
+ return jjMoveStringLiteralDfa4_0(active0, 0x400000000000L);
+ case 78:
+ case 110:
+ return jjMoveStringLiteralDfa4_0(active0, 0x41000000000000L);
+ case 79:
+ case 111:
+ if ((active0 & 0x10000L) != 0L)
+ return jjStartNfaWithStates_0(3, 16, 0);
+ return jjMoveStringLiteralDfa4_0(active0, 0x2a00000000000L);
case 80:
case 112:
if ((active0 & 0x20L) != 0L)
- return jjStartNfaWithStates_0(3, 5, 13);
- else if ((active0 & 0x400L) != 0L)
- return jjStartNfaWithStates_0(3, 10, 13);
- break;
+ return jjStartNfaWithStates_0(3, 5, 0);
+ else if ((active0 & 0x1000L) != 0L)
+ return jjStartNfaWithStates_0(3, 12, 0);
+ return jjMoveStringLiteralDfa4_0(active0, 0x40000000000L);
case 82:
case 114:
- return jjMoveStringLiteralDfa4_0(active0, 0x200000L);
+ return jjMoveStringLiteralDfa4_0(active0, 0xc00000L);
case 84:
case 116:
- if ((active0 & 0x1000L) != 0L)
- return jjStartNfaWithStates_0(3, 12, 13);
- break;
+ if ((active0 & 0x4000L) != 0L)
+ return jjStartNfaWithStates_0(3, 14, 0);
+ return jjMoveStringLiteralDfa4_0(active0, 0x4000000000000L);
case 85:
case 117:
- return jjMoveStringLiteralDfa4_0(active0, 0x1a0000L);
+ return jjMoveStringLiteralDfa4_0(active0, 0xc000000L);
case 87:
case 119:
- if ((active0 & 0x80L) != 0L)
- return jjStartNfaWithStates_0(3, 7, 13);
+ if ((active0 & 0x100L) != 0L)
+ return jjStartNfaWithStates_0(3, 8, 0);
break;
default :
break;
@@ -403,27 +543,60 @@
}
switch(curChar)
{
+ case 66:
+ case 98:
+ return jjMoveStringLiteralDfa5_0(active0, 0x200000L);
case 67:
case 99:
- return jjMoveStringLiteralDfa5_0(active0, 0x8000L);
+ return jjMoveStringLiteralDfa5_0(active0, 0x80000L);
case 69:
case 101:
- if ((active0 & 0x200000L) != 0L)
- return jjStartNfaWithStates_0(4, 21, 13);
- return jjMoveStringLiteralDfa5_0(active0, 0x80000L);
+ if ((active0 & 0x20000L) != 0L)
+ return jjStartNfaWithStates_0(4, 17, 0);
+ else if ((active0 & 0x800000L) != 0L)
+ return jjStartNfaWithStates_0(4, 23, 0);
+ return jjMoveStringLiteralDfa5_0(active0, 0x10400004000000L);
+ case 71:
+ case 103:
+ return jjMoveStringLiteralDfa5_0(active0, 0x40000000000000L);
+ case 72:
+ case 104:
+ return jjMoveStringLiteralDfa5_0(active0, 0x8000000000000L);
+ case 75:
+ case 107:
+ if ((active0 & 0x100000000000L) != 0L)
+ return jjStartNfaWithStates_0(4, 44, 0);
+ break;
+ case 76:
+ case 108:
+ return jjMoveStringLiteralDfa5_0(active0, 0x20000100000L);
case 77:
case 109:
- return jjMoveStringLiteralDfa5_0(active0, 0x120000L);
+ return jjMoveStringLiteralDfa5_0(active0, 0x800008000000L);
+ case 79:
+ case 111:
+ return jjMoveStringLiteralDfa5_0(active0, 0x4000000000000L);
case 82:
case 114:
if ((active0 & 0x40L) != 0L)
- return jjStartNfaWithStates_0(4, 6, 13);
- return jjMoveStringLiteralDfa5_0(active0, 0x2100L);
+ return jjStartNfaWithStates_0(4, 6, 0);
+ else if ((active0 & 0x80L) != 0L)
+ return jjStartNfaWithStates_0(4, 7, 0);
+ return jjMoveStringLiteralDfa5_0(active0, 0x240000008200L);
+ case 83:
+ case 115:
+ return jjMoveStringLiteralDfa5_0(active0, 0x10000000L);
case 84:
case 116:
- if ((active0 & 0x400000L) != 0L)
- return jjStartNfaWithStates_0(4, 22, 13);
- return jjMoveStringLiteralDfa5_0(active0, 0x4200L);
+ if ((active0 & 0x40000000L) != 0L)
+ return jjStartNfaWithStates_0(4, 30, 0);
+ return jjMoveStringLiteralDfa5_0(active0, 0x1000000440800L);
+ case 85:
+ case 117:
+ return jjMoveStringLiteralDfa5_0(active0, 0x2000000000000L);
+ case 86:
+ case 118:
+ return jjMoveStringLiteralDfa5_0(active0, 0x10020000000L);
default :
break;
}
@@ -440,36 +613,58 @@
}
switch(curChar)
{
+ case 65:
+ case 97:
+ return jjMoveStringLiteralDfa6_0(active0, 0x8000000000000L);
+ case 67:
+ case 99:
+ return jjMoveStringLiteralDfa6_0(active0, 0x2000000000000L);
+ case 68:
+ case 100:
+ if ((active0 & 0x200000000000L) != 0L)
+ return jjStartNfaWithStates_0(5, 45, 0);
+ break;
case 69:
case 101:
- if ((active0 & 0x200L) != 0L)
- return jjStartNfaWithStates_0(5, 9, 13);
- else if ((active0 & 0x4000L) != 0L)
- return jjStartNfaWithStates_0(5, 14, 13);
- break;
+ if ((active0 & 0x800L) != 0L)
+ return jjStartNfaWithStates_0(5, 11, 0);
+ else if ((active0 & 0x40000L) != 0L)
+ return jjStartNfaWithStates_0(5, 18, 0);
+ else if ((active0 & 0x100000L) != 0L)
+ return jjStartNfaWithStates_0(5, 20, 0);
+ else if ((active0 & 0x40000000000000L) != 0L)
+ return jjStartNfaWithStates_0(5, 54, 0);
+ return jjMoveStringLiteralDfa6_0(active0, 0x70020000000L);
+ case 70:
+ case 102:
+ return jjMoveStringLiteralDfa6_0(active0, 0x800000000000L);
case 73:
case 105:
- return jjMoveStringLiteralDfa6_0(active0, 0x100L);
+ return jjMoveStringLiteralDfa6_0(active0, 0x1000000400200L);
+ case 76:
+ case 108:
+ return jjMoveStringLiteralDfa6_0(active0, 0x200000L);
+ case 77:
+ case 109:
+ return jjMoveStringLiteralDfa6_0(active0, 0x400000000000L);
case 78:
case 110:
- if ((active0 & 0x20000L) != 0L)
- {
- jjmatchedKind = 17;
- jjmatchedPos = 5;
- }
- return jjMoveStringLiteralDfa6_0(active0, 0x100000L);
+ return jjMoveStringLiteralDfa6_0(active0, 0x10000008000000L);
+ case 82:
+ case 114:
+ return jjMoveStringLiteralDfa6_0(active0, 0x4000000000000L);
case 83:
case 115:
- if ((active0 & 0x80000L) != 0L)
- return jjStartNfaWithStates_0(5, 19, 13);
+ if ((active0 & 0x4000000L) != 0L)
+ return jjStartNfaWithStates_0(5, 26, 0);
break;
case 84:
case 116:
- if ((active0 & 0x2000L) != 0L)
- return jjStartNfaWithStates_0(5, 13, 13);
- else if ((active0 & 0x8000L) != 0L)
- return jjStartNfaWithStates_0(5, 15, 13);
- break;
+ if ((active0 & 0x8000L) != 0L)
+ return jjStartNfaWithStates_0(5, 15, 0);
+ else if ((active0 & 0x80000L) != 0L)
+ return jjStartNfaWithStates_0(5, 19, 0);
+ return jjMoveStringLiteralDfa6_0(active0, 0x10000000L);
default :
break;
}
@@ -486,12 +681,43 @@
}
switch(curChar)
{
+ case 95:
+ return jjMoveStringLiteralDfa7_0(active0, 0x4000000000000L);
+ case 65:
+ case 97:
+ return jjMoveStringLiteralDfa7_0(active0, 0x10000000L);
case 66:
case 98:
- return jjMoveStringLiteralDfa7_0(active0, 0x100L);
+ return jjMoveStringLiteralDfa7_0(active0, 0x200L);
+ case 69:
+ case 101:
+ if ((active0 & 0x200000L) != 0L)
+ return jjStartNfaWithStates_0(6, 21, 0);
+ break;
case 70:
case 102:
- return jjMoveStringLiteralDfa7_0(active0, 0x100000L);
+ return jjMoveStringLiteralDfa7_0(active0, 0x8000000L);
+ case 72:
+ case 104:
+ return jjMoveStringLiteralDfa7_0(active0, 0x2000000000000L);
+ case 73:
+ case 105:
+ return jjMoveStringLiteralDfa7_0(active0, 0x800000000000L);
+ case 78:
+ case 110:
+ return jjMoveStringLiteralDfa7_0(active0, 0x1020000400000L);
+ case 79:
+ case 111:
+ return jjMoveStringLiteralDfa7_0(active0, 0x400000000000L);
+ case 82:
+ case 114:
+ return jjMoveStringLiteralDfa7_0(active0, 0x10020000000L);
+ case 83:
+ case 115:
+ return jjMoveStringLiteralDfa7_0(active0, 0x8040000000000L);
+ case 84:
+ case 116:
+ return jjMoveStringLiteralDfa7_0(active0, 0x10000000000000L);
default :
break;
}
@@ -510,12 +736,34 @@
{
case 65:
case 97:
- return jjMoveStringLiteralDfa8_0(active0, 0x100000L);
+ return jjMoveStringLiteralDfa8_0(active0, 0x8000000L);
case 69:
case 101:
- if ((active0 & 0x100L) != 0L)
- return jjStartNfaWithStates_0(7, 8, 13);
+ if ((active0 & 0x200L) != 0L)
+ return jjStartNfaWithStates_0(7, 9, 0);
+ return jjMoveStringLiteralDfa8_0(active0, 0x2000000000000L);
+ case 71:
+ case 103:
+ if ((active0 & 0x400000L) != 0L)
+ return jjStartNfaWithStates_0(7, 22, 0);
+ return jjMoveStringLiteralDfa8_0(active0, 0x1020000000000L);
+ case 72:
+ case 104:
+ if ((active0 & 0x8000000000000L) != 0L)
+ return jjStartNfaWithStates_0(7, 51, 0);
break;
+ case 76:
+ case 108:
+ return jjMoveStringLiteralDfa8_0(active0, 0x800000000000L);
+ case 77:
+ case 109:
+ return jjMoveStringLiteralDfa8_0(active0, 0x10000000L);
+ case 82:
+ case 114:
+ return jjMoveStringLiteralDfa8_0(active0, 0x10400000000000L);
+ case 83:
+ case 115:
+ return jjMoveStringLiteralDfa8_0(active0, 0x4050020000000L);
default :
break;
}
@@ -532,9 +780,30 @@
}
switch(curChar)
{
+ case 95:
+ return jjMoveStringLiteralDfa9_0(active0, 0x1000000000000L);
+ case 68:
+ case 100:
+ return jjMoveStringLiteralDfa9_0(active0, 0x2000000000000L);
+ case 73:
+ case 105:
+ return jjMoveStringLiteralDfa9_0(active0, 0x14050020000000L);
case 77:
case 109:
- return jjMoveStringLiteralDfa9_0(active0, 0x100000L);
+ return jjMoveStringLiteralDfa9_0(active0, 0x8000000L);
+ case 80:
+ case 112:
+ if ((active0 & 0x10000000L) != 0L)
+ return jjStartNfaWithStates_0(8, 28, 0);
+ break;
+ case 84:
+ case 116:
+ return jjMoveStringLiteralDfa9_0(active0, 0x820000000000L);
+ case 89:
+ case 121:
+ if ((active0 & 0x400000000000L) != 0L)
+ return jjStartNfaWithStates_0(8, 46, 0);
+ break;
default :
break;
}
@@ -551,9 +820,28 @@
}
switch(curChar)
{
+ case 95:
+ return jjMoveStringLiteralDfa10_0(active0, 0x2000000000000L);
+ case 66:
+ case 98:
+ return jjMoveStringLiteralDfa10_0(active0, 0x1000000000000L);
+ case 69:
+ case 101:
+ return jjMoveStringLiteralDfa10_0(active0, 0x10800000000000L);
+ case 72:
+ case 104:
+ if ((active0 & 0x20000000000L) != 0L)
+ return jjStartNfaWithStates_0(9, 41, 0);
+ break;
case 73:
case 105:
- return jjMoveStringLiteralDfa10_0(active0, 0x100000L);
+ return jjMoveStringLiteralDfa10_0(active0, 0x8000000L);
+ case 79:
+ case 111:
+ return jjMoveStringLiteralDfa10_0(active0, 0x50020000000L);
+ case 90:
+ case 122:
+ return jjMoveStringLiteralDfa10_0(active0, 0x4000000000000L);
default :
break;
}
@@ -570,9 +858,32 @@
}
switch(curChar)
{
+ case 66:
+ case 98:
+ return jjMoveStringLiteralDfa11_0(active0, 0x2000000000000L);
+ case 69:
+ case 101:
+ if ((active0 & 0x4000000000000L) != 0L)
+ return jjStartNfaWithStates_0(10, 50, 0);
+ break;
case 76:
case 108:
- return jjMoveStringLiteralDfa11_0(active0, 0x100000L);
+ return jjMoveStringLiteralDfa11_0(active0, 0x1000008000000L);
+ case 78:
+ case 110:
+ if ((active0 & 0x40000000000L) != 0L)
+ return jjStartNfaWithStates_0(10, 42, 0);
+ return jjMoveStringLiteralDfa11_0(active0, 0x10020000000L);
+ case 82:
+ case 114:
+ if ((active0 & 0x800000000000L) != 0L)
+ return jjStartNfaWithStates_0(10, 47, 0);
+ break;
+ case 83:
+ case 115:
+ if ((active0 & 0x10000000000000L) != 0L)
+ return jjStartNfaWithStates_0(10, 52, 0);
+ break;
default :
break;
}
@@ -591,7 +902,20 @@
{
case 73:
case 105:
- return jjMoveStringLiteralDfa12_0(active0, 0x100000L);
+ return jjMoveStringLiteralDfa12_0(active0, 0x8000000L);
+ case 76:
+ case 108:
+ return jjMoveStringLiteralDfa12_0(active0, 0x2000000000000L);
+ case 79:
+ case 111:
+ return jjMoveStringLiteralDfa12_0(active0, 0x1000000000000L);
+ case 83:
+ case 115:
+ if ((active0 & 0x20000000L) != 0L)
+ return jjStartNfaWithStates_0(11, 29, 0);
+ else if ((active0 & 0x10000000000L) != 0L)
+ return jjStartNfaWithStates_0(11, 40, 0);
+ break;
default :
break;
}
@@ -610,7 +934,10 @@
{
case 69:
case 101:
- return jjMoveStringLiteralDfa13_0(active0, 0x100000L);
+ return jjMoveStringLiteralDfa13_0(active0, 0x8000000L);
+ case 79:
+ case 111:
+ return jjMoveStringLiteralDfa13_0(active0, 0x3000000000000L);
default :
break;
}
@@ -627,16 +954,177 @@
}
switch(curChar)
{
+ case 77:
+ case 109:
+ return jjMoveStringLiteralDfa14_0(active0, 0x1000000000000L);
+ case 79:
+ case 111:
+ return jjMoveStringLiteralDfa14_0(active0, 0x2000000000000L);
case 83:
case 115:
- if ((active0 & 0x100000L) != 0L)
- return jjStartNfaWithStates_0(13, 20, 13);
+ if ((active0 & 0x8000000L) != 0L)
+ return jjStartNfaWithStates_0(13, 27, 0);
break;
default :
break;
}
return jjStartNfa_0(12, active0);
}
+private final int jjMoveStringLiteralDfa14_0(long old0, long active0)
+{
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(12, old0);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(13, active0);
+ return 14;
+ }
+ switch(curChar)
+ {
+ case 70:
+ case 102:
+ return jjMoveStringLiteralDfa15_0(active0, 0x1000000000000L);
+ case 77:
+ case 109:
+ return jjMoveStringLiteralDfa15_0(active0, 0x2000000000000L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(13, active0);
+}
+private final int jjMoveStringLiteralDfa15_0(long old0, long active0)
+{
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(13, old0);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(14, active0);
+ return 15;
+ }
+ switch(curChar)
+ {
+ case 70:
+ case 102:
+ return jjMoveStringLiteralDfa16_0(active0, 0x2000000000000L);
+ case 73:
+ case 105:
+ return jjMoveStringLiteralDfa16_0(active0, 0x1000000000000L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(14, active0);
+}
+private final int jjMoveStringLiteralDfa16_0(long old0, long active0)
+{
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(14, old0);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(15, active0);
+ return 16;
+ }
+ switch(curChar)
+ {
+ case 73:
+ case 105:
+ return jjMoveStringLiteralDfa17_0(active0, 0x2000000000000L);
+ case 76:
+ case 108:
+ return jjMoveStringLiteralDfa17_0(active0, 0x1000000000000L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(15, active0);
+}
+private final int jjMoveStringLiteralDfa17_0(long old0, long active0)
+{
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(15, old0);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(16, active0);
+ return 17;
+ }
+ switch(curChar)
+ {
+ case 76:
+ case 108:
+ return jjMoveStringLiteralDfa18_0(active0, 0x2000000000000L);
+ case 84:
+ case 116:
+ return jjMoveStringLiteralDfa18_0(active0, 0x1000000000000L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(16, active0);
+}
+private final int jjMoveStringLiteralDfa18_0(long old0, long active0)
+{
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(16, old0);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(17, active0);
+ return 18;
+ }
+ switch(curChar)
+ {
+ case 69:
+ case 101:
+ return jjMoveStringLiteralDfa19_0(active0, 0x1000000000000L);
+ case 84:
+ case 116:
+ return jjMoveStringLiteralDfa19_0(active0, 0x2000000000000L);
+ default :
+ break;
+ }
+ return jjStartNfa_0(17, active0);
+}
+private final int jjMoveStringLiteralDfa19_0(long old0, long active0)
+{
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(17, old0);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(18, active0);
+ return 19;
+ }
+ switch(curChar)
+ {
+ case 69:
+ case 101:
+ return jjMoveStringLiteralDfa20_0(active0, 0x2000000000000L);
+ case 82:
+ case 114:
+ if ((active0 & 0x1000000000000L) != 0L)
+ return jjStartNfaWithStates_0(19, 48, 0);
+ break;
+ default :
+ break;
+ }
+ return jjStartNfa_0(18, active0);
+}
+private final int jjMoveStringLiteralDfa20_0(long old0, long active0)
+{
+ if (((active0 &= old0)) == 0L)
+ return jjStartNfa_0(18, old0);
+ try { curChar = input_stream.readChar(); }
+ catch(java.io.IOException e) {
+ jjStopStringLiteralDfa_0(19, active0);
+ return 20;
+ }
+ switch(curChar)
+ {
+ case 82:
+ case 114:
+ if ((active0 & 0x2000000000000L) != 0L)
+ return jjStartNfaWithStates_0(20, 49, 0);
+ break;
+ default :
+ break;
+ }
+ return jjStartNfa_0(19, active0);
+}
private final void jjCheckNAdd(int state)
{
if (jjrounds[state] != jjround)
@@ -674,7 +1162,7 @@
{
int[] nextStates;
int startsAt = 0;
- jjnewStateCnt = 13;
+ jjnewStateCnt = 31;
int i = 1;
jjstateSet[0] = startState;
int j, kind = 0x7fffffff;
@@ -689,101 +1177,174 @@
{
switch(jjstateSet[--i])
{
- case 0:
+ case 31:
if ((0x3ff000000000000L & l) != 0L)
{
- if (kind > 34)
- kind = 34;
- jjCheckNAdd(3);
+ if (kind > 57)
+ kind = 57;
+ jjCheckNAddTwoStates(2, 3);
}
- else if ((0xe00000000000L & l) != 0L)
+ else if ((0x400e00000000000L & l) != 0L)
{
- if (kind > 32)
- kind = 32;
- jjCheckNAdd(1);
+ if (kind > 55)
+ kind = 55;
+ jjCheckNAdd(0);
}
- else if (curChar == 39)
- jjCheckNAddStates(0, 2);
- else if (curChar == 34)
- jjCheckNAdd(5);
+ break;
+ case 1:
if ((0x3ff000000000000L & l) != 0L)
{
- if (kind > 33)
- kind = 33;
- jjCheckNAdd(2);
+ if (kind > 56)
+ kind = 56;
+ jjCheckNAddStates(0, 6);
}
- break;
- case 13:
- if ((0x3ffe00000000000L & l) != 0L)
+ else if ((0x400e00000000000L & l) != 0L)
{
- if (kind > 32)
- kind = 32;
- jjCheckNAdd(1);
+ if (kind > 55)
+ kind = 55;
+ jjCheckNAdd(0);
}
- if ((0x3ff000000000000L & l) != 0L)
- {
- if (kind > 34)
- kind = 34;
- jjCheckNAdd(3);
- }
+ else if (curChar == 39)
+ jjCheckNAddStates(7, 9);
+ else if (curChar == 34)
+ jjCheckNAdd(7);
+ if (curChar == 46)
+ jjCheckNAdd(2);
break;
- case 1:
- if ((0x3ffe00000000000L & l) == 0L)
+ case 0:
+ if ((0x400e00000000000L & l) == 0L)
break;
- if (kind > 32)
- kind = 32;
- jjCheckNAdd(1);
+ if (kind > 55)
+ kind = 55;
+ jjCheckNAdd(0);
break;
case 2:
if ((0x3ff000000000000L & l) == 0L)
break;
- if (kind > 33)
- kind = 33;
- jjCheckNAdd(2);
+ if (kind > 57)
+ kind = 57;
+ jjCheckNAddTwoStates(2, 3);
break;
- case 3:
- if ((0x3ff000000000000L & l) == 0L)
- break;
- if (kind > 34)
- kind = 34;
- jjCheckNAdd(3);
- break;
case 4:
- if (curChar == 34)
+ if ((0x280000000000L & l) != 0L)
jjCheckNAdd(5);
break;
case 5:
- if ((0xfffffffbffffffffL & l) != 0L)
- jjCheckNAddTwoStates(5, 6);
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 57)
+ kind = 57;
+ jjCheckNAdd(5);
break;
case 6:
- if (curChar == 34 && kind > 35)
- kind = 35;
+ if (curChar == 34)
+ jjCheckNAdd(7);
break;
case 7:
- if (curChar == 39)
- jjCheckNAddStates(0, 2);
+ if ((0xfffffffbffffffffL & l) != 0L)
+ jjCheckNAddTwoStates(7, 8);
break;
case 8:
- if ((0xffffff7fffffffffL & l) != 0L)
- jjCheckNAddStates(0, 2);
+ if (curChar == 34 && kind > 59)
+ kind = 59;
break;
case 9:
if (curChar == 39)
- jjCheckNAddStates(3, 5);
+ jjCheckNAddStates(7, 9);
break;
case 10:
- if (curChar == 39)
- jjstateSet[jjnewStateCnt++] = 9;
+ if ((0xffffff7fffffffffL & l) != 0L)
+ jjCheckNAddStates(7, 9);
break;
case 11:
- if ((0xffffff7fffffffffL & l) != 0L)
- jjCheckNAddStates(3, 5);
+ if (curChar == 39)
+ jjCheckNAddStates(10, 12);
break;
case 12:
- if (curChar == 39 && kind > 36)
- kind = 36;
+ if (curChar == 39)
+ jjstateSet[jjnewStateCnt++] = 11;
break;
+ case 13:
+ if ((0xffffff7fffffffffL & l) != 0L)
+ jjCheckNAddStates(10, 12);
+ break;
+ case 14:
+ if (curChar == 39 && kind > 60)
+ kind = 60;
+ break;
+ case 15:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 56)
+ kind = 56;
+ jjCheckNAddStates(0, 6);
+ break;
+ case 16:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 56)
+ kind = 56;
+ jjCheckNAdd(16);
+ break;
+ case 17:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(17, 18);
+ break;
+ case 18:
+ if (curChar == 46)
+ jjCheckNAdd(19);
+ break;
+ case 19:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 57)
+ kind = 57;
+ jjCheckNAddTwoStates(19, 20);
+ break;
+ case 21:
+ if ((0x280000000000L & l) != 0L)
+ jjCheckNAdd(22);
+ break;
+ case 22:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 57)
+ kind = 57;
+ jjCheckNAdd(22);
+ break;
+ case 23:
+ if ((0x3ff000000000000L & l) != 0L)
+ jjCheckNAddTwoStates(23, 24);
+ break;
+ case 25:
+ if ((0x280000000000L & l) != 0L)
+ jjCheckNAdd(26);
+ break;
+ case 26:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 57)
+ kind = 57;
+ jjCheckNAdd(26);
+ break;
+ case 27:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 57)
+ kind = 57;
+ jjCheckNAddTwoStates(27, 28);
+ break;
+ case 29:
+ if ((0x280000000000L & l) != 0L)
+ jjCheckNAdd(30);
+ break;
+ case 30:
+ if ((0x3ff000000000000L & l) == 0L)
+ break;
+ if (kind > 57)
+ kind = 57;
+ jjCheckNAdd(30);
+ break;
default : break;
}
} while(i != startsAt);
@@ -795,57 +1356,46 @@
{
switch(jjstateSet[--i])
{
+ case 31:
case 0:
- if ((0x7fffffe87fffffeL & l) != 0L)
- {
- if (kind > 32)
- kind = 32;
- jjCheckNAdd(1);
- }
- if ((0x7fffffe07fffffeL & l) != 0L)
- {
- if (kind > 34)
- kind = 34;
- jjCheckNAdd(3);
- }
+ if ((0x7fffffe87fffffeL & l) == 0L)
+ break;
+ if (kind > 55)
+ kind = 55;
+ jjCheckNAdd(0);
break;
- case 13:
- if ((0x7fffffe87fffffeL & l) != 0L)
- {
- if (kind > 32)
- kind = 32;
- jjCheckNAdd(1);
- }
- if ((0x7fffffe07fffffeL & l) != 0L)
- {
- if (kind > 34)
- kind = 34;
- jjCheckNAdd(3);
- }
- break;
case 1:
if ((0x7fffffe87fffffeL & l) == 0L)
break;
- if (kind > 32)
- kind = 32;
- jjCheckNAdd(1);
+ if (kind > 55)
+ kind = 55;
+ jjCheckNAdd(0);
break;
case 3:
- if ((0x7fffffe07fffffeL & l) == 0L)
- break;
- if (kind > 34)
- kind = 34;
- jjCheckNAdd(3);
+ if ((0x2000000020L & l) != 0L)
+ jjAddStates(13, 14);
break;
- case 5:
- jjAddStates(6, 7);
+ case 7:
+ jjAddStates(15, 16);
break;
- case 8:
- jjCheckNAddStates(0, 2);
+ case 10:
+ jjCheckNAddStates(7, 9);
break;
- case 11:
- jjCheckNAddStates(3, 5);
+ case 13:
+ jjCheckNAddStates(10, 12);
break;
+ case 20:
+ if ((0x2000000020L & l) != 0L)
+ jjAddStates(17, 18);
+ break;
+ case 24:
+ if ((0x2000000020L & l) != 0L)
+ jjAddStates(19, 20);
+ break;
+ case 28:
+ if ((0x2000000020L & l) != 0L)
+ jjAddStates(21, 22);
+ break;
default : break;
}
} while(i != startsAt);
@@ -858,17 +1408,17 @@
{
switch(jjstateSet[--i])
{
- case 5:
+ case 7:
if ((jjbitVec0[i2] & l2) != 0L)
- jjAddStates(6, 7);
+ jjAddStates(15, 16);
break;
- case 8:
+ case 10:
if ((jjbitVec0[i2] & l2) != 0L)
- jjCheckNAddStates(0, 2);
+ jjCheckNAddStates(7, 9);
break;
- case 11:
+ case 13:
if ((jjbitVec0[i2] & l2) != 0L)
- jjCheckNAddStates(3, 5);
+ jjCheckNAddStates(10, 12);
break;
default : break;
}
@@ -881,31 +1431,34 @@
kind = 0x7fffffff;
}
++curPos;
- if ((i = jjnewStateCnt) == (startsAt = 13 - (jjnewStateCnt = startsAt)))
+ if ((i = jjnewStateCnt) == (startsAt = 31 - (jjnewStateCnt = startsAt)))
return curPos;
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) { return curPos; }
}
}
static final int[] jjnextStates = {
- 8, 10, 12, 10, 11, 12, 5, 6,
+ 16, 17, 18, 23, 24, 27, 28, 10, 12, 14, 12, 13, 14, 4, 5, 7,
+ 8, 21, 22, 25, 26, 29, 30,
};
public static final String[] jjstrLiteralImages = {
"", null, null, null, null, null, null, null, null, null, null, null, null,
-null, null, null, null, null, null, null, null, null, null, null, null, "\54",
-"\56", "\50", "\51", "\75", "\74\76", "\55", null, null, null, null, null, "\73", };
+null, null, null, null, null, null, null, null, null, null, null, null, null, null,
+null, null, null, null, null, null, "\54", "\56", "\50", "\51", "\75", "\74\76",
+"\52", null, null, null, null, null, null, null, null, null, null, null, null, null,
+null, null, null, null, null, null, null, null, "\73", };
public static final String[] lexStateNames = {
"DEFAULT",
};
static final long[] jjtoToken = {
- 0x3fffffffe1L,
+ 0x3bffffffffffffe1L,
};
static final long[] jjtoSkip = {
0x1eL,
};
protected SimpleCharStream input_stream;
-private final int[] jjrounds = new int[13];
-private final int[] jjstateSet = new int[26];
+private final int[] jjrounds = new int[31];
+private final int[] jjstateSet = new int[62];
protected char curChar;
public ParserTokenManager(SimpleCharStream stream){
if (SimpleCharStream.staticFlag)
@@ -927,7 +1480,7 @@
{
int i;
jjround = 0x80000001;
- for (i = 13; i-- > 0;)
+ for (i = 31; i-- > 0;)
jjrounds[i] = 0x80000000;
}
public void ReInit(SimpleCharStream stream, int lexState)
Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/generated/ParserConstants.java
===================================================================
--- src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/generated/ParserConstants.java (revision 574788)
+++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/generated/ParserConstants.java (working copy)
@@ -24,37 +24,61 @@
int EOF = 0;
int HELP = 5;
- int CLEAR = 6;
- int SHOW = 7;
- int DESCRIBE = 8;
- int CREATE = 9;
- int DROP = 10;
- int FS = 11;
- int EXIT = 12;
- int INSERT = 13;
- int DELETE = 14;
- int SELECT = 15;
- int ROW = 16;
- int COLUMN = 17;
- int TIME = 18;
- int VALUES = 19;
- int COLUMNFAMILIES = 20;
- int WHERE = 21;
- int LIMIT = 22;
- int AND = 23;
- int OR = 24;
- int COMMA = 25;
- int DOT = 26;
- int LPAREN = 27;
- int RPAREN = 28;
- int EQUALS = 29;
- int NOTEQUAL = 30;
- int OPTIONS = 31;
- int ID = 32;
- int NUM = 33;
- int STRING = 34;
- int QUOTED_STRING = 35;
- int STRING_LITERAL = 36;
+ int ALTER = 6;
+ int CLEAR = 7;
+ int SHOW = 8;
+ int DESCRIBE = 9;
+ int DESC = 10;
+ int CREATE = 11;
+ int DROP = 12;
+ int FS = 13;
+ int EXIT = 14;
+ int INSERT = 15;
+ int INTO = 16;
+ int TABLE = 17;
+ int DELETE = 18;
+ int SELECT = 19;
+ int ENABLE = 20;
+ int DISABLE = 21;
+ int STARTING = 22;
+ int WHERE = 23;
+ int FROM = 24;
+ int ROW = 25;
+ int VALUES = 26;
+ int COLUMNFAMILIES = 27;
+ int TIMESTAMP = 28;
+ int NUM_VERSIONS = 29;
+ int LIMIT = 30;
+ int AND = 31;
+ int OR = 32;
+ int COMMA = 33;
+ int DOT = 34;
+ int LPAREN = 35;
+ int RPAREN = 36;
+ int EQUALS = 37;
+ int NOTEQUAL = 38;
+ int ASTERISK = 39;
+ int MAX_VERSIONS = 40;
+ int MAX_LENGTH = 41;
+ int COMPRESSION = 42;
+ int NONE = 43;
+ int BLOCK = 44;
+ int RECORD = 45;
+ int IN_MEMORY = 46;
+ int BLOOMFILTER = 47;
+ int COUNTING_BLOOMFILTER = 48;
+ int RETOUCHED_BLOOMFILTER = 49;
+ int VECTOR_SIZE = 50;
+ int NUM_HASH = 51;
+ int NUM_ENTRIES = 52;
+ int ADD = 53;
+ int CHANGE = 54;
+ int ID = 55;
+ int INTEGER_LITERAL = 56;
+ int FLOATING_POINT_LITERAL = 57;
+ int EXPONENT = 58;
+ int QUOTED_IDENTIFIER = 59;
+ int STRING_LITERAL = 60;
int DEFAULT = 0;
@@ -65,22 +89,30 @@
"\"\\r\"",
"\"\\n\"",
"\"help\"",
+ "\"alter\"",
"\"clear\"",
"\"show\"",
"\"describe\"",
+ "\"desc\"",
"\"create\"",
"\"drop\"",
"\"fs\"",
"\"exit\"",
"\"insert\"",
+ "\"into\"",
+ "\"table\"",
"\"delete\"",
"\"select\"",
+ "\"enable\"",
+ "\"disable\"",
+ "\"starting\"",
+ "\"where\"",
+ "\"from\"",
"\"row\"",
- "\"column\"",
- "\"time\"",
"\"values\"",
"\"columnfamilies\"",
- "\"where\"",
+ "\"timestamp\"",
+ "\"num_versions\"",
"\"limit\"",
"\"and\"",
"\"or\"",
@@ -90,11 +122,27 @@
"\")\"",
"\"=\"",
"\"<>\"",
- "\"-\"",
+ "\"*\"",
+ "\"max_versions\"",
+ "\"max_length\"",
+ "\"compression\"",
+ "\"none\"",
+ "\"block\"",
+ "\"record\"",
+ "\"in_memory\"",
+ "\"bloomfilter\"",
+ "\"counting_bloomfilter\"",
+ "\"retouched_bloomfilter\"",
+ "\"vector_size\"",
+ "\"num_hash\"",
+ "\"num_entries\"",
+ "\"add\"",
+ "\"change\"",
"",
- "",
- "",
- "",
+ "",
+ "",
+ "",
+ "",
"",
"\";\"",
};
Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/generated/Parser.java
===================================================================
--- src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/generated/Parser.java (revision 574788)
+++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/generated/Parser.java (working copy)
@@ -1,4 +1,6 @@
/* Generated By:JavaCC: Do not edit this line. Parser.java */
+package org.apache.hadoop.hbase.shell.generated;
+
/**
* Copyright 2007 The Apache Software Foundation
*
@@ -18,7 +20,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.hadoop.hbase.shell.generated;
import java.util.ArrayList;
import java.util.List;
@@ -51,9 +52,11 @@
Command statement = null;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case HELP:
+ case ALTER:
case CLEAR:
case SHOW:
case DESCRIBE:
+ case DESC:
case CREATE:
case DROP:
case FS:
@@ -61,12 +64,16 @@
case INSERT:
case DELETE:
case SELECT:
- case 37:
+ case ENABLE:
+ case DISABLE:
+ case 61:
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case HELP:
+ case ALTER:
case CLEAR:
case SHOW:
case DESCRIBE:
+ case DESC:
case CREATE:
case DROP:
case FS:
@@ -74,13 +81,15 @@
case INSERT:
case DELETE:
case SELECT:
+ case ENABLE:
+ case DISABLE:
statement = cmdStatement();
break;
default:
jj_la1[0] = jj_gen;
;
}
- jj_consume_token(37);
+ jj_consume_token(61);
break;
case 0:
jj_consume_token(0);
@@ -107,6 +116,7 @@
cmd = showCommand();
break;
case DESCRIBE:
+ case DESC:
cmd = descCommand();
break;
case CREATE:
@@ -115,6 +125,9 @@
case DROP:
cmd = dropCommand();
break;
+ case ALTER:
+ cmd = alterCommand();
+ break;
case INSERT:
cmd = insertCommand();
break;
@@ -124,6 +137,12 @@
case SELECT:
cmd = selectCommand();
break;
+ case ENABLE:
+ cmd = enableCommand();
+ break;
+ case DISABLE:
+ cmd = disableCommand();
+ break;
case CLEAR:
cmd = clearCommand();
break;
@@ -175,6 +194,7 @@
String argument = "";
jj_consume_token(HELP);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case ALTER:
case CLEAR:
case SHOW:
case DESCRIBE:
@@ -211,6 +231,9 @@
case SELECT:
t = jj_consume_token(SELECT);
break;
+ case ALTER:
+ t = jj_consume_token(ALTER);
+ break;
case CLEAR:
t = jj_consume_token(CLEAR);
break;
@@ -242,8 +265,9 @@
jj_consume_token(SHOW);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case ID:
- case QUOTED_STRING:
- argument = getString();
+ case QUOTED_IDENTIFIER:
+ case STRING_LITERAL:
+ argument = Identifier();
break;
default:
jj_la1[6] = jj_gen;
@@ -257,314 +281,419 @@
final public DescCommand descCommand() throws ParseException {
DescCommand desc = new DescCommand();
String argument = null;
- jj_consume_token(DESCRIBE);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case ID:
- case QUOTED_STRING:
- argument = getString();
+ case DESCRIBE:
+ jj_consume_token(DESCRIBE);
break;
+ case DESC:
+ jj_consume_token(DESC);
+ break;
default:
jj_la1[7] = jj_gen;
- ;
+ jj_consume_token(-1);
+ throw new ParseException();
}
- desc.setArgument(argument);
- {if (true) return desc;}
+ argument = Identifier();
+ desc.setArgument(argument);
+ {if (true) return desc;}
throw new Error("Missing return statement in function");
}
+ final public Map ColumnSpec() throws ParseException {
+ Map columnSpec = new HashMap();
+ int n = -1;
+ Token t = null;
+ label_2:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case MAX_VERSIONS:
+ case MAX_LENGTH:
+ case COMPRESSION:
+ case IN_MEMORY:
+ case BLOOMFILTER:
+ case VECTOR_SIZE:
+ case NUM_HASH:
+ case NUM_ENTRIES:
+ ;
+ break;
+ default:
+ jj_la1[8] = jj_gen;
+ break label_2;
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case MAX_VERSIONS:
+ jj_consume_token(MAX_VERSIONS);
+ jj_consume_token(EQUALS);
+ n = Number();
+ columnSpec.put("MAX_VERSIONS", n);
+ break;
+ case MAX_LENGTH:
+ jj_consume_token(MAX_LENGTH);
+ jj_consume_token(EQUALS);
+ n = Number();
+ columnSpec.put("MAX_LENGTH", n);
+ break;
+ case COMPRESSION:
+ jj_consume_token(COMPRESSION);
+ jj_consume_token(EQUALS);
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case NONE:
+ t = jj_consume_token(NONE);
+ break;
+ case BLOCK:
+ t = jj_consume_token(BLOCK);
+ break;
+ case RECORD:
+ t = jj_consume_token(RECORD);
+ break;
+ default:
+ jj_la1[9] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ columnSpec.put("COMPRESSION", t.image.toString());
+ break;
+ case IN_MEMORY:
+ jj_consume_token(IN_MEMORY);
+ columnSpec.put("IN_MEMORY", true);
+ break;
+ case BLOOMFILTER:
+ jj_consume_token(BLOOMFILTER);
+ jj_consume_token(EQUALS);
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case BLOOMFILTER:
+ t = jj_consume_token(BLOOMFILTER);
+ break;
+ case COUNTING_BLOOMFILTER:
+ t = jj_consume_token(COUNTING_BLOOMFILTER);
+ break;
+ case RETOUCHED_BLOOMFILTER:
+ t = jj_consume_token(RETOUCHED_BLOOMFILTER);
+ break;
+ default:
+ jj_la1[10] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ columnSpec.put("BLOOMFILTER", t.image.toString());
+ break;
+ case VECTOR_SIZE:
+ jj_consume_token(VECTOR_SIZE);
+ jj_consume_token(EQUALS);
+ n = Number();
+ columnSpec.put("VECTOR_SIZE", n);
+ break;
+ case NUM_HASH:
+ jj_consume_token(NUM_HASH);
+ jj_consume_token(EQUALS);
+ n = Number();
+ columnSpec.put("NUM_HASH", n);
+ break;
+ case NUM_ENTRIES:
+ jj_consume_token(NUM_ENTRIES);
+ jj_consume_token(EQUALS);
+ n = Number();
+ columnSpec.put("NUM_ENTRIES", n);
+ break;
+ default:
+ jj_la1[11] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ }
+ {if (true) return columnSpec;}
+ throw new Error("Missing return statement in function");
+ }
+
final public CreateCommand createCommand() throws ParseException {
- CreateCommand create = new CreateCommand();
- String argument = null;
- List columnfamilies = null;
- int limit = 1;
+ CreateCommand createCommand = new CreateCommand();
+ String table = null;
+ Map columnSpec = null;
+ String column = null;
jj_consume_token(CREATE);
- argument = getString();
- create.setTable(argument);
- jj_consume_token(COLUMNFAMILIES);
- columnfamilies = getLiteralValues();
- create.setColumnfamilies(columnfamilies);
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case LIMIT:
- jj_consume_token(LIMIT);
- jj_consume_token(EQUALS);
- limit = getInt();
- try{
- create.setLimit(limit);
- }catch(ClassCastException ce) {
- {if (true) throw generateParseException();}
+ jj_consume_token(TABLE);
+ table = Identifier();
+ createCommand.setTable(table);
+ jj_consume_token(LPAREN);
+ column = Identifier();
+ columnSpec = ColumnSpec();
+ createCommand.addColumnSpec(column, columnSpec);
+ label_3:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case COMMA:
+ ;
+ break;
+ default:
+ jj_la1[12] = jj_gen;
+ break label_3;
+ }
+ jj_consume_token(COMMA);
+ column = Identifier();
+ columnSpec = ColumnSpec();
+ createCommand.addColumnSpec(column, columnSpec);
+ }
+ jj_consume_token(RPAREN);
+ {if (true) return createCommand;}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public AlterCommand alterCommand() throws ParseException {
+ AlterCommand alterCommand = new AlterCommand();
+ String table = null;
+ String column = null;
+ Map columnSpec = null;
+ jj_consume_token(ALTER);
+ jj_consume_token(TABLE);
+ table = Identifier();
+ alterCommand.setTable(table);
+ if (jj_2_1(2)) {
+ jj_consume_token(ADD);
+ column = Identifier();
+ columnSpec = ColumnSpec();
+ alterCommand.setOperationType(AlterCommand.OperationType.ADD);
+ alterCommand.addColumnSpec(column, columnSpec);
+ } else {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case ADD:
+ jj_consume_token(ADD);
+ jj_consume_token(LPAREN);
+ alterCommand.setOperationType(AlterCommand.OperationType.ADD);
+ column = Identifier();
+ columnSpec = ColumnSpec();
+ alterCommand.addColumnSpec(column, columnSpec);
+ label_4:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case COMMA:
+ ;
+ break;
+ default:
+ jj_la1[13] = jj_gen;
+ break label_4;
+ }
+ jj_consume_token(COMMA);
+ column = Identifier();
+ columnSpec = ColumnSpec();
+ alterCommand.addColumnSpec(column, columnSpec);
}
- break;
- default:
- jj_la1[8] = jj_gen;
- ;
+ jj_consume_token(RPAREN);
+ break;
+ case DROP:
+ jj_consume_token(DROP);
+ column = Identifier();
+ alterCommand.setOperationType(AlterCommand.OperationType.DROP);
+ alterCommand.setColumn(column);
+ break;
+ case CHANGE:
+ jj_consume_token(CHANGE);
+ column = Identifier();
+ columnSpec = ColumnSpec();
+ alterCommand.setOperationType(AlterCommand.OperationType.CHANGE);
+ alterCommand.addColumnSpec(column, columnSpec);
+ break;
+ default:
+ jj_la1[14] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
}
- {if (true) return create;}
+ {if (true) return alterCommand;}
throw new Error("Missing return statement in function");
}
final public DropCommand dropCommand() throws ParseException {
DropCommand drop = new DropCommand();
- String argument = null;
+ List tableList = null;
jj_consume_token(DROP);
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case ID:
- case QUOTED_STRING:
- argument = getString();
- break;
- default:
- jj_la1[9] = jj_gen;
- ;
- }
- drop.setArgument(argument);
- {if (true) return drop;}
+ jj_consume_token(TABLE);
+ tableList = TableList();
+ drop.setTableList(tableList);
+ {if (true) return drop;}
throw new Error("Missing return statement in function");
}
final public InsertCommand insertCommand() throws ParseException {
- InsertCommand in = new InsertCommand();
- Map> cond = null;
- List columnfamilies = null;
- List values = null;
- String table = null;
+ InsertCommand in = new InsertCommand();
+ List columnfamilies = null;
+ List values = null;
+ String table = null;
+ Token t = null;
jj_consume_token(INSERT);
- table = getString();
- in.setTable(table);
- columnfamilies = getLiteralValues();
- in.setColumnfamilies(columnfamilies);
+ jj_consume_token(INTO);
+ table = Identifier();
+ in.setTable(table);
+ columnfamilies = getColumns();
+ in.setColumnfamilies(columnfamilies);
jj_consume_token(VALUES);
values = getLiteralValues();
- in.setValues(values);
+ in.setValues(values);
jj_consume_token(WHERE);
- cond = WhereClause();
- try{
- in.setCondition(cond);
- }catch(ClassCastException ce) {
- {if (true) throw generateParseException();}
- }
- {if (true) return in;}
+ jj_consume_token(ROW);
+ jj_consume_token(EQUALS);
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case STRING_LITERAL:
+ t = jj_consume_token(STRING_LITERAL);
+ break;
+ case QUOTED_IDENTIFIER:
+ t = jj_consume_token(QUOTED_IDENTIFIER);
+ break;
+ default:
+ jj_la1[15] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ in.setRow(t.image.substring(1, t.image.length()-1));
+ {if (true) return in;}
throw new Error("Missing return statement in function");
}
final public DeleteCommand deleteCommand() throws ParseException {
- DeleteCommand del = new DeleteCommand();
- Map> cond = null;
- String argument = null;
+ DeleteCommand deleteCommand = new DeleteCommand();
+ List columnList = null;
+ Token t = null;
+ String table = null;
jj_consume_token(DELETE);
- argument = getString();
- del.setTable(argument);
+ columnList = ColumnList();
+ deleteCommand.setColumnList(columnList);
+ jj_consume_token(FROM);
+ table = Identifier();
+ deleteCommand.setTable(table);
jj_consume_token(WHERE);
- cond = WhereClause();
- try{
- del.setCondition(cond);
- }catch(ClassCastException ce) {
- {if (true) throw generateParseException();}
- }
- {if (true) return del;}
+ jj_consume_token(ROW);
+ jj_consume_token(EQUALS);
+ t = jj_consume_token(STRING_LITERAL);
+ deleteCommand.setRow(t.image.substring(1, t.image.length()-1));
+ {if (true) return deleteCommand;}
throw new Error("Missing return statement in function");
}
final public SelectCommand selectCommand() throws ParseException {
- SelectCommand select = new SelectCommand();
- Map> cond = null;
- String argument = null;
- int limit;
+ SelectCommand select = new SelectCommand();
+ List columns = null;
+ String rowKey = "";
+ String timestamp = null;
+ int numVersion = 0;
+ String tableName = null;
+ int limit;
jj_consume_token(SELECT);
- argument = getString();
- select.setTable(argument);
+ columns = ColumnList();
+ jj_consume_token(FROM);
+ tableName = Identifier();
+ select.setColumns(columns);
+ select.setTable(tableName);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case STARTING:
case WHERE:
- jj_consume_token(WHERE);
- cond = WhereClause();
- try{
- select.setCondition(cond);
- }catch(ClassCastException ce) {
- {if (true) throw generateParseException();}
- }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case WHERE:
+ jj_consume_token(WHERE);
+ jj_consume_token(ROW);
+ jj_consume_token(EQUALS);
+ select.setWhere(true);
+ break;
+ case STARTING:
+ jj_consume_token(STARTING);
+ jj_consume_token(FROM);
+ break;
+ default:
+ jj_la1[16] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ rowKey = getStringLiteral();
+ select.setRowKey(rowKey);
break;
default:
- jj_la1[10] = jj_gen;
+ jj_la1[17] = jj_gen;
;
}
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case LIMIT:
- jj_consume_token(LIMIT);
- jj_consume_token(EQUALS);
- limit = getInt();
- try{
- select.setLimit(limit);
- }catch(ClassCastException ce) {
- {if (true) throw generateParseException();}
- }
+ case TIMESTAMP:
+ jj_consume_token(TIMESTAMP);
+ timestamp = getStringLiteral();
+ select.setTimestamp(timestamp);
break;
default:
- jj_la1[11] = jj_gen;
+ jj_la1[18] = jj_gen;
;
}
- {if (true) return select;}
- throw new Error("Missing return statement in function");
- }
-
- final public ClearCommand clearCommand() throws ParseException {
- ClearCommand clear = new ClearCommand();
- jj_consume_token(CLEAR);
- {if (true) return clear;}
- throw new Error("Missing return statement in function");
- }
-
-/**
-* TODO : expressions codes need more love.
-*/
- final public String getString() throws ParseException {
- Token t = null;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case ID:
- t = jj_consume_token(ID);
+ case NUM_VERSIONS:
+ jj_consume_token(NUM_VERSIONS);
+ numVersion = Number();
+ select.setVersion(numVersion);
break;
- case QUOTED_STRING:
- t = jj_consume_token(QUOTED_STRING);
+ default:
+ jj_la1[19] = jj_gen;
+ ;
+ }
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case LIMIT:
+ jj_consume_token(LIMIT);
+ jj_consume_token(EQUALS);
+ limit = Number();
+ try{
+ select.setLimit(limit);
+ }catch(ClassCastException ce) {
+ {if (true) throw generateParseException();}
+ }
break;
default:
- jj_la1[12] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
+ jj_la1[20] = jj_gen;
+ ;
}
- {if (true) return t.image.toString();}
+ {if (true) return select;}
throw new Error("Missing return statement in function");
}
- final public int getInt() throws ParseException {
- Token t = null;
- t = jj_consume_token(NUM);
- {if (true) return Integer.parseInt(t.image.toString());}
+ final public EnableCommand enableCommand() throws ParseException {
+ EnableCommand enableCommand = new EnableCommand();
+ String table = null;
+ jj_consume_token(ENABLE);
+ table = Identifier();
+ enableCommand.setTable(table);
+ {if (true) return enableCommand;}
throw new Error("Missing return statement in function");
}
- final public Map> WhereClause() throws ParseException {
- Map> result =
- new HashMap>();
- List exception =
- new ArrayList();
- try{
- result.putAll(ConditionExpression());
- }catch(ParseException pe) {
- exception.add(pe.toString());
- result.put("error", exception);
- }
- label_2:
- while (true) {
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case AND:
- ;
- break;
- default:
- jj_la1[13] = jj_gen;
- break label_2;
- }
- jj_consume_token(AND);
- try{
- result.putAll(ConditionExpression());
- }catch(ParseException pe) {
- exception.add(pe.toString());
- result.put("error", exception);
- }
- }
- {if (true) return result;}
+ final public DisableCommand disableCommand() throws ParseException {
+ DisableCommand disableCommand = new DisableCommand();
+ String table = null;
+ jj_consume_token(DISABLE);
+ table = Identifier();
+ disableCommand.setTable(table);
+ {if (true) return disableCommand;}
throw new Error("Missing return statement in function");
}
- final public Map> ConditionExpression() throws ParseException {
- Token tSearchName, tComparator, tComparand;
- Map> tmp =
- new HashMap>();
- List values =
- new ArrayList();
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case ROW:
- tSearchName = jj_consume_token(ROW);
- break;
- case COLUMN:
- tSearchName = jj_consume_token(COLUMN);
- break;
- case TIME:
- tSearchName = jj_consume_token(TIME);
- break;
- case ID:
- tSearchName = jj_consume_token(ID);
- break;
- case VALUES:
- tSearchName = jj_consume_token(VALUES);
- break;
- case COLUMNFAMILIES:
- tSearchName = jj_consume_token(COLUMNFAMILIES);
- break;
- default:
- jj_la1[14] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case EQUALS:
- tComparator = jj_consume_token(EQUALS);
- break;
- case NOTEQUAL:
- tComparator = jj_consume_token(NOTEQUAL);
- break;
- default:
- jj_la1[15] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
- switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
- case QUOTED_STRING:
- tComparand = jj_consume_token(QUOTED_STRING);
- values.add("quoted string");
- tmp.put("error", values);
- {if (true) return tmp;}
- break;
- case STRING_LITERAL:
- tComparand = jj_consume_token(STRING_LITERAL);
- values.add(tComparator.image);
- values.add(tComparand.image.substring(1,tComparand.image.length() - 1));
-
- if(tSearchName.image.toString().equals("row") ||
- tSearchName.image.toString().equals("column") ||
- tSearchName.image.toString().equals("time"))
- { tmp.put(tSearchName.image, values); }
- else
- {
- values.add(tSearchName.image.toString());
- tmp.put("error", values);
- }
-
- {if (true) return tmp;}
- break;
- default:
- jj_la1[16] = jj_gen;
- jj_consume_token(-1);
- throw new ParseException();
- }
+ final public ClearCommand clearCommand() throws ParseException {
+ ClearCommand clear = new ClearCommand();
+ jj_consume_token(CLEAR);
+ {if (true) return clear;}
throw new Error("Missing return statement in function");
}
+////////////////////////////////////////////////
+// Utility expansion units...
final public List getLiteralValues() throws ParseException {
- List values = new ArrayList();
- String literal = null;
+ List values = new ArrayList();
+ String literal = null;
jj_consume_token(LPAREN);
literal = getStringLiteral();
if(literal != null) values.add(literal);
- label_3:
+ label_5:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case COMMA:
case ID:
- case STRING:
- case QUOTED_STRING:
+ case QUOTED_IDENTIFIER:
case STRING_LITERAL:
;
break;
default:
- jj_la1[17] = jj_gen;
- break label_3;
+ jj_la1[21] = jj_gen;
+ break label_5;
}
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case COMMA:
@@ -573,8 +702,7 @@
if(literal != null) values.add(literal);
break;
case ID:
- case STRING:
- case QUOTED_STRING:
+ case QUOTED_IDENTIFIER:
case STRING_LITERAL:
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case ID:
@@ -583,21 +711,18 @@
case STRING_LITERAL:
jj_consume_token(STRING_LITERAL);
break;
- case QUOTED_STRING:
- jj_consume_token(QUOTED_STRING);
+ case QUOTED_IDENTIFIER:
+ jj_consume_token(QUOTED_IDENTIFIER);
break;
- case STRING:
- jj_consume_token(STRING);
- break;
default:
- jj_la1[18] = jj_gen;
+ jj_la1[22] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
values.removeAll(values);
break;
default:
- jj_la1[19] = jj_gen;
+ jj_la1[23] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
@@ -608,30 +733,228 @@
}
final public String getStringLiteral() throws ParseException {
- Token stringLiteral;
+ Token string;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case STRING_LITERAL:
- stringLiteral = jj_consume_token(STRING_LITERAL);
- {if (true) return stringLiteral.image.substring(1,stringLiteral.image.length() - 1);}
+ string = jj_consume_token(STRING_LITERAL);
break;
- case QUOTED_STRING:
- jj_consume_token(QUOTED_STRING);
- {if (true) return null;}
+ case QUOTED_IDENTIFIER:
+ string = jj_consume_token(QUOTED_IDENTIFIER);
break;
default:
- jj_la1[20] = jj_gen;
+ jj_la1[24] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
+ String value = string.image.toString();
+ {if (true) return value.substring(1,value.length() - 1);}
throw new Error("Missing return statement in function");
}
+ final public List getColumns() throws ParseException {
+ List values = new ArrayList();
+ String literal = null;
+ jj_consume_token(LPAREN);
+ literal = getColumn();
+ if(literal != null) values.add(literal);
+ label_6:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case COMMA:
+ ;
+ break;
+ default:
+ jj_la1[25] = jj_gen;
+ break label_6;
+ }
+ 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:
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case ID:
+ col = jj_consume_token(ID);
+ break;
+ case ASTERISK:
+ col = jj_consume_token(ASTERISK);
+ break;
+ default:
+ jj_la1[26] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ {if (true) return col.image.toString();}
+ break;
+ case QUOTED_IDENTIFIER:
+ case STRING_LITERAL:
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case QUOTED_IDENTIFIER:
+ col = jj_consume_token(QUOTED_IDENTIFIER);
+ break;
+ case STRING_LITERAL:
+ col = jj_consume_token(STRING_LITERAL);
+ break;
+ default:
+ jj_la1[27] = 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[28] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ throw new Error("Missing return statement in function");
+ }
+
+ final public List TableList() throws ParseException {
+ List tableList = new ArrayList();
+ String table = null;
+ table = Identifier();
+ tableList.add(table);
+ label_7:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case COMMA:
+ ;
+ break;
+ default:
+ jj_la1[29] = jj_gen;
+ break label_7;
+ }
+ jj_consume_token(COMMA);
+ table = Identifier();
+ tableList.add(table);
+ }
+ {if (true) return tableList;}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public List ColumnList() throws ParseException {
+ List columnList = new ArrayList();
+ String column = null;
+ column = getColumn();
+ if(column != null) {
+ columnList.add(column);
+ } else {
+ {if (true) return columnList;}
+ }
+ label_8:
+ while (true) {
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case COMMA:
+ ;
+ break;
+ default:
+ jj_la1[30] = jj_gen;
+ break label_8;
+ }
+ jj_consume_token(COMMA);
+ column = getColumn();
+ columnList.add(column);
+ }
+ {if (true) return columnList;}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public int Number() throws ParseException {
+ Token t = null;
+ t = jj_consume_token(INTEGER_LITERAL);
+ {if (true) return Integer.parseInt(t.image.toString());}
+ throw new Error("Missing return statement in function");
+ }
+
+ final public String Identifier() throws ParseException {
+ Token t = null;
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case ID:
+ t = jj_consume_token(ID);
+ {if (true) return t.image.toString();}
+ break;
+ case QUOTED_IDENTIFIER:
+ case STRING_LITERAL:
+ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
+ case QUOTED_IDENTIFIER:
+ t = jj_consume_token(QUOTED_IDENTIFIER);
+ break;
+ case STRING_LITERAL:
+ t = jj_consume_token(STRING_LITERAL);
+ break;
+ default:
+ jj_la1[31] = 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[32] = jj_gen;
+ jj_consume_token(-1);
+ throw new ParseException();
+ }
+ 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(); }
+ catch(LookaheadSuccess ls) { return true; }
+ finally { jj_save(0, xla); }
+ }
+
+ final private boolean jj_3R_9() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_3R_10()) {
+ jj_scanpos = xsp;
+ if (jj_3R_11()) return true;
+ }
+ return false;
+ }
+
+ final private boolean jj_3_1() {
+ if (jj_scan_token(ADD)) return true;
+ if (jj_3R_9()) return true;
+ return false;
+ }
+
+ final private boolean jj_3R_11() {
+ Token xsp;
+ xsp = jj_scanpos;
+ if (jj_scan_token(59)) {
+ jj_scanpos = xsp;
+ if (jj_scan_token(60)) return true;
+ }
+ return false;
+ }
+
+ final private boolean jj_3R_10() {
+ if (jj_scan_token(ID)) return true;
+ return false;
+ }
+
public ParserTokenManager token_source;
SimpleCharStream jj_input_stream;
public Token token, jj_nt;
private int jj_ntk;
+ private Token jj_scanpos, jj_lastpos;
+ private int jj_la;
+ public boolean lookingAhead = false;
+ private boolean jj_semLA;
private int jj_gen;
- final private int[] jj_la1 = new int[21];
+ final private int[] jj_la1 = new int[33];
static private int[] jj_la1_0;
static private int[] jj_la1_1;
static {
@@ -639,11 +962,14 @@
jj_la1_1();
}
private static void jj_la1_0() {
- jj_la1_0 = new int[] {0xffe0,0xffe1,0xffe0,0x0,0xffc0,0xffc0,0x0,0x0,0x400000,0x0,0x200000,0x400000,0x0,0x800000,0x1f0000,0x60000000,0x0,0x2000000,0x0,0x2000000,0x0,};
+ jj_la1_0 = new int[] {0x3cffe0,0x3cffe1,0x3cffe0,0x0,0xcfbc0,0xcfbc0,0x0,0x600,0x0,0x0,0x0,0x0,0x0,0x0,0x1000,0x0,0xc00000,0xc00000,0x10000000,0x20000000,0x40000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,};
}
private static void jj_la1_1() {
- jj_la1_1 = new int[] {0x0,0x20,0x0,0x1,0x1,0x1,0x9,0x9,0x0,0x9,0x0,0x0,0x9,0x0,0x1,0x0,0x18,0x1d,0x1d,0x1d,0x18,};
+ jj_la1_1 = new int[] {0x0,0x20000000,0x0,0x800000,0x800000,0x800000,0x18800000,0x0,0x1cc700,0x3800,0x38000,0x1cc700,0x2,0x2,0x600000,0x18000000,0x0,0x0,0x0,0x0,0x0,0x18800002,0x18800000,0x18800002,0x18000000,0x2,0x800080,0x18000000,0x18800080,0x2,0x2,0x18000000,0x18800000,};
}
+ final private JJCalls[] jj_2_rtns = new JJCalls[1];
+ private boolean jj_rescan = false;
+ private int jj_gc = 0;
public Parser(java.io.InputStream stream) {
this(stream, null);
@@ -654,7 +980,8 @@
token = new Token();
jj_ntk = -1;
jj_gen = 0;
- for (int i = 0; i < 21; i++) jj_la1[i] = -1;
+ for (int i = 0; i < 33; i++) jj_la1[i] = -1;
+ for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
}
public void ReInit(java.io.InputStream stream) {
@@ -666,7 +993,8 @@
token = new Token();
jj_ntk = -1;
jj_gen = 0;
- for (int i = 0; i < 21; i++) jj_la1[i] = -1;
+ for (int i = 0; i < 33; i++) jj_la1[i] = -1;
+ for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
}
public Parser(java.io.Reader stream) {
@@ -675,7 +1003,8 @@
token = new Token();
jj_ntk = -1;
jj_gen = 0;
- for (int i = 0; i < 21; i++) jj_la1[i] = -1;
+ for (int i = 0; i < 33; i++) jj_la1[i] = -1;
+ for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
}
public void ReInit(java.io.Reader stream) {
@@ -684,7 +1013,8 @@
token = new Token();
jj_ntk = -1;
jj_gen = 0;
- for (int i = 0; i < 21; i++) jj_la1[i] = -1;
+ for (int i = 0; i < 33; i++) jj_la1[i] = -1;
+ for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
}
public Parser(ParserTokenManager tm) {
@@ -692,7 +1022,8 @@
token = new Token();
jj_ntk = -1;
jj_gen = 0;
- for (int i = 0; i < 21; i++) jj_la1[i] = -1;
+ for (int i = 0; i < 33; i++) jj_la1[i] = -1;
+ for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
}
public void ReInit(ParserTokenManager tm) {
@@ -700,7 +1031,8 @@
token = new Token();
jj_ntk = -1;
jj_gen = 0;
- for (int i = 0; i < 21; i++) jj_la1[i] = -1;
+ for (int i = 0; i < 33; i++) jj_la1[i] = -1;
+ for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
}
final private Token jj_consume_token(int kind) throws ParseException {
@@ -710,6 +1042,16 @@
jj_ntk = -1;
if (token.kind == kind) {
jj_gen++;
+ if (++jj_gc > 100) {
+ jj_gc = 0;
+ for (int i = 0; i < jj_2_rtns.length; i++) {
+ JJCalls c = jj_2_rtns[i];
+ while (c != null) {
+ if (c.gen < jj_gen) c.first = null;
+ c = c.next;
+ }
+ }
+ }
return token;
}
token = oldToken;
@@ -717,6 +1059,29 @@
throw generateParseException();
}
+ static private final class LookaheadSuccess extends java.lang.Error { }
+ final private LookaheadSuccess jj_ls = new LookaheadSuccess();
+ final private boolean jj_scan_token(int kind) {
+ if (jj_scanpos == jj_lastpos) {
+ jj_la--;
+ if (jj_scanpos.next == null) {
+ jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken();
+ } else {
+ jj_lastpos = jj_scanpos = jj_scanpos.next;
+ }
+ } else {
+ jj_scanpos = jj_scanpos.next;
+ }
+ if (jj_rescan) {
+ int i = 0; Token tok = token;
+ while (tok != null && tok != jj_scanpos) { i++; tok = tok.next; }
+ if (tok != null) jj_add_error_token(kind, i);
+ }
+ if (jj_scanpos.kind != kind) return true;
+ if (jj_la == 0 && jj_scanpos == jj_lastpos) throw jj_ls;
+ return false;
+ }
+
final public Token getNextToken() {
if (token.next != null) token = token.next;
else token = token.next = token_source.getNextToken();
@@ -726,7 +1091,7 @@
}
final public Token getToken(int index) {
- Token t = token;
+ Token t = lookingAhead ? jj_scanpos : token;
for (int i = 0; i < index; i++) {
if (t.next != null) t = t.next;
else t = t.next = token_source.getNextToken();
@@ -744,18 +1109,48 @@
private java.util.Vector jj_expentries = new java.util.Vector();
private int[] jj_expentry;
private int jj_kind = -1;
+ private int[] jj_lasttokens = new int[100];
+ private int jj_endpos;
+ private void jj_add_error_token(int kind, int pos) {
+ if (pos >= 100) return;
+ if (pos == jj_endpos + 1) {
+ jj_lasttokens[jj_endpos++] = kind;
+ } else if (jj_endpos != 0) {
+ jj_expentry = new int[jj_endpos];
+ for (int i = 0; i < jj_endpos; i++) {
+ jj_expentry[i] = jj_lasttokens[i];
+ }
+ boolean exists = false;
+ for (java.util.Enumeration e = jj_expentries.elements(); e.hasMoreElements();) {
+ int[] oldentry = (int[])(e.nextElement());
+ if (oldentry.length == jj_expentry.length) {
+ exists = true;
+ for (int i = 0; i < jj_expentry.length; i++) {
+ if (oldentry[i] != jj_expentry[i]) {
+ exists = false;
+ break;
+ }
+ }
+ if (exists) break;
+ }
+ }
+ if (!exists) jj_expentries.addElement(jj_expentry);
+ if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind;
+ }
+ }
+
public ParseException generateParseException() {
jj_expentries.removeAllElements();
- boolean[] la1tokens = new boolean[38];
- for (int i = 0; i < 38; i++) {
+ boolean[] la1tokens = new boolean[62];
+ for (int i = 0; i < 62; i++) {
la1tokens[i] = false;
}
if (jj_kind >= 0) {
la1tokens[jj_kind] = true;
jj_kind = -1;
}
- for (int i = 0; i < 21; i++) {
+ for (int i = 0; i < 33; i++) {
if (jj_la1[i] == jj_gen) {
for (int j = 0; j < 32; j++) {
if ((jj_la1_0[i] & (1< jj_gen) {
+ jj_la = p.arg; jj_lastpos = jj_scanpos = p.first;
+ switch (i) {
+ case 0: jj_3_1(); break;
+ }
+ }
+ p = p.next;
+ } while (p != null);
+ } catch(LookaheadSuccess ls) { }
+ }
+ jj_rescan = false;
+ }
+
+ final private void jj_save(int index, int xla) {
+ JJCalls p = jj_2_rtns[index];
+ while (p.gen > jj_gen) {
+ if (p.next == null) { p = p.next = new JJCalls(); break; }
+ p = p.next;
+ }
+ p.gen = jj_gen + xla - jj_la; p.first = token; p.arg = xla;
+ }
+
+ static final class JJCalls {
+ int gen;
+ Token first;
+ int arg;
+ JJCalls next;
+ }
+
+}
\ No newline at end of file
Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/Command.java
===================================================================
--- src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/Command.java (revision 574788)
+++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/Command.java (working copy)
@@ -26,7 +26,10 @@
/** family indicator */
public static final String FAMILY_INDICATOR = ":";
- /** Execute a command */
+ /** Execute a command
+ * @param conf Configuration
+ * @return Result of command execution.
+ */
public ReturnMsg execute(Configuration conf);
}
\ No newline at end of file
Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/SelectCommand.java
===================================================================
--- src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/SelectCommand.java (revision 574788)
+++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/SelectCommand.java (working copy)
@@ -20,6 +20,7 @@
package org.apache.hadoop.hbase.shell;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
@@ -35,75 +36,66 @@
import org.apache.hadoop.io.DataInputBuffer;
import org.apache.hadoop.io.Text;
+/**
+ * Selects values from tables.
+ *
+ * INTO FILE is not yet implemented.
+ */
public class SelectCommand extends BasicCommand {
- private Text table;
+ private Text tableName;
+ private Text rowKey = new Text("");
+ private List columns;
+ private long timestamp;
private int limit;
- private Map> condition;
+ private int version;
+ private boolean whereClause = false;
public ReturnMsg execute(Configuration conf) {
- if (this.condition != null && this.condition.containsKey("error"))
+ if (this.tableName.equals("") || this.rowKey == null ||
+ this.columns.size() == 0) {
return new ReturnMsg(0, "Syntax error : Please check 'Select' syntax.");
-
+ }
+
try {
- HTable table = new HTable(conf, this.table);
+ HTable table = new HTable(conf, this.tableName);
HBaseAdmin admin = new HBaseAdmin(conf);
-
- switch (getCondition()) {
- case 0:
+ if (this.whereClause) {
+ dataRetrieval(table, admin);
+ } else {
+ dataScanning(table, admin);
+ }
+ return new ReturnMsg(1, "Successfully print out the selected data.");
+ } catch (IOException e) {
+ String[] msg = e.getMessage().split("[,]");
+ return new ReturnMsg(0, msg[0]);
+ }
+ }
- HTableDescriptor[] tables = admin.listTables();
- Text[] columns = null;
-
- if (this.table.equals(HConstants.ROOT_TABLE_NAME)
- || this.table.equals(HConstants.META_TABLE_NAME)) {
- columns = HConstants.COLUMN_FAMILY_ARRAY;
- } else {
- for (int i = 0; i < tables.length; i++) {
- if (tables[i].getName().equals(this.table)) {
- columns = tables[i].families().keySet().toArray(new Text[] {});
- }
+ private void dataRetrieval(HTable table, HBaseAdmin admin) {
+ try {
+ if (this.version != 0) {
+ byte[][] result = null;
+ Text[] cols = getColumns(admin);
+ for (int i = 0; i < cols.length; i++) {
+ if (this.timestamp == 0) {
+ result = table.get(this.rowKey, cols[i], this.timestamp, this.version);
+ } else {
+ result = table.get(this.rowKey, cols[i], this.version);
}
- }
- HScannerInterface scan = table.obtainScanner(columns, new Text(""));
- HStoreKey key = new HStoreKey();
- TreeMap results = new TreeMap();
-
- ConsoleTable.selectHead();
- int count = 0;
- while (scan.next(key, results)) {
- Text rowKey = key.getRow();
-
- for (Text columnKey : results.keySet()) {
- byte[] value = results.get(columnKey);
- String cellData = new String(value, HConstants.UTF8_ENCODING);
-
- if (columnKey.equals(HConstants.COL_REGIONINFO)) {
- DataInputBuffer inbuf = new DataInputBuffer();
- HRegionInfo info = new HRegionInfo();
- inbuf.reset(value, value.length);
- info.readFields(inbuf);
-
- cellData = "ID : " + String.valueOf(info.getRegionId());
- }
- ConsoleTable.printLine(count, rowKey.toString(), columnKey.toString(),
- cellData);
- count++;
+ ConsoleTable.selectHead();
+ for (int ii = 0; ii < result.length; ii++) {
+ ConsoleTable.printLine(i, this.rowKey.toString(), cols[i].toString(),
+ new String(result[ii], HConstants.UTF8_ENCODING));
}
- results = new TreeMap();
+ ConsoleTable.selectFoot();
}
- ConsoleTable.selectFoot();
- scan.close();
-
- break;
-
- case 1:
-
- count = 0;
+ } else {
+ int count = 0;
ConsoleTable.selectHead();
- for (Map.Entry entry : table.getRow(new Text(getRow())).entrySet()) {
-
+
+ for (Map.Entry entry : table.getRow(this.rowKey).entrySet()) {
byte[] value = entry.getValue();
String cellData = new String(value, HConstants.UTF8_ENCODING);
@@ -112,138 +104,122 @@
HRegionInfo info = new HRegionInfo();
inbuf.reset(value, value.length);
info.readFields(inbuf);
-
- cellData = "ID : " + String.valueOf(info.getRegionId());
+ cellData = String.valueOf(info.getRegionId());
}
- ConsoleTable.printLine(count, getRow().toString(), entry.getKey().toString(),
- cellData);
- count++;
- }
- ConsoleTable.selectFoot();
- break;
-
- case 2:
-
- Text[] column = new Text[] { new Text(getColumn()) };
-
- HScannerInterface scanner = table.obtainScanner(column, new Text(""));
- HStoreKey k = new HStoreKey();
- TreeMap r = new TreeMap();
-
- ConsoleTable.selectHead();
- count = 0;
- while (scanner.next(k, r)) {
- Text rowKey = k.getRow();
-
- for (Text columnKey : r.keySet()) {
- byte[] value = r.get(columnKey);
- String cellData = new String(value, HConstants.UTF8_ENCODING);
- ConsoleTable.printLine(count, rowKey.toString(), columnKey.toString(),
- cellData);
+ if (columns.contains(entry.getKey().toString()) || columns.contains("*")) {
+ ConsoleTable.printLine(count, this.rowKey.toString(), entry.getKey()
+ .toString(), cellData);
count++;
}
- results = new TreeMap();
}
ConsoleTable.selectFoot();
- scanner.close();
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
- break;
+ private void dataScanning(HTable table, HBaseAdmin admin) {
+ HScannerInterface scan = null;
+ try {
+ if (this.timestamp == 0) {
+ scan = table.obtainScanner(getColumns(admin), this.rowKey);
+ } else {
+ scan = table.obtainScanner(getColumns(admin), this.rowKey, this.timestamp);
+ }
- case 3:
+ HStoreKey key = new HStoreKey();
+ TreeMap results = new TreeMap();
- byte[] rs1 = table.get(new Text(getRow()), new Text(getColumn()));
+ ConsoleTable.selectHead();
+ int count = 0;
- ConsoleTable.selectHead();
- ConsoleTable.printLine(0, getRow(), getColumn(),
- new String(rs1, HConstants.UTF8_ENCODING));
- ConsoleTable.selectFoot();
+ while (scan.next(key, results) && checkLimit(count)) {
+ Text rowKey = key.getRow();
- break;
-
- case 4:
-
- byte[][] rs2 = table.get(new Text(getRow()), new Text(getColumn()), this.limit);
-
- ConsoleTable.selectHead();
- for (int i = 0; i < rs2.length; i++) {
- ConsoleTable.printLine(i, getRow(), getColumn(),
- new String(rs2[i], HConstants.UTF8_ENCODING));
+ for (Text columnKey : results.keySet()) {
+ String cellData = new String(results.get(columnKey), HConstants.UTF8_ENCODING);
+ ConsoleTable.printLine(count, rowKey.toString(), columnKey.toString(), cellData);
}
- ConsoleTable.selectFoot();
+ count++;
+ }
+ ConsoleTable.selectFoot();
+ scan.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
- break;
+ public Text[] getColumns(HBaseAdmin admin) {
+ Text[] cols = null;
- case 5:
-
- byte[][] rs3 = table.get(new Text(getRow()), new Text(getColumn()), getTime(), this.limit);
-
- ConsoleTable.selectHead();
- for (int i = 0; i < rs3.length; i++) {
- ConsoleTable.printLine(i, getRow(), getColumn(), new String(rs3[i], HConstants.UTF8_ENCODING));
+ try {
+ if (this.columns.contains("*")) {
+ HTableDescriptor[] tables = admin.listTables();
+ if (this.tableName.equals(HConstants.ROOT_TABLE_NAME)
+ || this.tableName.equals(HConstants.META_TABLE_NAME)) {
+ cols = HConstants.COLUMN_FAMILY_ARRAY;
+ } else {
+ for (int i = 0; i < tables.length; i++) {
+ if (tables[i].getName().equals(this.tableName)) {
+ cols = tables[i].families().keySet().toArray(new Text[] {});
+ }
+ }
}
- ConsoleTable.selectFoot();
-
- break;
-
+ } else {
+ List tmpList = new ArrayList();
+ for (int i = 0; i < this.columns.size(); i++) {
+ Text column = null;
+ if(this.columns.get(i).contains(":"))
+ column = new Text(this.columns.get(i));
+ else
+ column = new Text(this.columns.get(i) + ":");
+
+ tmpList.add(column);
+ }
+ cols = tmpList.toArray(new Text[] {});
}
-
- return new ReturnMsg(1, "Successfully print out the selected data.");
} catch (IOException e) {
- String[] msg = e.getMessage().split("[,]");
- return new ReturnMsg(0, msg[0]);
+ e.printStackTrace();
}
+ return cols;
}
+ private boolean checkLimit(int count) {
+ return (this.limit == 0)? true: (this.limit > count) ? true : false;
+ }
+
public void setTable(String table) {
- this.table = new Text(table);
+ this.tableName = new Text(table);
}
public void setLimit(int limit) {
this.limit = limit;
}
- public void setCondition(Map> cond) {
- this.condition = cond;
+ public void setWhere(boolean isWhereClause) {
+ if (isWhereClause)
+ this.whereClause = true;
}
- public String getRow() {
- return this.condition.get("row").get(1);
+ public void setTimestamp(String timestamp) {
+ this.timestamp = Long.parseLong(timestamp);
}
- public String getColumn() {
- return this.condition.get("column").get(1);
+ public void setColumns(List columns) {
+ this.columns = columns;
}
- public long getTime() {
- return Long.parseLong(this.condition.get("time").get(1));
+ public void setRowKey(String rowKey) {
+ if(rowKey == null)
+ this.rowKey = null;
+ else
+ this.rowKey = new Text(rowKey);
}
- public int getConditionSize() {
- return this.condition.size();
+ public void setVersion(int version) {
+ this.version = version;
}
-
- public int getCondition() {
- int type = 0;
- if (this.condition == null) {
- type = 0;
- } else if (this.condition.containsKey("row")) {
- if (getConditionSize() == 1) {
- type = 1;
- } else if (this.condition.containsKey("column")) {
- if (getConditionSize() == 2) {
- if (this.limit == 0) {
- type = 3;
- } else {
- type = 4;
- }
- } else {
- type = 5;
- }
- }
- } else if (this.condition.containsKey("column")) {
- type = 2;
- }
- return type;
- }
+
}
Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/ShowCommand.java
===================================================================
--- src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/ShowCommand.java (revision 574788)
+++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/ShowCommand.java (working copy)
@@ -25,6 +25,9 @@
import org.apache.hadoop.hbase.HBaseAdmin;
import org.apache.hadoop.hbase.HTableDescriptor;
+/**
+ * Shows all available tables.
+ */
public class ShowCommand extends BasicCommand {
private String command;
Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/BasicCommand.java
===================================================================
--- src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/BasicCommand.java (revision 574788)
+++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/BasicCommand.java (working copy)
@@ -20,7 +20,7 @@
package org.apache.hadoop.hbase.shell;
/**
- * @see HBaseShell
+ * @see HbaseShell
*/
public abstract class BasicCommand implements Command, CommandFactory {
@@ -33,4 +33,23 @@
return this;
}
+ protected String extractErrMsg(String msg) {
+ int index = msg.indexOf(":");
+ int eofIndex = msg.indexOf("\n");
+ return msg.substring(index + 1, eofIndex);
+ }
+
+ protected String extractErrMsg(Exception e) {
+ return extractErrMsg(e.getMessage());
+ }
+
+ /**
+ * Appends, if it does not exist, a delimiter (colon)
+ * at the end of the column name.
+ */
+ protected String appendDelimiter(String column) {
+ return (!column.endsWith(FAMILY_INDICATOR))?
+ column + FAMILY_INDICATOR: column;
+ }
+
}
Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/HelpManager.java
===================================================================
--- src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/HelpManager.java (revision 574788)
+++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/HelpManager.java (working copy)
@@ -30,7 +30,7 @@
public static final String APP_NAME = "HBase Shell";
/** version of the code */
- public static final String APP_VERSION = "0.0.1";
+ public static final String APP_VERSION = "0.0.2";
/** help contents map */
public static final Map help = new HashMap();
@@ -41,7 +41,6 @@
/** Print out the program version. */
public void printVersion() {
- ClearCommand.clear();
System.out.println(APP_NAME + ", " + APP_VERSION + " version.\n"
+ "Copyright (c) 2007 by udanax, "
+ "licensed to Apache Software Foundation.\n"
@@ -55,6 +54,7 @@
for (Map.Entry helpMap : help.entrySet()) {
wrapping(helpMap.getKey(), helpMap.getValue(), false);
}
+ System.out.println();
} else {
if (help.containsKey(cmd.toUpperCase())) {
String[] msg = help.get(cmd.toUpperCase());
@@ -76,6 +76,6 @@
}
if (example)
- System.out.println("\n>>> " + cmdType[1]);
+ System.out.println("\nSyntax:\n" + cmdType[1] + "\n");
}
}
Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/ClearCommand.java
===================================================================
--- src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/ClearCommand.java (revision 574788)
+++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/ClearCommand.java (working copy)
@@ -23,9 +23,12 @@
import org.apache.hadoop.conf.Configuration;
+/**
+ * Clears the console screen.
+ */
public class ClearCommand extends BasicCommand {
- public ReturnMsg execute(Configuration conf) {
+ public ReturnMsg execute(@SuppressWarnings("unused") Configuration conf) {
clear();
return null;
}
Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/EnableCommand.java
===================================================================
--- src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/EnableCommand.java (revision 0)
+++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/EnableCommand.java (revision 0)
@@ -0,0 +1,51 @@
+/**
+ * Copyright 2007 The Apache Software Foundation
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 at
+ *
+ * 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 org.apache.hadoop.hbase.shell;
+
+import java.io.IOException;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.HBaseAdmin;
+import org.apache.hadoop.io.Text;
+
+/**
+ * Enables tables.
+ */
+public class EnableCommand extends BasicCommand {
+
+ private String tableName;
+
+ public ReturnMsg execute(Configuration conf) {
+ assert tableName != null;
+ try {
+ HBaseAdmin admin = new HBaseAdmin(conf);
+ admin.enableTable(new Text(tableName));
+
+ return new ReturnMsg(1, "Table enabled successfully.");
+ } catch (IOException e) {
+ String[] msg = e.getMessage().split("[\n]");
+ return new ReturnMsg(0, msg[0]);
+ }
+ }
+
+ public void setTable(String table) {
+ this.tableName = table;
+ }
+}
\ No newline at end of file
Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/SchemaModificationCommand.java
===================================================================
--- src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/SchemaModificationCommand.java (revision 0)
+++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/SchemaModificationCommand.java (revision 0)
@@ -0,0 +1,106 @@
+/**
+ * Copyright 2007 The Apache Software Foundation
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 at
+ *
+ * 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 org.apache.hadoop.hbase.shell;
+
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.hadoop.hbase.BloomFilterDescriptor;
+import org.apache.hadoop.hbase.BloomFilterDescriptor.BloomFilterType;
+import org.apache.hadoop.hbase.HColumnDescriptor;
+import org.apache.hadoop.io.Text;
+
+/**
+ * The base class of schema modification commands, CreateCommand and Alter
+ * Command. Provides utility methods for alteration operations.
+ */
+public abstract class SchemaModificationCommand extends BasicCommand {
+
+ private int maxVersions;
+ private int maxLength;
+ private HColumnDescriptor.CompressionType compression;
+ private boolean inMemory;
+ private BloomFilterDescriptor bloomFilterDesc;
+ private BloomFilterType bloomFilterType;
+ private int vectorSize;
+ private int numHash;
+ private int numEntries;
+
+ private void initOptions() {
+ maxVersions = HColumnDescriptor.DEFAULT_N_VERSIONS;
+ maxLength = HColumnDescriptor.DEFAULT_MAX_VALUE_LENGTH;
+ compression = HColumnDescriptor.DEFAULT_COMPRESSION_TYPE;
+ inMemory = HColumnDescriptor.DEFAULT_IN_MEMORY;
+ bloomFilterDesc = HColumnDescriptor.DEFAULT_BLOOM_FILTER_DESCRIPTOR;
+ }
+
+ /**
+ * Given a column name and column spec, returns an instance of
+ * HColumnDescriptor representing the column spec.
+ */
+ protected HColumnDescriptor getColumnDescriptor(String column,
+ Map columnSpec) throws IllegalArgumentException {
+ initOptions();
+
+ Set specs = columnSpec.keySet();
+ for (String spec : specs) {
+ spec = spec.toUpperCase();
+
+ if (spec.equals("MAX_VERSIONS")) {
+ maxVersions = (Integer) columnSpec.get(spec);
+ } else if (spec.equals("MAX_LENGTH")) {
+ maxLength = (Integer) columnSpec.get(spec);
+ } else if (spec.equals("COMPRESSION")) {
+ compression = HColumnDescriptor.CompressionType
+ .valueOf(((String) columnSpec.get(spec)).toUpperCase());
+ } else if (spec.equals("IN_MEMORY")) {
+ inMemory = (Boolean) columnSpec.get(spec);
+ } else if (spec.equals("BLOOMFILTER")) {
+ bloomFilterType = BloomFilterType.valueOf(((String) columnSpec
+ .get(spec)).toUpperCase());
+ } else if (spec.equals("VECTOR_SIZE")) {
+ vectorSize = (Integer) columnSpec.get(spec);
+ } else if (spec.equals("NUM_HASH")) {
+ numHash = (Integer) columnSpec.get(spec);
+ } else if (spec.equals("NUM_ENTRIES")) {
+ numEntries = (Integer) columnSpec.get(spec);
+ } else {
+ throw new IllegalArgumentException("Invalid option: " + spec);
+ }
+ }
+
+ // Now we gather all the specified options for this column.
+ if (bloomFilterType != null) {
+ if (specs.contains("NUM_ENTRIES")) {
+ bloomFilterDesc = new BloomFilterDescriptor(bloomFilterType, numEntries);
+ } else {
+ bloomFilterDesc = new BloomFilterDescriptor(bloomFilterType,
+ vectorSize, numHash);
+ }
+ }
+
+ column = appendDelimiter(column);
+
+ HColumnDescriptor columnDesc = new HColumnDescriptor(new Text(column),
+ maxVersions, compression, inMemory, maxLength, bloomFilterDesc);
+
+ return columnDesc;
+ }
+}
\ No newline at end of file
Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/ReturnMsg.java
===================================================================
--- src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/ReturnMsg.java (revision 574788)
+++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/ReturnMsg.java (working copy)
@@ -19,6 +19,10 @@
*/
package org.apache.hadoop.hbase.shell;
+/**
+ * Message returned when a {@link Command} is
+ * {@link Command#execute(org.apache.hadoop.conf.Configuration)}'ed.
+ */
public class ReturnMsg {
private String msg;
Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/HelpCommand.java
===================================================================
--- src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/HelpCommand.java (revision 574788)
+++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/HelpCommand.java (working copy)
@@ -25,7 +25,7 @@
private String argument;
- public ReturnMsg execute(Configuration conf) {
+ public ReturnMsg execute(@SuppressWarnings("unused") Configuration conf) {
HelpManager.printHelp(this.argument);
return null;
}
Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/HBaseShell.jj
===================================================================
--- src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/HBaseShell.jj (revision 574788)
+++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/HBaseShell.jj (working copy)
@@ -4,6 +4,8 @@
}
PARSER_BEGIN(Parser)
+package org.apache.hadoop.hbase.shell.generated;
+
/**
* Copyright 2007 The Apache Software Foundation
*
@@ -23,7 +25,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.hadoop.hbase.shell.generated;
import java.util.ArrayList;
import java.util.List;
@@ -60,43 +61,72 @@
| "\n"
}
-TOKEN:
+TOKEN: /** for HQL statements */
{
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- | ">
- |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ | ">
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
}
-TOKEN :
+TOKEN : /** Literals */
{
-
- |
- |
- |
+
+ |
+ | )?
+ | "." (["0"-"9"])+ ()?
+ | (["0"-"9"])+
+ | (["0"-"9"])+ ()?
+ >
+ | <#EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+ >
+ |
|
}
@@ -120,17 +150,20 @@
}
{
(
- cmd = exitCommand()
- | cmd = helpCommand()
- | cmd = showCommand()
- | cmd = descCommand()
- | cmd = createCommand()
- | cmd = dropCommand()
- | cmd = insertCommand()
- | cmd = deleteCommand()
- | cmd = selectCommand()
- | cmd = clearCommand()
- | cmd = fsCommand()
+ cmd = exitCommand()
+ | cmd = helpCommand()
+ | cmd = showCommand()
+ | cmd = descCommand()
+ | cmd = createCommand()
+ | cmd = dropCommand()
+ | cmd = alterCommand()
+ | cmd = insertCommand()
+ | cmd = deleteCommand()
+ | cmd = selectCommand()
+ | cmd = enableCommand()
+ | cmd = disableCommand()
+ | cmd = clearCommand()
+ | cmd = fsCommand()
)
{
return cmd;
@@ -182,6 +215,7 @@
| t=
| t=
| t=