Index: src/contrib/hbase/src/test/org/apache/hadoop/hbase/shell/expression/TestBooleanExpression.java =================================================================== --- src/contrib/hbase/src/test/org/apache/hadoop/hbase/shell/expression/TestBooleanExpression.java (revision 0) +++ src/contrib/hbase/src/test/org/apache/hadoop/hbase/shell/expression/TestBooleanExpression.java (revision 0) @@ -0,0 +1,71 @@ +/** + * 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.expression; + +import junit.framework.TestCase; +import junit.framework.TestSuite; +import junit.textui.TestRunner; + +import org.apache.hadoop.hbase.io.ImmutableBytesWritable; +import org.apache.hadoop.io.MapWritable; +import org.apache.hadoop.io.Text; + +/** + * Test boolean expression + */ +public class TestBooleanExpression extends TestCase { + + BooleanExpression booleanExpression = new BooleanExpression(); + public static String EXPRESSION_OR = "key2 = value2 100 OR key3 = value1"; + public static String EXPRESSION_AND = "key2 = value2 100 AND key3 = value1"; + + Text[] keys = { + new Text("key1"), + new Text("key2"), + new Text("Key3"), + }; + + ImmutableBytesWritable[] values = { + new ImmutableBytesWritable("value1".getBytes()), + new ImmutableBytesWritable("value2".getBytes()), + new ImmutableBytesWritable("value3".getBytes()) + }; + + public void testBooleanExpression() { + booleanExpression.setExpression(EXPRESSION_OR); + } + + public void testCheckConstraints() { + MapWritable data = new MapWritable(); + for (int i = 0; i < keys.length; i++) { + data.put(keys[i], values[i]); + } + + booleanExpression.setExpression(EXPRESSION_OR); + assertTrue(booleanExpression.checkConstraints(data)); + booleanExpression.setExpression(EXPRESSION_AND); + assertFalse(booleanExpression.checkConstraints(data)); + } + + public static void main(String[] args) { + TestRunner.run(new TestSuite(TestBooleanExpression.class)); + } + +} Index: src/contrib/hbase/src/test/org/apache/hadoop/hbase/shell/expression/TestJoinExpression.java =================================================================== --- src/contrib/hbase/src/test/org/apache/hadoop/hbase/shell/expression/TestJoinExpression.java (revision 0) +++ src/contrib/hbase/src/test/org/apache/hadoop/hbase/shell/expression/TestJoinExpression.java (revision 0) @@ -0,0 +1,42 @@ +/** + * 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.expression; + +import junit.framework.TestCase; +import junit.framework.TestSuite; +import junit.textui.TestRunner; + +/** + * Test join expression + */ +public class TestJoinExpression extends TestCase { + + JoinExpression joinExpression = new JoinExpression(); + public static String EXPRESSION = "a.length = b.ROW"; + + public void testJoinExpression() { + joinExpression.setExpression(EXPRESSION); + } + + public static void main(String[] args) { + TestRunner.run(new TestSuite(TestJoinExpression.class)); + } + +} Index: src/contrib/hbase/src/test/org/apache/hadoop/hbase/shell/query/TestBooleanTermFilter.java =================================================================== --- src/contrib/hbase/src/test/org/apache/hadoop/hbase/shell/query/TestBooleanTermFilter.java (revision 0) +++ src/contrib/hbase/src/test/org/apache/hadoop/hbase/shell/query/TestBooleanTermFilter.java (revision 0) @@ -0,0 +1,237 @@ +/** + * 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.query; + +import java.io.IOException; +import java.util.Map; +import java.util.Random; +import java.util.TreeMap; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.dfs.MiniDFSCluster; +import org.apache.hadoop.fs.FileSystem; +import org.apache.hadoop.fs.Path; +import org.apache.hadoop.hbase.HBaseAdmin; +import org.apache.hadoop.hbase.HColumnDescriptor; +import org.apache.hadoop.hbase.HConstants; +import org.apache.hadoop.hbase.HScannerInterface; +import org.apache.hadoop.hbase.HStoreKey; +import org.apache.hadoop.hbase.HTable; +import org.apache.hadoop.hbase.HTableDescriptor; +import org.apache.hadoop.hbase.MasterNotRunningException; +import org.apache.hadoop.hbase.MiniHBaseCluster; +import org.apache.hadoop.hbase.MultiRegionTable; +import org.apache.hadoop.hbase.mapred.IdentityTableReduce; +import org.apache.hadoop.io.Text; +import org.apache.hadoop.mapred.JobClient; +import org.apache.hadoop.mapred.JobConf; +import org.apache.hadoop.mapred.MiniMRCluster; + +public class TestBooleanTermFilter extends MultiRegionTable { + @SuppressWarnings("hiding") + private static final Log LOG = LogFactory.getLog(TestBooleanTermFilter.class + .getName()); + + static final String INPUT_TABLE = "test_table"; + static final String OUTPUT_TABLE = "result_table"; + static final Text COUNT_COLUMNFAMILY = new Text("count:"); + static final Text RANDOMINT_COLUMNFAMILY = new Text("randomInt:"); + static final String GROUP_COLUMN_FAMILIES = "count: randomInt:"; + static final String BOOLEAN_TERM = "randomInt > 100 AND count <= 100 AND randomInt !! 110|120|130|140|150"; + private MiniDFSCluster dfsCluster = null; + private FileSystem fs; + private Path dir; + private MiniHBaseCluster hCluster = null; + + /** + * {@inheritDoc} + */ + @Override + public void setUp() throws Exception { + super.setUp(); + conf.setLong("hbase.hregion.max.filesize", 256 * 1024); + dfsCluster = new MiniDFSCluster(conf, 1, true, (String[]) null); + try { + fs = dfsCluster.getFileSystem(); + dir = new Path("/hbase"); + fs.mkdirs(dir); + // Start up HBase cluster + hCluster = new MiniHBaseCluster(conf, 1, dfsCluster); + } catch (Exception e) { + if (dfsCluster != null) { + dfsCluster.shutdown(); + dfsCluster = null; + } + throw e; + } + } + + /** + * {@inheritDoc} + */ + @Override + public void tearDown() throws Exception { + super.tearDown(); + if (hCluster != null) { + hCluster.shutdown(); + } + + if (dfsCluster != null) { + dfsCluster.shutdown(); + } + + if (fs != null) { + try { + fs.close(); + } catch (IOException e) { + LOG.info("During tear down got a " + e.getMessage()); + } + } + } + + public void testBooleanFilterMapReduce() { + try { + HTableDescriptor desc = new HTableDescriptor(INPUT_TABLE); + String[] columns = GROUP_COLUMN_FAMILIES.split(" "); + for (int i = 0; i < columns.length; i++) { + desc.addFamily(new HColumnDescriptor(columns[i])); + } + HBaseAdmin admin = new HBaseAdmin(this.conf); + admin.createTable(desc); + + // insert random data into the input table + HTable table = new HTable(conf, new Text(INPUT_TABLE)); + Random oRandom = new Random(); + + for (int j = 0; j < 200; j++) { + int i = oRandom.nextInt(200) + 1; + + long lockid = table.startUpdate(new Text("rowKey" + j)); + table.put(lockid, COUNT_COLUMNFAMILY, Integer.toString(j).getBytes( + HConstants.UTF8_ENCODING)); + table.put(lockid, RANDOMINT_COLUMNFAMILY, Integer.toString(i).getBytes( + HConstants.UTF8_ENCODING)); + table.commit(lockid, System.currentTimeMillis()); + } + + long lockid = table.startUpdate(new Text("rowKey2001")); + table.put(lockid, COUNT_COLUMNFAMILY, "12" + .getBytes(HConstants.UTF8_ENCODING)); + table.put(lockid, RANDOMINT_COLUMNFAMILY, "110" + .getBytes(HConstants.UTF8_ENCODING)); + table.commit(lockid, System.currentTimeMillis()); + + } catch (MasterNotRunningException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + + try { + HTableDescriptor output = new HTableDescriptor(OUTPUT_TABLE); + String[] columns = GROUP_COLUMN_FAMILIES.split(" "); + for (int i = 0; i < columns.length; i++) { + output.addFamily(new HColumnDescriptor(columns[i])); + } + // create output table + HBaseAdmin admin = new HBaseAdmin(this.conf); + admin.createTable(output); + } catch (MasterNotRunningException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + + MiniMRCluster mrCluster = null; + try { + mrCluster = new MiniMRCluster(2, fs.getUri().toString(), 1); + + JobConf jobConf = new JobConf(conf, TestBooleanTermFilter.class); + jobConf.setJobName("process boolean term filter mapreduce"); + jobConf.setNumMapTasks(2); + jobConf.setNumReduceTasks(1); + + IdentityFilterMap.initJob(INPUT_TABLE, GROUP_COLUMN_FAMILIES, + BOOLEAN_TERM, IdentityFilterMap.class, jobConf); + + IdentityTableReduce.initJob(OUTPUT_TABLE, IdentityTableReduce.class, + jobConf); + + JobClient.runJob(jobConf); + + } catch (IOException e) { + e.printStackTrace(); + } finally { + mrCluster.shutdown(); + } + + try { + verify(conf, OUTPUT_TABLE); + } catch (IOException e) { + e.printStackTrace(); + } + } + + /** + * Check the filtered value + * + * @param conf + * @param outputTable + * @throws IOException + */ + private void verify(Configuration conf, String outputTable) + throws IOException { + HTable table = new HTable(conf, new Text(outputTable)); + Text[] columns = { COUNT_COLUMNFAMILY, RANDOMINT_COLUMNFAMILY }; + HScannerInterface scanner = table.obtainScanner(columns, + HConstants.EMPTY_START_ROW); + + try { + HStoreKey key = new HStoreKey(); + TreeMap results = new TreeMap(); + + while (scanner.next(key, results)) { + for (Map.Entry e : results.entrySet()) { + if (e.getKey().equals(COUNT_COLUMNFAMILY)) { + assertTrue((Integer.parseInt(new String(e.getValue())) <= 100)); + } else { + assertTrue((Integer.parseInt(new String(e.getValue())) > 100 && checkNotInList(Integer + .parseInt(new String(e.getValue()))))); + } + } + } + + } finally { + scanner.close(); + } + + } + + /** + * Check 'NOT IN' filter-list + */ + private boolean checkNotInList(int parseInt) { + return (parseInt != 110 && parseInt != 120 && parseInt != 130 + && parseInt != 140 && parseInt != 150) ? true : false; + } + +} Index: src/contrib/hbase/src/test/org/apache/hadoop/hbase/shell/query/TestTableJoinMapReduce.java =================================================================== --- src/contrib/hbase/src/test/org/apache/hadoop/hbase/shell/query/TestTableJoinMapReduce.java (revision 0) +++ src/contrib/hbase/src/test/org/apache/hadoop/hbase/shell/query/TestTableJoinMapReduce.java (revision 0) @@ -0,0 +1,236 @@ +/** + * 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.query; + +import java.io.IOException; +import java.util.TreeMap; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.dfs.MiniDFSCluster; +import org.apache.hadoop.fs.FileSystem; +import org.apache.hadoop.fs.Path; +import org.apache.hadoop.hbase.HBaseAdmin; +import org.apache.hadoop.hbase.HColumnDescriptor; +import org.apache.hadoop.hbase.HConstants; +import org.apache.hadoop.hbase.HScannerInterface; +import org.apache.hadoop.hbase.HStoreKey; +import org.apache.hadoop.hbase.HTable; +import org.apache.hadoop.hbase.HTableDescriptor; +import org.apache.hadoop.hbase.MasterNotRunningException; +import org.apache.hadoop.hbase.MiniHBaseCluster; +import org.apache.hadoop.hbase.MultiRegionTable; +import org.apache.hadoop.io.Text; +import org.apache.hadoop.mapred.JobClient; +import org.apache.hadoop.mapred.JobConf; +import org.apache.hadoop.mapred.MiniMRCluster; + +public class TestTableJoinMapReduce extends MultiRegionTable { + @SuppressWarnings("hiding") + private static final Log LOG = LogFactory.getLog(TestTableJoinMapReduce.class + .getName()); + static final String FIRST_RELATION = "r1"; + static final String SECOND_RELATION = "r2"; + static final String JOIN_KEY_COLUMN = "c:"; + static final String FIRST_COLUMNS = "a: b: c:"; + static final String SECOND_COLUMNS = "d: e:"; + static final String OUTPUT_TABLE = "result_table"; + private MiniDFSCluster dfsCluster = null; + private FileSystem fs; + private Path dir; + private MiniHBaseCluster hCluster = null; + + /** + * {@inheritDoc} + */ + @Override + public void setUp() throws Exception { + super.setUp(); + conf.setLong("hbase.hregion.max.filesize", 256 * 1024); + dfsCluster = new MiniDFSCluster(conf, 1, true, (String[]) null); + try { + fs = dfsCluster.getFileSystem(); + dir = new Path("/hbase"); + fs.mkdirs(dir); + // Start up HBase cluster + hCluster = new MiniHBaseCluster(conf, 1, dfsCluster); + } catch (Exception e) { + if (dfsCluster != null) { + dfsCluster.shutdown(); + dfsCluster = null; + } + throw e; + } + } + + /** + * {@inheritDoc} + */ + @Override + public void tearDown() throws Exception { + super.tearDown(); + if (hCluster != null) { + hCluster.shutdown(); + } + + if (dfsCluster != null) { + dfsCluster.shutdown(); + } + + if (fs != null) { + try { + fs.close(); + } catch (IOException e) { + LOG.info("During tear down got a " + e.getMessage()); + } + } + } + + public void testTableJoinMapReduce() { + try { + HTableDescriptor desc = new HTableDescriptor(FIRST_RELATION); + String[] columns = FIRST_COLUMNS.split(" "); + for (int i = 0; i < columns.length; i++) { + desc.addFamily(new HColumnDescriptor(columns[i])); + } + HBaseAdmin admin = new HBaseAdmin(this.conf); + admin.createTable(desc); + + // insert random data into the input table + HTable table = new HTable(conf, new Text(FIRST_RELATION)); + for (int j = 0; j < 5; j++) { + long lockid = table.startUpdate(new Text("rowKey" + j)); + table.put(lockid, new Text("a:"), Integer.toString(j).getBytes( + HConstants.UTF8_ENCODING)); + table.put(lockid, new Text("b:"), Integer.toString(j).getBytes( + HConstants.UTF8_ENCODING)); + table.put(lockid, new Text("c:"), ("joinKey-" + Integer.toString(j)) + .getBytes(HConstants.UTF8_ENCODING)); + table.commit(lockid, System.currentTimeMillis()); + } + + } catch (MasterNotRunningException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + + try { + HTableDescriptor desc = new HTableDescriptor(SECOND_RELATION); + String[] columns = SECOND_COLUMNS.split(" "); + for (int i = 0; i < columns.length; i++) { + desc.addFamily(new HColumnDescriptor(columns[i])); + } + HBaseAdmin admin = new HBaseAdmin(this.conf); + admin.createTable(desc); + + // insert random data into the input table + HTable table = new HTable(conf, new Text(SECOND_RELATION)); + + for (int j = 0; j < 3; j++) { + long lockid = table.startUpdate(new Text("joinKey-" + j)); + table.put(lockid, new Text("d:"), ("s-" + Integer.toString(j)) + .getBytes(HConstants.UTF8_ENCODING)); + table.put(lockid, new Text("e:"), ("s-" + Integer.toString(j)) + .getBytes(HConstants.UTF8_ENCODING)); + table.commit(lockid, System.currentTimeMillis()); + } + + } catch (MasterNotRunningException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + + try { + HTableDescriptor output = new HTableDescriptor(OUTPUT_TABLE); + String[] columns = (FIRST_COLUMNS + " " + SECOND_COLUMNS).split(" "); + for (int i = 0; i < columns.length; i++) { + output.addFamily(new HColumnDescriptor(columns[i])); + } + // create output table + HBaseAdmin admin = new HBaseAdmin(this.conf); + admin.createTable(output); + } catch (MasterNotRunningException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + + MiniMRCluster mrCluster = null; + try { + mrCluster = new MiniMRCluster(2, fs.getUri().toString(), 1); + + JobConf jobConf = new JobConf(conf, TestBooleanTermFilter.class); + jobConf.setJobName("process boolean term filter mapreduce"); + jobConf.setNumMapTasks(2); + jobConf.setNumReduceTasks(1); + + ThetaJoinMap.initJob(FIRST_RELATION, SECOND_RELATION, FIRST_COLUMNS, + SECOND_COLUMNS, JOIN_KEY_COLUMN, ThetaJoinMap.class, jobConf); + ThetaJoinReduce.initJob(OUTPUT_TABLE, ThetaJoinReduce.class, jobConf); + + JobClient.runJob(jobConf); + + } catch (IOException e) { + e.printStackTrace(); + } finally { + mrCluster.shutdown(); + } + + try { + verify(conf, OUTPUT_TABLE); + } catch (IOException e) { + e.printStackTrace(); + } + } + + /** + * Check the joined table's lattice size. + * + * @param conf + * @param outputTable + * @throws IOException + */ + private void verify(Configuration conf, String outputTable) + throws IOException { + HTable table = new HTable(conf, new Text(outputTable)); + Text[] columns = { new Text("a:"), new Text("b:"), new Text("c:"), + new Text("d:"), new Text("e:") }; + HScannerInterface scanner = table.obtainScanner(columns, + HConstants.EMPTY_START_ROW); + + try { + HStoreKey key = new HStoreKey(); + TreeMap results = new TreeMap(); + + int i = 0; + while (scanner.next(key, results)) { + assertTrue(results.keySet().size() == 5); + i++; + } + assertTrue(i == 3); + } finally { + scanner.close(); + } + + } +} Index: src/contrib/hbase/src/test/org/apache/hadoop/hbase/shell/TestSubstitutionVariables.java =================================================================== --- src/contrib/hbase/src/test/org/apache/hadoop/hbase/shell/TestSubstitutionVariables.java (revision 0) +++ src/contrib/hbase/src/test/org/apache/hadoop/hbase/shell/TestSubstitutionVariables.java (revision 0) @@ -0,0 +1,79 @@ +/** + * 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.OutputStreamWriter; +import java.io.UnsupportedEncodingException; +import java.io.Writer; +import java.util.Map; + +import junit.framework.TestCase; +import junit.framework.TestSuite; +import junit.textui.TestRunner; + +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.hbase.HBaseConfiguration; +import org.apache.hadoop.hbase.shell.expression.TestBooleanExpression; + +/** + * Binding variables, substitution variables test + */ +public class TestSubstitutionVariables extends TestCase { + + private String TABLE_NAME = "table_name"; + private String SUBSTITUTION_VARIABLE = "A"; + static Configuration conf = new HBaseConfiguration(); + + public void testSubstitution() { + SubstituteCommand substitute = new SubstituteCommand(null); + + substitute.setKey(SUBSTITUTION_VARIABLE); + substitute.setInput(TABLE_NAME); + substitute.execute(conf); + + VariableRef ref = VariablesPool.get(SUBSTITUTION_VARIABLE).get(null); + assertTrue(ref.getArgument().equals(TABLE_NAME)); + } + + public void testCombinedQueries() throws UnsupportedEncodingException { + Writer out = new OutputStreamWriter(System.out, "UTF-8"); + SubstituteCommand substitute = new SubstituteCommand(out); + + substitute.setKey(SUBSTITUTION_VARIABLE); + substitute.setInput(TABLE_NAME); + substitute.execute(conf); + + substitute = new SubstituteCommand(out); + substitute.setKey("B"); + substitute.setChainKey(SUBSTITUTION_VARIABLE); + substitute.setOperation(OperationConstants.RELATIONAL_ALGEBRA_SELECTION); + substitute.setBooleanTerm(TestBooleanExpression.EXPRESSION_OR); + substitute.execute(conf); + + ConfigurationGenerator queryProc = new ConfigurationGenerator(conf, "B", "output_table"); + Map statements = queryProc.getStatements(); + assertTrue(statements.containsKey(OperationConstants.RELATIONAL_ALGEBRA_SELECTION)); + } + + public static void main(String[] args) { + TestRunner.run(new TestSuite(TestSubstitutionVariables.class)); + } + +} Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/SubstituteCommand.java =================================================================== --- src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/SubstituteCommand.java (revision 0) +++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/SubstituteCommand.java (revision 0) @@ -0,0 +1,84 @@ +/** + * 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.Writer; +import java.util.List; + +import org.apache.hadoop.conf.Configuration; + +/** + * This class represents a substitute command. + */ +public class SubstituteCommand extends BasicCommand { + + private String input; + private String key; + private String chainKey; + private String operation; + private List columnList; + private String booleanTerm; + + public SubstituteCommand(Writer o) { + super(o); + } + + public ReturnMsg execute(Configuration conf) { + if (input != null) { + this.operation = "table"; + this.booleanTerm = input; + } + + VariableRef formula = new VariableRef(operation, columnList, booleanTerm); + VariablesPool.put(key, chainKey, formula); + + return null; + } + + public void setInput(String input) { + this.input = input; + } + + public void setKey(String key) { + this.key = key; + } + + public void setChainKey(String chainKey) { + this.chainKey = chainKey; + } + + public void setOperation(String operation) { + this.operation = operation; + } + + public void setColumnList(List columnList) { + this.columnList = columnList; + } + + public void setBooleanTerm(String booleanTerm) { + this.booleanTerm = booleanTerm; + } + + @Override + public CommandType getCommandType() { + return CommandType.SHELL; + } + +} Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/ConfigurationGenerator.java =================================================================== --- src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/ConfigurationGenerator.java (revision 0) +++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/ConfigurationGenerator.java (revision 0) @@ -0,0 +1,92 @@ +/** + * 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.HashMap; +import java.util.Map; + +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.hbase.shell.query.ConfigurationFactory; +import org.apache.hadoop.hbase.shell.query.ClonningTable; +import org.apache.hadoop.hbase.shell.query.Projection; +import org.apache.hadoop.hbase.shell.query.Selection; +import org.apache.hadoop.hbase.shell.query.TableJoin; +import org.apache.hadoop.mapred.JobConf; + +/** + * This is the MapReduce Job Configuration Generator. + */ +public class ConfigurationGenerator { + + private Configuration conf; + private String input; + private String output; + Map statements = new HashMap(); + + /** Constructor */ + public ConfigurationGenerator(Configuration conf, String statement, + String output) { + this.conf = conf; + this.output = output; + String chainedIndex = statement; + while (chainedIndex != null) { + for (Map.Entry entry : VariablesPool.get( + chainedIndex).entrySet()) { + if (entry.getKey() == null) { + this.input = entry.getValue().getArgument(); + } else { + statements.put(entry.getValue().getOperation(), entry.getValue() + .getArgument()); + } + chainedIndex = entry.getKey(); + } + } + } + + public JobConf getJobConf() { + return getOperationObject().getConf(conf, input, output, statements); + } + + /** + * Returns the job configuration object for statements type + * + * @return ConfigurationFactory + */ + private ConfigurationFactory getOperationObject() { + if (statements.containsKey(OperationConstants.RELATIONAL_ALGEBRA_SELECTION)) { + return new Selection(); + } else if (statements + .containsKey(OperationConstants.RELATIONAL_ALGEBRA_PROJECTION)) { + return new Projection(); + } else if(statements.containsKey(OperationConstants.RELATIONAL_ALGEBRA_THETA_JOIN)) { + return new TableJoin(); + } else { + return new ClonningTable(); + } + } + + public void setOutput(String output) { + this.output = output; + } + + public Map getStatements() { + return statements; + } +} Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/expression/BooleanExpression.java =================================================================== --- src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/expression/BooleanExpression.java (revision 0) +++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/expression/BooleanExpression.java (revision 0) @@ -0,0 +1,119 @@ +/** + * 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.expression; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.hadoop.hbase.io.ImmutableBytesWritable; +import org.apache.hadoop.io.MapWritable; +import org.apache.hadoop.io.Writable; + +/** + * Boolean expression: truth values combined using AND, OR, NOT + */ +public class BooleanExpression { + + private String expression; + private Map> unionSet = new HashMap>(); + private Map> intersectionSet = new HashMap>(); + private String UNION = " OR "; + private String INTERSECTION = " AND "; + + /** + * Sets the expression + * + * @param string + */ + public void setExpression(String string) { + this.expression = string; + + String[] or = expression.split(UNION); + String[] and = null; + for (int i = 0; i < or.length; i++) { + if (or[i].split(INTERSECTION).length == 1) { + List valueList = new ArrayList(); + String[] parse = or[i].split(" "); + if (unionSet.containsKey(parse[0].trim())) { + valueList = unionSet.get(parse[0].trim()); + } + valueList.add(parse[1] + " " + parse[2]); + + unionSet.put(parse[0].trim(), valueList); + } else { + and = new String[or[i].split(INTERSECTION).length]; + and = or[i].split(INTERSECTION); + } + } + + if (and != null) { + for (int ii = 0; ii < and.length; ii++) { + List valueList = new ArrayList(); + String[] parse = and[ii].split(" "); + if (intersectionSet.containsKey(parse[0].trim())) { + valueList = intersectionSet.get(parse[0].trim()); + } + valueList.add(parse[1] + " " + parse[2]); + + intersectionSet.put(parse[0].trim(), valueList); + } + } + } + + /** + * @param data + * @return truth boolean value + */ + public boolean checkConstraints(MapWritable data) { + if (data == null) { + return false; // return false if data is null. + } + + boolean result = false; + Map record = new HashMap(); + + for (Map.Entry e : data.entrySet()) { + String cKey = e.getKey().toString(); + cKey = cKey.substring(0, cKey.length() - 1); + String val = new String(((ImmutableBytesWritable) e.getValue()).get()); + + if (intersectionSet.containsKey(cKey) || unionSet.containsKey(cKey)) { + record.put(cKey, val); + } + } + + if (intersectionSet.size() == record.size()) { + result = Comparator.booleanCompare(intersectionSet, record, true); + } else if (unionSet.size() == record.size()) { + result = Comparator.booleanCompare(unionSet, record, false); + } else { + if (Comparator.booleanCompare(intersectionSet, record, true) + && Comparator.booleanCompare(unionSet, record, false)) + result = true; + else + result = false; + } + + return result; + } + +} Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/expression/JoinExpression.java =================================================================== --- src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/expression/JoinExpression.java (revision 0) +++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/expression/JoinExpression.java (revision 0) @@ -0,0 +1,58 @@ +/** + * 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.expression; + +import java.util.HashMap; +import java.util.Map; + +import org.apache.hadoop.hbase.shell.VariableRef; +import org.apache.hadoop.hbase.shell.VariablesPool; + +public class JoinExpression { + + private String expression; + private Map joinCondition = new HashMap(); + + public void setExpression(String string) { + this.expression = string; + } + + /** + * TODO : add a boolean expression, set operators. + * (a.columnKey = b.ROW AND a.columnKey = 'valueStr') + * or (a.columnKey > b.ROW) + * or (a.columnKey != b.ROW) + * + * @return join_condition + */ + public Map getJoinKeyColumn() { + + String[] exArr = expression.split(" = "); + for (int i = 0; i < exArr.length; i++) { + for (Map.Entry e : VariablesPool.get( + exArr[i].split("[.]")[0]).entrySet()) { + joinCondition.put(e.getValue().getArgument(), exArr[i].split("[.]")[1]); + } + } + + return joinCondition; + } + +} Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/expression/Comparator.java =================================================================== --- src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/expression/Comparator.java (revision 0) +++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/expression/Comparator.java (revision 0) @@ -0,0 +1,150 @@ +/** + * 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.expression; + +import java.net.URLDecoder; +import java.util.List; +import java.util.Map; + +/** + * Comparison class + */ +public class Comparator { + + @SuppressWarnings("deprecation") + public static boolean booleanCompare(Map> expression, + Map record, boolean isIntersection) { + + boolean negative = true; + boolean positive = false; + + for (Map.Entry> e : expression.entrySet()) { + String key = e.getKey(); + List valueList = e.getValue(); + String recordValueList = record.get(key); + + for (int i = 0; i < valueList.size(); i++) { + String[] term = valueList.get(i).split(" "); + String comparator = term[0]; + String comparand = term[1]; + + switch (comparator.charAt(0)) { + case '>': + if (isSecond(comparator, "=")) { + if (Integer.parseInt(comparand) > Integer + .parseInt(recordValueList)) { + negative = false; + } else { + positive = true; + } + } else { + if (Integer.parseInt(comparand) > Integer + .parseInt(recordValueList) + || comparand.equals(recordValueList)) { + negative = false; + } else { + positive = true; + } + } + break; + case '<': + if (isSecond(comparator, "=")) { + if (Integer.parseInt(comparand) < Integer + .parseInt(recordValueList)) + negative = false; + else + positive = true; + } else { + if (Integer.parseInt(comparand) < Integer + .parseInt(recordValueList) + || comparand.equals(recordValueList)) + negative = false; + else + positive = true; + } + break; + + case '!': + if (isSecond(comparator, "!")) { + boolean checkBool = true; + String[] coms = comparand.split("[|]"); + for (int j = 0; j < coms.length; j++) { + if (URLDecoder.decode(coms[j]).equals(recordValueList)) { + checkBool = false; + } + } + + if (!checkBool) { + negative = false; + } else { + positive = true; + } + + } else { + if (comparand.equals(recordValueList)) + negative = false; + else + positive = true; + } + break; + case '=': + if (isSecond(comparator, "=")) { + + boolean checkBool = true; + String[] coms = comparand.split("[|]"); + for (int j = 0; j < coms.length; j++) { + if (URLDecoder.decode(coms[j]).equals(recordValueList)) { + checkBool = false; + } + } + + if (checkBool) { + negative = false; + } else { + positive = true; + } + + } else { + if (!comparand.equals(recordValueList)) + negative = false; + else + positive = true; + } + break; + } + } + } + + boolean result = false; + if (isIntersection) { + result = negative; + } else { + result = positive; + } + + return result; + } + + private static boolean isSecond(String comparator, String string) { + return (comparator.length() == 2 && string.charAt(0) == comparator + .charAt(1)) ? true : false; + } + +} Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/query/ClonningTable.java =================================================================== --- src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/query/ClonningTable.java (revision 0) +++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/query/ClonningTable.java (revision 0) @@ -0,0 +1,99 @@ +/** + * 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.query; + +import java.io.IOException; +import java.util.Map; + +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.hbase.mapred.IdentityTableMap; +import org.apache.hadoop.hbase.mapred.IdentityTableReduce; +import org.apache.hadoop.hbase.shell.OperationConstants; +import org.apache.hadoop.io.Text; +import org.apache.hadoop.mapred.ClusterStatus; +import org.apache.hadoop.mapred.JobClient; +import org.apache.hadoop.mapred.JobConf; + +/** + * Clone Table creates copy of table. + */ +public class ClonningTable implements ConfigurationFactory { + + public JobConf getConf(Configuration conf, String input, String output, + Map statements) { + + JobConf jobConf = new JobConf(conf, ClonningTable.class); + HTableDescriptor desc = new HTableDescriptor(output); + String tableColumns = ""; + + try { + HConnection conn = HConnectionManager.getConnection(conf); + HBaseAdmin admin = new HBaseAdmin(conf); + + HTableDescriptor[] tables = conn.listTables(); + HColumnDescriptor[] columns = null; + for (int i = 0; i < tables.length; i++) { + if (tables[i].getName().equals(new Text(input))) { + columns = tables[i].getFamilies().values().toArray( + new HColumnDescriptor[] {}); + break; + } + } + + if (conn.tableExists(new Text(output))) { + jobConf.setBoolean(OperationConstants.JOB_CONFIG_OUTPUT_TABLE_CREATION, + false); + return jobConf; + } else { + for (int i = 0; i < columns.length; i++) { + desc.addFamily(columns[i]); + tableColumns += columns[i].getName() + " "; + } + } + + admin.createTable(desc); + jobConf.setBoolean(OperationConstants.JOB_CONFIG_OUTPUT_TABLE_CREATION, + true); + } catch (IOException e) { + e.printStackTrace(); + } + + IdentityTableMap.initJob(input, tableColumns, IdentityTableMap.class, jobConf); + IdentityTableReduce.initJob(output, IdentityTableReduce.class, jobConf); + + try { + JobClient jobClient = new JobClient(jobConf); + + ClusterStatus cluster = jobClient.getClusterStatus(); + jobConf.setNumMapTasks(cluster.getMapTasks()); + jobConf.setNumReduceTasks(1); + + } catch (IOException e) { + e.printStackTrace(); + } + return jobConf; + } + +} Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/query/ConfigurationFactory.java =================================================================== --- src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/query/ConfigurationFactory.java (revision 0) +++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/query/ConfigurationFactory.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.query; + +import java.util.Map; + +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.mapred.JobConf; + +/** + * A factory class that provides configuration information. + */ +public interface ConfigurationFactory { + + JobConf getConf(Configuration conf, String input, String output, + Map statements); + +} Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/query/ThetaJoinMap.java =================================================================== --- src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/query/ThetaJoinMap.java (revision 0) +++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/query/ThetaJoinMap.java (revision 0) @@ -0,0 +1,134 @@ +/** + * 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.query; + +import java.io.IOException; +import java.util.Map; + +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.hbase.HBaseConfiguration; +import org.apache.hadoop.hbase.HStoreKey; +import org.apache.hadoop.hbase.HTable; +import org.apache.hadoop.hbase.io.ImmutableBytesWritable; +import org.apache.hadoop.hbase.mapred.TableMap; +import org.apache.hadoop.hbase.mapred.TableOutputCollector; +import org.apache.hadoop.io.MapWritable; +import org.apache.hadoop.io.Text; +import org.apache.hadoop.io.Writable; +import org.apache.hadoop.mapred.JobConf; +import org.apache.hadoop.mapred.Reporter; + +/** + * The join of two relations R1(A 1,A 2,...,A n) and R2(B~1~,B~2~,...,B~m~) is a + * relation with degree k=n+m and attributes (A 1,A 2,...,A n, B 1,B 2,...,B m) + * that satisfy the join condition + */ +public class ThetaJoinMap extends TableMap { + Configuration conf = new HBaseConfiguration(); + private String joinKeyColumn; + private String secondRelation; + public static final String JOIN_KEY_COLUMN = "shell.mapred.join.column"; + public static final String SECOND_RELATION = "shell.mapred.join.second.relation"; + public static final String FIRST_COLUMNS = "shell.mapred.first.columns"; + private Text[] first_columns; + + /** constructor */ + public ThetaJoinMap() { + super(); + } + + /** + * @param firstRelation R1 + * @param secondRelation R2 + * @param firstColumns (A 1,A 2,...,A n) + * @param secondColumns (B~1~,B~2~,...,B~m~) + * @param joinKeyColumn joinKeyColumn name + * @param mapper mapper class + * @param job jobConf + */ + public static void initJob(String firstRelation, String secondRelation, + String firstColumns, String secondColumns, String joinKeyColumn, + Class mapper, JobConf job) { + + initJob(firstRelation, firstColumns, mapper, job); + job.set(JOIN_KEY_COLUMN, joinKeyColumn); + job.set(SECOND_RELATION, secondRelation); + job.set(FIRST_COLUMNS, firstColumns); + } + + /** {@inheritDoc} */ + @Override + public void configure(JobConf job) { + super.configure(job); + joinKeyColumn = job.get(JOIN_KEY_COLUMN, ""); + secondRelation = job.get(SECOND_RELATION, ""); + + String[] cols = job.get(FIRST_COLUMNS, "").split(" "); + first_columns = new Text[cols.length]; + for (int i = 0; i < cols.length; i++) { + first_columns[i] = new Text(cols[i]); + } + } + + @Override + public void map(HStoreKey key, MapWritable value, + TableOutputCollector output, Reporter reporter) throws IOException { + Text tKey = key.getRow(); + String joinKey = extractJoinKey(value); + MapWritable appendValue = new MapWritable(); + + HTable table = new HTable(conf, new Text(secondRelation)); + for (Map.Entry e : table.getRow(new Text(joinKey)).entrySet()) { + appendValue.put(e.getKey(), new ImmutableBytesWritable(e.getValue())); + } + + if (appendValue.size() != 0) { + value.putAll(appendValue); + output.collect(tKey, value); + } + } + + /** + * return the join-key string + * + * @param r + * @return joinKey + */ + protected String extractJoinKey(MapWritable r) { + String joinKey = null; + + int numCols = first_columns.length; + if (numCols > 0) { + for (Map.Entry e : r.entrySet()) { + Text column = (Text) e.getKey(); + + for (int i = 0; i < numCols; i++) { + if (column.equals(new Text(joinKeyColumn))) { + joinKey = new String(((ImmutableBytesWritable) e.getValue()).get()); + break; + } + } + + } + } + return joinKey; + } + +} Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/query/Selection.java =================================================================== --- src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/query/Selection.java (revision 0) +++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/query/Selection.java (revision 0) @@ -0,0 +1,111 @@ +/** + * 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.query; + +import java.io.IOException; +import java.util.Map; + +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.hbase.mapred.IdentityTableReduce; +import org.apache.hadoop.hbase.shell.OperationConstants; +import org.apache.hadoop.io.Text; +import org.apache.hadoop.mapred.ClusterStatus; +import org.apache.hadoop.mapred.JobClient; +import org.apache.hadoop.mapred.JobConf; + +/** + * Perform a relational selection using MapReduce. + */ +public class Selection implements ConfigurationFactory { + + public JobConf getConf(Configuration conf, String input, String output, + Map statements) { + + JobConf jobConf = new JobConf(conf, Selection.class); + jobConf.setJobName("shell.mapred.select-" + +System.currentTimeMillis()); + + try { + HConnection conn = HConnectionManager.getConnection(conf); + HBaseAdmin admin = new HBaseAdmin(conf); + HTableDescriptor desc = new HTableDescriptor(output); + String groupColumns = ""; + + if (statements + .containsKey(OperationConstants.RELATIONAL_ALGEBRA_PROJECTION)) { + groupColumns = statements.get(OperationConstants.RELATIONAL_ALGEBRA_PROJECTION); + } else { + + HTableDescriptor[] tables = conn.listTables(); + HColumnDescriptor[] columns = null; + for (int i = 0; i < tables.length; i++) { + if (tables[i].getName().equals(new Text(input))) { + columns = tables[i].getFamilies().values().toArray( + new HColumnDescriptor[] {}); + break; + } + } + if (conn.tableExists(new Text(output))) { + jobConf.setBoolean( + OperationConstants.JOB_CONFIG_OUTPUT_TABLE_CREATION, false); + return jobConf; + } else { + for (int i = 0; i < columns.length; i++) { + desc.addFamily(columns[i]); + groupColumns += columns[i].getName() + " "; + } + } + admin.createTable(desc); // create output table. + jobConf.setBoolean(OperationConstants.JOB_CONFIG_OUTPUT_TABLE_CREATION, + true); + } + + if (statements.containsKey(OperationConstants.RELATIONAL_ALGEBRA_GROUP)) { + GroupingFilterMap.initJob(input, groupColumns, statements + .get(OperationConstants.RELATIONAL_ALGEBRA_GROUP), statements + .get(OperationConstants.RELATIONAL_ALGEBRA_SELECTION), + GroupingFilterMap.class, jobConf); + } else { + IdentityFilterMap.initJob(input, groupColumns, statements + .get(OperationConstants.RELATIONAL_ALGEBRA_SELECTION), + IdentityFilterMap.class, jobConf); + } + + IdentityTableReduce.initJob(output, IdentityTableReduce.class, jobConf); + + JobClient jobClient = new JobClient(jobConf); + + ClusterStatus cluster = jobClient.getClusterStatus(); + jobConf.setNumMapTasks(cluster.getMapTasks()); + jobConf.setNumReduceTasks(1); + + } catch (IOException e) { + e.printStackTrace(); + } + + return jobConf; + + } + +} Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/query/TableJoin.java =================================================================== --- src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/query/TableJoin.java (revision 0) +++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/query/TableJoin.java (revision 0) @@ -0,0 +1,115 @@ +/** + * 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.query; + +import java.io.IOException; +import java.util.Map; + +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.hbase.shell.OperationConstants; +import org.apache.hadoop.hbase.shell.expression.JoinExpression; +import org.apache.hadoop.io.Text; +import org.apache.hadoop.mapred.ClusterStatus; +import org.apache.hadoop.mapred.JobClient; +import org.apache.hadoop.mapred.JobConf; + +/** + * Perform a theta join using MapReduce. + */ +public class TableJoin implements ConfigurationFactory { + + public JobConf getConf(Configuration conf, String input, String output, + Map statements) { + + JobConf jobConf = new JobConf(conf, Selection.class); + jobConf.setJobName("shell.mapred.join-" + +System.currentTimeMillis()); + String secondRelation = statements + .get(OperationConstants.RELATIONAL_ALGEBRA_THETA_JOIN_SECOND_RELATION); + + try { + HConnection conn = HConnectionManager.getConnection(conf); + HBaseAdmin admin = new HBaseAdmin(conf); + HTableDescriptor desc = new HTableDescriptor(output); + + HTableDescriptor[] tables = conn.listTables(); + HColumnDescriptor[] firstColumns = null; + HColumnDescriptor[] secondColumns = null; + for (int i = 0; i < tables.length; i++) { + if (tables[i].getName().equals(new Text(input))) { + firstColumns = tables[i].getFamilies().values().toArray( + new HColumnDescriptor[] {}); + } else if (tables[i].getName().equals(new Text(secondRelation))) { + secondColumns = tables[i].getFamilies().values().toArray( + new HColumnDescriptor[] {}); + } + } + + String firstColumnsStr = ""; + String secondColumnsStr = ""; + + if (conn.tableExists(new Text(output))) { + jobConf.setBoolean(OperationConstants.JOB_CONFIG_OUTPUT_TABLE_CREATION, + false); + return jobConf; + } else { + for (int i = 0; i < firstColumns.length; i++) { + desc.addFamily(firstColumns[i]); + firstColumnsStr += firstColumns[i].getName() + " "; + } + + for (int i = 0; i < secondColumns.length; i++) { + desc.addFamily(secondColumns[i]); + secondColumnsStr += secondColumns[i].getName() + " "; + } + } + + admin.createTable(desc); // create output table. + jobConf.setBoolean(OperationConstants.JOB_CONFIG_OUTPUT_TABLE_CREATION, + true); + + // Find a joinKeyColumn + JoinExpression joinExpression = new JoinExpression(); + joinExpression.setExpression(statements + .get(OperationConstants.RELATIONAL_ALGEBRA_THETA_JOIN)); + + ThetaJoinMap.initJob(input, secondRelation, firstColumnsStr, + secondColumnsStr, joinExpression.getJoinKeyColumn().get(input), + ThetaJoinMap.class, jobConf); + ThetaJoinReduce.initJob(output, ThetaJoinReduce.class, jobConf); + + JobClient jobClient = new JobClient(jobConf); + + ClusterStatus cluster = jobClient.getClusterStatus(); + jobConf.setNumMapTasks(cluster.getMapTasks()); + jobConf.setNumReduceTasks(1); + + } catch (IOException e) { + e.printStackTrace(); + } + + return jobConf; + } + +} Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/query/Projection.java =================================================================== --- src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/query/Projection.java (revision 0) +++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/query/Projection.java (revision 0) @@ -0,0 +1,97 @@ +/** + * 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.query; + +import java.io.IOException; +import java.util.Map; + +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.hbase.mapred.GroupingTableMap; +import org.apache.hadoop.hbase.mapred.IdentityTableMap; +import org.apache.hadoop.hbase.mapred.IdentityTableReduce; +import org.apache.hadoop.hbase.shell.OperationConstants; +import org.apache.hadoop.io.Text; +import org.apache.hadoop.mapred.ClusterStatus; +import org.apache.hadoop.mapred.JobClient; +import org.apache.hadoop.mapred.JobConf; + +/** + * Perform a relational projection using MapReduce. + */ +public class Projection implements ConfigurationFactory { + + public JobConf getConf(Configuration conf, String input, String output, + Map statements) { + + JobConf jobConf = new JobConf(conf, Projection.class); + jobConf.setJobName("shell.mapred.proj-" + System.currentTimeMillis()); + + try { + HConnection conn = HConnectionManager.getConnection(conf); + if (conn.tableExists(new Text(output))) { + jobConf.setBoolean(OperationConstants.JOB_CONFIG_OUTPUT_TABLE_CREATION, + false); + return jobConf; + } else { + HTableDescriptor desc = new HTableDescriptor(output); + String columns = statements + .get(OperationConstants.RELATIONAL_ALGEBRA_PROJECTION); + String[] cols = columns.split(" "); + for (int i = 0; i < cols.length; i++) { + desc.addFamily(new HColumnDescriptor(cols[i])); + } + + // create output table. + HBaseAdmin admin = new HBaseAdmin(conf); + admin.createTable(desc); + jobConf.setBoolean(OperationConstants.JOB_CONFIG_OUTPUT_TABLE_CREATION, + true); + } + + if (statements.containsKey(OperationConstants.RELATIONAL_ALGEBRA_GROUP)) { + GroupingTableMap.initJob(input, statements + .get(OperationConstants.RELATIONAL_ALGEBRA_PROJECTION), statements + .get(OperationConstants.RELATIONAL_ALGEBRA_GROUP), + GroupingTableMap.class, jobConf); + } else { + IdentityTableMap.initJob(input, statements + .get(OperationConstants.RELATIONAL_ALGEBRA_PROJECTION), + IdentityTableMap.class, jobConf); + } + + IdentityTableReduce.initJob(output, IdentityTableReduce.class, jobConf); + JobClient jobClient = new JobClient(jobConf); + ClusterStatus cluster = jobClient.getClusterStatus(); + jobConf.setNumMapTasks(cluster.getMapTasks()); + jobConf.setNumReduceTasks(1); + + } catch (IOException e) { + e.printStackTrace(); + } + + return jobConf; + } + +} Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/query/IdentityFilterMap.java =================================================================== --- src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/query/IdentityFilterMap.java (revision 0) +++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/query/IdentityFilterMap.java (revision 0) @@ -0,0 +1,76 @@ +/** + * 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.query; + +import java.io.IOException; + +import org.apache.hadoop.hbase.HStoreKey; +import org.apache.hadoop.hbase.mapred.TableMap; +import org.apache.hadoop.hbase.mapred.TableOutputCollector; +import org.apache.hadoop.hbase.shell.expression.BooleanExpression; +import org.apache.hadoop.io.MapWritable; +import org.apache.hadoop.io.Text; +import org.apache.hadoop.mapred.JobConf; +import org.apache.hadoop.mapred.Reporter; + +/** + * Extract filtered records. + */ +public class IdentityFilterMap extends TableMap { + + private String expression; + BooleanExpression booleanTerm = new BooleanExpression(); + public static final String EXPRESSION = "shell.mapred.filtertablemap.exps"; + + /** Default Constructor. */ + public IdentityFilterMap() { + super(); + } + + @SuppressWarnings("deprecation") + public static void initJob(String table, String columns, String expression, + Class mapper, JobConf job) { + initJob(table, columns, mapper, job); + job.set(EXPRESSION, expression); + } + + /* + * (non-Javadoc) + * + * @see org.apache.hadoop.hbase.mapred.TableMap#configure(org.apache.hadoop.mapred.JobConf) + */ + public void configure(JobConf job) { + super.configure(job); + expression = job.get(EXPRESSION, ""); + } + + /** + * Filter the value for each specified column family. + */ + public void map(HStoreKey key, MapWritable value, + TableOutputCollector output, Reporter reporter) throws IOException { + booleanTerm.setExpression(expression); + Text tKey = key.getRow(); + if (booleanTerm.checkConstraints(value)) { + output.collect(tKey, value); + } + } + +} Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/query/ThetaJoinReduce.java =================================================================== --- src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/query/ThetaJoinReduce.java (revision 0) +++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/query/ThetaJoinReduce.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.query; + +import java.io.IOException; +import java.util.Iterator; + +import org.apache.hadoop.hbase.mapred.TableOutputCollector; +import org.apache.hadoop.hbase.mapred.TableReduce; +import org.apache.hadoop.io.MapWritable; +import org.apache.hadoop.io.Text; +import org.apache.hadoop.mapred.Reporter; + +/** + * Table join Reduce class + */ +public class ThetaJoinReduce extends TableReduce { + + /** constructor */ + public ThetaJoinReduce() { + super(); + } + + @Override + public void reduce(Text key, @SuppressWarnings("unchecked") + Iterator values, TableOutputCollector output, Reporter reporter) + throws IOException { + while (values.hasNext()) { + MapWritable r = (MapWritable) values.next(); + output.collect(key, r); + } + } + +} Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/query/GroupingFilterMap.java =================================================================== --- src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/query/GroupingFilterMap.java (revision 0) +++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/query/GroupingFilterMap.java (revision 0) @@ -0,0 +1,148 @@ +/** + * 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.query; + +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.util.ArrayList; +import java.util.Map; + +import org.apache.hadoop.hbase.HConstants; +import org.apache.hadoop.hbase.HStoreKey; +import org.apache.hadoop.hbase.io.ImmutableBytesWritable; +import org.apache.hadoop.hbase.mapred.TableMap; +import org.apache.hadoop.hbase.mapred.TableOutputCollector; +import org.apache.hadoop.hbase.shell.expression.BooleanExpression; +import org.apache.hadoop.io.MapWritable; +import org.apache.hadoop.io.Text; +import org.apache.hadoop.io.Writable; +import org.apache.hadoop.mapred.JobConf; +import org.apache.hadoop.mapred.Reporter; + +/** + * Extract grouping columns from filtered records. + */ +public class GroupingFilterMap extends TableMap { + + private String expression; + BooleanExpression booleanTerm = new BooleanExpression(); + public static final String EXPRESSION = "shell.mapred.filtertablemap.exps"; + public static final String GROUP_COLUMNS = "shell.mapred.filtertablemap.columns"; + private Text[] m_columns; + + /** default constructor */ + public GroupingFilterMap() { + super(); + } + + /** + * Use this before submitting a TableMap job. It will appropriately set up the + * JobConf. + * + * @param table table to be processed + * @param columns space separated list of columns to fetch + * @param groupColumns space separated list of columns used to form the key + * used in collect + * @param mapper map class + * @param job job configuration object + */ + public static void initJob(String table, String columns, String groupColumns, + String expression, Class mapper, JobConf job) { + + initJob(table, columns, mapper, job); + job.set(GROUP_COLUMNS, groupColumns); + job.set(EXPRESSION, expression); + } + + /** {@inheritDoc} */ + @Override + public void configure(JobConf job) { + super.configure(job); + String[] cols = job.get(GROUP_COLUMNS, "").split(" "); + m_columns = new Text[cols.length]; + for (int i = 0; i < cols.length; i++) { + m_columns[i] = new Text(cols[i]); + } + expression = job.get(EXPRESSION, ""); + } + + public void map(@SuppressWarnings("unused") + HStoreKey key, MapWritable value, TableOutputCollector output, + @SuppressWarnings("unused") + Reporter reporter) throws IOException { + booleanTerm.setExpression(expression); + + byte[][] keyVals = extractKeyValues(value); + if (keyVals != null) { + Text tKey = createGroupKey(keyVals); + + if (booleanTerm.checkConstraints(value)) { + output.collect(tKey, value); + } + } + } + + protected byte[][] extractKeyValues(MapWritable r) { + byte[][] keyVals = null; + ArrayList foundList = new ArrayList(); + int numCols = m_columns.length; + if (numCols > 0) { + for (Map.Entry e : r.entrySet()) { + Text column = (Text) e.getKey(); + for (int i = 0; i < numCols; i++) { + if (column.equals(m_columns[i])) { + foundList.add(((ImmutableBytesWritable) e.getValue()).get()); + break; + } + } + } + if (foundList.size() == numCols) { + keyVals = foundList.toArray(new byte[numCols][]); + } + } + return keyVals; + } + + /** + * Create a key by concatenating multiple column values. Override this + * function in order to produce different types of keys. + * + * @param vals + * @return key generated by concatenating multiple column values + */ + protected Text createGroupKey(byte[][] vals) { + if (vals == null) { + return null; + } + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < vals.length; i++) { + if (i > 0) { + sb.append(" "); + } + try { + sb.append(new String(vals[i], HConstants.UTF8_ENCODING)); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(e); + } + } + return new Text(sb.toString()); + } + +} 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 583354) +++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/HBaseShell.jj (working copy) @@ -1,751 +1,940 @@ -options { - STATIC = false; - IGNORE_CASE = true; -} - -PARSER_BEGIN(Parser) -package org.apache.hadoop.hbase.shell.generated; - -/** - * 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. - */ - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.HashMap; -import java.io.StringReader; -import java.io.Reader; -import java.io.Writer; - -import org.apache.hadoop.hbase.shell.*; - -/** - * Parsing command line. - */ -public class Parser { - private String QueryString; - private TableFormatter formatter; - private Writer out; - - public Parser(final String query, final Writer o, final TableFormatter f) { - this((Reader)(new StringReader(query))); - this.QueryString = query; - this.formatter = f; - this.out = o; - } - - public String getQueryStr() { - return this.QueryString; - } -} - -PARSER_END(Parser) - -SKIP : -{ - " " - | "\t" - | "\r" - | "\n" -} - -TOKEN: /** for HQL statements */ -{ - - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | "> - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | -} - -TOKEN : /** Literals */ -{ - - | - | )? - | "." (["0"-"9"])+ ()? - | (["0"-"9"])+ - | (["0"-"9"])+ ()? - > - | <#EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+ > - | - | -} - -/** - * Parses the given array of command line arguments. - */ -Command terminatedCommand() : -{ - Command statement = null; -} -{ - ([statement = cmdStatement()] ";" | ) - { - return statement; - } -} - -Command cmdStatement() : -{ - Command cmd = null; -} -{ - ( - 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() - | cmd = jarCommand() - ) - { - return cmd; - } -} - -ExitCommand exitCommand() : -{ - ExitCommand exit = new ExitCommand(this.out); -} -{ - { return exit; } -} - -FsCommand fsCommand() : -{ - Token t = null; - FsCommand fs = new FsCommand(this.out); - List query = new ArrayList(); -} -{ - - ( - t = - { query.add(t.image.toString()); } - )* - - { - fs.setQuery(query); - return fs; - } -} - -JarCommand jarCommand() : -{ - Token t = null; - JarCommand jar = new JarCommand(this.out); - List query = new ArrayList(); -} -{ - - ( - ( t = | t = ) - { query.add(t.image.toString()); } - )* - - { - jar.setQuery(query); - return jar; - } -} - -HelpCommand helpCommand() : -{ - Token t = null; - HelpCommand help = new HelpCommand(this.out, this.formatter); - String argument = ""; -} -{ - - [ - ( - t= - | t= - | t= - | t= - | t= - | t= - | t= - | t= - columns = ColumnList() - - tableName = Identifier() - { - select.setColumns(columns); - select.setTable(tableName); - } - - [ ( - { select.setWhere(true); } - | ) - - rowKey = getStringLiteral() - { - select.setRowKey(rowKey); - } - ] - - [ - timestamp = getStringLiteral() - { - select.setTimestamp(timestamp); - } - ] - - [ - numVersion = Number() - { - select.setVersion(numVersion); - } - ] - - [ limit = Number() { - try{ - select.setLimit(limit); - }catch(ClassCastException ce) { - throw generateParseException(); - } - } ] - { return select; } -} - -EnableCommand enableCommand() : -{ - EnableCommand enableCommand = new EnableCommand(this.out); - String table = null; -} -{ - - table = Identifier() - { - enableCommand.setTable(table); - return enableCommand; - } -} - -DisableCommand disableCommand() : -{ - DisableCommand disableCommand = new DisableCommand(this.out); - String table = null; -} -{ - - table = Identifier() - { - disableCommand.setTable(table); - return disableCommand; - } -} - -ClearCommand clearCommand() : -{ - ClearCommand clear = new ClearCommand(this.out); -} -{ - - { - return clear; - } -} - -//////////////////////////////////////////////// -// Utility expansion units... - -List getLiteralValues() : -{ - List values = new ArrayList(); - String literal = null; -} -{ - - { literal = getStringLiteral(); - if(literal != null) values.add(literal); - } - ( - { - literal = getStringLiteral(); - if(literal != null) values.add(literal); -} -| ( - - | - | - ) { values.removeAll(values); } - )* - - { - return values; - } -} - -String getStringLiteral() : -{ - Token s; -} -{ - ( s= | s= ) - { - String value = s.image.toString(); - return value.substring(1,value.length() - 1); - } -} - -List getColumns() : // return parenthesized column list -{ - List values = new ArrayList(); - String literal = null; -} -{ - - { literal = getColumn(); - if(literal != null) values.add(literal); - } - ( - - { - literal = getColumn(); - if(literal != null) values.add(literal); - } - )* - - { - return values; - } -} - -String getColumn() : -{ - Token col; -} -{ - ( - ( col= | col= ) - { return col.image.toString(); } - | (col= | col= ) - { return col.image.substring(1,col.image.toString().length() - 1); } - ) -} - -List TableList() : -{ - List tableList = new ArrayList(); - String table = null; -} -{ - table = Identifier() { tableList.add(table); } - ( table = Identifier() - { tableList.add(table); } - )* - - { return tableList; } -} - -List ColumnList() : -{ - List columnList = new ArrayList(); - String column = null; -} -{ - column = getColumn() - { - if(column != null) { - columnList.add(column); - } else { - return columnList; - } - } - ( column = getColumn() - { columnList.add(column); } - )* - - { return columnList; } -} - -int Number() : -{ - Token t = null; -} -{ - t = - { return Integer.parseInt(t.image.toString()); } -} - -String Identifier() : -{ - Token t = null; -} -{ - ( - t = - { return t.image.toString(); } - | ( t= | t= ) - { return t.image.substring(1,t.image.toString().length() - 1); } - ) +options { + STATIC = false; + IGNORE_CASE = true; +} + +PARSER_BEGIN(Parser) +package org.apache.hadoop.hbase.shell.generated; + +/** + * 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. + */ + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.HashMap; +import java.io.StringReader; +import java.io.Reader; +import java.io.Writer; +import java.net.URLEncoder; + +import org.apache.hadoop.hbase.shell.*; + +/** + * Parsing command line. + */ +public class Parser { + private String QueryString; + private TableFormatter formatter; + private Writer out; + + public Parser(final String query, final Writer o, final TableFormatter f) { + this((Reader)(new StringReader(query))); + this.QueryString = query; + this.formatter = f; + this.out = o; + } + + public String getQueryStr() { + return this.QueryString; + } +} + +PARSER_END(Parser) + +SKIP : +{ + " " + | "\t" + | "\r" + | "\n" +} + +TOKEN: /** for HQL statements */ +{ + + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | "> + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | + | +} + +TOKEN : +{ + + | + | +} + +TOKEN : /** Literals */ +{ + + | + | )? + | "." (["0"-"9"])+ ()? + | (["0"-"9"])+ + | (["0"-"9"])+ ()? + > + | <#EXPONENT: ["e","E"] (["+","-"])? (["0"-"9"])+ > + | + | +} + +/** + * Parses the given array of command line arguments. + */ +Command terminatedCommand() : +{ + Command statement = null; +} +{ + ( + [statement = cmdStatement()] ";" | + ) + + { + return statement; + } +} + +Command cmdStatement() : +{ + Command cmd = null; +} +{ + ( + 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() + | cmd = jarCommand() + | cmd = substituteCommand() + | cmd = saveCommand() + ) + { + return cmd; + } +} + +ExitCommand exitCommand() : +{ + ExitCommand exit = new ExitCommand(this.out); +} +{ + { return exit; } +} + +FsCommand fsCommand() : +{ + Token t = null; + FsCommand fs = new FsCommand(this.out); + List query = new ArrayList(); +} +{ + + ( + t = + { query.add(t.image.toString()); } + )* + + { + fs.setQuery(query); + return fs; + } +} + +JarCommand jarCommand() : +{ + Token t = null; + JarCommand jar = new JarCommand(this.out); + List query = new ArrayList(); +} +{ + + ( + ( t = | t = ) + { query.add(t.image.toString()); } + )* + + { + jar.setQuery(query); + return jar; + } +} + +HelpCommand helpCommand() : +{ + Token t = null; + HelpCommand help = new HelpCommand(this.out, this.formatter); + String argument = ""; +} +{ + + [ + ( + t= + | t= + | t= + | t= + | t= + | t= + | t= + | t= + columns = columnList() + + tableName = identifier() + { + select.setColumns(columns); + select.setTable(tableName); + } + + [ ( + { select.setWhere(true); } + | ) + + rowKey = getStringLiteral() + { + select.setRowKey(rowKey); + } + ] + + [ + timestamp = getStringLiteral() + { + select.setTimestamp(timestamp); + } + ] + + [ + numVersion = Number() + { + select.setVersion(numVersion); + } + ] + + [ limit = Number() { + try{ + select.setLimit(limit); + }catch(ClassCastException ce) { + throw generateParseException(); + } + } ] + { return select; } +} + +EnableCommand enableCommand() : +{ + EnableCommand enableCommand = new EnableCommand(this.out); + String table = null; +} +{ + + table = identifier() + { + enableCommand.setTable(table); + return enableCommand; + } +} + +DisableCommand disableCommand() : +{ + DisableCommand disableCommand = new DisableCommand(this.out); + String table = null; +} +{ + + table = identifier() + { + disableCommand.setTable(table); + return disableCommand; + } +} + +ClearCommand clearCommand() : +{ + ClearCommand clear = new ClearCommand(this.out); +} +{ + + { + return clear; + } +} + +SubstituteCommand substituteCommand() : +{ + Token key = null; + Token chainKey = null; + Token operation = null; + String tableName; + String booleanTerm; + List columnList = new ArrayList(); + List notInList = new ArrayList(); + SubstituteCommand substitute = new SubstituteCommand(this.out); + Token extendedKey = null; +} +{ + key= + { substitute.setKey(key.image.toString()); } + ( + chainKey= + { substitute.setChainKey(chainKey.image.toString()); } + operation = + { substitute.setOperation(operation.image.toString()); } + + { + if(operation.image.toLowerCase().equals(OperationConstants.RELATIONAL_ALGEBRA_PROJECTION)) { + columnList = columnList(); + substitute.setColumnList(columnList); + } else if(operation.image.toLowerCase().equals(OperationConstants.RELATIONAL_ALGEBRA_SELECTION)) { + booleanTerm = booleanTerm(); + substitute.setBooleanTerm(booleanTerm); + } else if(operation.image.toLowerCase().equals(OperationConstants.RELATIONAL_ALGEBRA_THETA_JOIN)) { + booleanTerm = booleanTerm(); + substitute.setBooleanTerm(booleanTerm); + } + } + + [ + extendedKey= + { + //chainning key. + substitute.setChainKey(extendedKey.image.toString()); + VariableRef formula = new VariableRef(OperationConstants.RELATIONAL_ALGEBRA_THETA_JOIN_SECOND_RELATION, null, + VariablesPool.get(extendedKey.image.toString()).get(null).getArgument()); + VariablesPool.put(extendedKey.image.toString(), chainKey.image.toString(), formula); + } + ] + | + tableName = identifier() + { substitute.setInput(tableName); } + + | operation=chainKey= + + columnList = columnList() + + { + substitute.setChainKey(chainKey.image.toString()); + substitute.setOperation(operation.image.toString()); + substitute.setColumnList(columnList); + } + ) + + { + return substitute; + } +} + +SaveCommand saveCommand() : +{ + Token t = null; + String tableName; + SaveCommand save = new SaveCommand(this.out); +} +{ + t= + { save.setStatement(t.image.toString()); } +
+ tableName = identifier() { save.setOutput(tableName); } + + { + return save; + } +} + +//////////////////////////////////////////////// +// Utility expansion units... + +List getLiteralValues() : +{ + List values = new ArrayList(); + String literal = null; +} +{ + + { literal = getStringLiteral(); + if(literal != null) values.add(literal); + } + ( + { + literal = getStringLiteral(); + if(literal != null) values.add(literal); +} +| ( + + | + | + ) { values.removeAll(values); } + )* + + { + return values; + } +} + +String getStringLiteral() : +{ + Token s; +} +{ + ( s= | s= ) + { + String value = s.image.toString(); + return value.substring(1,value.length() - 1); + } +} + +String getColumn() : +{ + Token col; +} +{ + ( + ( col= | col= | col= ) + { return col.image.toString(); } + | (col= | col= ) + { return col.image.substring(1,col.image.toString().length() - 1); } + ) +} + +List getColumns() : // return parenthesized column list +{ + List values = new ArrayList(); + String literal = null; +} +{ + + { literal = getColumn(); + if(literal != null) values.add(literal); + } + ( + + { + literal = getColumn(); + if(literal != null) values.add(literal); + } + )* + + { + return values; + } +} + +List tableList() : +{ + List tableList = new ArrayList(); + String table = null; +} +{ + table = identifier() { tableList.add(table); } + ( table = identifier() + { tableList.add(table); } + )* + + { return tableList; } +} + +List columnList() : +{ + List columnList = new ArrayList(); + String column = null; +} +{ + column = getColumn() + { + if(column != null) { + columnList.add(column); + } else { + return columnList; + } + } + ( column = getColumn() + { columnList.add(column); } + )* + + { return columnList; } +} + +int Number() : +{ + Token t = null; +} +{ + t = + { return Integer.parseInt(t.image.toString()); } +} + +String identifier() : +{ + Token t = null; +} +{ + ( + t = + { return t.image.toString(); } + | ( t= | t= ) + { return t.image.substring(1,t.image.toString().length() - 1); } + ) +} + +String booleanTerm() : +{ + String query = null; + String tmp = null; +} +{ + query = booleanTerms() + ( + ( + + { query += " AND "; } + | + { query += " OR "; } + ) tmp = booleanTerms() { query += tmp; } + )* + + { return query; } +} + +String booleanTerms() : +{ + Token tSearchName, tComparator, tComparand; + List inList = new ArrayList(); + String searchName=null,comparator=null,comparand=null; + Token joinColumn = null; + Token joinKey = null; +} +{ + ( + tSearchName= { searchName = tSearchName.image.toString(); } + [ + joinColumn= + { + searchName += "." + joinColumn.image.toString(); + } + ] + ) + + ( + tComparator= + { comparator = tComparator.image.toString(); } + [ { comparator += "="; }] + | tComparator= + { comparator = tComparator.image.toString(); } + [ { comparator += "="; }] + | tComparator= + { comparator = tComparator.image.toString(); } + [ { comparator = ">" + comparator; } ] + [ { comparator = "<" + comparator; } ] + | tComparator= + { comparator = tComparator.image.toString(); } + | + { comparator = "!!"; } + | + { comparator = "=="; } + ) + + ( + tComparand= + { comparand = tComparand.image.toString(); } + | tComparand= + { comparand = tComparand.image.substring(1,tComparand.image.length() - 1); } + | tComparand= + { comparand = tComparand.image.toString(); } + [ + + { + comparand += ".ROW"; + } + ] + | inList = getColumns() + { + if(comparator == null) { + comparator = "=="; + } + comparand = ""; + for(int i=0; i> commandMap = new HashMap>(); + + /** + * puts the date in the substitution variable. + * + * @param key + * @param parentKey + * @param statement + */ + public static void put(String key, String parentKey, VariableRef statement) { + HashMap value = new HashMap(); + value.put(parentKey, statement); + commandMap.put(key, value); + } + + /** + * returns the substitution variable's value. + * + * @param key + * @return HashMap + */ + public static HashMap get(String key) { + return commandMap.get(key); + } + +} 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 583354) +++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/generated/ParserTokenManager.java (working copy) @@ -1,1598 +1,1611 @@ -/* Generated By:JavaCC: Do not edit this line. ParserTokenManager.java */ -package org.apache.hadoop.hbase.shell.generated; -/** - * 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. - */ - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.HashMap; -import java.io.StringReader; -import java.io.Reader; -import java.io.Writer; -import org.apache.hadoop.hbase.shell.*; - -public class ParserTokenManager implements ParserConstants -{ - public java.io.PrintStream debugStream = System.out; - public void setDebugStream(java.io.PrintStream ds) { debugStream = ds; } -private final int jjStopStringLiteralDfa_0(int pos, long active0) -{ +/* Generated By:JavaCC: Do not edit this line. ParserTokenManager.java */ +package org.apache.hadoop.hbase.shell.generated; +/** + * 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. + */ + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.HashMap; +import java.io.StringReader; +import java.io.Reader; +import java.io.Writer; +import java.net.URLEncoder; +import org.apache.hadoop.hbase.shell.*; + +public class ParserTokenManager implements ParserConstants +{ + public java.io.PrintStream debugStream = System.out; + public void setDebugStream(java.io.PrintStream ds) { debugStream = ds; } +private final int jjStopStringLiteralDfa_0(int pos, long active0, long active1) +{ switch (pos) - { - case 0: - if ((active0 & 0x800000000L) != 0L) - return 32; - if ((active0 & 0xfffe03ffffffe0L) != 0L) - { - jjmatchedKind = 56; - return 1; - } - return -1; - case 1: - if ((active0 & 0x200002000L) != 0L) - return 1; - if ((active0 & 0xfffe01ffffdfe0L) != 0L) - { - jjmatchedKind = 56; - jjmatchedPos = 1; - return 1; - } - return -1; - case 2: - if ((active0 & 0x40000104004000L) != 0L) - return 1; - if ((active0 & 0xbffe00fbff9fe0L) != 0L) - { - jjmatchedKind = 56; - jjmatchedPos = 2; - return 1; - } - return -1; - case 3: - if ((active0 & 0x100002029720L) != 0L) - return 1; - if ((active0 & 0xbfee00f9fd08c0L) != 0L) - { - if (jjmatchedPos != 3) - { - jjmatchedKind = 56; - jjmatchedPos = 3; - } - return 1; - } - return -1; - case 4: - if ((active0 & 0xbfce0078f90a00L) != 0L) - { - jjmatchedKind = 56; - jjmatchedPos = 4; - return 1; - } - if ((active0 & 0x2000810400c0L) != 0L) - return 1; - return -1; - case 5: - if ((active0 & 0x3f8e0070c00200L) != 0L) - { - jjmatchedKind = 56; - jjmatchedPos = 5; - return 1; - } - if ((active0 & 0x80400008390800L) != 0L) - return 1; - return -1; - case 6: - if ((active0 & 0x3f8e0070800200L) != 0L) - { - jjmatchedKind = 56; - jjmatchedPos = 6; - return 1; - } - if ((active0 & 0x400000L) != 0L) - return 1; - return -1; - case 7: - if ((active0 & 0x2f8e0070000000L) != 0L) - { - jjmatchedKind = 56; - jjmatchedPos = 7; - return 1; - } - if ((active0 & 0x10000000800200L) != 0L) - return 1; - return -1; - case 8: - if ((active0 & 0x2f0e0050000000L) != 0L) - { - jjmatchedKind = 56; - jjmatchedPos = 8; - return 1; - } - if ((active0 & 0x800020000000L) != 0L) - return 1; - return -1; - case 9: - if ((active0 & 0x2f0a0050000000L) != 0L) - { - jjmatchedKind = 56; - jjmatchedPos = 9; - return 1; - } - if ((active0 & 0x40000000000L) != 0L) - return 1; - return -1; - case 10: - if ((active0 & 0x29080000000000L) != 0L) - return 1; - if ((active0 & 0x6020050000000L) != 0L) - { - jjmatchedKind = 56; - jjmatchedPos = 10; - return 1; - } - return -1; - case 11: - if ((active0 & 0x6000010000000L) != 0L) - { - jjmatchedKind = 56; - jjmatchedPos = 11; - return 1; - } - if ((active0 & 0x20040000000L) != 0L) - return 1; - return -1; - case 12: - if ((active0 & 0x6000010000000L) != 0L) - { - jjmatchedKind = 56; - jjmatchedPos = 12; - return 1; - } - return -1; - case 13: - if ((active0 & 0x6000000000000L) != 0L) - { - jjmatchedKind = 56; - jjmatchedPos = 13; - return 1; - } - if ((active0 & 0x10000000L) != 0L) - return 1; - return -1; - case 14: - if ((active0 & 0x6000000000000L) != 0L) - { - jjmatchedKind = 56; - jjmatchedPos = 14; - return 1; - } - return -1; - case 15: - if ((active0 & 0x6000000000000L) != 0L) - { - jjmatchedKind = 56; - jjmatchedPos = 15; - return 1; - } - return -1; - case 16: - if ((active0 & 0x6000000000000L) != 0L) - { - jjmatchedKind = 56; - jjmatchedPos = 16; - return 1; - } - return -1; - case 17: - if ((active0 & 0x6000000000000L) != 0L) - { - jjmatchedKind = 56; - jjmatchedPos = 17; - return 1; - } - return -1; - case 18: - if ((active0 & 0x6000000000000L) != 0L) - { - jjmatchedKind = 56; - jjmatchedPos = 18; - return 1; - } - return -1; - case 19: - if ((active0 & 0x4000000000000L) != 0L) - { - jjmatchedKind = 56; - jjmatchedPos = 19; - return 1; - } - if ((active0 & 0x2000000000000L) != 0L) - return 1; - return -1; - default : - return -1; - } -} -private final int jjStartNfa_0(int pos, long active0) -{ - return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0), pos + 1); -} -private final int jjStopAtPos(int pos, int kind) -{ - jjmatchedKind = kind; - jjmatchedPos = pos; - return pos + 1; -} -private final int jjStartNfaWithStates_0(int pos, int kind, int state) -{ - jjmatchedKind = kind; - jjmatchedPos = pos; - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { return pos + 1; } - return jjMoveNfa_0(state, pos + 1); -} -private final int jjMoveStringLiteralDfa0_0() -{ - switch(curChar) - { - case 40: - return jjStopAtPos(0, 36); - case 41: - return jjStopAtPos(0, 37); - case 42: - return jjStopAtPos(0, 40); - case 44: - return jjStopAtPos(0, 34); - case 46: - return jjStartNfaWithStates_0(0, 35, 32); - case 59: - return jjStopAtPos(0, 62); - case 60: - return jjMoveStringLiteralDfa1_0(0x8000000000L); - case 61: - return jjStopAtPos(0, 38); - case 65: - case 97: - return jjMoveStringLiteralDfa1_0(0x40000100000040L); - case 66: - case 98: - return jjMoveStringLiteralDfa1_0(0x1200000000000L); - case 67: - case 99: - return jjMoveStringLiteralDfa1_0(0x82080010000880L); - case 68: - case 100: - return jjMoveStringLiteralDfa1_0(0x481600L); - case 69: - case 101: - return jjMoveStringLiteralDfa1_0(0x208000L); - case 70: - case 102: - return jjMoveStringLiteralDfa1_0(0x2002000L); - case 72: - case 104: - return jjMoveStringLiteralDfa1_0(0x20L); - case 73: - case 105: - return jjMoveStringLiteralDfa1_0(0x800000030000L); - case 74: - case 106: - return jjMoveStringLiteralDfa1_0(0x4000L); - case 76: - case 108: - return jjMoveStringLiteralDfa1_0(0x80000000L); - case 77: - case 109: - return jjMoveStringLiteralDfa1_0(0x60000000000L); - case 78: - case 110: - return jjMoveStringLiteralDfa1_0(0x30100040000000L); - case 79: - case 111: - return jjMoveStringLiteralDfa1_0(0x200000000L); - case 82: - case 114: - return jjMoveStringLiteralDfa1_0(0x4400004000000L); - case 83: - case 115: - return jjMoveStringLiteralDfa1_0(0x900100L); - case 84: - case 116: - return jjMoveStringLiteralDfa1_0(0x20040000L); - case 86: - case 118: - return jjMoveStringLiteralDfa1_0(0x8000008000000L); - case 87: - case 119: - return jjMoveStringLiteralDfa1_0(0x1000000L); - default : - return jjMoveNfa_0(0, 0); - } -} -private final int jjMoveStringLiteralDfa1_0(long active0) -{ - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - jjStopStringLiteralDfa_0(0, active0); - return 1; - } - switch(curChar) - { - case 62: - if ((active0 & 0x8000000000L) != 0L) - return jjStopAtPos(1, 39); - break; - case 65: - case 97: - return jjMoveStringLiteralDfa2_0(active0, 0x60008044000L); - case 68: - case 100: - return jjMoveStringLiteralDfa2_0(active0, 0x40000000000000L); - case 69: - case 101: - return jjMoveStringLiteralDfa2_0(active0, 0xc400000180620L); - case 72: - case 104: - return jjMoveStringLiteralDfa2_0(active0, 0x80000001000100L); - case 73: - case 105: - return jjMoveStringLiteralDfa2_0(active0, 0xa0400000L); - case 76: - case 108: - return jjMoveStringLiteralDfa2_0(active0, 0x12000000000c0L); - case 78: - case 110: - return jjMoveStringLiteralDfa2_0(active0, 0x800100230000L); - case 79: - case 111: - return jjMoveStringLiteralDfa2_0(active0, 0x2180014000000L); - case 82: - case 114: - if ((active0 & 0x200000000L) != 0L) - return jjStartNfaWithStates_0(1, 33, 1); - return jjMoveStringLiteralDfa2_0(active0, 0x2001800L); - case 83: - case 115: - if ((active0 & 0x2000L) != 0L) - return jjStartNfaWithStates_0(1, 13, 1); - break; - case 84: - case 116: - return jjMoveStringLiteralDfa2_0(active0, 0x800000L); - case 85: - case 117: - return jjMoveStringLiteralDfa2_0(active0, 0x30000040000000L); - case 88: - case 120: - return jjMoveStringLiteralDfa2_0(active0, 0x8000L); - default : - break; - } - return jjStartNfa_0(0, active0); -} -private final int jjMoveStringLiteralDfa2_0(long old0, long active0) -{ - if (((active0 &= old0)) == 0L) - return jjStartNfa_0(0, old0); - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - jjStopStringLiteralDfa_0(1, active0); - return 2; - } - switch(curChar) - { - case 95: - return jjMoveStringLiteralDfa3_0(active0, 0x800000000000L); - case 65: - case 97: - return jjMoveStringLiteralDfa3_0(active0, 0x80000000a00000L); - case 66: - case 98: - return jjMoveStringLiteralDfa3_0(active0, 0x40000L); - case 67: - case 99: - return jjMoveStringLiteralDfa3_0(active0, 0x8400000000000L); - case 68: - case 100: - if ((active0 & 0x100000000L) != 0L) - return jjStartNfaWithStates_0(2, 32, 1); - else if ((active0 & 0x40000000000000L) != 0L) - return jjStartNfaWithStates_0(2, 54, 1); - break; - case 69: - case 101: - return jjMoveStringLiteralDfa3_0(active0, 0x1000880L); - case 73: - case 105: - return jjMoveStringLiteralDfa3_0(active0, 0x8000L); - case 76: - case 108: - return jjMoveStringLiteralDfa3_0(active0, 0x18180020L); - case 77: - case 109: - return jjMoveStringLiteralDfa3_0(active0, 0x300800e0000000L); - case 78: - case 110: - return jjMoveStringLiteralDfa3_0(active0, 0x100000000000L); - case 79: - case 111: - return jjMoveStringLiteralDfa3_0(active0, 0x1200002001100L); - case 82: - case 114: - if ((active0 & 0x4000L) != 0L) - return jjStartNfaWithStates_0(2, 14, 1); - break; - case 83: - case 115: - return jjMoveStringLiteralDfa3_0(active0, 0x410600L); - case 84: - case 116: - return jjMoveStringLiteralDfa3_0(active0, 0x4000000020040L); - case 85: - case 117: - return jjMoveStringLiteralDfa3_0(active0, 0x2000000000000L); - case 87: - case 119: - if ((active0 & 0x4000000L) != 0L) - return jjStartNfaWithStates_0(2, 26, 1); - break; - case 88: - case 120: - return jjMoveStringLiteralDfa3_0(active0, 0x60000000000L); - default : - break; - } - return jjStartNfa_0(1, active0); -} -private final int jjMoveStringLiteralDfa3_0(long old0, long active0) -{ - if (((active0 &= old0)) == 0L) - return jjStartNfa_0(1, old0); - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - jjStopStringLiteralDfa_0(2, active0); - return 3; - } - switch(curChar) - { - case 95: - return jjMoveStringLiteralDfa4_0(active0, 0x30060040000000L); - case 65: - case 97: - return jjMoveStringLiteralDfa4_0(active0, 0x400880L); - case 66: - case 98: - return jjMoveStringLiteralDfa4_0(active0, 0x200000L); - case 67: - case 99: - if ((active0 & 0x400L) != 0L) - { - jjmatchedKind = 10; - jjmatchedPos = 3; - } - return jjMoveStringLiteralDfa4_0(active0, 0x200000000200L); - case 69: - case 101: - if ((active0 & 0x100000000000L) != 0L) - return jjStartNfaWithStates_0(3, 44, 1); - return jjMoveStringLiteralDfa4_0(active0, 0x20190040L); - case 73: - case 105: - return jjMoveStringLiteralDfa4_0(active0, 0x80000000L); - case 76: - case 108: - return jjMoveStringLiteralDfa4_0(active0, 0x40000L); - case 77: - case 109: - if ((active0 & 0x2000000L) != 0L) - return jjStartNfaWithStates_0(3, 25, 1); - return jjMoveStringLiteralDfa4_0(active0, 0x800000000000L); - case 78: - case 110: - return jjMoveStringLiteralDfa4_0(active0, 0x82000000000000L); - case 79: - case 111: - if ((active0 & 0x20000L) != 0L) - return jjStartNfaWithStates_0(3, 17, 1); - return jjMoveStringLiteralDfa4_0(active0, 0x5400000000000L); - case 80: - case 112: - if ((active0 & 0x20L) != 0L) - return jjStartNfaWithStates_0(3, 5, 1); - else if ((active0 & 0x1000L) != 0L) - return jjStartNfaWithStates_0(3, 12, 1); - return jjMoveStringLiteralDfa4_0(active0, 0x80000000000L); - case 82: - case 114: - return jjMoveStringLiteralDfa4_0(active0, 0x1800000L); - case 84: - case 116: - if ((active0 & 0x8000L) != 0L) - return jjStartNfaWithStates_0(3, 15, 1); - return jjMoveStringLiteralDfa4_0(active0, 0x8000000000000L); - case 85: - case 117: - return jjMoveStringLiteralDfa4_0(active0, 0x18000000L); - case 87: - case 119: - if ((active0 & 0x100L) != 0L) - return jjStartNfaWithStates_0(3, 8, 1); - break; - default : - break; - } - return jjStartNfa_0(2, active0); -} -private final int jjMoveStringLiteralDfa4_0(long old0, long active0) -{ - if (((active0 &= old0)) == 0L) - return jjStartNfa_0(2, old0); - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - jjStopStringLiteralDfa_0(3, active0); - return 4; - } - switch(curChar) - { - case 66: - case 98: - return jjMoveStringLiteralDfa5_0(active0, 0x400000L); - case 67: - case 99: - return jjMoveStringLiteralDfa5_0(active0, 0x100000L); - case 69: - case 101: - if ((active0 & 0x40000L) != 0L) - return jjStartNfaWithStates_0(4, 18, 1); - else if ((active0 & 0x1000000L) != 0L) - return jjStartNfaWithStates_0(4, 24, 1); - return jjMoveStringLiteralDfa5_0(active0, 0x20800008000000L); - case 71: - case 103: - return jjMoveStringLiteralDfa5_0(active0, 0x80000000000000L); - case 72: - case 104: - return jjMoveStringLiteralDfa5_0(active0, 0x10000000000000L); - case 75: - case 107: - if ((active0 & 0x200000000000L) != 0L) - return jjStartNfaWithStates_0(4, 45, 1); - break; - case 76: - case 108: - return jjMoveStringLiteralDfa5_0(active0, 0x40000200000L); - case 77: - case 109: - return jjMoveStringLiteralDfa5_0(active0, 0x1000010000000L); - case 79: - case 111: - return jjMoveStringLiteralDfa5_0(active0, 0x8000000000000L); - case 82: - case 114: - if ((active0 & 0x40L) != 0L) - return jjStartNfaWithStates_0(4, 6, 1); - else if ((active0 & 0x80L) != 0L) - return jjStartNfaWithStates_0(4, 7, 1); - return jjMoveStringLiteralDfa5_0(active0, 0x480000010200L); - case 83: - case 115: - return jjMoveStringLiteralDfa5_0(active0, 0x20000000L); - case 84: - case 116: - if ((active0 & 0x80000000L) != 0L) - return jjStartNfaWithStates_0(4, 31, 1); - return jjMoveStringLiteralDfa5_0(active0, 0x2000000880800L); - case 85: - case 117: - return jjMoveStringLiteralDfa5_0(active0, 0x4000000000000L); - case 86: - case 118: - return jjMoveStringLiteralDfa5_0(active0, 0x20040000000L); - default : - break; - } - return jjStartNfa_0(3, active0); -} -private final int jjMoveStringLiteralDfa5_0(long old0, long active0) -{ - if (((active0 &= old0)) == 0L) - return jjStartNfa_0(3, old0); - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - jjStopStringLiteralDfa_0(4, active0); - return 5; - } - switch(curChar) - { - case 65: - case 97: - return jjMoveStringLiteralDfa6_0(active0, 0x10000000000000L); - case 67: - case 99: - return jjMoveStringLiteralDfa6_0(active0, 0x4000000000000L); - case 68: - case 100: - if ((active0 & 0x400000000000L) != 0L) - return jjStartNfaWithStates_0(5, 46, 1); - break; - case 69: - case 101: - if ((active0 & 0x800L) != 0L) - return jjStartNfaWithStates_0(5, 11, 1); - else if ((active0 & 0x80000L) != 0L) - return jjStartNfaWithStates_0(5, 19, 1); - else if ((active0 & 0x200000L) != 0L) - return jjStartNfaWithStates_0(5, 21, 1); - else if ((active0 & 0x80000000000000L) != 0L) - return jjStartNfaWithStates_0(5, 55, 1); - return jjMoveStringLiteralDfa6_0(active0, 0xe0040000000L); - case 70: - case 102: - return jjMoveStringLiteralDfa6_0(active0, 0x1000000000000L); - case 73: - case 105: - return jjMoveStringLiteralDfa6_0(active0, 0x2000000800200L); - case 76: - case 108: - return jjMoveStringLiteralDfa6_0(active0, 0x400000L); - case 77: - case 109: - return jjMoveStringLiteralDfa6_0(active0, 0x800000000000L); - case 78: - case 110: - return jjMoveStringLiteralDfa6_0(active0, 0x20000010000000L); - case 82: - case 114: - return jjMoveStringLiteralDfa6_0(active0, 0x8000000000000L); - case 83: - case 115: - if ((active0 & 0x8000000L) != 0L) - return jjStartNfaWithStates_0(5, 27, 1); - break; - case 84: - case 116: - if ((active0 & 0x10000L) != 0L) - return jjStartNfaWithStates_0(5, 16, 1); - else if ((active0 & 0x100000L) != 0L) - return jjStartNfaWithStates_0(5, 20, 1); - return jjMoveStringLiteralDfa6_0(active0, 0x20000000L); - default : - break; - } - return jjStartNfa_0(4, active0); -} -private final int jjMoveStringLiteralDfa6_0(long old0, long active0) -{ - if (((active0 &= old0)) == 0L) - return jjStartNfa_0(4, old0); - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - jjStopStringLiteralDfa_0(5, active0); - return 6; - } - switch(curChar) - { - case 95: - return jjMoveStringLiteralDfa7_0(active0, 0x8000000000000L); - case 65: - case 97: - return jjMoveStringLiteralDfa7_0(active0, 0x20000000L); - case 66: - case 98: - return jjMoveStringLiteralDfa7_0(active0, 0x200L); - case 69: - case 101: - if ((active0 & 0x400000L) != 0L) - return jjStartNfaWithStates_0(6, 22, 1); - break; - case 70: - case 102: - return jjMoveStringLiteralDfa7_0(active0, 0x10000000L); - case 72: - case 104: - return jjMoveStringLiteralDfa7_0(active0, 0x4000000000000L); - case 73: - case 105: - return jjMoveStringLiteralDfa7_0(active0, 0x1000000000000L); - case 78: - case 110: - return jjMoveStringLiteralDfa7_0(active0, 0x2040000800000L); - case 79: - case 111: - return jjMoveStringLiteralDfa7_0(active0, 0x800000000000L); - case 82: - case 114: - return jjMoveStringLiteralDfa7_0(active0, 0x20040000000L); - case 83: - case 115: - return jjMoveStringLiteralDfa7_0(active0, 0x10080000000000L); - case 84: - case 116: - return jjMoveStringLiteralDfa7_0(active0, 0x20000000000000L); - default : - break; - } - return jjStartNfa_0(5, active0); -} -private final int jjMoveStringLiteralDfa7_0(long old0, long active0) -{ - if (((active0 &= old0)) == 0L) - return jjStartNfa_0(5, old0); - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - jjStopStringLiteralDfa_0(6, active0); - return 7; - } - switch(curChar) - { - case 65: - case 97: - return jjMoveStringLiteralDfa8_0(active0, 0x10000000L); - case 69: - case 101: - if ((active0 & 0x200L) != 0L) - return jjStartNfaWithStates_0(7, 9, 1); - return jjMoveStringLiteralDfa8_0(active0, 0x4000000000000L); - case 71: - case 103: - if ((active0 & 0x800000L) != 0L) - return jjStartNfaWithStates_0(7, 23, 1); - return jjMoveStringLiteralDfa8_0(active0, 0x2040000000000L); - case 72: - case 104: - if ((active0 & 0x10000000000000L) != 0L) - return jjStartNfaWithStates_0(7, 52, 1); - break; - case 76: - case 108: - return jjMoveStringLiteralDfa8_0(active0, 0x1000000000000L); - case 77: - case 109: - return jjMoveStringLiteralDfa8_0(active0, 0x20000000L); - case 82: - case 114: - return jjMoveStringLiteralDfa8_0(active0, 0x20800000000000L); - case 83: - case 115: - return jjMoveStringLiteralDfa8_0(active0, 0x80a0040000000L); - default : - break; - } - return jjStartNfa_0(6, active0); -} -private final int jjMoveStringLiteralDfa8_0(long old0, long active0) -{ - if (((active0 &= old0)) == 0L) - return jjStartNfa_0(6, old0); - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - jjStopStringLiteralDfa_0(7, active0); - return 8; - } - switch(curChar) - { - case 95: - return jjMoveStringLiteralDfa9_0(active0, 0x2000000000000L); - case 68: - case 100: - return jjMoveStringLiteralDfa9_0(active0, 0x4000000000000L); - case 73: - case 105: - return jjMoveStringLiteralDfa9_0(active0, 0x280a0040000000L); - case 77: - case 109: - return jjMoveStringLiteralDfa9_0(active0, 0x10000000L); - case 80: - case 112: - if ((active0 & 0x20000000L) != 0L) - return jjStartNfaWithStates_0(8, 29, 1); - break; - case 84: - case 116: - return jjMoveStringLiteralDfa9_0(active0, 0x1040000000000L); - case 89: - case 121: - if ((active0 & 0x800000000000L) != 0L) - return jjStartNfaWithStates_0(8, 47, 1); - break; - default : - break; - } - return jjStartNfa_0(7, active0); -} -private final int jjMoveStringLiteralDfa9_0(long old0, long active0) -{ - if (((active0 &= old0)) == 0L) - return jjStartNfa_0(7, old0); - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - jjStopStringLiteralDfa_0(8, active0); - return 9; - } - switch(curChar) - { - case 95: - return jjMoveStringLiteralDfa10_0(active0, 0x4000000000000L); - case 66: - case 98: - return jjMoveStringLiteralDfa10_0(active0, 0x2000000000000L); - case 69: - case 101: - return jjMoveStringLiteralDfa10_0(active0, 0x21000000000000L); - case 72: - case 104: - if ((active0 & 0x40000000000L) != 0L) - return jjStartNfaWithStates_0(9, 42, 1); - break; - case 73: - case 105: - return jjMoveStringLiteralDfa10_0(active0, 0x10000000L); - case 79: - case 111: - return jjMoveStringLiteralDfa10_0(active0, 0xa0040000000L); - case 90: - case 122: - return jjMoveStringLiteralDfa10_0(active0, 0x8000000000000L); - default : - break; - } - return jjStartNfa_0(8, active0); -} -private final int jjMoveStringLiteralDfa10_0(long old0, long active0) -{ - if (((active0 &= old0)) == 0L) - return jjStartNfa_0(8, old0); - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - jjStopStringLiteralDfa_0(9, active0); - return 10; - } - switch(curChar) - { - case 66: - case 98: - return jjMoveStringLiteralDfa11_0(active0, 0x4000000000000L); - case 69: - case 101: - if ((active0 & 0x8000000000000L) != 0L) - return jjStartNfaWithStates_0(10, 51, 1); - break; - case 76: - case 108: - return jjMoveStringLiteralDfa11_0(active0, 0x2000010000000L); - case 78: - case 110: - if ((active0 & 0x80000000000L) != 0L) - return jjStartNfaWithStates_0(10, 43, 1); - return jjMoveStringLiteralDfa11_0(active0, 0x20040000000L); - case 82: - case 114: - if ((active0 & 0x1000000000000L) != 0L) - return jjStartNfaWithStates_0(10, 48, 1); - break; - case 83: - case 115: - if ((active0 & 0x20000000000000L) != 0L) - return jjStartNfaWithStates_0(10, 53, 1); - break; - default : - break; - } - return jjStartNfa_0(9, active0); -} -private final int jjMoveStringLiteralDfa11_0(long old0, long active0) -{ - if (((active0 &= old0)) == 0L) - return jjStartNfa_0(9, old0); - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - jjStopStringLiteralDfa_0(10, active0); - return 11; - } - switch(curChar) - { - case 73: - case 105: - return jjMoveStringLiteralDfa12_0(active0, 0x10000000L); - case 76: - case 108: - return jjMoveStringLiteralDfa12_0(active0, 0x4000000000000L); - case 79: - case 111: - return jjMoveStringLiteralDfa12_0(active0, 0x2000000000000L); - case 83: - case 115: - if ((active0 & 0x40000000L) != 0L) - return jjStartNfaWithStates_0(11, 30, 1); - else if ((active0 & 0x20000000000L) != 0L) - return jjStartNfaWithStates_0(11, 41, 1); - break; - default : - break; - } - return jjStartNfa_0(10, active0); -} -private final int jjMoveStringLiteralDfa12_0(long old0, long active0) -{ - if (((active0 &= old0)) == 0L) - return jjStartNfa_0(10, old0); - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - jjStopStringLiteralDfa_0(11, active0); - return 12; - } - switch(curChar) - { - case 69: - case 101: - return jjMoveStringLiteralDfa13_0(active0, 0x10000000L); - case 79: - case 111: - return jjMoveStringLiteralDfa13_0(active0, 0x6000000000000L); - default : - break; - } - return jjStartNfa_0(11, active0); -} -private final int jjMoveStringLiteralDfa13_0(long old0, long active0) -{ - if (((active0 &= old0)) == 0L) - return jjStartNfa_0(11, old0); - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { - jjStopStringLiteralDfa_0(12, active0); - return 13; - } - switch(curChar) - { - case 77: - case 109: - return jjMoveStringLiteralDfa14_0(active0, 0x2000000000000L); - case 79: - case 111: - return jjMoveStringLiteralDfa14_0(active0, 0x4000000000000L); - case 83: - case 115: - if ((active0 & 0x10000000L) != 0L) - return jjStartNfaWithStates_0(13, 28, 1); - 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, 0x2000000000000L); - case 77: - case 109: - return jjMoveStringLiteralDfa15_0(active0, 0x4000000000000L); - 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, 0x4000000000000L); - case 73: - case 105: - return jjMoveStringLiteralDfa16_0(active0, 0x2000000000000L); - 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, 0x4000000000000L); - case 76: - case 108: - return jjMoveStringLiteralDfa17_0(active0, 0x2000000000000L); - 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, 0x4000000000000L); - case 84: - case 116: - return jjMoveStringLiteralDfa18_0(active0, 0x2000000000000L); - 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, 0x2000000000000L); - case 84: - case 116: - return jjMoveStringLiteralDfa19_0(active0, 0x4000000000000L); - 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, 0x4000000000000L); - case 82: - case 114: - if ((active0 & 0x2000000000000L) != 0L) - return jjStartNfaWithStates_0(19, 49, 1); - 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 & 0x4000000000000L) != 0L) - return jjStartNfaWithStates_0(20, 50, 1); - break; - default : - break; - } - return jjStartNfa_0(19, active0); -} -private final void jjCheckNAdd(int state) -{ - if (jjrounds[state] != jjround) - { - jjstateSet[jjnewStateCnt++] = state; - jjrounds[state] = jjround; - } -} -private final void jjAddStates(int start, int end) -{ - do { - jjstateSet[jjnewStateCnt++] = jjnextStates[start]; - } while (start++ != end); -} -private final void jjCheckNAddTwoStates(int state1, int state2) -{ - jjCheckNAdd(state1); - jjCheckNAdd(state2); -} -private final void jjCheckNAddStates(int start, int end) -{ - do { - jjCheckNAdd(jjnextStates[start]); - } while (start++ != end); -} -private final void jjCheckNAddStates(int start) -{ - jjCheckNAdd(jjnextStates[start]); - jjCheckNAdd(jjnextStates[start + 1]); -} + { + case 0: + if ((active0 & 0x800000000L) != 0L) + return 3; + if ((active0 & 0x7fffe603ffffffe0L) != 0L) + { + jjmatchedKind = 63; + return 1; + } + return -1; + case 1: + if ((active0 & 0x4008040200032000L) != 0L) + return 1; + if ((active0 & 0x3ff7e201fffcdfe0L) != 0L) + { + if (jjmatchedPos != 1) + { + jjmatchedKind = 63; + jjmatchedPos = 1; + } + return 1; + } + return -1; + case 2: + if ((active0 & 0x400020104004000L) != 0L) + return 1; + if ((active0 & 0x3bffe000fbff9fe0L) != 0L) + { + jjmatchedKind = 63; + jjmatchedPos = 2; + return 1; + } + return -1; + case 3: + if ((active0 & 0x2bfee000f9fd08c0L) != 0L) + { + if (jjmatchedPos != 3) + { + jjmatchedKind = 63; + jjmatchedPos = 3; + } + return 1; + } + if ((active0 & 0x1001000002029720L) != 0L) + return 1; + return -1; + case 4: + if ((active0 & 0xbfce00078f90a00L) != 0L) + { + jjmatchedKind = 63; + jjmatchedPos = 4; + return 1; + } + if ((active0 & 0x20020000810400c0L) != 0L) + return 1; + return -1; + case 5: + if ((active0 & 0x3f8e00070c00200L) != 0L) + { + jjmatchedKind = 63; + jjmatchedPos = 5; + return 1; + } + if ((active0 & 0x804000008390800L) != 0L) + return 1; + return -1; + case 6: + if ((active0 & 0x3f8e00070800200L) != 0L) + { + jjmatchedKind = 63; + jjmatchedPos = 6; + return 1; + } + if ((active0 & 0x400000L) != 0L) + return 1; + return -1; + case 7: + if ((active0 & 0x2f8e00070000000L) != 0L) + { + jjmatchedKind = 63; + jjmatchedPos = 7; + return 1; + } + if ((active0 & 0x100000000800200L) != 0L) + return 1; + return -1; + case 8: + if ((active0 & 0x2f0e00050000000L) != 0L) + { + jjmatchedKind = 63; + jjmatchedPos = 8; + return 1; + } + if ((active0 & 0x8000020000000L) != 0L) + return 1; + return -1; + case 9: + if ((active0 & 0x400000000000L) != 0L) + return 1; + if ((active0 & 0x2f0a00050000000L) != 0L) + { + jjmatchedKind = 63; + jjmatchedPos = 9; + return 1; + } + return -1; + case 10: + if ((active0 & 0x290800000000000L) != 0L) + return 1; + if ((active0 & 0x60200050000000L) != 0L) + { + jjmatchedKind = 63; + jjmatchedPos = 10; + return 1; + } + return -1; + case 11: + if ((active0 & 0x200040000000L) != 0L) + return 1; + if ((active0 & 0x60000010000000L) != 0L) + { + jjmatchedKind = 63; + jjmatchedPos = 11; + return 1; + } + return -1; + case 12: + if ((active0 & 0x60000010000000L) != 0L) + { + jjmatchedKind = 63; + jjmatchedPos = 12; + return 1; + } + return -1; + case 13: + if ((active0 & 0x10000000L) != 0L) + return 1; + if ((active0 & 0x60000000000000L) != 0L) + { + jjmatchedKind = 63; + jjmatchedPos = 13; + return 1; + } + return -1; + case 14: + if ((active0 & 0x60000000000000L) != 0L) + { + jjmatchedKind = 63; + jjmatchedPos = 14; + return 1; + } + return -1; + case 15: + if ((active0 & 0x60000000000000L) != 0L) + { + jjmatchedKind = 63; + jjmatchedPos = 15; + return 1; + } + return -1; + case 16: + if ((active0 & 0x60000000000000L) != 0L) + { + jjmatchedKind = 63; + jjmatchedPos = 16; + return 1; + } + return -1; + case 17: + if ((active0 & 0x60000000000000L) != 0L) + { + jjmatchedKind = 63; + jjmatchedPos = 17; + return 1; + } + return -1; + case 18: + if ((active0 & 0x60000000000000L) != 0L) + { + jjmatchedKind = 63; + jjmatchedPos = 18; + return 1; + } + return -1; + case 19: + if ((active0 & 0x40000000000000L) != 0L) + { + jjmatchedKind = 63; + jjmatchedPos = 19; + return 1; + } + if ((active0 & 0x20000000000000L) != 0L) + return 1; + return -1; + default : + return -1; + } +} +private final int jjStartNfa_0(int pos, long active0, long active1) +{ + return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0, active1), pos + 1); +} +private final int jjStopAtPos(int pos, int kind) +{ + jjmatchedKind = kind; + jjmatchedPos = pos; + return pos + 1; +} +private final int jjStartNfaWithStates_0(int pos, int kind, int state) +{ + jjmatchedKind = kind; + jjmatchedPos = pos; + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { return pos + 1; } + return jjMoveNfa_0(state, pos + 1); +} +private final int jjMoveStringLiteralDfa0_0() +{ + switch(curChar) + { + case 33: + return jjMoveStringLiteralDfa1_0(0x80000000000L); + case 40: + return jjStopAtPos(0, 36); + case 41: + return jjStopAtPos(0, 37); + case 42: + return jjStopAtPos(0, 44); + case 44: + return jjStopAtPos(0, 34); + case 46: + return jjStartNfaWithStates_0(0, 35, 3); + case 59: + return jjStopAtPos(0, 69); + case 60: + return jjStopAtPos(0, 40); + case 61: + return jjStopAtPos(0, 38); + case 62: + return jjStopAtPos(0, 39); + case 65: + case 97: + return jjMoveStringLiteralDfa1_0(0x400000100000040L); + case 66: + case 98: + return jjMoveStringLiteralDfa1_0(0x4012000000000000L); + case 67: + case 99: + return jjMoveStringLiteralDfa1_0(0x820800010000880L); + case 68: + case 100: + return jjMoveStringLiteralDfa1_0(0x481600L); + case 69: + case 101: + return jjMoveStringLiteralDfa1_0(0x208000L); + case 70: + case 102: + return jjMoveStringLiteralDfa1_0(0x2002000L); + case 71: + case 103: + return jjMoveStringLiteralDfa1_0(0x2000000000000000L); + case 72: + case 104: + return jjMoveStringLiteralDfa1_0(0x20L); + case 73: + case 105: + return jjMoveStringLiteralDfa1_0(0x8040000030000L); + case 74: + case 106: + return jjMoveStringLiteralDfa1_0(0x4000L); + case 76: + case 108: + return jjMoveStringLiteralDfa1_0(0x80000000L); + case 77: + case 109: + return jjMoveStringLiteralDfa1_0(0x600000000000L); + case 78: + case 110: + return jjMoveStringLiteralDfa1_0(0x301020040000000L); + case 79: + case 111: + return jjMoveStringLiteralDfa1_0(0x200000000L); + case 82: + case 114: + return jjMoveStringLiteralDfa1_0(0x44000004000000L); + case 83: + case 115: + return jjMoveStringLiteralDfa1_0(0x1000000000900100L); + case 84: + case 116: + return jjMoveStringLiteralDfa1_0(0x20040000L); + case 86: + case 118: + return jjMoveStringLiteralDfa1_0(0x80000008000000L); + case 87: + case 119: + return jjMoveStringLiteralDfa1_0(0x1000000L); + default : + return jjMoveNfa_0(0, 0); + } +} +private final int jjMoveStringLiteralDfa1_0(long active0) +{ + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(0, active0, 0L); + return 1; + } + switch(curChar) + { + case 61: + if ((active0 & 0x80000000000L) != 0L) + return jjStopAtPos(1, 43); + break; + case 65: + case 97: + return jjMoveStringLiteralDfa2_0(active0, 0x1000600008044000L); + case 68: + case 100: + return jjMoveStringLiteralDfa2_0(active0, 0x400000000000000L); + case 69: + case 101: + return jjMoveStringLiteralDfa2_0(active0, 0xc4000000180620L); + case 72: + case 104: + return jjMoveStringLiteralDfa2_0(active0, 0x800000001000100L); + case 73: + case 105: + return jjMoveStringLiteralDfa2_0(active0, 0xa0400000L); + case 76: + case 108: + return jjMoveStringLiteralDfa2_0(active0, 0x120000000000c0L); + case 78: + case 110: + if ((active0 & 0x40000000000L) != 0L) + { + jjmatchedKind = 42; + jjmatchedPos = 1; + } + return jjMoveStringLiteralDfa2_0(active0, 0x8000100230000L); + case 79: + case 111: + return jjMoveStringLiteralDfa2_0(active0, 0x21820014000000L); + case 82: + case 114: + if ((active0 & 0x200000000L) != 0L) + return jjStartNfaWithStates_0(1, 33, 1); + return jjMoveStringLiteralDfa2_0(active0, 0x2000000002001800L); + case 83: + case 115: + if ((active0 & 0x2000L) != 0L) + return jjStartNfaWithStates_0(1, 13, 1); + break; + case 84: + case 116: + return jjMoveStringLiteralDfa2_0(active0, 0x800000L); + case 85: + case 117: + return jjMoveStringLiteralDfa2_0(active0, 0x300000040000000L); + case 88: + case 120: + return jjMoveStringLiteralDfa2_0(active0, 0x8000L); + case 89: + case 121: + if ((active0 & 0x4000000000000000L) != 0L) + return jjStartNfaWithStates_0(1, 62, 1); + break; + default : + break; + } + return jjStartNfa_0(0, active0, 0L); +} +private final int jjMoveStringLiteralDfa2_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(0, old0, 0L); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(1, active0, 0L); + return 2; + } + switch(curChar) + { + case 95: + return jjMoveStringLiteralDfa3_0(active0, 0x8000000000000L); + case 65: + case 97: + return jjMoveStringLiteralDfa3_0(active0, 0x800000000a00000L); + case 66: + case 98: + return jjMoveStringLiteralDfa3_0(active0, 0x40000L); + case 67: + case 99: + return jjMoveStringLiteralDfa3_0(active0, 0x84000000000000L); + case 68: + case 100: + if ((active0 & 0x100000000L) != 0L) + return jjStartNfaWithStates_0(2, 32, 1); + else if ((active0 & 0x400000000000000L) != 0L) + return jjStartNfaWithStates_0(2, 58, 1); + break; + case 69: + case 101: + return jjMoveStringLiteralDfa3_0(active0, 0x1000880L); + case 73: + case 105: + return jjMoveStringLiteralDfa3_0(active0, 0x8000L); + case 76: + case 108: + return jjMoveStringLiteralDfa3_0(active0, 0x18180020L); + case 77: + case 109: + return jjMoveStringLiteralDfa3_0(active0, 0x3008000e0000000L); + case 78: + case 110: + return jjMoveStringLiteralDfa3_0(active0, 0x1000000000000L); + case 79: + case 111: + return jjMoveStringLiteralDfa3_0(active0, 0x2012000002001100L); + case 82: + case 114: + if ((active0 & 0x4000L) != 0L) + return jjStartNfaWithStates_0(2, 14, 1); + break; + case 83: + case 115: + return jjMoveStringLiteralDfa3_0(active0, 0x410600L); + case 84: + case 116: + if ((active0 & 0x20000000000L) != 0L) + return jjStartNfaWithStates_0(2, 41, 1); + return jjMoveStringLiteralDfa3_0(active0, 0x40000000020040L); + case 85: + case 117: + return jjMoveStringLiteralDfa3_0(active0, 0x20000000000000L); + case 86: + case 118: + return jjMoveStringLiteralDfa3_0(active0, 0x1000000000000000L); + case 87: + case 119: + if ((active0 & 0x4000000L) != 0L) + return jjStartNfaWithStates_0(2, 26, 1); + break; + case 88: + case 120: + return jjMoveStringLiteralDfa3_0(active0, 0x600000000000L); + default : + break; + } + return jjStartNfa_0(1, active0, 0L); +} +private final int jjMoveStringLiteralDfa3_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(1, old0, 0L); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(2, active0, 0L); + return 3; + } + switch(curChar) + { + case 95: + return jjMoveStringLiteralDfa4_0(active0, 0x300600040000000L); + case 65: + case 97: + return jjMoveStringLiteralDfa4_0(active0, 0x400880L); + case 66: + case 98: + return jjMoveStringLiteralDfa4_0(active0, 0x200000L); + case 67: + case 99: + if ((active0 & 0x400L) != 0L) + { + jjmatchedKind = 10; + jjmatchedPos = 3; + } + return jjMoveStringLiteralDfa4_0(active0, 0x2000000000200L); + case 69: + case 101: + if ((active0 & 0x1000000000000L) != 0L) + return jjStartNfaWithStates_0(3, 48, 1); + else if ((active0 & 0x1000000000000000L) != 0L) + return jjStartNfaWithStates_0(3, 60, 1); + return jjMoveStringLiteralDfa4_0(active0, 0x20190040L); + case 73: + case 105: + return jjMoveStringLiteralDfa4_0(active0, 0x80000000L); + case 76: + case 108: + return jjMoveStringLiteralDfa4_0(active0, 0x40000L); + case 77: + case 109: + if ((active0 & 0x2000000L) != 0L) + return jjStartNfaWithStates_0(3, 25, 1); + return jjMoveStringLiteralDfa4_0(active0, 0x8000000000000L); + case 78: + case 110: + return jjMoveStringLiteralDfa4_0(active0, 0x820000000000000L); + case 79: + case 111: + if ((active0 & 0x20000L) != 0L) + return jjStartNfaWithStates_0(3, 17, 1); + return jjMoveStringLiteralDfa4_0(active0, 0x54000000000000L); + case 80: + case 112: + if ((active0 & 0x20L) != 0L) + return jjStartNfaWithStates_0(3, 5, 1); + else if ((active0 & 0x1000L) != 0L) + return jjStartNfaWithStates_0(3, 12, 1); + return jjMoveStringLiteralDfa4_0(active0, 0x800000000000L); + case 82: + case 114: + return jjMoveStringLiteralDfa4_0(active0, 0x1800000L); + case 84: + case 116: + if ((active0 & 0x8000L) != 0L) + return jjStartNfaWithStates_0(3, 15, 1); + return jjMoveStringLiteralDfa4_0(active0, 0x80000000000000L); + case 85: + case 117: + return jjMoveStringLiteralDfa4_0(active0, 0x2000000018000000L); + case 87: + case 119: + if ((active0 & 0x100L) != 0L) + return jjStartNfaWithStates_0(3, 8, 1); + break; + default : + break; + } + return jjStartNfa_0(2, active0, 0L); +} +private final int jjMoveStringLiteralDfa4_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(2, old0, 0L); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(3, active0, 0L); + return 4; + } + switch(curChar) + { + case 66: + case 98: + return jjMoveStringLiteralDfa5_0(active0, 0x400000L); + case 67: + case 99: + return jjMoveStringLiteralDfa5_0(active0, 0x100000L); + case 69: + case 101: + if ((active0 & 0x40000L) != 0L) + return jjStartNfaWithStates_0(4, 18, 1); + else if ((active0 & 0x1000000L) != 0L) + return jjStartNfaWithStates_0(4, 24, 1); + return jjMoveStringLiteralDfa5_0(active0, 0x208000008000000L); + case 71: + case 103: + return jjMoveStringLiteralDfa5_0(active0, 0x800000000000000L); + case 72: + case 104: + return jjMoveStringLiteralDfa5_0(active0, 0x100000000000000L); + case 75: + case 107: + if ((active0 & 0x2000000000000L) != 0L) + return jjStartNfaWithStates_0(4, 49, 1); + break; + case 76: + case 108: + return jjMoveStringLiteralDfa5_0(active0, 0x400000200000L); + case 77: + case 109: + return jjMoveStringLiteralDfa5_0(active0, 0x10000010000000L); + case 79: + case 111: + return jjMoveStringLiteralDfa5_0(active0, 0x80000000000000L); + case 80: + case 112: + if ((active0 & 0x2000000000000000L) != 0L) + return jjStartNfaWithStates_0(4, 61, 1); + break; + case 82: + case 114: + if ((active0 & 0x40L) != 0L) + return jjStartNfaWithStates_0(4, 6, 1); + else if ((active0 & 0x80L) != 0L) + return jjStartNfaWithStates_0(4, 7, 1); + return jjMoveStringLiteralDfa5_0(active0, 0x4800000010200L); + case 83: + case 115: + return jjMoveStringLiteralDfa5_0(active0, 0x20000000L); + case 84: + case 116: + if ((active0 & 0x80000000L) != 0L) + return jjStartNfaWithStates_0(4, 31, 1); + return jjMoveStringLiteralDfa5_0(active0, 0x20000000880800L); + case 85: + case 117: + return jjMoveStringLiteralDfa5_0(active0, 0x40000000000000L); + case 86: + case 118: + return jjMoveStringLiteralDfa5_0(active0, 0x200040000000L); + default : + break; + } + return jjStartNfa_0(3, active0, 0L); +} +private final int jjMoveStringLiteralDfa5_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(3, old0, 0L); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(4, active0, 0L); + return 5; + } + switch(curChar) + { + case 65: + case 97: + return jjMoveStringLiteralDfa6_0(active0, 0x100000000000000L); + case 67: + case 99: + return jjMoveStringLiteralDfa6_0(active0, 0x40000000000000L); + case 68: + case 100: + if ((active0 & 0x4000000000000L) != 0L) + return jjStartNfaWithStates_0(5, 50, 1); + break; + case 69: + case 101: + if ((active0 & 0x800L) != 0L) + return jjStartNfaWithStates_0(5, 11, 1); + else if ((active0 & 0x80000L) != 0L) + return jjStartNfaWithStates_0(5, 19, 1); + else if ((active0 & 0x200000L) != 0L) + return jjStartNfaWithStates_0(5, 21, 1); + else if ((active0 & 0x800000000000000L) != 0L) + return jjStartNfaWithStates_0(5, 59, 1); + return jjMoveStringLiteralDfa6_0(active0, 0xe00040000000L); + case 70: + case 102: + return jjMoveStringLiteralDfa6_0(active0, 0x10000000000000L); + case 73: + case 105: + return jjMoveStringLiteralDfa6_0(active0, 0x20000000800200L); + case 76: + case 108: + return jjMoveStringLiteralDfa6_0(active0, 0x400000L); + case 77: + case 109: + return jjMoveStringLiteralDfa6_0(active0, 0x8000000000000L); + case 78: + case 110: + return jjMoveStringLiteralDfa6_0(active0, 0x200000010000000L); + case 82: + case 114: + return jjMoveStringLiteralDfa6_0(active0, 0x80000000000000L); + case 83: + case 115: + if ((active0 & 0x8000000L) != 0L) + return jjStartNfaWithStates_0(5, 27, 1); + break; + case 84: + case 116: + if ((active0 & 0x10000L) != 0L) + return jjStartNfaWithStates_0(5, 16, 1); + else if ((active0 & 0x100000L) != 0L) + return jjStartNfaWithStates_0(5, 20, 1); + return jjMoveStringLiteralDfa6_0(active0, 0x20000000L); + default : + break; + } + return jjStartNfa_0(4, active0, 0L); +} +private final int jjMoveStringLiteralDfa6_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(4, old0, 0L); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(5, active0, 0L); + return 6; + } + switch(curChar) + { + case 95: + return jjMoveStringLiteralDfa7_0(active0, 0x80000000000000L); + case 65: + case 97: + return jjMoveStringLiteralDfa7_0(active0, 0x20000000L); + case 66: + case 98: + return jjMoveStringLiteralDfa7_0(active0, 0x200L); + case 69: + case 101: + if ((active0 & 0x400000L) != 0L) + return jjStartNfaWithStates_0(6, 22, 1); + break; + case 70: + case 102: + return jjMoveStringLiteralDfa7_0(active0, 0x10000000L); + case 72: + case 104: + return jjMoveStringLiteralDfa7_0(active0, 0x40000000000000L); + case 73: + case 105: + return jjMoveStringLiteralDfa7_0(active0, 0x10000000000000L); + case 78: + case 110: + return jjMoveStringLiteralDfa7_0(active0, 0x20400000800000L); + case 79: + case 111: + return jjMoveStringLiteralDfa7_0(active0, 0x8000000000000L); + case 82: + case 114: + return jjMoveStringLiteralDfa7_0(active0, 0x200040000000L); + case 83: + case 115: + return jjMoveStringLiteralDfa7_0(active0, 0x100800000000000L); + case 84: + case 116: + return jjMoveStringLiteralDfa7_0(active0, 0x200000000000000L); + default : + break; + } + return jjStartNfa_0(5, active0, 0L); +} +private final int jjMoveStringLiteralDfa7_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(5, old0, 0L); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(6, active0, 0L); + return 7; + } + switch(curChar) + { + case 65: + case 97: + return jjMoveStringLiteralDfa8_0(active0, 0x10000000L); + case 69: + case 101: + if ((active0 & 0x200L) != 0L) + return jjStartNfaWithStates_0(7, 9, 1); + return jjMoveStringLiteralDfa8_0(active0, 0x40000000000000L); + case 71: + case 103: + if ((active0 & 0x800000L) != 0L) + return jjStartNfaWithStates_0(7, 23, 1); + return jjMoveStringLiteralDfa8_0(active0, 0x20400000000000L); + case 72: + case 104: + if ((active0 & 0x100000000000000L) != 0L) + return jjStartNfaWithStates_0(7, 56, 1); + break; + case 76: + case 108: + return jjMoveStringLiteralDfa8_0(active0, 0x10000000000000L); + case 77: + case 109: + return jjMoveStringLiteralDfa8_0(active0, 0x20000000L); + case 82: + case 114: + return jjMoveStringLiteralDfa8_0(active0, 0x208000000000000L); + case 83: + case 115: + return jjMoveStringLiteralDfa8_0(active0, 0x80a00040000000L); + default : + break; + } + return jjStartNfa_0(6, active0, 0L); +} +private final int jjMoveStringLiteralDfa8_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(6, old0, 0L); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(7, active0, 0L); + return 8; + } + switch(curChar) + { + case 95: + return jjMoveStringLiteralDfa9_0(active0, 0x20000000000000L); + case 68: + case 100: + return jjMoveStringLiteralDfa9_0(active0, 0x40000000000000L); + case 73: + case 105: + return jjMoveStringLiteralDfa9_0(active0, 0x280a00040000000L); + case 77: + case 109: + return jjMoveStringLiteralDfa9_0(active0, 0x10000000L); + case 80: + case 112: + if ((active0 & 0x20000000L) != 0L) + return jjStartNfaWithStates_0(8, 29, 1); + break; + case 84: + case 116: + return jjMoveStringLiteralDfa9_0(active0, 0x10400000000000L); + case 89: + case 121: + if ((active0 & 0x8000000000000L) != 0L) + return jjStartNfaWithStates_0(8, 51, 1); + break; + default : + break; + } + return jjStartNfa_0(7, active0, 0L); +} +private final int jjMoveStringLiteralDfa9_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(7, old0, 0L); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(8, active0, 0L); + return 9; + } + switch(curChar) + { + case 95: + return jjMoveStringLiteralDfa10_0(active0, 0x40000000000000L); + case 66: + case 98: + return jjMoveStringLiteralDfa10_0(active0, 0x20000000000000L); + case 69: + case 101: + return jjMoveStringLiteralDfa10_0(active0, 0x210000000000000L); + case 72: + case 104: + if ((active0 & 0x400000000000L) != 0L) + return jjStartNfaWithStates_0(9, 46, 1); + break; + case 73: + case 105: + return jjMoveStringLiteralDfa10_0(active0, 0x10000000L); + case 79: + case 111: + return jjMoveStringLiteralDfa10_0(active0, 0xa00040000000L); + case 90: + case 122: + return jjMoveStringLiteralDfa10_0(active0, 0x80000000000000L); + default : + break; + } + return jjStartNfa_0(8, active0, 0L); +} +private final int jjMoveStringLiteralDfa10_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(8, old0, 0L); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(9, active0, 0L); + return 10; + } + switch(curChar) + { + case 66: + case 98: + return jjMoveStringLiteralDfa11_0(active0, 0x40000000000000L); + case 69: + case 101: + if ((active0 & 0x80000000000000L) != 0L) + return jjStartNfaWithStates_0(10, 55, 1); + break; + case 76: + case 108: + return jjMoveStringLiteralDfa11_0(active0, 0x20000010000000L); + case 78: + case 110: + if ((active0 & 0x800000000000L) != 0L) + return jjStartNfaWithStates_0(10, 47, 1); + return jjMoveStringLiteralDfa11_0(active0, 0x200040000000L); + case 82: + case 114: + if ((active0 & 0x10000000000000L) != 0L) + return jjStartNfaWithStates_0(10, 52, 1); + break; + case 83: + case 115: + if ((active0 & 0x200000000000000L) != 0L) + return jjStartNfaWithStates_0(10, 57, 1); + break; + default : + break; + } + return jjStartNfa_0(9, active0, 0L); +} +private final int jjMoveStringLiteralDfa11_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(9, old0, 0L); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(10, active0, 0L); + return 11; + } + switch(curChar) + { + case 73: + case 105: + return jjMoveStringLiteralDfa12_0(active0, 0x10000000L); + case 76: + case 108: + return jjMoveStringLiteralDfa12_0(active0, 0x40000000000000L); + case 79: + case 111: + return jjMoveStringLiteralDfa12_0(active0, 0x20000000000000L); + case 83: + case 115: + if ((active0 & 0x40000000L) != 0L) + return jjStartNfaWithStates_0(11, 30, 1); + else if ((active0 & 0x200000000000L) != 0L) + return jjStartNfaWithStates_0(11, 45, 1); + break; + default : + break; + } + return jjStartNfa_0(10, active0, 0L); +} +private final int jjMoveStringLiteralDfa12_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(10, old0, 0L); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(11, active0, 0L); + return 12; + } + switch(curChar) + { + case 69: + case 101: + return jjMoveStringLiteralDfa13_0(active0, 0x10000000L); + case 79: + case 111: + return jjMoveStringLiteralDfa13_0(active0, 0x60000000000000L); + default : + break; + } + return jjStartNfa_0(11, active0, 0L); +} +private final int jjMoveStringLiteralDfa13_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(11, old0, 0L); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(12, active0, 0L); + return 13; + } + switch(curChar) + { + case 77: + case 109: + return jjMoveStringLiteralDfa14_0(active0, 0x20000000000000L); + case 79: + case 111: + return jjMoveStringLiteralDfa14_0(active0, 0x40000000000000L); + case 83: + case 115: + if ((active0 & 0x10000000L) != 0L) + return jjStartNfaWithStates_0(13, 28, 1); + break; + default : + break; + } + return jjStartNfa_0(12, active0, 0L); +} +private final int jjMoveStringLiteralDfa14_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(12, old0, 0L); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(13, active0, 0L); + return 14; + } + switch(curChar) + { + case 70: + case 102: + return jjMoveStringLiteralDfa15_0(active0, 0x20000000000000L); + case 77: + case 109: + return jjMoveStringLiteralDfa15_0(active0, 0x40000000000000L); + default : + break; + } + return jjStartNfa_0(13, active0, 0L); +} +private final int jjMoveStringLiteralDfa15_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(13, old0, 0L); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(14, active0, 0L); + return 15; + } + switch(curChar) + { + case 70: + case 102: + return jjMoveStringLiteralDfa16_0(active0, 0x40000000000000L); + case 73: + case 105: + return jjMoveStringLiteralDfa16_0(active0, 0x20000000000000L); + default : + break; + } + return jjStartNfa_0(14, active0, 0L); +} +private final int jjMoveStringLiteralDfa16_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(14, old0, 0L); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(15, active0, 0L); + return 16; + } + switch(curChar) + { + case 73: + case 105: + return jjMoveStringLiteralDfa17_0(active0, 0x40000000000000L); + case 76: + case 108: + return jjMoveStringLiteralDfa17_0(active0, 0x20000000000000L); + default : + break; + } + return jjStartNfa_0(15, active0, 0L); +} +private final int jjMoveStringLiteralDfa17_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(15, old0, 0L); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(16, active0, 0L); + return 17; + } + switch(curChar) + { + case 76: + case 108: + return jjMoveStringLiteralDfa18_0(active0, 0x40000000000000L); + case 84: + case 116: + return jjMoveStringLiteralDfa18_0(active0, 0x20000000000000L); + default : + break; + } + return jjStartNfa_0(16, active0, 0L); +} +private final int jjMoveStringLiteralDfa18_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(16, old0, 0L); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(17, active0, 0L); + return 18; + } + switch(curChar) + { + case 69: + case 101: + return jjMoveStringLiteralDfa19_0(active0, 0x20000000000000L); + case 84: + case 116: + return jjMoveStringLiteralDfa19_0(active0, 0x40000000000000L); + default : + break; + } + return jjStartNfa_0(17, active0, 0L); +} +private final int jjMoveStringLiteralDfa19_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(17, old0, 0L); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(18, active0, 0L); + return 19; + } + switch(curChar) + { + case 69: + case 101: + return jjMoveStringLiteralDfa20_0(active0, 0x40000000000000L); + case 82: + case 114: + if ((active0 & 0x20000000000000L) != 0L) + return jjStartNfaWithStates_0(19, 53, 1); + break; + default : + break; + } + return jjStartNfa_0(18, active0, 0L); +} +private final int jjMoveStringLiteralDfa20_0(long old0, long active0) +{ + if (((active0 &= old0)) == 0L) + return jjStartNfa_0(18, old0, 0L); + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { + jjStopStringLiteralDfa_0(19, active0, 0L); + return 20; + } + switch(curChar) + { + case 82: + case 114: + if ((active0 & 0x40000000000000L) != 0L) + return jjStartNfaWithStates_0(20, 54, 1); + break; + default : + break; + } + return jjStartNfa_0(19, active0, 0L); +} +private final void jjCheckNAdd(int state) +{ + if (jjrounds[state] != jjround) + { + jjstateSet[jjnewStateCnt++] = state; + jjrounds[state] = jjround; + } +} +private final void jjAddStates(int start, int end) +{ + do { + jjstateSet[jjnewStateCnt++] = jjnextStates[start]; + } while (start++ != end); +} +private final void jjCheckNAddTwoStates(int state1, int state2) +{ + jjCheckNAdd(state1); + jjCheckNAdd(state2); +} +private final void jjCheckNAddStates(int start, int end) +{ + do { + jjCheckNAdd(jjnextStates[start]); + } while (start++ != end); +} +private final void jjCheckNAddStates(int start) +{ + jjCheckNAdd(jjnextStates[start]); + jjCheckNAdd(jjnextStates[start + 1]); +} static final long[] jjbitVec0 = { 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL -}; -private final int jjMoveNfa_0(int startState, int curPos) -{ - int[] nextStates; - int startsAt = 0; - jjnewStateCnt = 32; - int i = 1; - jjstateSet[0] = startState; - int j, kind = 0x7fffffff; - for (;;) - { - if (++jjround == 0x7fffffff) - ReInitRounds(); - if (curChar < 64) - { - long l = 1L << curChar; - MatchLoop: do - { - switch(jjstateSet[--i]) - { - case 0: - if ((0x3ff000000000000L & l) != 0L) - { - if (kind > 57) - kind = 57; - jjCheckNAddStates(0, 6); - } - else if ((0x400e00000000000L & l) != 0L) - { - if (kind > 56) - kind = 56; - jjCheckNAdd(1); - } - else if (curChar == 39) - jjCheckNAddStates(7, 9); - else if (curChar == 34) - jjCheckNAdd(8); - if (curChar == 46) - jjCheckNAdd(3); - break; - case 32: - if ((0x7ffe00000000000L & l) != 0L) - { - if (kind > 56) - kind = 56; - jjCheckNAdd(1); - } - if ((0x3ff000000000000L & l) != 0L) - { - if (kind > 58) - kind = 58; - jjCheckNAddTwoStates(3, 4); - } - break; - case 1: - if ((0x7ffe00000000000L & l) == 0L) - break; - if (kind > 56) - kind = 56; - jjCheckNAdd(1); - break; - case 2: - if (curChar == 46) - jjCheckNAdd(3); - break; - case 3: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 58) - kind = 58; - jjCheckNAddTwoStates(3, 4); - break; - case 5: - if ((0x280000000000L & l) != 0L) - jjCheckNAdd(6); - break; - case 6: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 58) - kind = 58; - jjCheckNAdd(6); - break; - case 7: - if (curChar == 34) - jjCheckNAdd(8); - break; - case 8: - if ((0xfffffffbffffffffL & l) != 0L) - jjCheckNAddTwoStates(8, 9); - break; - case 9: - if (curChar == 34 && kind > 60) - kind = 60; - break; - case 10: - if (curChar == 39) - jjCheckNAddStates(7, 9); - break; - case 11: - if ((0xffffff7fffffffffL & l) != 0L) - jjCheckNAddStates(7, 9); - break; - case 12: - if (curChar == 39) - jjCheckNAddStates(10, 12); - break; - case 13: - if (curChar == 39) - jjstateSet[jjnewStateCnt++] = 12; - break; - case 14: - if ((0xffffff7fffffffffL & l) != 0L) - jjCheckNAddStates(10, 12); - break; - case 15: - if (curChar == 39 && kind > 61) - kind = 61; - break; - case 16: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 57) - kind = 57; - jjCheckNAddStates(0, 6); - break; - case 17: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 57) - kind = 57; - jjCheckNAdd(17); - break; - case 18: - if ((0x3ff000000000000L & l) != 0L) - jjCheckNAddTwoStates(18, 19); - break; - case 19: - if (curChar == 46) - jjCheckNAdd(20); - break; - case 20: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 58) - kind = 58; - jjCheckNAddTwoStates(20, 21); - break; - case 22: - if ((0x280000000000L & l) != 0L) - jjCheckNAdd(23); - break; - case 23: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 58) - kind = 58; - jjCheckNAdd(23); - break; - case 24: - if ((0x3ff000000000000L & l) != 0L) - jjCheckNAddTwoStates(24, 25); - break; - case 26: - if ((0x280000000000L & l) != 0L) - jjCheckNAdd(27); - break; - case 27: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 58) - kind = 58; - jjCheckNAdd(27); - break; - case 28: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 58) - kind = 58; - jjCheckNAddTwoStates(28, 29); - break; - case 30: - if ((0x280000000000L & l) != 0L) - jjCheckNAdd(31); - break; - case 31: - if ((0x3ff000000000000L & l) == 0L) - break; - if (kind > 58) - kind = 58; - jjCheckNAdd(31); - break; - default : break; - } - } while(i != startsAt); - } - else if (curChar < 128) - { - long l = 1L << (curChar & 077); - MatchLoop: do - { - switch(jjstateSet[--i]) - { - case 0: - if ((0x7fffffe87fffffeL & l) == 0L) - break; - if (kind > 56) - kind = 56; - jjCheckNAdd(1); - break; - case 32: - case 1: - if ((0x7fffffe87fffffeL & l) == 0L) - break; - if (kind > 56) - kind = 56; - jjCheckNAdd(1); - break; - case 4: - if ((0x2000000020L & l) != 0L) - jjAddStates(13, 14); - break; - case 8: - jjAddStates(15, 16); - break; - case 11: - jjCheckNAddStates(7, 9); - break; - case 14: - jjCheckNAddStates(10, 12); - break; - case 21: - if ((0x2000000020L & l) != 0L) - jjAddStates(17, 18); - break; - case 25: - if ((0x2000000020L & l) != 0L) - jjAddStates(19, 20); - break; - case 29: - if ((0x2000000020L & l) != 0L) - jjAddStates(21, 22); - break; - default : break; - } - } while(i != startsAt); - } - else - { - int i2 = (curChar & 0xff) >> 6; - long l2 = 1L << (curChar & 077); - MatchLoop: do - { - switch(jjstateSet[--i]) - { - case 8: - if ((jjbitVec0[i2] & l2) != 0L) - jjAddStates(15, 16); - break; - case 11: - if ((jjbitVec0[i2] & l2) != 0L) - jjCheckNAddStates(7, 9); - break; - case 14: - if ((jjbitVec0[i2] & l2) != 0L) - jjCheckNAddStates(10, 12); - break; - default : break; - } - } while(i != startsAt); - } - if (kind != 0x7fffffff) - { - jjmatchedKind = kind; - jjmatchedPos = curPos; - kind = 0x7fffffff; - } - ++curPos; - if ((i = jjnewStateCnt) == (startsAt = 32 - (jjnewStateCnt = startsAt))) - return curPos; - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { return curPos; } - } -} +}; +private final int jjMoveNfa_0(int startState, int curPos) +{ + int[] nextStates; + int startsAt = 0; + jjnewStateCnt = 32; + int i = 1; + jjstateSet[0] = startState; + int j, kind = 0x7fffffff; + for (;;) + { + if (++jjround == 0x7fffffff) + ReInitRounds(); + if (curChar < 64) + { + long l = 1L << curChar; + MatchLoop: do + { + switch(jjstateSet[--i]) + { + case 0: + if ((0x3ff000000000000L & l) != 0L) + { + if (kind > 64) + kind = 64; + jjCheckNAddStates(0, 6); + } + else if ((0x400a00000000000L & l) != 0L) + { + if (kind > 63) + kind = 63; + jjCheckNAdd(1); + } + else if (curChar == 39) + jjCheckNAddStates(7, 9); + else if (curChar == 34) + jjCheckNAdd(8); + else if (curChar == 46) + jjCheckNAdd(3); + break; + case 1: + if ((0x7ffa00000000000L & l) == 0L) + break; + if (kind > 63) + kind = 63; + jjCheckNAdd(1); + break; + case 2: + if (curChar == 46) + jjCheckNAdd(3); + break; + case 3: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 65) + kind = 65; + jjCheckNAddTwoStates(3, 4); + break; + case 5: + if ((0x280000000000L & l) != 0L) + jjCheckNAdd(6); + break; + case 6: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 65) + kind = 65; + jjCheckNAdd(6); + break; + case 7: + if (curChar == 34) + jjCheckNAdd(8); + break; + case 8: + if ((0xfffffffbffffffffL & l) != 0L) + jjCheckNAddTwoStates(8, 9); + break; + case 9: + if (curChar == 34 && kind > 67) + kind = 67; + break; + case 10: + if (curChar == 39) + jjCheckNAddStates(7, 9); + break; + case 11: + if ((0xffffff7fffffffffL & l) != 0L) + jjCheckNAddStates(7, 9); + break; + case 12: + if (curChar == 39) + jjCheckNAddStates(10, 12); + break; + case 13: + if (curChar == 39) + jjstateSet[jjnewStateCnt++] = 12; + break; + case 14: + if ((0xffffff7fffffffffL & l) != 0L) + jjCheckNAddStates(10, 12); + break; + case 15: + if (curChar == 39 && kind > 68) + kind = 68; + break; + case 16: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 64) + kind = 64; + jjCheckNAddStates(0, 6); + break; + case 17: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 64) + kind = 64; + jjCheckNAdd(17); + break; + case 18: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddTwoStates(18, 19); + break; + case 19: + if (curChar == 46) + jjCheckNAdd(20); + break; + case 20: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 65) + kind = 65; + jjCheckNAddTwoStates(20, 21); + break; + case 22: + if ((0x280000000000L & l) != 0L) + jjCheckNAdd(23); + break; + case 23: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 65) + kind = 65; + jjCheckNAdd(23); + break; + case 24: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddTwoStates(24, 25); + break; + case 26: + if ((0x280000000000L & l) != 0L) + jjCheckNAdd(27); + break; + case 27: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 65) + kind = 65; + jjCheckNAdd(27); + break; + case 28: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 65) + kind = 65; + jjCheckNAddTwoStates(28, 29); + break; + case 30: + if ((0x280000000000L & l) != 0L) + jjCheckNAdd(31); + break; + case 31: + if ((0x3ff000000000000L & l) == 0L) + break; + if (kind > 65) + kind = 65; + jjCheckNAdd(31); + break; + default : break; + } + } while(i != startsAt); + } + else if (curChar < 128) + { + long l = 1L << (curChar & 077); + MatchLoop: do + { + switch(jjstateSet[--i]) + { + case 0: + case 1: + if ((0x7fffffe87fffffeL & l) == 0L) + break; + if (kind > 63) + kind = 63; + jjCheckNAdd(1); + break; + case 4: + if ((0x2000000020L & l) != 0L) + jjAddStates(13, 14); + break; + case 8: + jjAddStates(15, 16); + break; + case 11: + jjCheckNAddStates(7, 9); + break; + case 14: + jjCheckNAddStates(10, 12); + break; + case 21: + if ((0x2000000020L & l) != 0L) + jjAddStates(17, 18); + break; + case 25: + if ((0x2000000020L & l) != 0L) + jjAddStates(19, 20); + break; + case 29: + if ((0x2000000020L & l) != 0L) + jjAddStates(21, 22); + break; + default : break; + } + } while(i != startsAt); + } + else + { + int i2 = (curChar & 0xff) >> 6; + long l2 = 1L << (curChar & 077); + MatchLoop: do + { + switch(jjstateSet[--i]) + { + case 8: + if ((jjbitVec0[i2] & l2) != 0L) + jjAddStates(15, 16); + break; + case 11: + if ((jjbitVec0[i2] & l2) != 0L) + jjCheckNAddStates(7, 9); + break; + case 14: + if ((jjbitVec0[i2] & l2) != 0L) + jjCheckNAddStates(10, 12); + break; + default : break; + } + } while(i != startsAt); + } + if (kind != 0x7fffffff) + { + jjmatchedKind = kind; + jjmatchedPos = curPos; + kind = 0x7fffffff; + } + ++curPos; + if ((i = jjnewStateCnt) == (startsAt = 32 - (jjnewStateCnt = startsAt))) + return curPos; + try { curChar = input_stream.readChar(); } + catch(java.io.IOException e) { return curPos; } + } +} static final int[] jjnextStates = { 17, 18, 19, 24, 25, 28, 29, 11, 13, 15, 13, 14, 15, 5, 6, 8, 9, 22, 23, 26, 27, 30, 31, -}; -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, 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", -}; +}; +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, null, null, +null, null, null, null, null, null, null, "\54", "\56", "\50", "\51", "\75", "\76", +"\74", null, null, "\41\75", "\52", null, null, null, 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 = { - 0x77ffffffffffffe1L, -}; + 0xffffffffffffffe1L, 0x3bL, +}; static final long[] jjtoSkip = { - 0x1eL, -}; -protected SimpleCharStream input_stream; -private final int[] jjrounds = new int[32]; -private final int[] jjstateSet = new int[64]; -protected char curChar; -public ParserTokenManager(SimpleCharStream stream){ - if (SimpleCharStream.staticFlag) - throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer."); - input_stream = stream; -} -public ParserTokenManager(SimpleCharStream stream, int lexState){ - this(stream); - SwitchTo(lexState); -} -public void ReInit(SimpleCharStream stream) -{ - jjmatchedPos = jjnewStateCnt = 0; - curLexState = defaultLexState; - input_stream = stream; - ReInitRounds(); -} -private final void ReInitRounds() -{ - int i; - jjround = 0x80000001; - for (i = 32; i-- > 0;) - jjrounds[i] = 0x80000000; -} -public void ReInit(SimpleCharStream stream, int lexState) -{ - ReInit(stream); - SwitchTo(lexState); -} -public void SwitchTo(int lexState) -{ - if (lexState >= 1 || lexState < 0) - throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE); - else - curLexState = lexState; -} - -protected Token jjFillToken() -{ - Token t = Token.newToken(jjmatchedKind); - t.kind = jjmatchedKind; - String im = jjstrLiteralImages[jjmatchedKind]; - t.image = (im == null) ? input_stream.GetImage() : im; - t.beginLine = input_stream.getBeginLine(); - t.beginColumn = input_stream.getBeginColumn(); - t.endLine = input_stream.getEndLine(); - t.endColumn = input_stream.getEndColumn(); - return t; -} - -int curLexState = 0; -int defaultLexState = 0; -int jjnewStateCnt; -int jjround; -int jjmatchedPos; -int jjmatchedKind; - -public Token getNextToken() -{ - int kind; - Token specialToken = null; - Token matchedToken; - int curPos = 0; - + 0x1eL, 0x0L, +}; +protected SimpleCharStream input_stream; +private final int[] jjrounds = new int[32]; +private final int[] jjstateSet = new int[64]; +protected char curChar; +public ParserTokenManager(SimpleCharStream stream){ + if (SimpleCharStream.staticFlag) + throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer."); + input_stream = stream; +} +public ParserTokenManager(SimpleCharStream stream, int lexState){ + this(stream); + SwitchTo(lexState); +} +public void ReInit(SimpleCharStream stream) +{ + jjmatchedPos = jjnewStateCnt = 0; + curLexState = defaultLexState; + input_stream = stream; + ReInitRounds(); +} +private final void ReInitRounds() +{ + int i; + jjround = 0x80000001; + for (i = 32; i-- > 0;) + jjrounds[i] = 0x80000000; +} +public void ReInit(SimpleCharStream stream, int lexState) +{ + ReInit(stream); + SwitchTo(lexState); +} +public void SwitchTo(int lexState) +{ + if (lexState >= 1 || lexState < 0) + throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE); + else + curLexState = lexState; +} + +protected Token jjFillToken() +{ + Token t = Token.newToken(jjmatchedKind); + t.kind = jjmatchedKind; + String im = jjstrLiteralImages[jjmatchedKind]; + t.image = (im == null) ? input_stream.GetImage() : im; + t.beginLine = input_stream.getBeginLine(); + t.beginColumn = input_stream.getBeginColumn(); + t.endLine = input_stream.getEndLine(); + t.endColumn = input_stream.getEndColumn(); + return t; +} + +int curLexState = 0; +int defaultLexState = 0; +int jjnewStateCnt; +int jjround; +int jjmatchedPos; +int jjmatchedKind; + +public Token getNextToken() +{ + int kind; + Token specialToken = null; + Token matchedToken; + int curPos = 0; + EOFLoop : - for (;;) - { - try - { - curChar = input_stream.BeginToken(); - } - catch(java.io.IOException e) - { - jjmatchedKind = 0; - matchedToken = jjFillToken(); - return matchedToken; - } - - try { input_stream.backup(0); - while (curChar <= 32 && (0x100002600L & (1L << curChar)) != 0L) - curChar = input_stream.BeginToken(); - } - catch (java.io.IOException e1) { continue EOFLoop; } - jjmatchedKind = 0x7fffffff; - jjmatchedPos = 0; - curPos = jjMoveStringLiteralDfa0_0(); - if (jjmatchedKind != 0x7fffffff) - { - if (jjmatchedPos + 1 < curPos) - input_stream.backup(curPos - jjmatchedPos - 1); - if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) - { - matchedToken = jjFillToken(); - return matchedToken; - } - else - { - continue EOFLoop; - } - } - int error_line = input_stream.getEndLine(); - int error_column = input_stream.getEndColumn(); - String error_after = null; - boolean EOFSeen = false; - try { input_stream.readChar(); input_stream.backup(1); } - catch (java.io.IOException e1) { - EOFSeen = true; - error_after = curPos <= 1 ? "" : input_stream.GetImage(); - if (curChar == '\n' || curChar == '\r') { - error_line++; - error_column = 0; - } - else - error_column++; - } - if (!EOFSeen) { - input_stream.backup(1); - error_after = curPos <= 1 ? "" : input_stream.GetImage(); - } - throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR); - } -} - -} + for (;;) + { + try + { + curChar = input_stream.BeginToken(); + } + catch(java.io.IOException e) + { + jjmatchedKind = 0; + matchedToken = jjFillToken(); + return matchedToken; + } + + try { input_stream.backup(0); + while (curChar <= 32 && (0x100002600L & (1L << curChar)) != 0L) + curChar = input_stream.BeginToken(); + } + catch (java.io.IOException e1) { continue EOFLoop; } + jjmatchedKind = 0x7fffffff; + jjmatchedPos = 0; + curPos = jjMoveStringLiteralDfa0_0(); + if (jjmatchedKind != 0x7fffffff) + { + if (jjmatchedPos + 1 < curPos) + input_stream.backup(curPos - jjmatchedPos - 1); + if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) + { + matchedToken = jjFillToken(); + return matchedToken; + } + else + { + continue EOFLoop; + } + } + int error_line = input_stream.getEndLine(); + int error_column = input_stream.getEndColumn(); + String error_after = null; + boolean EOFSeen = false; + try { input_stream.readChar(); input_stream.backup(1); } + catch (java.io.IOException e1) { + EOFSeen = true; + error_after = curPos <= 1 ? "" : input_stream.GetImage(); + if (curChar == '\n' || curChar == '\r') { + error_line++; + error_column = 0; + } + else + error_column++; + } + if (!EOFSeen) { + input_stream.backup(1); + error_after = curPos <= 1 ? "" : input_stream.GetImage(); + } + throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR); + } +} + +} 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 583354) +++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/generated/ParserConstants.java (working copy) @@ -1,133 +1,147 @@ -/* Generated By:JavaCC: Do not edit this line. ParserConstants.java */ -package org.apache.hadoop.hbase.shell.generated; - -public interface ParserConstants { - - int EOF = 0; - int HELP = 5; - 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 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 DOT = 35; - int LPAREN = 36; - int RPAREN = 37; - int EQUALS = 38; - int NOTEQUAL = 39; - int ASTERISK = 40; - int MAX_VERSIONS = 41; - int MAX_LENGTH = 42; - int COMPRESSION = 43; - int NONE = 44; - int BLOCK = 45; - int RECORD = 46; - int IN_MEMORY = 47; - int BLOOMFILTER = 48; - int COUNTING_BLOOMFILTER = 49; - int RETOUCHED_BLOOMFILTER = 50; - int VECTOR_SIZE = 51; - int NUM_HASH = 52; - int NUM_ENTRIES = 53; - int ADD = 54; - int CHANGE = 55; - int ID = 56; - int INTEGER_LITERAL = 57; - int FLOATING_POINT_LITERAL = 58; - int EXPONENT = 59; - int QUOTED_IDENTIFIER = 60; - int STRING_LITERAL = 61; - - int DEFAULT = 0; - - String[] tokenImage = { - "", - "\" \"", - "\"\\t\"", - "\"\\r\"", - "\"\\n\"", - "\"help\"", - "\"alter\"", - "\"clear\"", - "\"show\"", - "\"describe\"", - "\"desc\"", - "\"create\"", - "\"drop\"", - "\"fs\"", - "\"jar\"", - "\"exit\"", - "\"insert\"", - "\"into\"", - "\"table\"", - "\"delete\"", - "\"select\"", - "\"enable\"", - "\"disable\"", - "\"starting\"", - "\"where\"", - "\"from\"", - "\"row\"", - "\"values\"", - "\"columnfamilies\"", - "\"timestamp\"", - "\"num_versions\"", - "\"limit\"", - "\"and\"", - "\"or\"", - "\",\"", - "\".\"", - "\"(\"", - "\")\"", - "\"=\"", - "\"<>\"", - "\"*\"", - "\"max_versions\"", - "\"max_length\"", - "\"compression\"", - "\"none\"", - "\"block\"", - "\"record\"", - "\"in_memory\"", - "\"bloomfilter\"", - "\"counting_bloomfilter\"", - "\"retouched_bloomfilter\"", - "\"vector_size\"", - "\"num_hash\"", - "\"num_entries\"", - "\"add\"", - "\"change\"", - "", - "", - "", - "", - "", - "", - "\";\"", - }; - -} +/* Generated By:JavaCC: Do not edit this line. ParserConstants.java */ +package org.apache.hadoop.hbase.shell.generated; + +public interface ParserConstants { + + int EOF = 0; + int HELP = 5; + 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 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 DOT = 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 SAVE = 60; + int GROUP = 61; + int BY = 62; + int ID = 63; + int INTEGER_LITERAL = 64; + int FLOATING_POINT_LITERAL = 65; + int EXPONENT = 66; + int QUOTED_IDENTIFIER = 67; + int STRING_LITERAL = 68; + + int DEFAULT = 0; + + String[] tokenImage = { + "", + "\" \"", + "\"\\t\"", + "\"\\r\"", + "\"\\n\"", + "\"help\"", + "\"alter\"", + "\"clear\"", + "\"show\"", + "\"describe\"", + "\"desc\"", + "\"create\"", + "\"drop\"", + "\"fs\"", + "\"jar\"", + "\"exit\"", + "\"insert\"", + "\"into\"", + "\"table\"", + "\"delete\"", + "\"select\"", + "\"enable\"", + "\"disable\"", + "\"starting\"", + "\"where\"", + "\"from\"", + "\"row\"", + "\"values\"", + "\"columnfamilies\"", + "\"timestamp\"", + "\"num_versions\"", + "\"limit\"", + "\"and\"", + "\"or\"", + "\",\"", + "\".\"", + "\"(\"", + "\")\"", + "\"=\"", + "\">\"", + "\"<\"", + "\"not\"", + "\"in\"", + "\"!=\"", + "\"*\"", + "\"max_versions\"", + "\"max_length\"", + "\"compression\"", + "\"none\"", + "\"block\"", + "\"record\"", + "\"in_memory\"", + "\"bloomfilter\"", + "\"counting_bloomfilter\"", + "\"retouched_bloomfilter\"", + "\"vector_size\"", + "\"num_hash\"", + "\"num_entries\"", + "\"add\"", + "\"change\"", + "\"save\"", + "\"group\"", + "\"by\"", + "", + "", + "", + "", + "", + "", + "\";\"", + }; + +} 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 583354) +++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/generated/Parser.java (working copy) @@ -1,1284 +1,1571 @@ -/* Generated By:JavaCC: Do not edit this line. Parser.java */ -package org.apache.hadoop.hbase.shell.generated; - -/** - * 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. - */ - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.HashMap; -import java.io.StringReader; -import java.io.Reader; -import java.io.Writer; - -import org.apache.hadoop.hbase.shell.*; - -/** - * Parsing command line. - */ -public class Parser implements ParserConstants { - private String QueryString; - private TableFormatter formatter; - private Writer out; - - public Parser(final String query, final Writer o, final TableFormatter f) { - this((Reader)(new StringReader(query))); - this.QueryString = query; - this.formatter = f; - this.out = o; - } - - public String getQueryStr() { - return this.QueryString; - } - -/** - * Parses the given array of command line arguments. - */ - final public Command terminatedCommand() throws ParseException { - 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: - case JAR: - case EXIT: - case INSERT: - case DELETE: - case SELECT: - case ENABLE: - case DISABLE: - case 62: - 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: - case JAR: - case EXIT: - case INSERT: - case DELETE: - case SELECT: - case ENABLE: - case DISABLE: - statement = cmdStatement(); - break; - default: - jj_la1[0] = jj_gen; - ; - } - jj_consume_token(62); - break; - case 0: - jj_consume_token(0); - break; - default: - jj_la1[1] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - {if (true) return statement;} - throw new Error("Missing return statement in function"); - } - - final public Command cmdStatement() throws ParseException { - Command cmd = null; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case EXIT: - cmd = exitCommand(); - break; - case HELP: - cmd = helpCommand(); - break; - case SHOW: - cmd = showCommand(); - break; - case DESCRIBE: - case DESC: - cmd = descCommand(); - break; - case CREATE: - cmd = createCommand(); - break; - case DROP: - cmd = dropCommand(); - break; - case ALTER: - cmd = alterCommand(); - break; - case INSERT: - cmd = insertCommand(); - break; - case DELETE: - cmd = deleteCommand(); - break; - case SELECT: - cmd = selectCommand(); - break; - case ENABLE: - cmd = enableCommand(); - break; - case DISABLE: - cmd = disableCommand(); - break; - case CLEAR: - cmd = clearCommand(); - break; - case FS: - cmd = fsCommand(); - break; - case JAR: - cmd = jarCommand(); - break; - default: - jj_la1[2] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - {if (true) return cmd;} - throw new Error("Missing return statement in function"); - } - - final public ExitCommand exitCommand() throws ParseException { - ExitCommand exit = new ExitCommand(this.out); - jj_consume_token(EXIT); - {if (true) return exit;} - throw new Error("Missing return statement in function"); - } - - final public FsCommand fsCommand() throws ParseException { - Token t = null; - FsCommand fs = new FsCommand(this.out); - List query = new ArrayList(); - jj_consume_token(FS); - label_1: - while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case ID: - ; - break; - default: - jj_la1[3] = jj_gen; - break label_1; - } - t = jj_consume_token(ID); - query.add(t.image.toString()); - } - fs.setQuery(query); - {if (true) return fs;} - throw new Error("Missing return statement in function"); - } - - final public JarCommand jarCommand() throws ParseException { - Token t = null; - JarCommand jar = new JarCommand(this.out); - List query = new ArrayList(); - jj_consume_token(JAR); - label_2: - while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case ID: - case INTEGER_LITERAL: - ; - break; - default: - jj_la1[4] = jj_gen; - break label_2; - } - 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; - default: - jj_la1[5] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - query.add(t.image.toString()); - } - jar.setQuery(query); - {if (true) return jar;} - 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); - String argument = ""; - jj_consume_token(HELP); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case ALTER: - case CLEAR: - case SHOW: - case DESCRIBE: - case CREATE: - case DROP: - case FS: - case JAR: - case EXIT: - case INSERT: - case DELETE: - case SELECT: - case ID: - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case SHOW: - t = jj_consume_token(SHOW); - break; - case DESCRIBE: - t = jj_consume_token(DESCRIBE); - break; - case CREATE: - t = jj_consume_token(CREATE); - break; - case DROP: - t = jj_consume_token(DROP); - break; - case EXIT: - t = jj_consume_token(EXIT); - break; - case INSERT: - t = jj_consume_token(INSERT); - break; - case DELETE: - t = jj_consume_token(DELETE); - break; - case SELECT: - t = jj_consume_token(SELECT); - break; - case ALTER: - t = jj_consume_token(ALTER); - break; - case CLEAR: - t = jj_consume_token(CLEAR); - break; - case FS: - t = jj_consume_token(FS); - break; - case JAR: - t = jj_consume_token(JAR); - break; - case ID: - t = jj_consume_token(ID); - break; - default: - jj_la1[6] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - argument = t.image.toString(); - break; - default: - jj_la1[7] = jj_gen; - ; - } - help.setArgument(argument); - {if (true) return help;} - throw new Error("Missing return statement in function"); - } - - final public ShowCommand showCommand() throws ParseException { - ShowCommand show = new ShowCommand(this.out, this.formatter); - String argument = null; - jj_consume_token(SHOW); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case ID: - case QUOTED_IDENTIFIER: - case STRING_LITERAL: - argument = Identifier(); - break; - default: - jj_la1[8] = jj_gen; - ; - } - show.setArgument(argument); - {if (true) return show;} - throw new Error("Missing return statement in function"); - } - - final public DescCommand descCommand() throws ParseException { - DescCommand desc = new DescCommand(this.out, this.formatter); - String argument = null; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case DESCRIBE: - jj_consume_token(DESCRIBE); - break; - case DESC: - jj_consume_token(DESC); - break; - default: - jj_la1[9] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - 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_3: - 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[10] = 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(); - 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[11] = 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[12] = 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[13] = 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 createCommand = new CreateCommand(this.out); - String table = null; - Map columnSpec = null; - String column = null; - jj_consume_token(CREATE); - jj_consume_token(TABLE); - table = Identifier(); - createCommand.setTable(table); - jj_consume_token(LPAREN); - column = Identifier(); - columnSpec = ColumnSpec(); - createCommand.addColumnSpec(column, columnSpec); - label_4: - while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case COMMA: - ; - break; - default: - jj_la1[14] = jj_gen; - break label_4; - } - 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(this.out); - 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_5: - while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case COMMA: - ; - break; - default: - jj_la1[15] = jj_gen; - break label_5; - } - jj_consume_token(COMMA); - column = Identifier(); - columnSpec = ColumnSpec(); - alterCommand.addColumnSpec(column, columnSpec); - } - 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[16] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } - {if (true) return alterCommand;} - throw new Error("Missing return statement in function"); - } - - final public DropCommand dropCommand() throws ParseException { - DropCommand drop = new DropCommand(this.out); - List tableList = null; - jj_consume_token(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(this.out); - List columnfamilies = null; - List values = null; - String table = null; - Token t = null; - jj_consume_token(INSERT); - jj_consume_token(INTO); - table = Identifier(); - in.setTable(table); - columnfamilies = getColumns(); - in.setColumnfamilies(columnfamilies); - jj_consume_token(VALUES); - values = getLiteralValues(); - in.setValues(values); - jj_consume_token(WHERE); - 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[17] = 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 deleteCommand = new DeleteCommand(this.out); - List columnList = null; - Token t = null; - String table = null; - jj_consume_token(DELETE); - columnList = ColumnList(); - deleteCommand.setColumnList(columnList); - jj_consume_token(FROM); - table = Identifier(); - deleteCommand.setTable(table); - jj_consume_token(WHERE); - 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[18] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - 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(this.out, this.formatter); - List columns = null; - String rowKey = ""; - String timestamp = null; - int numVersion = 0; - String tableName = null; - int limit; - jj_consume_token(SELECT); - 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: - 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[19] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - rowKey = getStringLiteral(); - select.setRowKey(rowKey); - break; - default: - jj_la1[20] = jj_gen; - ; - } - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case TIMESTAMP: - jj_consume_token(TIMESTAMP); - timestamp = getStringLiteral(); - select.setTimestamp(timestamp); - break; - default: - jj_la1[21] = jj_gen; - ; - } - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case NUM_VERSIONS: - jj_consume_token(NUM_VERSIONS); - jj_consume_token(EQUALS); - numVersion = Number(); - select.setVersion(numVersion); - break; - default: - jj_la1[22] = 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[23] = jj_gen; - ; - } - {if (true) return select;} - throw new Error("Missing return statement in function"); - } - - final public EnableCommand enableCommand() throws ParseException { - EnableCommand enableCommand = new EnableCommand(this.out); - 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 DisableCommand disableCommand() throws ParseException { - DisableCommand disableCommand = new DisableCommand(this.out); - 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 ClearCommand clearCommand() throws ParseException { - ClearCommand clear = new ClearCommand(this.out); - 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; - jj_consume_token(LPAREN); - literal = getStringLiteral(); - if(literal != null) values.add(literal); - label_6: - while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case COMMA: - case ID: - case QUOTED_IDENTIFIER: - case STRING_LITERAL: - ; - break; - default: - jj_la1[24] = jj_gen; - break label_6; - } - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case COMMA: - jj_consume_token(COMMA); - literal = getStringLiteral(); - if(literal != null) values.add(literal); - break; - case ID: - case QUOTED_IDENTIFIER: - case STRING_LITERAL: - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case ID: - jj_consume_token(ID); - break; - case STRING_LITERAL: - jj_consume_token(STRING_LITERAL); - break; - case QUOTED_IDENTIFIER: - jj_consume_token(QUOTED_IDENTIFIER); - break; - default: - jj_la1[25] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - values.removeAll(values); - break; - default: - jj_la1[26] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } - jj_consume_token(RPAREN); - {if (true) return values;} - throw new Error("Missing return statement in function"); - } - - final public String getStringLiteral() throws ParseException { - Token s; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case STRING_LITERAL: - s = jj_consume_token(STRING_LITERAL); - break; - case QUOTED_IDENTIFIER: - s = jj_consume_token(QUOTED_IDENTIFIER); - break; - default: - jj_la1[27] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - String value = s.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_7: - while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case COMMA: - ; - break; - default: - jj_la1[28] = jj_gen; - break label_7; - } - jj_consume_token(COMMA); - literal = getColumn(); - if(literal != null) values.add(literal); - } - jj_consume_token(RPAREN); - {if (true) return values;} - throw new Error("Missing return statement in function"); - } - - final public String getColumn() throws ParseException { - Token col; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case ASTERISK: - case ID: - 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[29] = 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[30] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - {if (true) return col.image.substring(1,col.image.toString().length() - 1);} - break; - default: - jj_la1[31] = jj_gen; - jj_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_8: - while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case COMMA: - ; - break; - default: - jj_la1[32] = jj_gen; - break label_8; - } - 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_9: - while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case COMMA: - ; - break; - default: - jj_la1[33] = jj_gen; - break label_9; - } - 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[34] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - {if (true) return t.image.substring(1,t.image.toString().length() - 1);} - break; - default: - jj_la1[35] = jj_gen; - jj_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_12() { - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(60)) { - jj_scanpos = xsp; - if (jj_scan_token(61)) 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_11()) { - jj_scanpos = xsp; - if (jj_3R_12()) return true; - } - return false; - } - - final private boolean jj_3_1() { - if (jj_scan_token(ADD)) return true; - if (jj_3R_10()) 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[36]; - static private int[] jj_la1_0; - static private int[] jj_la1_1; - static { - jj_la1_0(); - jj_la1_1(); - } - private static void jj_la1_0() { - jj_la1_0 = new int[] {0x79ffe0,0x79ffe1,0x79ffe0,0x0,0x0,0x0,0x19fbc0,0x19fbc0,0x0,0x600,0x0,0x0,0x0,0x0,0x0,0x0,0x1000,0x0,0x0,0x1800000,0x1800000,0x20000000,0x40000000,0x80000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; - } - private static void jj_la1_1() { - jj_la1_1 = new int[] {0x0,0x40000000,0x0,0x1000000,0x3000000,0x3000000,0x1000000,0x1000000,0x31000000,0x0,0x398e00,0x7000,0x70000,0x398e00,0x4,0x4,0xc00000,0x30000000,0x30000000,0x0,0x0,0x0,0x0,0x0,0x31000004,0x31000000,0x31000004,0x30000000,0x4,0x1000100,0x30000000,0x31000100,0x4,0x4,0x30000000,0x31000000,}; - } - 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); - } - public Parser(java.io.InputStream stream, String encoding) { - try { jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } - token_source = new ParserTokenManager(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 36; i++) jj_la1[i] = -1; - for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); - } - - public void ReInit(java.io.InputStream stream) { - ReInit(stream, null); - } - public void ReInit(java.io.InputStream stream, String encoding) { - try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } - token_source.ReInit(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 36; i++) jj_la1[i] = -1; - for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); - } - - public Parser(java.io.Reader stream) { - jj_input_stream = new SimpleCharStream(stream, 1, 1); - token_source = new ParserTokenManager(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 36; i++) jj_la1[i] = -1; - for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); - } - - public void ReInit(java.io.Reader stream) { - jj_input_stream.ReInit(stream, 1, 1); - token_source.ReInit(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 36; i++) jj_la1[i] = -1; - for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); - } - - public Parser(ParserTokenManager tm) { - token_source = tm; - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 36; i++) jj_la1[i] = -1; - for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); - } - - public void ReInit(ParserTokenManager tm) { - token_source = tm; - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 36; i++) jj_la1[i] = -1; - for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); - } - - final private Token jj_consume_token(int kind) throws ParseException { - Token oldToken; - if ((oldToken = token).next != null) token = token.next; - else token = token.next = token_source.getNextToken(); - 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; - jj_kind = kind; - 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(); - jj_ntk = -1; - jj_gen++; - return token; - } - - final public Token getToken(int index) { - 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(); - } - return t; - } - - final private int jj_ntk() { - if ((jj_nt=token.next) == null) - return (jj_ntk = (token.next=token_source.getNextToken()).kind); - else - return (jj_ntk = jj_nt.kind); - } - - 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[63]; - for (int i = 0; i < 63; i++) { - la1tokens[i] = false; - } - if (jj_kind >= 0) { - la1tokens[jj_kind] = true; - jj_kind = -1; - } - for (int i = 0; i < 36; 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; - } - -} +/* Generated By:JavaCC: Do not edit this line. Parser.java */ +package org.apache.hadoop.hbase.shell.generated; + +/** + * 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. + */ + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.HashMap; +import java.io.StringReader; +import java.io.Reader; +import java.io.Writer; +import java.net.URLEncoder; + +import org.apache.hadoop.hbase.shell.*; + +/** + * Parsing command line. + */ +public class Parser implements ParserConstants { + private String QueryString; + private TableFormatter formatter; + private Writer out; + + public Parser(final String query, final Writer o, final TableFormatter f) { + this((Reader)(new StringReader(query))); + this.QueryString = query; + this.formatter = f; + this.out = o; + } + + public String getQueryStr() { + return this.QueryString; + } + +/** + * Parses the given array of command line arguments. + */ + final public Command terminatedCommand() throws ParseException { + 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: + case JAR: + case EXIT: + case INSERT: + case DELETE: + case SELECT: + case ENABLE: + case DISABLE: + case SAVE: + case ID: + case 69: + 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: + case JAR: + case EXIT: + case INSERT: + case DELETE: + case SELECT: + case ENABLE: + case DISABLE: + case SAVE: + case ID: + statement = cmdStatement(); + break; + default: + jj_la1[0] = jj_gen; + ; + } + jj_consume_token(69); + break; + case 0: + jj_consume_token(0); + break; + default: + jj_la1[1] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + {if (true) return statement;} + throw new Error("Missing return statement in function"); + } + + final public Command cmdStatement() throws ParseException { + Command cmd = null; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case EXIT: + cmd = exitCommand(); + break; + case HELP: + cmd = helpCommand(); + break; + case SHOW: + cmd = showCommand(); + break; + case DESCRIBE: + case DESC: + cmd = descCommand(); + break; + case CREATE: + cmd = createCommand(); + break; + case DROP: + cmd = dropCommand(); + break; + case ALTER: + cmd = alterCommand(); + break; + case INSERT: + cmd = insertCommand(); + break; + case DELETE: + cmd = deleteCommand(); + break; + case SELECT: + cmd = selectCommand(); + break; + case ENABLE: + cmd = enableCommand(); + break; + case DISABLE: + cmd = disableCommand(); + break; + case CLEAR: + cmd = clearCommand(); + break; + case FS: + cmd = fsCommand(); + break; + case JAR: + cmd = jarCommand(); + break; + case ID: + cmd = substituteCommand(); + break; + case SAVE: + cmd = saveCommand(); + break; + default: + jj_la1[2] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + {if (true) return cmd;} + throw new Error("Missing return statement in function"); + } + + final public ExitCommand exitCommand() throws ParseException { + ExitCommand exit = new ExitCommand(this.out); + jj_consume_token(EXIT); + {if (true) return exit;} + throw new Error("Missing return statement in function"); + } + + final public FsCommand fsCommand() throws ParseException { + Token t = null; + FsCommand fs = new FsCommand(this.out); + List query = new ArrayList(); + jj_consume_token(FS); + label_1: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case ID: + ; + break; + default: + jj_la1[3] = jj_gen; + break label_1; + } + t = jj_consume_token(ID); + query.add(t.image.toString()); + } + fs.setQuery(query); + {if (true) return fs;} + throw new Error("Missing return statement in function"); + } + + final public JarCommand jarCommand() throws ParseException { + Token t = null; + JarCommand jar = new JarCommand(this.out); + List query = new ArrayList(); + jj_consume_token(JAR); + label_2: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case ID: + case INTEGER_LITERAL: + ; + break; + default: + jj_la1[4] = jj_gen; + break label_2; + } + 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; + default: + jj_la1[5] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + query.add(t.image.toString()); + } + jar.setQuery(query); + {if (true) return jar;} + 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); + String argument = ""; + jj_consume_token(HELP); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case ALTER: + case CLEAR: + case SHOW: + case DESCRIBE: + case CREATE: + case DROP: + case FS: + case JAR: + case EXIT: + case INSERT: + case DELETE: + case SELECT: + case SAVE: + case GROUP: + case ID: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SHOW: + t = jj_consume_token(SHOW); + break; + case DESCRIBE: + t = jj_consume_token(DESCRIBE); + break; + case CREATE: + t = jj_consume_token(CREATE); + break; + case DROP: + t = jj_consume_token(DROP); + break; + case EXIT: + t = jj_consume_token(EXIT); + break; + case INSERT: + t = jj_consume_token(INSERT); + break; + case DELETE: + t = jj_consume_token(DELETE); + break; + case SELECT: + t = jj_consume_token(SELECT); + break; + case ALTER: + t = jj_consume_token(ALTER); + break; + case CLEAR: + t = jj_consume_token(CLEAR); + break; + case FS: + t = jj_consume_token(FS); + break; + case JAR: + t = jj_consume_token(JAR); + break; + case GROUP: + t = jj_consume_token(GROUP); + break; + case SAVE: + t = jj_consume_token(SAVE); + break; + case ID: + t = jj_consume_token(ID); + break; + default: + jj_la1[6] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + argument = t.image.toString(); + break; + default: + jj_la1[7] = jj_gen; + ; + } + help.setArgument(argument); + {if (true) return help;} + throw new Error("Missing return statement in function"); + } + + final public ShowCommand showCommand() throws ParseException { + ShowCommand show = new ShowCommand(this.out, this.formatter); + String argument = null; + jj_consume_token(SHOW); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case ID: + case QUOTED_IDENTIFIER: + case STRING_LITERAL: + argument = identifier(); + break; + default: + jj_la1[8] = jj_gen; + ; + } + show.setArgument(argument); + {if (true) return show;} + throw new Error("Missing return statement in function"); + } + + final public DescCommand descCommand() throws ParseException { + DescCommand desc = new DescCommand(this.out, this.formatter); + String argument = null; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DESCRIBE: + jj_consume_token(DESCRIBE); + break; + case DESC: + jj_consume_token(DESC); + break; + default: + jj_la1[9] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + 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_3: + 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[10] = 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(); + 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[11] = 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[12] = 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[13] = 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 createCommand = new CreateCommand(this.out); + String table = null; + Map columnSpec = null; + String column = null; + jj_consume_token(CREATE); + jj_consume_token(TABLE); + table = identifier(); + createCommand.setTable(table); + jj_consume_token(LPAREN); + column = identifier(); + columnSpec = ColumnSpec(); + createCommand.addColumnSpec(column, columnSpec); + label_4: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: + ; + break; + default: + jj_la1[14] = jj_gen; + break label_4; + } + 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(this.out); + 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_5: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: + ; + break; + default: + jj_la1[15] = jj_gen; + break label_5; + } + jj_consume_token(COMMA); + column = identifier(); + columnSpec = ColumnSpec(); + alterCommand.addColumnSpec(column, columnSpec); + } + 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[16] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + {if (true) return alterCommand;} + throw new Error("Missing return statement in function"); + } + + final public DropCommand dropCommand() throws ParseException { + DropCommand drop = new DropCommand(this.out); + List tableList = null; + jj_consume_token(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(this.out); + List columnfamilies = null; + List values = null; + String table = null; + Token t = null; + jj_consume_token(INSERT); + jj_consume_token(INTO); + table = identifier(); + in.setTable(table); + columnfamilies = getColumns(); + in.setColumnfamilies(columnfamilies); + jj_consume_token(VALUES); + values = getLiteralValues(); + in.setValues(values); + jj_consume_token(WHERE); + 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[17] = 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 deleteCommand = new DeleteCommand(this.out); + List columnList = null; + Token t = null; + String table = null; + jj_consume_token(DELETE); + columnList = columnList(); + deleteCommand.setColumnList(columnList); + jj_consume_token(FROM); + table = identifier(); + deleteCommand.setTable(table); + jj_consume_token(WHERE); + 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[18] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + 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(this.out, this.formatter); + List columns = null; + String rowKey = ""; + String timestamp = null; + int numVersion = 0; + String tableName = null; + int limit; + jj_consume_token(SELECT); + 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: + 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[19] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + rowKey = getStringLiteral(); + select.setRowKey(rowKey); + break; + default: + jj_la1[20] = jj_gen; + ; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case TIMESTAMP: + jj_consume_token(TIMESTAMP); + timestamp = getStringLiteral(); + select.setTimestamp(timestamp); + break; + default: + jj_la1[21] = jj_gen; + ; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case NUM_VERSIONS: + jj_consume_token(NUM_VERSIONS); + jj_consume_token(EQUALS); + numVersion = Number(); + select.setVersion(numVersion); + break; + default: + jj_la1[22] = 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[23] = jj_gen; + ; + } + {if (true) return select;} + throw new Error("Missing return statement in function"); + } + + final public EnableCommand enableCommand() throws ParseException { + EnableCommand enableCommand = new EnableCommand(this.out); + 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 DisableCommand disableCommand() throws ParseException { + DisableCommand disableCommand = new DisableCommand(this.out); + 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 ClearCommand clearCommand() throws ParseException { + ClearCommand clear = new ClearCommand(this.out); + jj_consume_token(CLEAR); + {if (true) return clear;} + throw new Error("Missing return statement in function"); + } + + final public SubstituteCommand substituteCommand() throws ParseException { + Token key = null; + Token chainKey = null; + Token operation = null; + String tableName; + String booleanTerm; + List columnList = new ArrayList(); + List notInList = new ArrayList(); + SubstituteCommand substitute = new SubstituteCommand(this.out); + Token extendedKey = null; + key = jj_consume_token(ID); + jj_consume_token(EQUALS); + substitute.setKey(key.image.toString()); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case ID: + chainKey = jj_consume_token(ID); + jj_consume_token(DOT); + substitute.setChainKey(chainKey.image.toString()); + operation = jj_consume_token(ID); + substitute.setOperation(operation.image.toString()); + jj_consume_token(LPAREN); + if(operation.image.toLowerCase().equals(OperationConstants.RELATIONAL_ALGEBRA_PROJECTION)) { + columnList = columnList(); + substitute.setColumnList(columnList); + } else if(operation.image.toLowerCase().equals(OperationConstants.RELATIONAL_ALGEBRA_SELECTION)) { + booleanTerm = booleanTerm(); + substitute.setBooleanTerm(booleanTerm); + } else if(operation.image.toLowerCase().equals(OperationConstants.RELATIONAL_ALGEBRA_THETA_JOIN)) { + booleanTerm = booleanTerm(); + substitute.setBooleanTerm(booleanTerm); + } + jj_consume_token(RPAREN); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case AND: + jj_consume_token(AND); + extendedKey = jj_consume_token(ID); + //chainning key. + substitute.setChainKey(extendedKey.image.toString()); + VariableRef formula = new VariableRef(OperationConstants.RELATIONAL_ALGEBRA_THETA_JOIN_SECOND_RELATION, null, + VariablesPool.get(extendedKey.image.toString()).get(null).getArgument()); + VariablesPool.put(extendedKey.image.toString(), chainKey.image.toString(), formula); + break; + default: + jj_la1[24] = jj_gen; + ; + } + break; + case TABLE: + jj_consume_token(TABLE); + jj_consume_token(LPAREN); + tableName = identifier(); + substitute.setInput(tableName); + jj_consume_token(RPAREN); + break; + case GROUP: + operation = jj_consume_token(GROUP); + chainKey = jj_consume_token(ID); + jj_consume_token(BY); + jj_consume_token(LPAREN); + columnList = columnList(); + jj_consume_token(RPAREN); + substitute.setChainKey(chainKey.image.toString()); + substitute.setOperation(operation.image.toString()); + substitute.setColumnList(columnList); + break; + default: + jj_la1[25] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + {if (true) return substitute;} + throw new Error("Missing return statement in function"); + } + + final public SaveCommand saveCommand() throws ParseException { + Token t = null; + String tableName; + SaveCommand save = new SaveCommand(this.out); + jj_consume_token(SAVE); + t = jj_consume_token(ID); + save.setStatement(t.image.toString()); + jj_consume_token(INTO); + jj_consume_token(TABLE); + jj_consume_token(LPAREN); + tableName = identifier(); + save.setOutput(tableName); + jj_consume_token(RPAREN); + {if (true) return save;} + throw new Error("Missing return statement in function"); + } + +//////////////////////////////////////////////// +// Utility expansion units... + final public List getLiteralValues() throws ParseException { + List values = new ArrayList(); + String literal = null; + jj_consume_token(LPAREN); + literal = getStringLiteral(); + if(literal != null) values.add(literal); + label_6: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: + case ID: + case QUOTED_IDENTIFIER: + case STRING_LITERAL: + ; + break; + default: + jj_la1[26] = jj_gen; + break label_6; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: + jj_consume_token(COMMA); + literal = getStringLiteral(); + if(literal != null) values.add(literal); + break; + case ID: + case QUOTED_IDENTIFIER: + case STRING_LITERAL: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case ID: + jj_consume_token(ID); + break; + case STRING_LITERAL: + jj_consume_token(STRING_LITERAL); + break; + case QUOTED_IDENTIFIER: + jj_consume_token(QUOTED_IDENTIFIER); + break; + default: + jj_la1[27] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + values.removeAll(values); + break; + default: + jj_la1[28] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + } + jj_consume_token(RPAREN); + {if (true) return values;} + throw new Error("Missing return statement in function"); + } + + final public String getStringLiteral() throws ParseException { + Token s; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case STRING_LITERAL: + s = jj_consume_token(STRING_LITERAL); + break; + case QUOTED_IDENTIFIER: + s = jj_consume_token(QUOTED_IDENTIFIER); + break; + default: + jj_la1[29] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + String value = s.image.toString(); + {if (true) return value.substring(1,value.length() - 1);} + throw new Error("Missing return statement in function"); + } + + final public String getColumn() throws ParseException { + Token col; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case ASTERISK: + case ID: + case INTEGER_LITERAL: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case ID: + col = jj_consume_token(ID); + break; + case INTEGER_LITERAL: + col = jj_consume_token(INTEGER_LITERAL); + break; + case ASTERISK: + col = jj_consume_token(ASTERISK); + break; + default: + jj_la1[30] = 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[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[32] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + 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_7: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: + ; + break; + default: + jj_la1[33] = jj_gen; + break label_7; + } + jj_consume_token(COMMA); + literal = getColumn(); + if(literal != null) values.add(literal); + } + jj_consume_token(RPAREN); + {if (true) return values;} + throw new Error("Missing return statement in function"); + } + + final public List tableList() throws ParseException { + List tableList = new ArrayList(); + String table = null; + table = identifier(); + tableList.add(table); + label_8: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: + ; + break; + default: + jj_la1[34] = jj_gen; + break label_8; + } + 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_9: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMMA: + ; + break; + default: + jj_la1[35] = jj_gen; + break label_9; + } + 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[36] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + {if (true) return t.image.substring(1,t.image.toString().length() - 1);} + break; + default: + jj_la1[37] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + throw new Error("Missing return statement in function"); + } + + final public String booleanTerm() throws ParseException { + String query = null; + String tmp = null; + query = booleanTerms(); + label_10: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case AND: + case OR: + ; + break; + default: + jj_la1[38] = jj_gen; + break label_10; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case AND: + jj_consume_token(AND); + query += " AND "; + break; + case OR: + jj_consume_token(OR); + query += " OR "; + break; + default: + jj_la1[39] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + tmp = booleanTerms(); + query += tmp; + } + {if (true) return query;} + throw new Error("Missing return statement in function"); + } + + final public String booleanTerms() throws ParseException { + Token tSearchName, tComparator, tComparand; + List inList = new ArrayList(); + String searchName=null,comparator=null,comparand=null; + Token joinColumn = null; + Token joinKey = null; + tSearchName = jj_consume_token(ID); + searchName = tSearchName.image.toString(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DOT: + jj_consume_token(DOT); + joinColumn = jj_consume_token(ID); + searchName += "." + joinColumn.image.toString(); + break; + default: + jj_la1[40] = jj_gen; + ; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LCOMP: + tComparator = jj_consume_token(LCOMP); + comparator = tComparator.image.toString(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case EQUALS: + jj_consume_token(EQUALS); + comparator += "="; + break; + default: + jj_la1[41] = jj_gen; + ; + } + break; + case RCOMP: + tComparator = jj_consume_token(RCOMP); + comparator = tComparator.image.toString(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case EQUALS: + jj_consume_token(EQUALS); + comparator += "="; + break; + default: + jj_la1[42] = jj_gen; + ; + } + break; + case EQUALS: + tComparator = jj_consume_token(EQUALS); + comparator = tComparator.image.toString(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LCOMP: + jj_consume_token(LCOMP); + comparator = ">" + comparator; + break; + default: + jj_la1[43] = jj_gen; + ; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case RCOMP: + jj_consume_token(RCOMP); + comparator = "<" + comparator; + break; + default: + jj_la1[44] = jj_gen; + ; + } + break; + case NOTEQUAL: + tComparator = jj_consume_token(NOTEQUAL); + comparator = tComparator.image.toString(); + break; + case NOT: + jj_consume_token(NOT); + jj_consume_token(IN); + comparator = "!!"; + break; + case IN: + jj_consume_token(IN); + comparator = "=="; + break; + default: + jj_la1[45] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case INTEGER_LITERAL: + tComparand = jj_consume_token(INTEGER_LITERAL); + comparand = tComparand.image.toString(); + break; + case STRING_LITERAL: + tComparand = jj_consume_token(STRING_LITERAL); + comparand = tComparand.image.substring(1,tComparand.image.length() - 1); + break; + case ID: + tComparand = jj_consume_token(ID); + comparand = tComparand.image.toString(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case DOT: + jj_consume_token(DOT); + jj_consume_token(ROW); + comparand += ".ROW"; + break; + default: + jj_la1[46] = jj_gen; + ; + } + break; + case LPAREN: + inList = getColumns(); + if(comparator == null) { + comparator = "=="; + } + comparand = ""; + for(int i=0; i 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; + jj_kind = kind; + 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(); + jj_ntk = -1; + jj_gen++; + return token; + } + + final public Token getToken(int index) { + 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(); + } + return t; + } + + final private int jj_ntk() { + if ((jj_nt=token.next) == null) + return (jj_ntk = (token.next=token_source.getNextToken()).kind); + else + return (jj_ntk = jj_nt.kind); + } + + 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[70]; + for (int i = 0; i < 70; i++) { + la1tokens[i] = false; + } + if (jj_kind >= 0) { + la1tokens[jj_kind] = true; + jj_kind = -1; + } + for (int i = 0; i < 48; 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; + } + +} Index: src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/VariableRef.java =================================================================== --- src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/VariableRef.java (revision 0) +++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/VariableRef.java (revision 0) @@ -0,0 +1,68 @@ +/** + * 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.List; + +/** + * VariableRef is used to reference declared Variables. + */ +public class VariableRef { + + String operation; + String argument; + + /** + * Constructor + */ + public VariableRef(String operation, List columnList, + String booleanTerm) { + this.operation = operation; + + if (booleanTerm != null) { + this.argument = booleanTerm; + } else { + String args = ""; + for (int i = 0; i < columnList.size(); i++) { + args += columnList.get(i) + ": "; + } + this.argument = args; + } + } + + /** + * Return argument of an operation + * + * @return argument + */ + public String getArgument() { + return argument; + } + + /** + * Return operation + * + * @return operation + */ + public String getOperation() { + return operation; + } + +} 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 583354) +++ src/contrib/hbase/src/java/org/apache/hadoop/hbase/shell/HelpCommand.java (working copy) @@ -1,182 +1,214 @@ -/** - * 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.io.OutputStreamWriter; -import java.io.UnsupportedEncodingException; -import java.io.Writer; -import java.util.HashMap; -import java.util.Map; - -import org.apache.hadoop.conf.Configuration; -import org.apache.hadoop.hbase.HBaseConfiguration; - -public class HelpCommand extends BasicCommand { - private String argument; - private static final String [] HEADER = - new String [] {"Command", "Description", "Example"}; - - /** application name */ - public static final String APP_NAME = "Hbase Shell"; - - /** version of the code */ - public static final String APP_VERSION = "0.0.2"; - - /** help contents map */ - public final Map help = - new HashMap(); - - private final TableFormatter formatter; - - public HelpCommand(final Writer o, final TableFormatter f) { - super(o); - this.help.putAll(load()); - this.formatter = f; - } - - public ReturnMsg execute(@SuppressWarnings("unused") Configuration conf) { - try { - printHelp(this.argument); - } catch (IOException e) { - e.printStackTrace(); - } - return null; - } - - public void setArgument(String argument) { - this.argument = argument; - } - - /** - * add help contents - */ - private Map load() { - Map load = new HashMap(); - load.put("SHOW", new String[] {"List all user tables", "SHOW TABLES;"}); - - load.put("FS", new String[] { "Hadoop FsShell; entering a lone 'FS;' " + - "will emit usage", - "FS -copyFromLocal /home/user/backup.dat fs/user/backup;"}); - - load.put("JAR", new String[] { "Hadoop RunJar util", - "JAR ./build/hadoop-examples.jar pi 10 10;"}); - load.put("CLEAR", new String[] {"Clear the screen", "CLEAR;"} ); - - load.put("DESCRIBE", new String[] { "Print table information", - "[DESCRIBE|DESC] table_name;"}); - - load.put("CREATE", new String[] { - "Create tables", - "CREATE TABLE table_name (column_family_name [MAX_VERSIONS=n] " + - "[MAX_LENGTH=n] [COMPRESSION=NONE|RECORD|BLOCK] [IN_MEMORY] " + - "[BLOOMFILTER=NONE|BLOOM|COUNTING|RETOUCHED VECTOR_SIZE=n NUM_HASH=n], " + - "...)" - }); - load.put("DROP", new String[] { - "Drop tables", - "DROP TABLE table_name [, table_name] ...;"}); - - load.put("INSERT", new String[] { - "Insert values into table", - "INSERT INTO table_name (column_name, ...) " + - "VALUES ('value', ...) WHERE row='row_key';" - }); - - load.put("DELETE", new String[] { - "Delete table data", - "DELETE {column_name, [, column_name] ... | *} FROM table_name " + - "WHERE row='row-key';" - }); - - load.put("SELECT", - new String[] { - "Select values from table", - "SELECT {column_name, [, column_name] ... | *} FROM table_name " + - "[WHERE row='row_key' | STARTING FROM 'row-key'] " + - "[NUM_VERSIONS = version_count] " + - "[TIMESTAMP 'timestamp'] " + - "[LIMIT = row_count] " + - "[INTO FILE 'file_name'];" - }); - - load.put("ALTER", - new String[] { - "Alter structure of table", - "ALTER TABLE table_name ADD column_spec | " + - "ADD (column_spec, column_spec, ...) | " + - "DROP column_family_name | " + - "CHANGE column_spec;" - }); - - load.put("EXIT", new String[] { "Exit shell", "EXIT;"}); - - return load; - } - - /** Print out the program version. - * @throws IOException */ - public void printVersion() throws IOException { - println(APP_NAME + ", " + APP_VERSION + " version.\n" - + "Copyright (c) 2007 by udanax, " - + "licensed to Apache Software Foundation.\n" - + "Type 'help;' for usage.\n"); - } - - public void printHelp(final String cmd) throws IOException { - if (cmd.equals("")) { - println("Type 'help COMMAND;' to see command-specific usage."); - printHelp(this.help); - } else { - if (this.help.containsKey(cmd.toUpperCase())) { - final Map m = new HashMap(); - m.put(cmd.toUpperCase(), this.help.get(cmd.toUpperCase())); - printHelp(m); - } else { - println("Unknown Command : Type 'help;' for usage."); - } - } - } - - private void printHelp(final Map m) throws IOException { - this.formatter.header(HEADER); - for (Map.Entry e: m.entrySet()) { - String [] value = e.getValue(); - if (value.length == 2) { - this.formatter.row(new String [] {e.getKey().toUpperCase(), value[0], - value[1]}); - } else { - throw new IOException("Value has too many elements:" + value); - } - } - this.formatter.footer(); - } - - public static void main(String[] args) throws UnsupportedEncodingException { - HBaseConfiguration conf = new HBaseConfiguration(); - Writer out = new OutputStreamWriter(System.out, "UTF-8"); - TableFormatterFactory tff = new TableFormatterFactory(out, conf); - HelpCommand cmd = new HelpCommand(out, tff.get()); - cmd.setArgument(""); - cmd.execute(conf); - cmd.setArgument("select"); - cmd.execute(conf); - } -} +/** + * 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.io.OutputStreamWriter; +import java.io.UnsupportedEncodingException; +import java.io.Writer; +import java.util.HashMap; +import java.util.Map; + +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.hbase.HBaseConfiguration; + +public class HelpCommand extends BasicCommand { + private String argument; + private static final String [] HEADER = + new String [] {"Command", "Description", "Example"}; + + /** application name */ + public static final String APP_NAME = "Hbase Shell"; + + /** version of the code */ + public static final String APP_VERSION = "0.0.2"; + + /** help contents map */ + public final Map help = + new HashMap(); + + private final TableFormatter formatter; + + public HelpCommand(final Writer o, final TableFormatter f) { + super(o); + this.help.putAll(load()); + this.formatter = f; + } + + public ReturnMsg execute(@SuppressWarnings("unused") Configuration conf) { + try { + printHelp(this.argument); + } catch (IOException e) { + e.printStackTrace(); + } + return null; + } + + public void setArgument(String argument) { + this.argument = argument; + } + + /** + * add help contents + */ + private Map load() { + Map load = new HashMap(); + load.put("SHOW", new String[] {"List all user tables", "SHOW TABLES;"}); + + load.put("FS", new String[] { "Hadoop FsShell; entering a lone 'FS;' " + + "will emit usage", + "FS -copyFromLocal /home/user/backup.dat fs/user/backup;"}); + + load.put("JAR", new String[] { "Hadoop RunJar util", + "JAR ./build/hadoop-examples.jar pi 10 10;"}); + load.put("CLEAR", new String[] {"Clear the screen", "CLEAR;"} ); + + load.put("DESCRIBE", new String[] { "Print table information", + "[DESCRIBE|DESC] table_name;"}); + + load.put("CREATE", new String[] { + "Create tables", + "CREATE TABLE table_name (column_family_name [MAX_VERSIONS=n] " + + "[MAX_LENGTH=n] [COMPRESSION=NONE|RECORD|BLOCK] [IN_MEMORY] " + + "[BLOOMFILTER=NONE|BLOOM|COUNTING|RETOUCHED VECTOR_SIZE=n NUM_HASH=n], " + + "...)" + }); + load.put("DROP", new String[] { + "Drop tables", + "DROP TABLE table_name [, table_name] ...;"}); + + load.put("INSERT", new String[] { + "Insert values into table", + "INSERT INTO table_name (column_name, ...) " + + "VALUES ('value', ...) WHERE row='row_key';" + }); + + load.put("DELETE", new String[] { + "Delete table data", + "DELETE {column_name, [, column_name] ... | *} FROM table_name " + + "WHERE row='row-key';" + }); + + load.put("SELECT", + new String[] { + "Select values from table", + "SELECT {column_name, [, column_name] ... | *} FROM table_name " + + "[WHERE row='row_key' | STARTING FROM 'row-key'] " + + "[NUM_VERSIONS = version_count] " + + "[TIMESTAMP 'timestamp'] " + + "[LIMIT = row_count] " + + "[INTO FILE 'file_name'];" + }); + + load.put("ALTER", + new String[] { + "Alter structure of table", + "ALTER TABLE table_name ADD column_spec | " + + "ADD (column_spec, column_spec, ...) | " + + "DROP column_family_name | " + + "CHANGE column_spec;" + }); + + load.put("EXIT", new String[] { "Exit shell", "EXIT;"}); + + // A Algebraic Query Commands + // this is a tentative query language based on a hbase which uses relational model of + // data. + + load.put("TABLE", new String[] { "Load a table", + "A = table('table_name');" }); + load.put("SUBSTITUTE", new String[] { "Substitute expression to [A~Z]", + "D = A.projection('cf_name1'[, 'cf_name2']);" }); + load.put("SAVE", new String[] { + "Save results into specified table", + "SAVE A INTO table('table_name');" }); + + // Relational Operations + load.put("PROJECTION", new String[] { + "Selects a subset of the columnfamilies of a relation", + "A = TABLE('table_name');" + + " B = A.Projection('cf_name1'[, 'cf_name2']);" }); + load + .put( + "SELECTION", + new String[] { + "Selects a subset of the rows in a relation that satisfy a selection condition", + "A = Table('table_name');" + + " B = A.Selection(cf_name1 > 100[ AND cf_name2 = 'string_value']);" }); + + // Aggregation Functions + load.put("GROUP", new String[] { + "Group rows by value of an attribute and apply aggregate function independently to each group of rows", + "A = Table('table_name');" + + " B = Group A by ('cf_name1'[, 'cf_name2']);" }); + + + return load; + } + + /** Print out the program version. + * @throws IOException */ + public void printVersion() throws IOException { + println(APP_NAME + ", " + APP_VERSION + " version.\n" + + "Copyright (c) 2007 by udanax, " + + "licensed to Apache Software Foundation.\n" + + "Type 'help;' for usage.\n"); + } + + public void printHelp(final String cmd) throws IOException { + if (cmd.equals("")) { + println("Type 'help COMMAND;' to see command-specific usage."); + printHelp(this.help); + } else { + if (this.help.containsKey(cmd.toUpperCase())) { + final Map m = new HashMap(); + m.put(cmd.toUpperCase(), this.help.get(cmd.toUpperCase())); + printHelp(m); + } else { + println("Unknown Command : Type 'help;' for usage."); + } + } + } + + private void printHelp(final Map m) throws IOException { + this.formatter.header(HEADER); + for (Map.Entry e: m.entrySet()) { + String [] value = e.getValue(); + if (value.length == 2) { + this.formatter.row(new String [] {e.getKey().toUpperCase(), value[0], + value[1]}); + } else { + throw new IOException("Value has too many elements:" + value); + } + } + this.formatter.footer(); + } + + public static void main(String[] args) throws UnsupportedEncodingException { + HBaseConfiguration conf = new HBaseConfiguration(); + Writer out = new OutputStreamWriter(System.out, "UTF-8"); + TableFormatterFactory tff = new TableFormatterFactory(out, conf); + HelpCommand cmd = new HelpCommand(out, tff.get()); + cmd.setArgument(""); + cmd.execute(conf); + cmd.setArgument("select"); + cmd.execute(conf); + } +}