HADOOP-2240 Truncate for hbase
git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk/src/contrib/hbase@609254 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
3f4e2cd235
commit
56fa3392a1
|
@ -20,6 +20,7 @@ Trunk (unreleased changes)
|
|||
(Bryan Duxbury via Stack)
|
||||
HADOOP-2395 Implement "ALTER TABLE ... CHANGE column" operation
|
||||
(Bryan Duxbury via Stack)
|
||||
HADOOP-2240 Truncate for hbase (Edward Yoon via Stack)
|
||||
|
||||
OPTIMIZATIONS
|
||||
HADOOP-2479 Save on number of Text object creations
|
||||
|
|
|
@ -48,6 +48,7 @@ public class Shell {
|
|||
public static String MASTER_ADDRESS = null;
|
||||
public static String HTML_OPTION = null;
|
||||
public static int RELAUNCH_FLAG = 7;
|
||||
public static int EXIT_FLAG = 9999;
|
||||
|
||||
/** Return the boolean value indicating whether end of command or not */
|
||||
static boolean isEndOfCommand(String line) {
|
||||
|
|
|
@ -53,6 +53,7 @@ public class AlterCommand extends SchemaModificationCommand {
|
|||
super(o);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public ReturnMsg execute(HBaseConfiguration conf) {
|
||||
try {
|
||||
HConnection conn = HConnectionManager.getConnection(conf);
|
||||
|
@ -76,8 +77,7 @@ public class AlterCommand extends SchemaModificationCommand {
|
|||
break;
|
||||
case DROP:
|
||||
disableTable(admin, tableName);
|
||||
println("Dropping " + column + " from " + tableName
|
||||
+ "... Please wait.");
|
||||
println("Dropping " + column + " from " + tableName + "... Please wait.");
|
||||
column = appendDelimiter(column);
|
||||
admin.deleteColumn(new Text(tableName), new Text(column));
|
||||
enableTable(admin, tableName);
|
||||
|
@ -85,12 +85,13 @@ public class AlterCommand extends SchemaModificationCommand {
|
|||
case CHANGE:
|
||||
disableTable(admin, tableName);
|
||||
|
||||
Map.Entry<String, Map<String, Object>> columnEntry =
|
||||
(Map.Entry<String, Map<String, Object>>)columnSpecMap.entrySet().toArray()[0];
|
||||
Map.Entry<String, Map<String, Object>> columnEntry = (Map.Entry<String, Map<String, Object>>) columnSpecMap
|
||||
.entrySet().toArray()[0];
|
||||
|
||||
// add the : if there isn't one
|
||||
Text columnName = new Text(columnEntry.getKey().endsWith(":") ?
|
||||
columnEntry.getKey() : columnEntry.getKey() + ":");
|
||||
Text columnName = new Text(
|
||||
columnEntry.getKey().endsWith(":") ? columnEntry.getKey()
|
||||
: columnEntry.getKey() + ":");
|
||||
|
||||
// get the table descriptor so we can get the old column descriptor
|
||||
HTableDescriptor tDesc = getTableDescByName(admin, tableName);
|
||||
|
@ -98,8 +99,8 @@ public class AlterCommand extends SchemaModificationCommand {
|
|||
|
||||
// combine the options specified in the shell with the options
|
||||
// from the exiting descriptor to produce the new descriptor
|
||||
columnDesc = getColumnDescriptor(columnName.toString(),
|
||||
columnEntry.getValue(), oldColumnDesc);
|
||||
columnDesc = getColumnDescriptor(columnName.toString(), columnEntry
|
||||
.getValue(), oldColumnDesc);
|
||||
|
||||
// send the changes out to the master
|
||||
admin.modifyColumn(new Text(tableName), columnName, columnDesc);
|
||||
|
@ -168,9 +169,9 @@ public class AlterCommand extends SchemaModificationCommand {
|
|||
}
|
||||
|
||||
private HTableDescriptor getTableDescByName(HBaseAdmin admin, String tableName)
|
||||
throws IOException{
|
||||
throws IOException {
|
||||
HTableDescriptor[] tables = admin.listTables();
|
||||
for(HTableDescriptor tDesc : tables){
|
||||
for (HTableDescriptor tDesc : tables) {
|
||||
if (tDesc.getName().toString().equals(tableName)) {
|
||||
return tDesc;
|
||||
}
|
||||
|
@ -197,8 +198,8 @@ public class AlterCommand extends SchemaModificationCommand {
|
|||
} 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());
|
||||
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")) {
|
||||
|
@ -244,6 +245,4 @@ public class AlterCommand extends SchemaModificationCommand {
|
|||
inMemory = original.isInMemory();
|
||||
bloomFilterDesc = original.getBloomFilter();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -79,6 +79,7 @@ TOKEN: /** for HQL statements */
|
|||
| <DESC: "desc">
|
||||
| <CREATE: "create">
|
||||
| <DROP: "drop">
|
||||
| <TRUNCATE: "truncate">
|
||||
| <FS: "fs">
|
||||
| <JAR: "jar">
|
||||
| <EXIT: "exit">
|
||||
|
@ -171,6 +172,7 @@ Command cmdStatement() :
|
|||
| cmd = descCommand()
|
||||
| cmd = createCommand()
|
||||
| cmd = dropCommand()
|
||||
| cmd = truncateCommand()
|
||||
| cmd = alterCommand()
|
||||
| cmd = insertCommand()
|
||||
| cmd = deleteCommand()
|
||||
|
@ -218,17 +220,9 @@ JarCommand jarCommand() :
|
|||
Token t = null;
|
||||
JarCommand jar = new JarCommand(this.out);
|
||||
List<String> query = new ArrayList<String>();
|
||||
String path = "";
|
||||
}
|
||||
{
|
||||
<JAR>
|
||||
(
|
||||
( t=<ID> | t=<INTEGER_LITERAL> | t=<FLOATING_POINT_LITERAL> )
|
||||
{ path += t.image.toString(); }
|
||||
)*
|
||||
t=<JAR>
|
||||
{ query.add(path + t.image.toString()); }
|
||||
|
||||
(
|
||||
( t=<ID> | t=<INTEGER_LITERAL> | t=<FLOATING_POINT_LITERAL> )
|
||||
{ query.add(t.image.toString()); }
|
||||
|
@ -240,6 +234,22 @@ JarCommand jarCommand() :
|
|||
}
|
||||
}
|
||||
|
||||
TruncateCommand truncateCommand() :
|
||||
{
|
||||
TruncateCommand truncate = new TruncateCommand(this.out);
|
||||
String tableName = null;
|
||||
}
|
||||
{
|
||||
<TRUNCATE><TABLE>
|
||||
[
|
||||
tableName = identifier()
|
||||
]
|
||||
{
|
||||
truncate.setTableName(tableName);
|
||||
return truncate;
|
||||
}
|
||||
}
|
||||
|
||||
HelpCommand helpCommand() :
|
||||
{
|
||||
Token t = null;
|
||||
|
@ -311,7 +321,7 @@ Map<String, Object> ColumnSpec() :
|
|||
{
|
||||
(
|
||||
<MAX_VERSIONS>
|
||||
<EQUALS> n = Number()
|
||||
<EQUALS> n = number()
|
||||
{
|
||||
if(n < 0) {
|
||||
n = Integer.MAX_VALUE;
|
||||
|
@ -320,7 +330,7 @@ Map<String, Object> ColumnSpec() :
|
|||
}
|
||||
|
|
||||
<MAX_LENGTH>
|
||||
<EQUALS> n = Number()
|
||||
<EQUALS> n = number()
|
||||
{
|
||||
columnSpec.put("MAX_LENGTH", n);
|
||||
}
|
||||
|
@ -350,18 +360,18 @@ Map<String, Object> ColumnSpec() :
|
|||
}
|
||||
|
|
||||
<VECTOR_SIZE>
|
||||
<EQUALS> n = Number()
|
||||
<EQUALS> n = number()
|
||||
{
|
||||
columnSpec.put("VECTOR_SIZE", n);
|
||||
}
|
||||
|
|
||||
<NUM_HASH>
|
||||
<EQUALS> n = Number()
|
||||
<EQUALS> n = number()
|
||||
{
|
||||
columnSpec.put("NUM_HASH", n);
|
||||
}
|
||||
|
|
||||
<NUM_ENTRIES> <EQUALS> n = Number()
|
||||
<NUM_ENTRIES> <EQUALS> n = number()
|
||||
{
|
||||
columnSpec.put("NUM_ENTRIES", n);
|
||||
}
|
||||
|
@ -581,13 +591,13 @@ SelectCommand selectCommand() :
|
|||
]
|
||||
|
||||
[
|
||||
<NUM_VERSIONS><EQUALS> numVersion = Number()
|
||||
<NUM_VERSIONS><EQUALS> numVersion = number()
|
||||
{
|
||||
select.setVersion(numVersion);
|
||||
}
|
||||
]
|
||||
|
||||
[ <LIMIT><EQUALS> limit = Number() {
|
||||
[ <LIMIT><EQUALS> limit = number() {
|
||||
try{
|
||||
select.setLimit(limit);
|
||||
}catch(ClassCastException ce) {
|
||||
|
@ -746,7 +756,7 @@ List<String> columnList() :
|
|||
{ return columnList; }
|
||||
}
|
||||
|
||||
int Number() :
|
||||
int number() :
|
||||
{
|
||||
Token t = null;
|
||||
Token minusSignedInt = null;
|
||||
|
|
|
@ -119,6 +119,10 @@ public class HelpCommand extends BasicCommand {
|
|||
+ "CHANGE column_family column_spec | "
|
||||
+ "DROP column_family_name | " + "CHANGE column_spec;" });
|
||||
|
||||
load.put("TRUNCATE", new String[] {
|
||||
"Truncate table is used to clean all data from a table",
|
||||
"TRUNCATE TABLE table_name;" });
|
||||
|
||||
load.put("EXIT", new String[] { "Exit shell", "EXIT;" });
|
||||
|
||||
return load;
|
||||
|
|
|
@ -43,7 +43,7 @@ public class ShellSecurityManager extends SecurityManager {
|
|||
*/
|
||||
@SuppressWarnings("static-access")
|
||||
public void checkExit(int status) {
|
||||
if (status != 9999) {
|
||||
if (status != Shell.EXIT_FLAG) {
|
||||
// throw new ExitException(status);
|
||||
|
||||
// I didn't figure out How can catch the ExitException in shell main.
|
||||
|
|
|
@ -21,7 +21,6 @@ package org.apache.hadoop.hbase.shell;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.hadoop.hbase.HBaseAdmin;
|
||||
import org.apache.hadoop.hbase.HBaseConfiguration;
|
||||
|
|
|
@ -67,6 +67,7 @@ public class Parser implements ParserConstants {
|
|||
case DESC:
|
||||
case CREATE:
|
||||
case DROP:
|
||||
case TRUNCATE:
|
||||
case FS:
|
||||
case JAR:
|
||||
case EXIT:
|
||||
|
@ -75,7 +76,7 @@ public class Parser implements ParserConstants {
|
|||
case SELECT:
|
||||
case ENABLE:
|
||||
case DISABLE:
|
||||
case 65:
|
||||
case 66:
|
||||
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
|
||||
case HELP:
|
||||
case ALTER:
|
||||
|
@ -85,6 +86,7 @@ public class Parser implements ParserConstants {
|
|||
case DESC:
|
||||
case CREATE:
|
||||
case DROP:
|
||||
case TRUNCATE:
|
||||
case FS:
|
||||
case JAR:
|
||||
case EXIT:
|
||||
|
@ -99,7 +101,7 @@ public class Parser implements ParserConstants {
|
|||
jj_la1[0] = jj_gen;
|
||||
;
|
||||
}
|
||||
jj_consume_token(65);
|
||||
jj_consume_token(66);
|
||||
break;
|
||||
case 0:
|
||||
jj_consume_token(0);
|
||||
|
@ -135,6 +137,9 @@ public class Parser implements ParserConstants {
|
|||
case DROP:
|
||||
cmd = dropCommand();
|
||||
break;
|
||||
case TRUNCATE:
|
||||
cmd = truncateCommand();
|
||||
break;
|
||||
case ALTER:
|
||||
cmd = alterCommand();
|
||||
break;
|
||||
|
@ -205,7 +210,6 @@ public class Parser implements ParserConstants {
|
|||
Token t = null;
|
||||
JarCommand jar = new JarCommand(this.out);
|
||||
List<String> query = new ArrayList<String>();
|
||||
String path = "";
|
||||
jj_consume_token(JAR);
|
||||
label_2:
|
||||
while (true) {
|
||||
|
@ -233,37 +237,6 @@ public class Parser implements ParserConstants {
|
|||
jj_la1[5] = jj_gen;
|
||||
jj_consume_token(-1);
|
||||
throw new ParseException();
|
||||
}
|
||||
path += t.image.toString();
|
||||
}
|
||||
t = jj_consume_token(JAR);
|
||||
query.add(path + t.image.toString());
|
||||
label_3:
|
||||
while (true) {
|
||||
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
|
||||
case ID:
|
||||
case INTEGER_LITERAL:
|
||||
case FLOATING_POINT_LITERAL:
|
||||
;
|
||||
break;
|
||||
default:
|
||||
jj_la1[6] = jj_gen;
|
||||
break label_3;
|
||||
}
|
||||
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
|
||||
case ID:
|
||||
t = jj_consume_token(ID);
|
||||
break;
|
||||
case INTEGER_LITERAL:
|
||||
t = jj_consume_token(INTEGER_LITERAL);
|
||||
break;
|
||||
case FLOATING_POINT_LITERAL:
|
||||
t = jj_consume_token(FLOATING_POINT_LITERAL);
|
||||
break;
|
||||
default:
|
||||
jj_la1[7] = jj_gen;
|
||||
jj_consume_token(-1);
|
||||
throw new ParseException();
|
||||
}
|
||||
query.add(t.image.toString());
|
||||
}
|
||||
|
@ -272,6 +245,26 @@ public class Parser implements ParserConstants {
|
|||
throw new Error("Missing return statement in function");
|
||||
}
|
||||
|
||||
final public TruncateCommand truncateCommand() throws ParseException {
|
||||
TruncateCommand truncate = new TruncateCommand(this.out);
|
||||
String tableName = null;
|
||||
jj_consume_token(TRUNCATE);
|
||||
jj_consume_token(TABLE);
|
||||
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
|
||||
case ID:
|
||||
case QUOTED_IDENTIFIER:
|
||||
case STRING_LITERAL:
|
||||
tableName = identifier();
|
||||
break;
|
||||
default:
|
||||
jj_la1[6] = jj_gen;
|
||||
;
|
||||
}
|
||||
truncate.setTableName(tableName);
|
||||
{if (true) return truncate;}
|
||||
throw new Error("Missing return statement in function");
|
||||
}
|
||||
|
||||
final public HelpCommand helpCommand() throws ParseException {
|
||||
Token t = null;
|
||||
HelpCommand help = new HelpCommand(this.out, this.formatter);
|
||||
|
@ -332,14 +325,14 @@ public class Parser implements ParserConstants {
|
|||
t = jj_consume_token(ID);
|
||||
break;
|
||||
default:
|
||||
jj_la1[8] = jj_gen;
|
||||
jj_la1[7] = jj_gen;
|
||||
jj_consume_token(-1);
|
||||
throw new ParseException();
|
||||
}
|
||||
argument = t.image.toString();
|
||||
break;
|
||||
default:
|
||||
jj_la1[9] = jj_gen;
|
||||
jj_la1[8] = jj_gen;
|
||||
;
|
||||
}
|
||||
help.setArgument(argument);
|
||||
|
@ -358,7 +351,7 @@ public class Parser implements ParserConstants {
|
|||
argument = identifier();
|
||||
break;
|
||||
default:
|
||||
jj_la1[10] = jj_gen;
|
||||
jj_la1[9] = jj_gen;
|
||||
;
|
||||
}
|
||||
show.setArgument(argument);
|
||||
|
@ -377,7 +370,7 @@ public class Parser implements ParserConstants {
|
|||
jj_consume_token(DESC);
|
||||
break;
|
||||
default:
|
||||
jj_la1[11] = jj_gen;
|
||||
jj_la1[10] = jj_gen;
|
||||
jj_consume_token(-1);
|
||||
throw new ParseException();
|
||||
}
|
||||
|
@ -391,7 +384,7 @@ public class Parser implements ParserConstants {
|
|||
Map<String, Object> columnSpec = new HashMap<String, Object>();
|
||||
int n = -1;
|
||||
Token t = null;
|
||||
label_4:
|
||||
label_3:
|
||||
while (true) {
|
||||
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
|
||||
case MAX_VERSIONS:
|
||||
|
@ -405,14 +398,14 @@ public class Parser implements ParserConstants {
|
|||
;
|
||||
break;
|
||||
default:
|
||||
jj_la1[12] = jj_gen;
|
||||
break label_4;
|
||||
jj_la1[11] = jj_gen;
|
||||
break label_3;
|
||||
}
|
||||
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
|
||||
case MAX_VERSIONS:
|
||||
jj_consume_token(MAX_VERSIONS);
|
||||
jj_consume_token(EQUALS);
|
||||
n = Number();
|
||||
n = number();
|
||||
if(n < 0) {
|
||||
n = Integer.MAX_VALUE;
|
||||
}
|
||||
|
@ -421,7 +414,7 @@ public class Parser implements ParserConstants {
|
|||
case MAX_LENGTH:
|
||||
jj_consume_token(MAX_LENGTH);
|
||||
jj_consume_token(EQUALS);
|
||||
n = Number();
|
||||
n = number();
|
||||
columnSpec.put("MAX_LENGTH", n);
|
||||
break;
|
||||
case COMPRESSION:
|
||||
|
@ -438,7 +431,7 @@ public class Parser implements ParserConstants {
|
|||
t = jj_consume_token(RECORD);
|
||||
break;
|
||||
default:
|
||||
jj_la1[13] = jj_gen;
|
||||
jj_la1[12] = jj_gen;
|
||||
jj_consume_token(-1);
|
||||
throw new ParseException();
|
||||
}
|
||||
|
@ -462,7 +455,7 @@ public class Parser implements ParserConstants {
|
|||
t = jj_consume_token(RETOUCHED_BLOOMFILTER);
|
||||
break;
|
||||
default:
|
||||
jj_la1[14] = jj_gen;
|
||||
jj_la1[13] = jj_gen;
|
||||
jj_consume_token(-1);
|
||||
throw new ParseException();
|
||||
}
|
||||
|
@ -471,23 +464,23 @@ public class Parser implements ParserConstants {
|
|||
case VECTOR_SIZE:
|
||||
jj_consume_token(VECTOR_SIZE);
|
||||
jj_consume_token(EQUALS);
|
||||
n = Number();
|
||||
n = number();
|
||||
columnSpec.put("VECTOR_SIZE", n);
|
||||
break;
|
||||
case NUM_HASH:
|
||||
jj_consume_token(NUM_HASH);
|
||||
jj_consume_token(EQUALS);
|
||||
n = Number();
|
||||
n = number();
|
||||
columnSpec.put("NUM_HASH", n);
|
||||
break;
|
||||
case NUM_ENTRIES:
|
||||
jj_consume_token(NUM_ENTRIES);
|
||||
jj_consume_token(EQUALS);
|
||||
n = Number();
|
||||
n = number();
|
||||
columnSpec.put("NUM_ENTRIES", n);
|
||||
break;
|
||||
default:
|
||||
jj_la1[15] = jj_gen;
|
||||
jj_la1[14] = jj_gen;
|
||||
jj_consume_token(-1);
|
||||
throw new ParseException();
|
||||
}
|
||||
|
@ -509,15 +502,15 @@ public class Parser implements ParserConstants {
|
|||
column = identifier();
|
||||
columnSpec = ColumnSpec();
|
||||
createCommand.addColumnSpec(column, columnSpec);
|
||||
label_5:
|
||||
label_4:
|
||||
while (true) {
|
||||
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
|
||||
case COMMA:
|
||||
;
|
||||
break;
|
||||
default:
|
||||
jj_la1[16] = jj_gen;
|
||||
break label_5;
|
||||
jj_la1[15] = jj_gen;
|
||||
break label_4;
|
||||
}
|
||||
jj_consume_token(COMMA);
|
||||
column = identifier();
|
||||
|
@ -553,15 +546,15 @@ public class Parser implements ParserConstants {
|
|||
column = identifier();
|
||||
columnSpec = ColumnSpec();
|
||||
alterCommand.addColumnSpec(column, columnSpec);
|
||||
label_6:
|
||||
label_5:
|
||||
while (true) {
|
||||
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
|
||||
case COMMA:
|
||||
;
|
||||
break;
|
||||
default:
|
||||
jj_la1[17] = jj_gen;
|
||||
break label_6;
|
||||
jj_la1[16] = jj_gen;
|
||||
break label_5;
|
||||
}
|
||||
jj_consume_token(COMMA);
|
||||
column = identifier();
|
||||
|
@ -584,7 +577,7 @@ public class Parser implements ParserConstants {
|
|||
alterCommand.addColumnSpec(column, columnSpec);
|
||||
break;
|
||||
default:
|
||||
jj_la1[18] = jj_gen;
|
||||
jj_la1[17] = jj_gen;
|
||||
jj_consume_token(-1);
|
||||
throw new ParseException();
|
||||
}
|
||||
|
@ -630,7 +623,7 @@ public class Parser implements ParserConstants {
|
|||
t = jj_consume_token(QUOTED_IDENTIFIER);
|
||||
break;
|
||||
default:
|
||||
jj_la1[19] = jj_gen;
|
||||
jj_la1[18] = jj_gen;
|
||||
jj_consume_token(-1);
|
||||
throw new ParseException();
|
||||
}
|
||||
|
@ -663,14 +656,14 @@ public class Parser implements ParserConstants {
|
|||
t = jj_consume_token(QUOTED_IDENTIFIER);
|
||||
break;
|
||||
default:
|
||||
jj_la1[20] = jj_gen;
|
||||
jj_la1[19] = jj_gen;
|
||||
jj_consume_token(-1);
|
||||
throw new ParseException();
|
||||
}
|
||||
deleteCommand.setRow(t.image.substring(1, t.image.length()-1));
|
||||
break;
|
||||
default:
|
||||
jj_la1[21] = jj_gen;
|
||||
jj_la1[20] = jj_gen;
|
||||
;
|
||||
}
|
||||
{if (true) return deleteCommand;}
|
||||
|
@ -706,7 +699,7 @@ public class Parser implements ParserConstants {
|
|||
jj_consume_token(FROM);
|
||||
break;
|
||||
default:
|
||||
jj_la1[22] = jj_gen;
|
||||
jj_la1[21] = jj_gen;
|
||||
jj_consume_token(-1);
|
||||
throw new ParseException();
|
||||
}
|
||||
|
@ -714,7 +707,7 @@ public class Parser implements ParserConstants {
|
|||
select.setRowKey(rowKey);
|
||||
break;
|
||||
default:
|
||||
jj_la1[23] = jj_gen;
|
||||
jj_la1[22] = jj_gen;
|
||||
;
|
||||
}
|
||||
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
|
||||
|
@ -724,25 +717,25 @@ public class Parser implements ParserConstants {
|
|||
select.setTimestamp(timestamp);
|
||||
break;
|
||||
default:
|
||||
jj_la1[24] = jj_gen;
|
||||
jj_la1[23] = jj_gen;
|
||||
;
|
||||
}
|
||||
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
|
||||
case NUM_VERSIONS:
|
||||
jj_consume_token(NUM_VERSIONS);
|
||||
jj_consume_token(EQUALS);
|
||||
numVersion = Number();
|
||||
numVersion = number();
|
||||
select.setVersion(numVersion);
|
||||
break;
|
||||
default:
|
||||
jj_la1[25] = jj_gen;
|
||||
jj_la1[24] = jj_gen;
|
||||
;
|
||||
}
|
||||
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
|
||||
case LIMIT:
|
||||
jj_consume_token(LIMIT);
|
||||
jj_consume_token(EQUALS);
|
||||
limit = Number();
|
||||
limit = number();
|
||||
try{
|
||||
select.setLimit(limit);
|
||||
}catch(ClassCastException ce) {
|
||||
|
@ -750,7 +743,7 @@ public class Parser implements ParserConstants {
|
|||
}
|
||||
break;
|
||||
default:
|
||||
jj_la1[26] = jj_gen;
|
||||
jj_la1[25] = jj_gen;
|
||||
;
|
||||
}
|
||||
{if (true) return select;}
|
||||
|
@ -790,7 +783,7 @@ public class Parser implements ParserConstants {
|
|||
jj_consume_token(LPAREN);
|
||||
literal = getStringLiteral();
|
||||
if(literal != null) values.add(literal);
|
||||
label_7:
|
||||
label_6:
|
||||
while (true) {
|
||||
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
|
||||
case COMMA:
|
||||
|
@ -800,8 +793,8 @@ public class Parser implements ParserConstants {
|
|||
;
|
||||
break;
|
||||
default:
|
||||
jj_la1[27] = jj_gen;
|
||||
break label_7;
|
||||
jj_la1[26] = jj_gen;
|
||||
break label_6;
|
||||
}
|
||||
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
|
||||
case COMMA:
|
||||
|
@ -823,14 +816,14 @@ public class Parser implements ParserConstants {
|
|||
jj_consume_token(QUOTED_IDENTIFIER);
|
||||
break;
|
||||
default:
|
||||
jj_la1[28] = jj_gen;
|
||||
jj_la1[27] = jj_gen;
|
||||
jj_consume_token(-1);
|
||||
throw new ParseException();
|
||||
}
|
||||
values.removeAll(values);
|
||||
break;
|
||||
default:
|
||||
jj_la1[29] = jj_gen;
|
||||
jj_la1[28] = jj_gen;
|
||||
jj_consume_token(-1);
|
||||
throw new ParseException();
|
||||
}
|
||||
|
@ -850,7 +843,7 @@ public class Parser implements ParserConstants {
|
|||
s = jj_consume_token(QUOTED_IDENTIFIER);
|
||||
break;
|
||||
default:
|
||||
jj_la1[30] = jj_gen;
|
||||
jj_la1[29] = jj_gen;
|
||||
jj_consume_token(-1);
|
||||
throw new ParseException();
|
||||
}
|
||||
|
@ -876,7 +869,7 @@ public class Parser implements ParserConstants {
|
|||
col = jj_consume_token(ASTERISK);
|
||||
break;
|
||||
default:
|
||||
jj_la1[31] = jj_gen;
|
||||
jj_la1[30] = jj_gen;
|
||||
jj_consume_token(-1);
|
||||
throw new ParseException();
|
||||
}
|
||||
|
@ -892,14 +885,14 @@ public class Parser implements ParserConstants {
|
|||
col = jj_consume_token(STRING_LITERAL);
|
||||
break;
|
||||
default:
|
||||
jj_la1[32] = jj_gen;
|
||||
jj_la1[31] = jj_gen;
|
||||
jj_consume_token(-1);
|
||||
throw new ParseException();
|
||||
}
|
||||
{if (true) return col.image.substring(1,col.image.toString().length() - 1);}
|
||||
break;
|
||||
default:
|
||||
jj_la1[33] = jj_gen;
|
||||
jj_la1[32] = jj_gen;
|
||||
jj_consume_token(-1);
|
||||
throw new ParseException();
|
||||
}
|
||||
|
@ -912,15 +905,15 @@ public class Parser implements ParserConstants {
|
|||
jj_consume_token(LPAREN);
|
||||
literal = getColumn();
|
||||
if(literal != null) values.add(literal);
|
||||
label_8:
|
||||
label_7:
|
||||
while (true) {
|
||||
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
|
||||
case COMMA:
|
||||
;
|
||||
break;
|
||||
default:
|
||||
jj_la1[34] = jj_gen;
|
||||
break label_8;
|
||||
jj_la1[33] = jj_gen;
|
||||
break label_7;
|
||||
}
|
||||
jj_consume_token(COMMA);
|
||||
literal = getColumn();
|
||||
|
@ -936,15 +929,15 @@ public class Parser implements ParserConstants {
|
|||
String table = null;
|
||||
table = identifier();
|
||||
tableList.add(table);
|
||||
label_9:
|
||||
label_8:
|
||||
while (true) {
|
||||
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
|
||||
case COMMA:
|
||||
;
|
||||
break;
|
||||
default:
|
||||
jj_la1[35] = jj_gen;
|
||||
break label_9;
|
||||
jj_la1[34] = jj_gen;
|
||||
break label_8;
|
||||
}
|
||||
jj_consume_token(COMMA);
|
||||
table = identifier();
|
||||
|
@ -963,15 +956,15 @@ public class Parser implements ParserConstants {
|
|||
} else {
|
||||
{if (true) return columnList;}
|
||||
}
|
||||
label_10:
|
||||
label_9:
|
||||
while (true) {
|
||||
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
|
||||
case COMMA:
|
||||
;
|
||||
break;
|
||||
default:
|
||||
jj_la1[36] = jj_gen;
|
||||
break label_10;
|
||||
jj_la1[35] = jj_gen;
|
||||
break label_9;
|
||||
}
|
||||
jj_consume_token(COMMA);
|
||||
column = getColumn();
|
||||
|
@ -981,7 +974,7 @@ public class Parser implements ParserConstants {
|
|||
throw new Error("Missing return statement in function");
|
||||
}
|
||||
|
||||
final public int Number() throws ParseException {
|
||||
final public int number() throws ParseException {
|
||||
Token t = null;
|
||||
Token minusSignedInt = null;
|
||||
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
|
||||
|
@ -992,7 +985,7 @@ public class Parser implements ParserConstants {
|
|||
t = jj_consume_token(INTEGER_LITERAL);
|
||||
break;
|
||||
default:
|
||||
jj_la1[37] = jj_gen;
|
||||
jj_la1[36] = jj_gen;
|
||||
jj_consume_token(-1);
|
||||
throw new ParseException();
|
||||
}
|
||||
|
@ -1021,14 +1014,14 @@ public class Parser implements ParserConstants {
|
|||
t = jj_consume_token(STRING_LITERAL);
|
||||
break;
|
||||
default:
|
||||
jj_la1[38] = jj_gen;
|
||||
jj_la1[37] = 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[39] = jj_gen;
|
||||
jj_la1[38] = jj_gen;
|
||||
jj_consume_token(-1);
|
||||
throw new ParseException();
|
||||
}
|
||||
|
@ -1049,33 +1042,33 @@ public class Parser implements ParserConstants {
|
|||
finally { jj_save(0, xla); }
|
||||
}
|
||||
|
||||
final private boolean jj_3R_13() {
|
||||
final private boolean jj_3R_12() {
|
||||
Token xsp;
|
||||
xsp = jj_scanpos;
|
||||
if (jj_scan_token(63)) {
|
||||
if (jj_scan_token(64)) {
|
||||
jj_scanpos = xsp;
|
||||
if (jj_scan_token(64)) return true;
|
||||
if (jj_scan_token(65)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
final private boolean jj_3_1() {
|
||||
if (jj_scan_token(ADD)) return true;
|
||||
if (jj_3R_11()) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
final private boolean jj_3R_12() {
|
||||
if (jj_scan_token(ID)) return true;
|
||||
if (jj_3R_10()) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
final private boolean jj_3R_11() {
|
||||
if (jj_scan_token(ID)) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
final private boolean jj_3R_10() {
|
||||
Token xsp;
|
||||
xsp = jj_scanpos;
|
||||
if (jj_3R_12()) {
|
||||
if (jj_3R_11()) {
|
||||
jj_scanpos = xsp;
|
||||
if (jj_3R_13()) return true;
|
||||
if (jj_3R_12()) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -1089,7 +1082,7 @@ public class Parser implements ParserConstants {
|
|||
public boolean lookingAhead = false;
|
||||
private boolean jj_semLA;
|
||||
private int jj_gen;
|
||||
final private int[] jj_la1 = new int[40];
|
||||
final private int[] jj_la1 = new int[39];
|
||||
static private int[] jj_la1_0;
|
||||
static private int[] jj_la1_1;
|
||||
static private int[] jj_la1_2;
|
||||
|
@ -1099,13 +1092,13 @@ public class Parser implements ParserConstants {
|
|||
jj_la1_2();
|
||||
}
|
||||
private static void jj_la1_0() {
|
||||
jj_la1_0 = new int[] {0x79ffe0,0x79ffe1,0x79ffe0,0x0,0x0,0x0,0x0,0x0,0x19fbc0,0x19fbc0,0x0,0x600,0x0,0x0,0x0,0x0,0x0,0x0,0x1000,0x0,0x0,0x1000000,0x1800000,0x1800000,0x20000000,0x40000000,0x80000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,};
|
||||
jj_la1_0 = new int[] {0xf3ffe0,0xf3ffe1,0xf3ffe0,0x0,0x0,0x0,0x0,0x33dbc0,0x33dbc0,0x0,0x600,0x0,0x0,0x0,0x0,0x0,0x0,0x1000,0x0,0x0,0x2000000,0x3000000,0x3000000,0x40000000,0x80000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,};
|
||||
}
|
||||
private static void jj_la1_1() {
|
||||
jj_la1_1 = new int[] {0x0,0x0,0x0,0x8000000,0x38000000,0x38000000,0x38000000,0x38000000,0x8000000,0x8000000,0x88000000,0x0,0x1cc7000,0x38000,0x380000,0x1cc7000,0x4,0x4,0x6000000,0x80000000,0x80000000,0x0,0x0,0x0,0x0,0x0,0x0,0x88000004,0x88000000,0x88000004,0x80000000,0x18000800,0x80000000,0x98000800,0x4,0x4,0x4,0x18000000,0x80000000,0x88000000,};
|
||||
jj_la1_1 = new int[] {0x0,0x0,0x0,0x10000000,0x70000000,0x70000000,0x10000000,0x10000000,0x10000000,0x10000000,0x0,0x398e000,0x70000,0x700000,0x398e000,0x8,0x8,0xc000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x10000008,0x10000000,0x10000008,0x0,0x30001000,0x0,0x30001000,0x8,0x8,0x8,0x30000000,0x0,0x10000000,};
|
||||
}
|
||||
private static void jj_la1_2() {
|
||||
jj_la1_2 = new int[] {0x0,0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x1,0x1,0x1,0x0,0x1,0x1,0x0,0x0,0x0,0x0,0x1,0x1,};
|
||||
jj_la1_2 = new int[] {0x0,0x4,0x0,0x0,0x0,0x0,0x3,0x0,0x0,0x3,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x3,0x3,0x0,0x0,0x0,0x0,0x0,0x0,0x3,0x3,0x3,0x3,0x0,0x3,0x3,0x0,0x0,0x0,0x0,0x3,0x3,};
|
||||
}
|
||||
final private JJCalls[] jj_2_rtns = new JJCalls[1];
|
||||
private boolean jj_rescan = false;
|
||||
|
@ -1120,7 +1113,7 @@ public class Parser implements ParserConstants {
|
|||
token = new Token();
|
||||
jj_ntk = -1;
|
||||
jj_gen = 0;
|
||||
for (int i = 0; i < 40; i++) jj_la1[i] = -1;
|
||||
for (int i = 0; i < 39; i++) jj_la1[i] = -1;
|
||||
for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
|
||||
}
|
||||
|
||||
|
@ -1133,7 +1126,7 @@ public class Parser implements ParserConstants {
|
|||
token = new Token();
|
||||
jj_ntk = -1;
|
||||
jj_gen = 0;
|
||||
for (int i = 0; i < 40; i++) jj_la1[i] = -1;
|
||||
for (int i = 0; i < 39; i++) jj_la1[i] = -1;
|
||||
for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
|
||||
}
|
||||
|
||||
|
@ -1143,7 +1136,7 @@ public class Parser implements ParserConstants {
|
|||
token = new Token();
|
||||
jj_ntk = -1;
|
||||
jj_gen = 0;
|
||||
for (int i = 0; i < 40; i++) jj_la1[i] = -1;
|
||||
for (int i = 0; i < 39; i++) jj_la1[i] = -1;
|
||||
for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
|
||||
}
|
||||
|
||||
|
@ -1153,7 +1146,7 @@ public class Parser implements ParserConstants {
|
|||
token = new Token();
|
||||
jj_ntk = -1;
|
||||
jj_gen = 0;
|
||||
for (int i = 0; i < 40; i++) jj_la1[i] = -1;
|
||||
for (int i = 0; i < 39; i++) jj_la1[i] = -1;
|
||||
for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
|
||||
}
|
||||
|
||||
|
@ -1162,7 +1155,7 @@ public class Parser implements ParserConstants {
|
|||
token = new Token();
|
||||
jj_ntk = -1;
|
||||
jj_gen = 0;
|
||||
for (int i = 0; i < 40; i++) jj_la1[i] = -1;
|
||||
for (int i = 0; i < 39; i++) jj_la1[i] = -1;
|
||||
for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
|
||||
}
|
||||
|
||||
|
@ -1171,7 +1164,7 @@ public class Parser implements ParserConstants {
|
|||
token = new Token();
|
||||
jj_ntk = -1;
|
||||
jj_gen = 0;
|
||||
for (int i = 0; i < 40; i++) jj_la1[i] = -1;
|
||||
for (int i = 0; i < 39; i++) jj_la1[i] = -1;
|
||||
for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
|
||||
}
|
||||
|
||||
|
@ -1282,15 +1275,15 @@ public class Parser implements ParserConstants {
|
|||
|
||||
public ParseException generateParseException() {
|
||||
jj_expentries.removeAllElements();
|
||||
boolean[] la1tokens = new boolean[66];
|
||||
for (int i = 0; i < 66; i++) {
|
||||
boolean[] la1tokens = new boolean[67];
|
||||
for (int i = 0; i < 67; i++) {
|
||||
la1tokens[i] = false;
|
||||
}
|
||||
if (jj_kind >= 0) {
|
||||
la1tokens[jj_kind] = true;
|
||||
jj_kind = -1;
|
||||
}
|
||||
for (int i = 0; i < 40; i++) {
|
||||
for (int i = 0; i < 39; i++) {
|
||||
if (jj_la1[i] == jj_gen) {
|
||||
for (int j = 0; j < 32; j++) {
|
||||
if ((jj_la1_0[i] & (1<<j)) != 0) {
|
||||
|
@ -1305,7 +1298,7 @@ public class Parser implements ParserConstants {
|
|||
}
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < 66; i++) {
|
||||
for (int i = 0; i < 67; i++) {
|
||||
if (la1tokens[i]) {
|
||||
jj_expentry = new int[1];
|
||||
jj_expentry[0] = i;
|
||||
|
|
|
@ -12,58 +12,59 @@ public interface ParserConstants {
|
|||
int DESC = 10;
|
||||
int CREATE = 11;
|
||||
int DROP = 12;
|
||||
int FS = 13;
|
||||
int JAR = 14;
|
||||
int EXIT = 15;
|
||||
int INSERT = 16;
|
||||
int INTO = 17;
|
||||
int TABLE = 18;
|
||||
int DELETE = 19;
|
||||
int SELECT = 20;
|
||||
int ENABLE = 21;
|
||||
int DISABLE = 22;
|
||||
int STARTING = 23;
|
||||
int WHERE = 24;
|
||||
int FROM = 25;
|
||||
int ROW = 26;
|
||||
int VALUES = 27;
|
||||
int COLUMNFAMILIES = 28;
|
||||
int TIMESTAMP = 29;
|
||||
int NUM_VERSIONS = 30;
|
||||
int LIMIT = 31;
|
||||
int AND = 32;
|
||||
int OR = 33;
|
||||
int COMMA = 34;
|
||||
int LPAREN = 35;
|
||||
int RPAREN = 36;
|
||||
int EQUALS = 37;
|
||||
int LCOMP = 38;
|
||||
int RCOMP = 39;
|
||||
int NOT = 40;
|
||||
int IN = 41;
|
||||
int NOTEQUAL = 42;
|
||||
int ASTERISK = 43;
|
||||
int MAX_VERSIONS = 44;
|
||||
int MAX_LENGTH = 45;
|
||||
int COMPRESSION = 46;
|
||||
int NONE = 47;
|
||||
int BLOCK = 48;
|
||||
int RECORD = 49;
|
||||
int IN_MEMORY = 50;
|
||||
int BLOOMFILTER = 51;
|
||||
int COUNTING_BLOOMFILTER = 52;
|
||||
int RETOUCHED_BLOOMFILTER = 53;
|
||||
int VECTOR_SIZE = 54;
|
||||
int NUM_HASH = 55;
|
||||
int NUM_ENTRIES = 56;
|
||||
int ADD = 57;
|
||||
int CHANGE = 58;
|
||||
int ID = 59;
|
||||
int INTEGER_LITERAL = 60;
|
||||
int FLOATING_POINT_LITERAL = 61;
|
||||
int EXPONENT = 62;
|
||||
int QUOTED_IDENTIFIER = 63;
|
||||
int STRING_LITERAL = 64;
|
||||
int TRUNCATE = 13;
|
||||
int FS = 14;
|
||||
int JAR = 15;
|
||||
int EXIT = 16;
|
||||
int INSERT = 17;
|
||||
int INTO = 18;
|
||||
int TABLE = 19;
|
||||
int DELETE = 20;
|
||||
int SELECT = 21;
|
||||
int ENABLE = 22;
|
||||
int DISABLE = 23;
|
||||
int STARTING = 24;
|
||||
int WHERE = 25;
|
||||
int FROM = 26;
|
||||
int ROW = 27;
|
||||
int VALUES = 28;
|
||||
int COLUMNFAMILIES = 29;
|
||||
int TIMESTAMP = 30;
|
||||
int NUM_VERSIONS = 31;
|
||||
int LIMIT = 32;
|
||||
int AND = 33;
|
||||
int OR = 34;
|
||||
int COMMA = 35;
|
||||
int LPAREN = 36;
|
||||
int RPAREN = 37;
|
||||
int EQUALS = 38;
|
||||
int LCOMP = 39;
|
||||
int RCOMP = 40;
|
||||
int NOT = 41;
|
||||
int IN = 42;
|
||||
int NOTEQUAL = 43;
|
||||
int ASTERISK = 44;
|
||||
int MAX_VERSIONS = 45;
|
||||
int MAX_LENGTH = 46;
|
||||
int COMPRESSION = 47;
|
||||
int NONE = 48;
|
||||
int BLOCK = 49;
|
||||
int RECORD = 50;
|
||||
int IN_MEMORY = 51;
|
||||
int BLOOMFILTER = 52;
|
||||
int COUNTING_BLOOMFILTER = 53;
|
||||
int RETOUCHED_BLOOMFILTER = 54;
|
||||
int VECTOR_SIZE = 55;
|
||||
int NUM_HASH = 56;
|
||||
int NUM_ENTRIES = 57;
|
||||
int ADD = 58;
|
||||
int CHANGE = 59;
|
||||
int ID = 60;
|
||||
int INTEGER_LITERAL = 61;
|
||||
int FLOATING_POINT_LITERAL = 62;
|
||||
int EXPONENT = 63;
|
||||
int QUOTED_IDENTIFIER = 64;
|
||||
int STRING_LITERAL = 65;
|
||||
|
||||
int DEFAULT = 0;
|
||||
|
||||
|
@ -81,6 +82,7 @@ public interface ParserConstants {
|
|||
"\"desc\"",
|
||||
"\"create\"",
|
||||
"\"drop\"",
|
||||
"\"truncate\"",
|
||||
"\"fs\"",
|
||||
"\"jar\"",
|
||||
"\"exit\"",
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue