diff --git a/archiver/hdfs-archiver/src/test/java/com/srotya/sidewinder/archiver/hdfs/TestHDFSArchiver.java b/archiver/hdfs-archiver/src/test/java/com/srotya/sidewinder/archiver/hdfs/TestHDFSArchiver.java index 7971485..b1789f7 100644 --- a/archiver/hdfs-archiver/src/test/java/com/srotya/sidewinder/archiver/hdfs/TestHDFSArchiver.java +++ b/archiver/hdfs-archiver/src/test/java/com/srotya/sidewinder/archiver/hdfs/TestHDFSArchiver.java @@ -30,8 +30,8 @@ import com.srotya.sidewinder.core.storage.ArchiveException; import com.srotya.sidewinder.core.storage.Archiver; import com.srotya.sidewinder.core.storage.DataPoint; -import com.srotya.sidewinder.core.storage.Reader; import com.srotya.sidewinder.core.storage.TimeSeriesBucket; +import com.srotya.sidewinder.core.storage.compression.Reader; import com.srotya.sidewinder.core.storage.compression.byzantine.ByzantineWriter; import com.srotya.sidewinder.core.storage.mem.archival.TimeSeriesArchivalObject; @@ -60,7 +60,8 @@ public void testHDFSArchive() throws IOException, ArchiveException { conf.put(HDFSArchiver.HDFS_ARCHIVE_DIRECTORY, "target/test-hdfs-" + System.currentTimeMillis()); archiver.init(conf); long ts = System.currentTimeMillis(); - TimeSeriesBucket bucket = new TimeSeriesBucket("seriesId", ByzantineWriter.class.getName(), ts, false, new HashMap<>()); + //TODO fix unit tests for HDFS Archiver + TimeSeriesBucket bucket = null; for (int i = 0; i < 1000; i++) { bucket.addDataPoint(ts + i * 1000, i); } diff --git a/cluster/src/main/java/com/srotya/sidewinder/cluster/ClusterResourceMonitor.java b/cluster/src/main/java/com/srotya/sidewinder/cluster/ClusterResourceMonitor.java index f4d8776..3025610 100644 --- a/cluster/src/main/java/com/srotya/sidewinder/cluster/ClusterResourceMonitor.java +++ b/cluster/src/main/java/com/srotya/sidewinder/cluster/ClusterResourceMonitor.java @@ -19,6 +19,8 @@ import java.util.Arrays; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; +import java.util.logging.Level; +import java.util.logging.Logger; import com.srotya.sidewinder.cluster.connectors.ClusterConnector; import com.srotya.sidewinder.core.storage.DataPoint; @@ -30,7 +32,7 @@ public class ClusterResourceMonitor { private static final String DB = "_internal"; -// private static Logger logger = Logger.getLogger(ClusterResourceMonitor.class.getName()); + private static Logger logger = Logger.getLogger(ClusterResourceMonitor.class.getName()); private static final ClusterResourceMonitor INSTANCE = new ClusterResourceMonitor(); private StorageEngine storageEngine; private ClusterConnector connector; @@ -67,8 +69,7 @@ private void clusterMonitor() { dp.setTags(Arrays.asList("controller")); storageEngine.writeDataPoint(dp); } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); + logger.log(Level.SEVERE, "Failed to monitor cluster", e); } } diff --git a/cluster/src/main/java/com/srotya/sidewinder/cluster/routing/RoutingEngine.java b/cluster/src/main/java/com/srotya/sidewinder/cluster/routing/RoutingEngine.java index f794498..7017d71 100644 --- a/cluster/src/main/java/com/srotya/sidewinder/cluster/routing/RoutingEngine.java +++ b/cluster/src/main/java/com/srotya/sidewinder/cluster/routing/RoutingEngine.java @@ -27,8 +27,8 @@ import com.srotya.sidewinder.core.rpc.RawTimeSeriesBucket; import com.srotya.sidewinder.core.rpc.RawTimeSeriesBucket.Builder; import com.srotya.sidewinder.core.storage.StorageEngine; +import com.srotya.sidewinder.core.storage.TimeSeries; import com.srotya.sidewinder.core.storage.TimeSeriesBucket; -import com.srotya.sidewinder.core.storage.mem.TimeSeries; /** * Routing Engine provides the abstraction to stitch together the diff --git a/core/pom.xml b/core/pom.xml index dfe0a9f..588d955 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -139,6 +139,11 @@ 2.2 test + + org.lz4 + lz4-java + 1.4.0 + org.mockito mockito-all diff --git a/core/src/arc/AbstractStorageEngine.java b/core/src/arc/AbstractStorageEngine.java deleted file mode 100644 index e0481e2..0000000 --- a/core/src/arc/AbstractStorageEngine.java +++ /dev/null @@ -1,121 +0,0 @@ -/** - * Copyright 2016 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.storage; - -import java.io.IOException; -import java.util.Collections; -import java.util.List; -import java.util.TreeMap; -import java.util.concurrent.ArrayBlockingQueue; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicBoolean; - -import com.srotya.sidewinder.core.utils.ByteUtils; -import com.srotya.sidewinder.core.utils.TimeUtils; - -/** - * @author ambudsharma - * - */ -public abstract class AbstractStorageEngine implements StorageEngine, Runnable { - - public static final int BUCKET_SIZE = 4096; - private ArrayBlockingQueue taskQueue = new ArrayBlockingQueue<>(1024 * 4); - private AtomicBoolean control = new AtomicBoolean(true); - - @Override - public void run() { - while (control.get() || taskQueue.size() > 0) { - WriteTask poll; - try { - poll = taskQueue.take(); - writeSeriesPoint(poll); - poll.getCallback().complete(); - } catch (InterruptedException e) { - break; - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - try { - flush(); - } catch (IOException e) { - } - } - - public abstract byte[] indexIdentifier(String identifier) throws IOException; - - public byte[] buildRowKey(String seriesName, List tags, TimeUnit unit, long timestamp) throws IOException { - /** - * 3 bytes for each tag, 3 bytes for series name and 4 bytes for the - * time bucket - */ - byte[] rowKey = new byte[3 * (tags.size() + 1) + 4]; - int bucket = TimeUtils.getTimeBucket(unit, timestamp, BUCKET_SIZE); - byte[] bucketBytes = ByteUtils.intToByteMSB(bucket); - byte[] seriesBytes = indexIdentifier(seriesName); - System.arraycopy(seriesBytes, 0, rowKey, 0, seriesBytes.length); - int pos = seriesBytes.length; - Collections.sort(tags); - for (String tag : tags) { - byte[] tagBytes = indexIdentifier(tag); - System.arraycopy(tagBytes, 0, rowKey, pos, tagBytes.length); - pos += tagBytes.length; - } - System.arraycopy(bucketBytes, 0, rowKey, pos, bucketBytes.length); - return rowKey; - } - - @Override - public void writeSeries(String dbName, String seriesName, List tags, TimeUnit unit, long timestamp, long value, - Callback callback) throws IOException { - byte[] valueBytes = ByteUtils.longToBytes(value); - writeSeries(dbName, seriesName, tags, unit, timestamp, valueBytes, callback); - } - - public void writeSeries(String dbName, String seriesName, List tags, TimeUnit unit, long timestamp, byte[] value, - Callback callback) throws IOException { - byte[] rowKey = buildRowKey(seriesName, tags, unit, timestamp); - try { - taskQueue.put(new WriteTask(("db_"+dbName+"series_" + seriesName).getBytes(), rowKey, timestamp, value, callback)); - } catch (InterruptedException e) { - throw new IOException(e); - } - } - - @Override - public void writeSeries(String dbName, String seriesName, List tags, TimeUnit unit, long timestamp, double value, - Callback callback) throws IOException { - byte[] valueBytes = ByteUtils.doubleToBytes(value); - writeSeries(dbName, seriesName, tags, unit, timestamp, valueBytes, callback); - } - - public abstract void writeSeriesPoint(WriteTask point) throws IOException; - - public abstract TreeMap getTreeFromDS(byte[] rowKey) throws Exception; - - public abstract void flush() throws IOException; - - public abstract void print() throws Exception; - - /** - * - */ - public void stop() { - control.set(false); - } -} diff --git a/core/src/arc/App.java b/core/src/arc/App.java deleted file mode 100644 index 81f816a..0000000 --- a/core/src/arc/App.java +++ /dev/null @@ -1,89 +0,0 @@ -/** - * Copyright 2016 Ambud Sharma - * - * Licensed 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 com.test.zmisc; - -import java.util.concurrent.ThreadLocalRandom; - -import org.apache.commons.math.stat.correlation.PearsonsCorrelation; -import org.apache.commons.math.stat.descriptive.moment.StandardDeviation; - -/** - * Hello world! - * - */ -public class App { - - public static void main(String[] args) { - double[] a = new double[32768]; - double[] b = new double[32768]; - - ThreadLocalRandom rand = ThreadLocalRandom.current(); - - for (int i = 0; i < a.length; i++) { - a[i] = rand.nextDouble(); - b[i] = a[i]; - } - - long ts = System.currentTimeMillis(); - PearsonsCorrelation corr = new PearsonsCorrelation(); - corr.correlation(a, b); - ts = System.currentTimeMillis() - ts; - System.out.println("Time elapsed:" + ts + "ms"); - - // standard deviation is the sqrt(mean((X-avg)^2)) - - ts = System.currentTimeMillis(); - double amean = average(a); - double aStdDev = standardDeviation(a, amean); - - StandardDeviation sd = new StandardDeviation(); - sd.setBiasCorrected(false); - - double bmean = average(b); - double bStdDev = standardDeviation(b, bmean); - - double cor = (covariance(a, aStdDev, b, bmean)) / (aStdDev * bStdDev); - ts = System.currentTimeMillis() - ts; - System.out.println("Time elapsed:" + ts + "ms"); - } - - public static double average(double[] a) { - double avg = 0; - for (int i = 0; i < a.length; i++) { - avg += a[i]; - } - avg = avg / a.length; - return avg; - } - - public static double covariance(double[] a, double amean, double[] b, double bmean) { - double t = 0; - for (int i = 0; i < a.length; i++) { - t += (a[i] - amean) * (b[i] - bmean); - } - return t / a.length; - } - - public static double standardDeviation(double[] a, double avg) { - double aStdDev = 0; - for (int i = 0; i < a.length; i++) { - double tmp = (a[i] - avg); - aStdDev += tmp * tmp; - } - aStdDev = Math.sqrt(aStdDev / (a.length)); - return aStdDev; - } -} diff --git a/core/src/arc/DiskWriterBenchmark.java b/core/src/arc/DiskWriterBenchmark.java deleted file mode 100644 index cb34e39..0000000 --- a/core/src/arc/DiskWriterBenchmark.java +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Copyright 2017 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.storage.compression.byzantine; - -import java.io.File; -import java.util.HashMap; - -import com.srotya.sidewinder.core.storage.Reader; -import com.srotya.sidewinder.core.storage.StorageEngine; - -public class DiskWriterBenchmark { - - public static void main(String[] args) throws Throwable { - ByzantineWriter writer = new ByzantineWriter(); - HashMap conf = new HashMap<>(); - new File("/tmp/benchmark").mkdirs(); - conf.put(StorageEngine.PERSISTENCE_DISK, "false"); - conf.put("data.dir", "/tmp/benchmark"); - writer.setSeriesId("test_1M_writes" + 0); - writer.configure(conf); - long ts = System.currentTimeMillis(); - writer.setHeaderTimestamp(ts); - int limit = 100_000_000; - for (int i = 0; i < limit; i++) { - writer.addValue(ts + i * 1000, i); - } - ts = (System.currentTimeMillis() - ts); - System.out.println("Byzantine Write time:" + ts + " data size:" + writer.getBuf().position()); - ts = System.currentTimeMillis(); - Reader reader = writer.getReader(); - for (int i = 0; i < limit; i++) { - reader.readPair(); - } - ts = (System.currentTimeMillis() - ts); - System.out.println("Byzantine Read time:" + ts); - } - -} diff --git a/core/src/arc/SidewinderSchema.java b/core/src/arc/SidewinderSchema.java deleted file mode 100644 index 578b608..0000000 --- a/core/src/arc/SidewinderSchema.java +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Copyright 2016 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.storage; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.apache.calcite.schema.Table; -import org.apache.calcite.schema.impl.AbstractSchema; - -/** - * @author ambudsharma - */ -public class SidewinderSchema extends AbstractSchema { - - private AbstractStorageEngine engine; - - public SidewinderSchema(AbstractStorageEngine engine) { - this.engine = engine; - } - - @Override - protected Map getTableMap() { - try { - Set series = engine.getSeries(null); - Map tableMap = new HashMap<>(); - for(String seriesName:series) { - tableMap.put(seriesName, new SidewinderTable(seriesName, engine)); - } - return tableMap; - } catch (Exception e) { - e.printStackTrace(); - } - return super.getTableMap(); - } - -} diff --git a/core/src/arc/SidewinderSchemaFactory.java b/core/src/arc/SidewinderSchemaFactory.java deleted file mode 100644 index e2ffab5..0000000 --- a/core/src/arc/SidewinderSchemaFactory.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * Copyright 2016 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.storage; - -import java.util.Map; - -import org.apache.calcite.schema.Schema; -import org.apache.calcite.schema.SchemaFactory; -import org.apache.calcite.schema.SchemaPlus; - -import com.srotya.sidewinder.core.SidewinderServer; - -/** - * @author ambudsharma - */ -public class SidewinderSchemaFactory implements SchemaFactory { - - public SidewinderSchemaFactory() { - } - - @Override - public Schema create(SchemaPlus parentSchema, String name, Map operand) { - SidewinderServer server = SidewinderServer.getSidewinderServer(); - if (server == null || server.getStorageEngine()==null) { - // case when server wasn't started - return null; - } else { - AbstractStorageEngine engine = server.getStorageEngine(); - return new SidewinderSchema(engine); - } - } - -} diff --git a/core/src/arc/SidewinderTable.java b/core/src/arc/SidewinderTable.java deleted file mode 100644 index 19c7b16..0000000 --- a/core/src/arc/SidewinderTable.java +++ /dev/null @@ -1,174 +0,0 @@ -/** - * Copyright 2016 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.storage; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.apache.calcite.DataContext; -import org.apache.calcite.adapter.java.AbstractQueryableTable; -import org.apache.calcite.linq4j.Enumerable; -import org.apache.calcite.linq4j.Enumerator; -import org.apache.calcite.linq4j.QueryProvider; -import org.apache.calcite.linq4j.Queryable; -import org.apache.calcite.plan.RelOptTable; -import org.apache.calcite.plan.RelOptTable.ToRelContext; -import org.apache.calcite.rel.RelNode; -import org.apache.calcite.rel.type.RelDataType; -import org.apache.calcite.rel.type.RelDataTypeFactory; -import org.apache.calcite.rex.RexCall; -import org.apache.calcite.rex.RexInputRef; -import org.apache.calcite.rex.RexLiteral; -import org.apache.calcite.rex.RexNode; -import org.apache.calcite.schema.FilterableTable; -import org.apache.calcite.schema.SchemaPlus; -import org.apache.calcite.schema.TranslatableTable; -import org.apache.calcite.schema.impl.AbstractTable; -import org.apache.calcite.sql.SqlKind; -import org.apache.calcite.sql.fun.SqlBetweenOperator; -import org.apache.calcite.sql.type.SqlTypeName; - -import com.srotya.sidewinder.core.operators.AndOperator; -import com.srotya.sidewinder.core.operators.GreaterThan; -import com.srotya.sidewinder.core.operators.GreaterThanEquals; -import com.srotya.sidewinder.core.operators.LessThan; -import com.srotya.sidewinder.core.operators.LessThanEquals; -import com.srotya.sidewinder.core.operators.NumericEquals; -import com.srotya.sidewinder.core.operators.Operator; -import com.srotya.sidewinder.core.operators.OrOperator; - -/** - * @author ambud - */ -public class SidewinderTable extends AbstractQueryableTable implements TranslatableTable { - - private RelDataType types; - private AbstractStorageEngine engine; - private String seriesName; - - public SidewinderTable(String seriesName, AbstractStorageEngine engine) { - super(Object[].class); - this.seriesName = seriesName; - this.engine = engine; - } - - @Override - public RelDataType getRowType(RelDataTypeFactory typeFactory) { - types = typeFactory.builder().add("timestamp", SqlTypeName.TIMESTAMP).add("value", SqlTypeName.DOUBLE) - .add("tags", SqlTypeName.MAP).build(); - return types; - } - - @Override - public Queryable asQueryable(QueryProvider queryProvider, SchemaPlus schema, String tableName) { - // TODO Auto-generated method stub - return null; - } - - @Override - public RelNode toRel(ToRelContext context, RelOptTable relOptTable) { - // TODO Auto-generated method stub - return null; - } - - /* - * @Override public Enumerable scan(DataContext root, - * List filters) { // TODO Auto-generated method stub - * List> timeSeriesOperators = new ArrayList<>(); for - * (Iterator iterator = filters.iterator(); iterator.hasNext();) { - * RexNode filter = iterator.next(); if (extractReductionFilter(filter, - * timeSeriesOperators)) { iterator.remove(); } } return null; } - * - * public static Operator buildOperator(Class type, RexNode - * filter, boolean negated) { boolean isNegated = negated; if - * (filter.isA(SqlKind.NOT)) { filter = ((RexCall) filter).operands.get(0); - * isNegated = true; } else { isNegated = false; } - * - * final RexCall call = (RexCall) filter; if (filter.isA(SqlKind.AND) || - * filter.isA(SqlKind.OR)) { List> operators = new - * ArrayList<>(); call.operands.forEach(operand -> { - * operators.add(buildOperator(type, operand, false)); }); if - * (filter.isA(SqlKind.AND)) { return new AndOperator<>(operators); } else { - * return new OrOperator<>(operators); } } else { RexNode left = - * call.getOperands().get(0); if (left.isA(SqlKind.CAST)) { left = - * ((RexCall) left).operands.get(0); } if (left instanceof RexInputRef) { - * RexInputRef ref = (RexInputRef) left; } } - * - * return null; } - * - * public static Operator buildNumericOperator(RexNode filter, - * RexCall call) { Number value = (Number) ((RexLiteral) - * call.getOperands().get(1)).getValue(); boolean isFloat = - * value.doubleValue() == value.longValue(); switch (filter.getKind()) { - * case EQUALS: return new NumericEquals(isFloat, value); case GREATER_THAN: - * return new GreaterThan(isFloat, value); case GREATER_THAN_OR_EQUAL: - * return new GreaterThanEquals(isFloat, value); case LESS_THAN: return new - * LessThan(isFloat, value); case LESS_THAN_OR_EQUAL: return new - * LessThanEquals(isFloat, value); default: return null; } } - * - * public static boolean extractReductionFilter(RexNode filter, - * List> timeSeriesOperators) { // Extract comparison filter - * boolean negateCondition = false; if (filter.isA(SqlKind.NOT)) { filter = - * ((RexCall) filter).operands.get(0); } if (filter.isA(SqlKind.COMPARISON)) - * { final RexCall call = (RexCall) filter; RexNode left = - * call.getOperands().get(0); if (left.isA(SqlKind.CAST)) { left = - * ((RexCall) left).operands.get(0); } if (left instanceof RexInputRef) { - * RexInputRef ref = (RexInputRef) left; if - * (ref.getName().equalsIgnoreCase("timestamp")) { // time based filter if - * (call.getOperands().get(1) instanceof RexLiteral) { switch - * (filter.getKind()) { case EQUALS: break; case GREATER_THAN: break; case - * GREATER_THAN_OR_EQUAL: break; case LESS_THAN: break; case - * LESS_THAN_OR_EQUAL: break; } } else if (call.getOperands().get(1) - * instanceof RexCall) { - * - * } else { // unknown operator } } else if - * (ref.getName().equalsIgnoreCase("value")) { // value filtering } else if - * (filter.isA(SqlKind.IN)) { // for tag filtering } else { - * - * } } } else if (filter.isA(SqlKind.BETWEEN)) { final RexCall call = - * (RexCall) filter; RexNode left = call.getOperands().get(0); if - * (left.isA(SqlKind.CAST)) { left = ((RexCall) left).operands.get(0); } if - * (left instanceof RexInputRef) { RexInputRef ref = (RexInputRef) left; if - * (ref.getName().equalsIgnoreCase("timestamp")) { // time based filter if - * (call.getOperands().get(SqlBetweenOperator.VALUE_OPERAND) instanceof - * RexLiteral) { - * - * } else if (call.getOperands().get(SqlBetweenOperator.VALUE_OPERAND) - * instanceof RexCall) { - * - * } else { // unknown operator } } else if - * (ref.getName().equalsIgnoreCase("value")) { // value filtering } else { - * // invalid filtering case } } } return false; } - * - * public class SeriesEnumerator implements Enumerator { - * - * @Override public void close() { // TODO Auto-generated method stub - * - * } - * - * @Override public Object[] current() { return null; } - * - * @Override public boolean moveNext() { return false; } - * - * @Override public void reset() { // TODO Auto-generated method stub - * - * } - * - * } - */ - -} diff --git a/core/src/arc/functions/DateDiffFunction.java b/core/src/arc/functions/DateDiffFunction.java deleted file mode 100644 index 4eaacdd..0000000 --- a/core/src/arc/functions/DateDiffFunction.java +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Copyright 2017 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.sql.calcite.functions; - -import java.sql.Timestamp; - -import org.apache.calcite.linq4j.function.Function2; - -public class DateDiffFunction implements Function2 { - - @Override - public Long apply(Timestamp v0, Timestamp v1) { - return Math.abs(v0.getTime() - v1.getTime()); - } - -} diff --git a/core/src/arc/functions/NowFunction.java b/core/src/arc/functions/NowFunction.java deleted file mode 100644 index ac39e16..0000000 --- a/core/src/arc/functions/NowFunction.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright 2017 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.sql.calcite.functions; - -import java.sql.Timestamp; -import java.time.Instant; - -import org.apache.calcite.linq4j.function.Function0; - -/** - * @author ambud - */ -public class NowFunction implements Function0 { - - @Override - public Timestamp apply() { - return Timestamp.from(Instant.now()); - } - -} diff --git a/core/src/arc/functions/ToMilliseconds.java b/core/src/arc/functions/ToMilliseconds.java deleted file mode 100644 index 6ea5837..0000000 --- a/core/src/arc/functions/ToMilliseconds.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Copyright 2017 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.sql.calcite.functions; - -import java.util.concurrent.TimeUnit; - -import org.apache.calcite.linq4j.function.Function2; - -import com.srotya.sidewinder.core.utils.TimeUtils; - -/** - * @author ambud - */ -public class ToMilliseconds implements Function2 { - - @Override - public Long apply(Integer v0, String v1) { - return (long) TimeUtils.timeToSeconds(TimeUnit.valueOf(v1), v0) * 1000; - } - -} diff --git a/core/src/arc/functions/ToTimestamp.java b/core/src/arc/functions/ToTimestamp.java deleted file mode 100644 index f59ac3e..0000000 --- a/core/src/arc/functions/ToTimestamp.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright 2017 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.sql.calcite.functions; - -import java.sql.Timestamp; -import java.time.Instant; - -import org.apache.calcite.linq4j.function.Function1; - -/** - * @author ambud - */ -public class ToTimestamp implements Function1 { - - @Override - public Timestamp apply(Long a0) { - return Timestamp.from(Instant.ofEpochMilli(a0)); - } - -} diff --git a/core/src/arc/operators/AndOperator.java b/core/src/arc/operators/AndOperator.java deleted file mode 100644 index 38ba918..0000000 --- a/core/src/arc/operators/AndOperator.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Copyright 2016 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.operators; - -import java.util.List; - -public class AndOperator extends ComplexOperator{ - - public AndOperator(List> operators) { - super(operators); - } - - @Override - public boolean shortCircuit(boolean prev, boolean current) { - return !(prev && current); - } - - @Override - public boolean operator(boolean prev, Operator next, E value) { - return prev && next.operate(value); - } - - -} diff --git a/core/src/arc/operators/BetweenOperator.java b/core/src/arc/operators/BetweenOperator.java deleted file mode 100644 index c19f529..0000000 --- a/core/src/arc/operators/BetweenOperator.java +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Copyright 2016 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.operators; - -public class BetweenOperator implements Operator { - - private Number upperBound; - private Number lowerBound; - private boolean isFloat; - private boolean isInclusive; - - public BetweenOperator(boolean isFloat, boolean isInclusive, Number lowerBound, Number upperBound) { - this.isFloat = isFloat; - this.isInclusive = isInclusive; - this.lowerBound = lowerBound; - this.upperBound = upperBound; - } - - @Override - public boolean operate(Number value) { - if (isInclusive) { - if (isFloat) { - return lowerBound.doubleValue() <= value.doubleValue() - && upperBound.doubleValue() >= value.doubleValue(); - } else { - return lowerBound.longValue() <= value.longValue() && upperBound.longValue() >= value.longValue(); - } - } else { - if (isFloat) { - return lowerBound.doubleValue() < value.doubleValue() && upperBound.doubleValue() > value.doubleValue(); - } else { - return lowerBound.longValue() <= value.longValue() && upperBound.longValue() >= value.longValue(); - } - } - } - -} diff --git a/core/src/arc/operators/ComplexOperator.java b/core/src/arc/operators/ComplexOperator.java deleted file mode 100644 index e22d7f6..0000000 --- a/core/src/arc/operators/ComplexOperator.java +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Copyright 2016 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.operators; - -import java.util.List; - -public abstract class ComplexOperator implements Operator { - - private List> operators; - - public ComplexOperator(List> operators) { - this.operators = operators; - } - - @Override - public boolean operate(E value) { - boolean result = operators.get(0).operate(value); - for (int i = 1; i < operators.size(); i++) { - boolean temp = result; - result = operator(result, operators.get(i), value); - if (shortCircuit(temp, result)) { - break; - } - } - return result; - } - - public abstract boolean shortCircuit(boolean prev, boolean current); - - public abstract boolean operator(boolean prev, Operator next, E value); - -} diff --git a/core/src/arc/operators/Equals.java b/core/src/arc/operators/Equals.java deleted file mode 100644 index b02b309..0000000 --- a/core/src/arc/operators/Equals.java +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Copyright 2016 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.operators; - -public class Equals extends SimpleOperator { - - public Equals(E literal) { - super(literal); - } - - @Override - public boolean operate(E value) { - return getLiteral().equals(value); - } - -} diff --git a/core/src/arc/operators/GreaterThan.java b/core/src/arc/operators/GreaterThan.java deleted file mode 100644 index 1dd9506..0000000 --- a/core/src/arc/operators/GreaterThan.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright 2016 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.operators; - -public class GreaterThan extends NumericOperator { - - public GreaterThan(boolean isFloat, Number literal) { - super(isFloat, literal); - } - - @Override - public boolean compareTrue(Number literal, Number value) { - if (isFloat()) { - return value.doubleValue() > literal.doubleValue(); - } else { - return value.longValue() > literal.longValue(); - } - } - -} diff --git a/core/src/arc/operators/GreaterThanEquals.java b/core/src/arc/operators/GreaterThanEquals.java deleted file mode 100644 index eec2fed..0000000 --- a/core/src/arc/operators/GreaterThanEquals.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright 2016 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.operators; - -public class GreaterThanEquals extends NumericOperator { - - public GreaterThanEquals(boolean isFloat, Number literal) { - super(isFloat, literal); - } - - @Override - public boolean compareTrue(Number literal, Number value) { - if (isFloat()) { - return value.doubleValue() >= literal.doubleValue(); - } else { - return value.longValue() >= literal.longValue(); - } - } - -} diff --git a/core/src/arc/operators/LessThan.java b/core/src/arc/operators/LessThan.java deleted file mode 100644 index d17252d..0000000 --- a/core/src/arc/operators/LessThan.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright 2016 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.operators; - -public class LessThan extends NumericOperator { - - public LessThan(boolean isFloat, Number literal) { - super(isFloat, literal); - } - - @Override - public boolean compareTrue(Number literal, Number value) { - if (isFloat()) { - return value.doubleValue() < literal.doubleValue(); - } else { - return value.longValue() < literal.longValue(); - } - } - -} diff --git a/core/src/arc/operators/LessThanEquals.java b/core/src/arc/operators/LessThanEquals.java deleted file mode 100644 index ecd8aa2..0000000 --- a/core/src/arc/operators/LessThanEquals.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright 2016 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.operators; - -public class LessThanEquals extends NumericOperator { - - public LessThanEquals(boolean isFloat, Number literal) { - super(isFloat, literal); - } - - @Override - public boolean compareTrue(Number literal, Number value) { - if (isFloat()) { - return value.doubleValue() <= literal.doubleValue(); - } else { - return value.longValue() <= literal.longValue(); - } - } - -} diff --git a/core/src/arc/operators/NotOperator.java b/core/src/arc/operators/NotOperator.java deleted file mode 100644 index 3697441..0000000 --- a/core/src/arc/operators/NotOperator.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright 2016 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.operators; - -public class NotOperator implements Operator{ - - private Operator inputOperator; - - public NotOperator(Operator inputOperator) { - this.inputOperator = inputOperator; - } - - @Override - public boolean operate(E value) { - return !inputOperator.operate(value); - } - -} diff --git a/core/src/arc/operators/NumericEquals.java b/core/src/arc/operators/NumericEquals.java deleted file mode 100644 index 6d721b6..0000000 --- a/core/src/arc/operators/NumericEquals.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright 2016 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.operators; - -public class NumericEquals extends NumericOperator { - - public NumericEquals(boolean isFloat, Number literal) { - super(isFloat, literal); - } - - @Override - public boolean compareTrue(Number literal, Number value) { - if (isFloat()) { - return value.doubleValue() == literal.doubleValue(); - } else { - return value.longValue() == literal.longValue(); - } - } - -} diff --git a/core/src/arc/operators/NumericOperator.java b/core/src/arc/operators/NumericOperator.java deleted file mode 100644 index 2214b4d..0000000 --- a/core/src/arc/operators/NumericOperator.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Copyright 2016 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.operators; - -public abstract class NumericOperator extends SimpleOperator{ - - private boolean isFloat; - - public NumericOperator(boolean isFloat, Number literal) { - super(literal); - this.isFloat = isFloat; - } - - @Override - public boolean operate(Number value) { - return compareTrue(getLiteral(), value) ; - } - - public abstract boolean compareTrue(Number literal, Number value); - - public boolean isFloat() { - return isFloat; - } - -} diff --git a/core/src/arc/operators/Operator.java b/core/src/arc/operators/Operator.java deleted file mode 100644 index e645bb9..0000000 --- a/core/src/arc/operators/Operator.java +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Copyright 2016 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.operators; - -public interface Operator { - - boolean operate(E value); - -} diff --git a/core/src/arc/operators/OrOperator.java b/core/src/arc/operators/OrOperator.java deleted file mode 100644 index 7588b4f..0000000 --- a/core/src/arc/operators/OrOperator.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Copyright 2016 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.operators; - -import java.util.List; - -public class OrOperator extends ComplexOperator { - - public OrOperator(List> operators) { - super(operators); - } - - @Override - public boolean shortCircuit(boolean prev, boolean current) { - return prev || current; - } - - @Override - public boolean operator(boolean prev, Operator next, E value) { - return prev || next.operate(value); - } - -} diff --git a/core/src/arc/operators/SimpleOperator.java b/core/src/arc/operators/SimpleOperator.java deleted file mode 100644 index c9784c2..0000000 --- a/core/src/arc/operators/SimpleOperator.java +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Copyright 2016 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.operators; - -public abstract class SimpleOperator implements Operator { - - private E literal; - - public SimpleOperator(E literal) { - this.literal = literal; - } - - public E getLiteral() { - return literal; - } -} diff --git a/core/src/arc/rocksdb/RocksDBStorageEngine.java b/core/src/arc/rocksdb/RocksDBStorageEngine.java deleted file mode 100644 index fb3c388..0000000 --- a/core/src/arc/rocksdb/RocksDBStorageEngine.java +++ /dev/null @@ -1,315 +0,0 @@ -/** - * Copyright 2016 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.storage.rocksdb; - -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.IOException; -import java.nio.charset.Charset; -import java.util.Arrays; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.TreeMap; -import java.util.concurrent.ExecutionException; - -import org.rocksdb.CompactionStyle; -import org.rocksdb.FlushOptions; -import org.rocksdb.Options; -import org.rocksdb.RocksDB; -import org.rocksdb.RocksDBException; -import org.rocksdb.RocksIterator; -import org.rocksdb.WriteOptions; -import org.rocksdb.util.SizeUnit; - -import com.esotericsoftware.kryo.Kryo; -import com.esotericsoftware.kryo.io.Input; -import com.esotericsoftware.kryo.io.Output; -import com.google.common.cache.CacheBuilder; -import com.google.common.cache.CacheLoader; -import com.google.common.cache.LoadingCache; -import com.srotya.sidewinder.core.predicates.Predicate; -import com.srotya.sidewinder.core.storage.AbstractStorageEngine; -import com.srotya.sidewinder.core.storage.DataPoint; -import com.srotya.sidewinder.core.storage.WriteTask; - -/** - * @author ambudsharma - */ -public class RocksDBStorageEngine extends AbstractStorageEngine { - - private static final Charset CHARSET = Charset.forName("utf-8"); - private LoadingCache> seriesLookup; - private RocksDB indexdb; - private Options indexdbOptions; - private RocksDB tsdb; - private Options tsdbOptions; - private WriteOptions writeOptions; - private String tsdbWalDirectory; - private String tsdbMemDirectory; - private String indexdbMemDirectory; - private String indexdbWalDirectory; - private FlushOptions flushOptions; - private static final ThreadLocal kryoThreadLocal = new ThreadLocal() { - @Override - protected Kryo initialValue() { - Kryo kryo = new Kryo(); - return kryo; - } - }; - - static { - RocksDB.loadLibrary(); - } - - @SuppressWarnings("resource") - @Override - public void configure(Map conf) throws IOException { - tsdbWalDirectory = conf.getOrDefault("tsdb.wal.directory", "target/tsdbw"); - tsdbMemDirectory = conf.getOrDefault("tsdb.mem.directory", "target/tsdbm"); - - indexdbWalDirectory = conf.getOrDefault("idxdb.wal.directory", "target/idxdbw"); - indexdbMemDirectory = conf.getOrDefault("idxdb.mem.directory", "target/idxdbm"); - - if (true) { - wipeDirectory(tsdbWalDirectory); - wipeDirectory(tsdbMemDirectory); - wipeDirectory(indexdbWalDirectory); - wipeDirectory(indexdbMemDirectory); - } - tsdbOptions = new Options().setCreateIfMissing(true) - .setAllowMmapReads(true).setAllowMmapWrites(true) - .setIncreaseParallelism(2).setFilterDeletes(true).setMaxBackgroundCompactions(10) - .setMaxBackgroundFlushes(10).setDisableDataSync(false).setUseFsync(false).setUseAdaptiveMutex(false) - .setWriteBufferSize(1 * SizeUnit.MB).setCompactionStyle(CompactionStyle.UNIVERSAL) - .setMaxWriteBufferNumber(6).setWalTtlSeconds(60).setWalSizeLimitMB(512) - .setMaxTotalWalSize(1024 * SizeUnit.MB).setErrorIfExists(false).setAllowOsBuffer(true) - .setWalDir(tsdbWalDirectory).setOptimizeFiltersForHits(false); - - indexdbOptions = new Options().setCreateIfMissing(true) - .setAllowMmapReads(true).setAllowMmapWrites(true) - .setIncreaseParallelism(2).setFilterDeletes(true).setMaxBackgroundCompactions(10) - .setMaxBackgroundFlushes(10).setDisableDataSync(false).setUseFsync(false).setUseAdaptiveMutex(false) - .setWriteBufferSize(1 * SizeUnit.MB).setCompactionStyle(CompactionStyle.UNIVERSAL) - .setMaxWriteBufferNumber(6).setWalTtlSeconds(60).setWalSizeLimitMB(512) - .setMaxTotalWalSize(1024 * SizeUnit.MB).setErrorIfExists(false).setAllowOsBuffer(true) - .setWalDir(indexdbWalDirectory).setOptimizeFiltersForHits(false); - writeOptions = new WriteOptions().setDisableWAL(false).setSync(false); - - flushOptions = new FlushOptions().setWaitForFlush(true); - } - - private void wipeDirectory(String directory) { - File file = new File(directory); - if (file.isDirectory() && file.exists()) { - Arrays.asList(file.listFiles()).forEach((f) -> { - f.delete(); - }); - file.delete(); - file.mkdirs(); - } - } - - @Override - public void connect() throws IOException { - try { - tsdb = RocksDB.open(tsdbOptions, tsdbMemDirectory); - indexdb = RocksDB.open(indexdbOptions, indexdbMemDirectory); - seriesLookup = CacheBuilder.newBuilder().maximumSize(1000) - .build(new CacheLoader>() { - - @Override - public TreeMap load(String key) throws Exception { - return getTreeFromDS(key); - } - - }); - } catch (RocksDBException e) { - throw new IOException(e); - } - } - - @Override - public void disconnect() throws IOException { - if(flushOptions!=null) { - flushOptions.close(); - } - if (tsdb != null) { - tsdb.close(); - } - if (indexdb != null) { - indexdb.close(); - } - if (writeOptions != null) { - writeOptions.close(); - } - if (indexdbOptions != null) { - indexdbOptions.close(); - } - if (tsdbOptions != null) { - tsdbOptions.close(); - } - } - - @Override - public byte[] indexIdentifier(String identifier) throws IOException { - try { - byte[] key = identifier.getBytes(CHARSET); - byte[] val = indexdb.get(key); - if (val == null) { -// val = ByteUtils.intToByteMSBTruncated((identifier)); - indexdb.put(key, val); - } - return val; - } catch (RocksDBException e) { - throw new IOException(e); - } - } - - public TreeMap getTreeFromDS(String rowKey) throws Exception { - return getTreeFromDS(rowKey.getBytes()); - } - - @SuppressWarnings("unchecked") - public TreeMap getTreeFromDS(byte[] rowKey) throws RocksDBException { - byte[] ds = tsdb.get(rowKey); - TreeMap map; - if (ds != null) { - map = kryoThreadLocal.get().readObject(new Input(ds), TreeMap.class); - } else { - map = new TreeMap<>(); - } - return map; - } - - @Override - public void writeSeriesPoint(WriteTask point) throws IOException { - String encodedKey = new String(point.getRowKey()); - try { - TreeMap map = seriesLookup.get(encodedKey); - indexdb.put(point.getSeriesName(), point.getSeriesName()); - map.put(point.getTimestamp(), point.getValue()); - ByteArrayOutputStream stream = new ByteArrayOutputStream((map.size() + 1) * 20); - Output output = new Output(stream); - kryoThreadLocal.get().writeObject(output, map); - output.close(); - tsdb.put(point.getRowKey(), stream.toByteArray()); - } catch (RocksDBException | ExecutionException e) { - e.printStackTrace(); - throw new IOException(e); - } - } - - @Override - public Set getAllMeasurementsForDb(String dbName) throws Exception { - Set series = new HashSet<>(); - RocksIterator itr = indexdb.newIterator(); - itr.seekToFirst(); - while (itr.isValid()) { - String seriesName = new String(itr.key()); - if (seriesName.startsWith(dbName+"_series_")) { - series.add(seriesName); - } - itr.next(); - } - return series; - } - - @Override - public void flush() throws IOException { - try { - tsdb.flush(flushOptions); - System.err.println("Flushed"); - } catch (RocksDBException e) { - throw new IOException(e); - } - } - - public void print() throws Exception { - RocksIterator itr = tsdb.newIterator(); - itr.seekToFirst(); - do { - System.out.println(new String(itr.key())); - itr.next(); - }while(itr.isValid()); - } - - @Override - public Set getDatabases() throws Exception { - Set databases = new HashSet<>(); - RocksIterator itr = indexdb.newIterator(); - itr.seekToFirst(); - while (itr.isValid()) { - String seriesName = new String(itr.key()); - if (seriesName.startsWith("db_")) { - String dbName = seriesName.split("_")[1]; - databases.add(dbName); - } - itr.next(); - } - return databases; - } - - @Override - public void deleteAllData() throws Exception { - // TODO Auto-generated method stub - - } - - @Override - public boolean checkIfExists(String dbName) throws Exception { - // TODO Auto-generated method stub - return false; - } - - @Override - public void dropDatabase(String dbName) throws Exception { - // TODO Auto-generated method stub - - } - - @Override - public void writeDataPoint(String dbName, DataPoint dp) throws IOException { - // TODO Auto-generated method stub - - } - - @Override - public Set getMeasurementsLike(String dbName, String seriesNames) throws IOException { - // TODO Auto-generated method stub - return null; - } - - @Override - public List queryDataPoints(String dbName, String measurementName, long startTime, long endTime, - List tags, Predicate valuePredicate) { - // TODO Auto-generated method stub - return null; - } - - @Override - public void dropMeasurement(String dbName, String measurementName) throws Exception { - // TODO Auto-generated method stub - - } - - @Override - public boolean checkIfExists(String dbName, String measurement) throws Exception { - // TODO Auto-generated method stub - return false; - } -} \ No newline at end of file diff --git a/core/src/arc/scrapbook.jpage b/core/src/arc/scrapbook.jpage deleted file mode 100644 index fe5fce8..0000000 --- a/core/src/arc/scrapbook.jpage +++ /dev/null @@ -1 +0,0 @@ -System.out.println(new java.util.Date(1483985514960000L)); \ No newline at end of file diff --git a/core/src/arc/sql/TestSQLDriver.java b/core/src/arc/sql/TestSQLDriver.java deleted file mode 100644 index e03b133..0000000 --- a/core/src/arc/sql/TestSQLDriver.java +++ /dev/null @@ -1,71 +0,0 @@ -/** - * Copyright 2017 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.sql.parser; - -import static org.junit.Assert.*; - -import org.junit.Test; - -import com.srotya.sidewinder.core.sql.SQLDriver; -import com.srotya.sidewinder.core.sql.SQLParserBaseListener; -import com.srotya.sidewinder.core.sql.operators.Operator; - -/** - * @author ambud - */ -public class TestSQLDriver { - - @Test - public void testSimpleStatement() { - SQLParserBaseListener parseSQL = SQLDriver.parseSQL("select * from test"); - Operator filterTree = parseSQL.getFilterTree(); - assertNull(filterTree); - assertEquals("test", parseSQL.getMeasurementName()); - } - - @Test - public void testSimpleConditionStatement() { - System.out.println("Timestamp:" + System.currentTimeMillis()); - SQLParserBaseListener parseSQL = SQLDriver.parseSQL("select * from test where datediff(timestamp, now())<5"); - Operator filterTree = parseSQL.getFilterTree(); - assertNotNull(filterTree); - assertEquals("test", parseSQL.getMeasurementName()); - System.out.println(filterTree); - } - - @Test - public void testSimpleInConditionStatement() { - System.out.println("Timestamp:" + System.currentTimeMillis()); - SQLParserBaseListener parseSQL = SQLDriver - .parseSQL("select * from test where datediff(timestamp, now())<5 and tags in (host, cpu)"); - Operator filterTree = parseSQL.getFilterTree(); - assertNotNull(filterTree); - assertEquals("test", parseSQL.getMeasurementName()); - System.out.println(filterTree); - } - - @Test - public void testSimpleInValueConditionStatement() { - System.out.println("Timestamp:" + System.currentTimeMillis()); - SQLParserBaseListener parseSQL = SQLDriver - .parseSQL("select * from test where value>5 and datediff(timestamp, now())<5 and tags in (host, cpu)"); - Operator filterTree = parseSQL.getFilterTree(); - assertNotNull(filterTree); - assertEquals("test", parseSQL.getMeasurementName()); - System.out.println(filterTree); - } - -} diff --git a/core/src/arc/sql/operators/AndOperator.java b/core/src/arc/sql/operators/AndOperator.java deleted file mode 100644 index 38ba918..0000000 --- a/core/src/arc/sql/operators/AndOperator.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Copyright 2016 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.operators; - -import java.util.List; - -public class AndOperator extends ComplexOperator{ - - public AndOperator(List> operators) { - super(operators); - } - - @Override - public boolean shortCircuit(boolean prev, boolean current) { - return !(prev && current); - } - - @Override - public boolean operator(boolean prev, Operator next, E value) { - return prev && next.operate(value); - } - - -} diff --git a/core/src/arc/sql/operators/BetweenOperator.java b/core/src/arc/sql/operators/BetweenOperator.java deleted file mode 100644 index c19f529..0000000 --- a/core/src/arc/sql/operators/BetweenOperator.java +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Copyright 2016 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.operators; - -public class BetweenOperator implements Operator { - - private Number upperBound; - private Number lowerBound; - private boolean isFloat; - private boolean isInclusive; - - public BetweenOperator(boolean isFloat, boolean isInclusive, Number lowerBound, Number upperBound) { - this.isFloat = isFloat; - this.isInclusive = isInclusive; - this.lowerBound = lowerBound; - this.upperBound = upperBound; - } - - @Override - public boolean operate(Number value) { - if (isInclusive) { - if (isFloat) { - return lowerBound.doubleValue() <= value.doubleValue() - && upperBound.doubleValue() >= value.doubleValue(); - } else { - return lowerBound.longValue() <= value.longValue() && upperBound.longValue() >= value.longValue(); - } - } else { - if (isFloat) { - return lowerBound.doubleValue() < value.doubleValue() && upperBound.doubleValue() > value.doubleValue(); - } else { - return lowerBound.longValue() <= value.longValue() && upperBound.longValue() >= value.longValue(); - } - } - } - -} diff --git a/core/src/arc/sql/operators/ComplexOperator.java b/core/src/arc/sql/operators/ComplexOperator.java deleted file mode 100644 index e22d7f6..0000000 --- a/core/src/arc/sql/operators/ComplexOperator.java +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Copyright 2016 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.operators; - -import java.util.List; - -public abstract class ComplexOperator implements Operator { - - private List> operators; - - public ComplexOperator(List> operators) { - this.operators = operators; - } - - @Override - public boolean operate(E value) { - boolean result = operators.get(0).operate(value); - for (int i = 1; i < operators.size(); i++) { - boolean temp = result; - result = operator(result, operators.get(i), value); - if (shortCircuit(temp, result)) { - break; - } - } - return result; - } - - public abstract boolean shortCircuit(boolean prev, boolean current); - - public abstract boolean operator(boolean prev, Operator next, E value); - -} diff --git a/core/src/arc/sql/operators/Equals.java b/core/src/arc/sql/operators/Equals.java deleted file mode 100644 index b02b309..0000000 --- a/core/src/arc/sql/operators/Equals.java +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Copyright 2016 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.operators; - -public class Equals extends SimpleOperator { - - public Equals(E literal) { - super(literal); - } - - @Override - public boolean operate(E value) { - return getLiteral().equals(value); - } - -} diff --git a/core/src/arc/sql/operators/GreaterThan.java b/core/src/arc/sql/operators/GreaterThan.java deleted file mode 100644 index 1dd9506..0000000 --- a/core/src/arc/sql/operators/GreaterThan.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright 2016 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.operators; - -public class GreaterThan extends NumericOperator { - - public GreaterThan(boolean isFloat, Number literal) { - super(isFloat, literal); - } - - @Override - public boolean compareTrue(Number literal, Number value) { - if (isFloat()) { - return value.doubleValue() > literal.doubleValue(); - } else { - return value.longValue() > literal.longValue(); - } - } - -} diff --git a/core/src/arc/sql/operators/GreaterThanEquals.java b/core/src/arc/sql/operators/GreaterThanEquals.java deleted file mode 100644 index eec2fed..0000000 --- a/core/src/arc/sql/operators/GreaterThanEquals.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright 2016 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.operators; - -public class GreaterThanEquals extends NumericOperator { - - public GreaterThanEquals(boolean isFloat, Number literal) { - super(isFloat, literal); - } - - @Override - public boolean compareTrue(Number literal, Number value) { - if (isFloat()) { - return value.doubleValue() >= literal.doubleValue(); - } else { - return value.longValue() >= literal.longValue(); - } - } - -} diff --git a/core/src/arc/sql/operators/LessThan.java b/core/src/arc/sql/operators/LessThan.java deleted file mode 100644 index d17252d..0000000 --- a/core/src/arc/sql/operators/LessThan.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright 2016 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.operators; - -public class LessThan extends NumericOperator { - - public LessThan(boolean isFloat, Number literal) { - super(isFloat, literal); - } - - @Override - public boolean compareTrue(Number literal, Number value) { - if (isFloat()) { - return value.doubleValue() < literal.doubleValue(); - } else { - return value.longValue() < literal.longValue(); - } - } - -} diff --git a/core/src/arc/sql/operators/LessThanEquals.java b/core/src/arc/sql/operators/LessThanEquals.java deleted file mode 100644 index ecd8aa2..0000000 --- a/core/src/arc/sql/operators/LessThanEquals.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright 2016 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.operators; - -public class LessThanEquals extends NumericOperator { - - public LessThanEquals(boolean isFloat, Number literal) { - super(isFloat, literal); - } - - @Override - public boolean compareTrue(Number literal, Number value) { - if (isFloat()) { - return value.doubleValue() <= literal.doubleValue(); - } else { - return value.longValue() <= literal.longValue(); - } - } - -} diff --git a/core/src/arc/sql/operators/NotOperator.java b/core/src/arc/sql/operators/NotOperator.java deleted file mode 100644 index 3697441..0000000 --- a/core/src/arc/sql/operators/NotOperator.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright 2016 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.operators; - -public class NotOperator implements Operator{ - - private Operator inputOperator; - - public NotOperator(Operator inputOperator) { - this.inputOperator = inputOperator; - } - - @Override - public boolean operate(E value) { - return !inputOperator.operate(value); - } - -} diff --git a/core/src/arc/sql/operators/NumericEquals.java b/core/src/arc/sql/operators/NumericEquals.java deleted file mode 100644 index 6d721b6..0000000 --- a/core/src/arc/sql/operators/NumericEquals.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright 2016 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.operators; - -public class NumericEquals extends NumericOperator { - - public NumericEquals(boolean isFloat, Number literal) { - super(isFloat, literal); - } - - @Override - public boolean compareTrue(Number literal, Number value) { - if (isFloat()) { - return value.doubleValue() == literal.doubleValue(); - } else { - return value.longValue() == literal.longValue(); - } - } - -} diff --git a/core/src/arc/sql/operators/NumericOperator.java b/core/src/arc/sql/operators/NumericOperator.java deleted file mode 100644 index 2214b4d..0000000 --- a/core/src/arc/sql/operators/NumericOperator.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Copyright 2016 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.operators; - -public abstract class NumericOperator extends SimpleOperator{ - - private boolean isFloat; - - public NumericOperator(boolean isFloat, Number literal) { - super(literal); - this.isFloat = isFloat; - } - - @Override - public boolean operate(Number value) { - return compareTrue(getLiteral(), value) ; - } - - public abstract boolean compareTrue(Number literal, Number value); - - public boolean isFloat() { - return isFloat; - } - -} diff --git a/core/src/arc/sql/operators/Operator.java b/core/src/arc/sql/operators/Operator.java deleted file mode 100644 index e645bb9..0000000 --- a/core/src/arc/sql/operators/Operator.java +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Copyright 2016 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.operators; - -public interface Operator { - - boolean operate(E value); - -} diff --git a/core/src/arc/sql/operators/OrOperator.java b/core/src/arc/sql/operators/OrOperator.java deleted file mode 100644 index 7588b4f..0000000 --- a/core/src/arc/sql/operators/OrOperator.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Copyright 2016 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.operators; - -import java.util.List; - -public class OrOperator extends ComplexOperator { - - public OrOperator(List> operators) { - super(operators); - } - - @Override - public boolean shortCircuit(boolean prev, boolean current) { - return prev || current; - } - - @Override - public boolean operator(boolean prev, Operator next, E value) { - return prev || next.operate(value); - } - -} diff --git a/core/src/arc/sql/operators/SimpleOperator.java b/core/src/arc/sql/operators/SimpleOperator.java deleted file mode 100644 index c9784c2..0000000 --- a/core/src/arc/sql/operators/SimpleOperator.java +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Copyright 2016 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.operators; - -public abstract class SimpleOperator implements Operator { - - private E literal; - - public SimpleOperator(E literal) { - this.literal = literal; - } - - public E getLiteral() { - return literal; - } -} diff --git a/core/src/arc/sql/parser/SQLLexer.g4 b/core/src/arc/sql/parser/SQLLexer.g4 deleted file mode 100644 index 1ceaca8..0000000 --- a/core/src/arc/sql/parser/SQLLexer.g4 +++ /dev/null @@ -1,474 +0,0 @@ -/* - 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. - */ - -lexer grammar SQLLexer; - -@header { -} - -@members { -} - - -/* -=============================================================================== - Tokens for Case Insensitive Keywords -=============================================================================== -*/ -fragment A - : 'A' | 'a'; - -fragment B - : 'B' | 'b'; - -fragment C - : 'C' | 'c'; - -fragment D - : 'D' | 'd'; - -fragment E - : 'E' | 'e'; - -fragment F - : 'F' | 'f'; - -fragment G - : 'G' | 'g'; - -fragment H - : 'H' | 'h'; - -fragment I - : 'I' | 'i'; - -fragment J - : 'J' | 'j'; - -fragment K - : 'K' | 'k'; - -fragment L - : 'L' | 'l'; - -fragment M - : 'M' | 'm'; - -fragment N - : 'N' | 'n'; - -fragment O - : 'O' | 'o'; - -fragment P - : 'P' | 'p'; - -fragment Q - : 'Q' | 'q'; - -fragment R - : 'R' | 'r'; - -fragment S - : 'S' | 's'; - -fragment T - : 'T' | 't'; - -fragment U - : 'U' | 'u'; - -fragment V - : 'V' | 'v'; - -fragment W - : 'W' | 'w'; - -fragment X - : 'X' | 'x'; - -fragment Y - : 'Y' | 'y'; - -fragment Z - : 'Z' | 'z'; - -/* -=============================================================================== - Reserved Keywords -=============================================================================== -*/ - -AS : A S; -ALL : A L L; -AND : A N D; -ANY : A N Y; -ASYMMETRIC : A S Y M M E T R I C; -ASC : A S C; - -BOTH : B O T H; - -CASE : C A S E; -CAST : C A S T; -CREATE : C R E A T E; -CROSS : C R O S S; - -DESC : D E S C; -DISTINCT : D I S T I N C T; - -END : E N D; -ELSE : E L S E; -EXCEPT : E X C E P T; - -FALSE : F A L S E; -FULL : F U L L; -FROM : F R O M; - -GROUP : G R O U P; - -HAVING : H A V I N G; - -ILIKE : I L I K E; -IN : I N; -INNER : I N N E R; -INTERSECT : I N T E R S E C T; -INTO : I N T O; -IS : I S; - -JOIN : J O I N; - -LEADING : L E A D I N G; -LEFT : L E F T; -LIKE : L I K E; -LIMIT : L I M I T; - -NATURAL : N A T U R A L; -NOT : N O T; -NULL : N U L L; - -ON : O N; -OUTER : O U T E R; -OR : O R; -ORDER : O R D E R; -RIGHT : R I G H T; -SELECT : S E L E C T; -SOME : S O M E; -SYMMETRIC : S Y M M E T R I C; - -TABLE : T A B L E; -THEN : T H E N; -TRAILING : T R A I L I N G; -TRUE : T R U E; - -UNION : U N I O N; -UNIQUE : U N I Q U E; -USING : U S I N G; - -WHEN : W H E N; -WHERE : W H E R E; -WITH : W I T H; - -/* -=============================================================================== - Non Reserved Keywords -=============================================================================== -*/ -AVG : A V G; - -BETWEEN : B E T W E E N; -BY : B Y; - -CENTURY : C E N T U R Y; -CHARACTER : C H A R A C T E R; -COLLECT : C O L L E C T; -COALESCE : C O A L E S C E; -COLUMN : C O L U M N; -COUNT : C O U N T; -CUBE : C U B E; - -DAY : D A Y; -DEC : D E C; -DECADE : D E C A D E; -DOW : D O W; -DOY : D O Y; -DROP : D R O P; - -EPOCH : E P O C H; -EVERY : E V E R Y; -EXISTS : E X I S T S; -EXTERNAL : E X T E R N A L; -EXTRACT : E X T R A C T; - - -FILTER : F I L T E R; -FIRST : F I R S T; -FORMAT : F O R M A T; -FUSION : F U S I O N; - -GROUPING : G R O U P I N G; - -HASH : H A S H; -HOUR : H O U R; - -INDEX : I N D E X; -INSERT : I N S E R T; -INTERSECTION : I N T E R S E C T I O N; -ISODOW : I S O D O W; -ISOYEAR : I S O Y E A R; - -LAST : L A S T; -LESS : L E S S; -LIST : L I S T; -LOCATION : L O C A T I O N; - -MAX : M A X; -MAXVALUE : M A X V A L U E; -MICROSECONDS : M I C R O S E C O N D S; -MILLENNIUM : M I L L E N N I U M; -MILLISECONDS : M I L L I S E C O N D S; -MIN : M I N; -MINUTE : M I N U T E; -MONTH : M O N T H; - -NATIONAL : N A T I O N A L; -NULLIF : N U L L I F; - -OVERWRITE : O V E R W R I T E; - -PARTITION : P A R T I T I O N; -PARTITIONS : P A R T I T I O N S; -PRECISION : P R E C I S I O N; -PURGE : P U R G E; - -QUARTER : Q U A R T E R; - -RANGE : R A N G E; -REGEXP : R E G E X P; -RLIKE : R L I K E; -ROLLUP : R O L L U P; - -SECOND : S E C O N D; -SET : S E T; -SIMILAR : S I M I L A R; -STDDEV_POP : S T D D E V UNDERLINE P O P; -STDDEV_SAMP : S T D D E V UNDERLINE S A M P; -SUBPARTITION : S U B P A R T I T I O N; -SUM : S U M; - -TABLESPACE : T A B L E S P A C E; -THAN : T H A N; -TIMEZONE: T I M E Z O N E; -TIMEZONE_HOUR: T I M E Z O N E UNDERLINE H O U R; -TIMEZONE_MINUTE: T I M E Z O N E UNDERLINE M I N U T E; -TRIM : T R I M; -TO : T O; - -UNKNOWN : U N K N O W N; - -VALUES : V A L U E S; -VAR_SAMP : V A R UNDERLINE S A M P; -VAR_POP : V A R UNDERLINE P O P; -VARYING : V A R Y I N G; - -WEEK : W E E K; - -YEAR : Y E A R; - -ZONE : Z O N E; - - -/* -=============================================================================== - Data Type Tokens -=============================================================================== -*/ -BOOLEAN : B O O L E A N; -BOOL : B O O L; -BIT : B I T; -VARBIT : V A R B I T; - -INT1 : I N T '1'; -INT2 : I N T '2'; -INT4 : I N T '4'; -INT8 : I N T '8'; - -TINYINT : T I N Y I N T; // alias for INT1 -SMALLINT : S M A L L I N T; // alias for INT2 -INT : I N T; // alias for INT4 -INTEGER : I N T E G E R; // alias - INT4 -BIGINT : B I G I N T; // alias for INT8 - -FLOAT4 : F L O A T '4'; -FLOAT8 : F L O A T '8'; - -REAL : R E A L; // alias for FLOAT4 -FLOAT : F L O A T; // alias for FLOAT8 -DOUBLE : D O U B L E; // alias for FLOAT8 - -NUMERIC : N U M E R I C; -DECIMAL : D E C I M A L; // alias for number - -CHAR : C H A R; -VARCHAR : V A R C H A R; -NCHAR : N C H A R; -NVARCHAR : N V A R C H A R; - -DATE : D A T E; -TIME : T I M E; -TIMETZ : T I M E T Z; -TIMESTAMP : T I M E S T A M P; -TIMESTAMPTZ : T I M E S T A M P T Z; - -TEXT : T E X T; - -BINARY : B I N A R Y; -VARBINARY : V A R B I N A R Y; -BLOB : B L O B; -BYTEA : B Y T E A; // alias for BLOB - -INET4 : I N E T '4'; - -// Operators -Similar_To : '~'; -Not_Similar_To : '!~'; -Similar_To_Case_Insensitive : '~*'; -Not_Similar_To_Case_Insensitive : '!~*'; - -// Cast Operator -CAST_EXPRESSION - : COLON COLON - ; - -ASSIGN : ':='; -EQUAL : '='; -COLON : ':'; -SEMI_COLON : ';'; -COMMA : ','; -CONCATENATION_OPERATOR : VERTICAL_BAR VERTICAL_BAR; -NOT_EQUAL : '<>' | '!=' | '~='| '^=' ; -LTH : '<' ; -LEQ : '<='; -GTH : '>'; -GEQ : '>='; -LEFT_PAREN : '('; -RIGHT_PAREN : ')'; -PLUS : '+'; -MINUS : '-'; -MULTIPLY: '*'; -DIVIDE : '/'; -MODULAR : '%'; -DOT : '.'; -UNDERLINE : '_'; -VERTICAL_BAR : '|'; -QUOTE : '\''; -DOUBLE_QUOTE : '"'; - -NUMBER : Digit+; - -fragment -Digit : '0'..'9'; - -REAL_NUMBER - : ('0'..'9')+ '.' ('0'..'9')* EXPONENT? - | '.' ('0'..'9')+ EXPONENT? - | ('0'..'9')+ EXPONENT - ; - -BlockComment - : '/*' .*? '*/' -> skip - ; - -LineComment - : '--' ~[\r\n]* -> skip - ; - -/* -=============================================================================== - Identifiers -=============================================================================== -*/ - -Identifier - : Regular_Identifier - ; - -fragment -Regular_Identifier - : ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|Digit|'_')* - ; - -/* -=============================================================================== - Literal -=============================================================================== -*/ - -// Some Unicode Character Ranges -fragment -Control_Characters : '\u0001' .. '\u001F'; -fragment -Extended_Control_Characters : '\u0080' .. '\u009F'; - -Character_String_Literal - : QUOTE ( ESC_SEQ | ~('\\'|'\'') )* QUOTE - ; - -fragment -EXPONENT : ('e'|'E') ('+'|'-')? ('0'..'9')+ ; - -fragment -HEX_DIGIT : ('0'..'9'|'a'..'f'|'A'..'F') ; - -fragment -ESC_SEQ - : '\\' ('b'|'t'|'n'|'f'|'r'|'\"'|'\''|'\\') - | UNICODE_ESC - | OCTAL_ESC - ; - -fragment -OCTAL_ESC - : '\\' ('0'..'3') ('0'..'7') ('0'..'7') - | '\\' ('0'..'7') ('0'..'7') - | '\\' ('0'..'7') - ; - -fragment -UNICODE_ESC - : '\\' 'u' HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT - ; - - -/* -=============================================================================== - Whitespace Tokens -=============================================================================== -*/ - -Space - : ' ' -> skip - ; - -White_Space - : ( Control_Characters | Extended_Control_Characters )+ -> skip - ; - - -BAD - : . -> skip - ; diff --git a/core/src/arc/sql/parser/SQLParser.g4 b/core/src/arc/sql/parser/SQLParser.g4 deleted file mode 100644 index 16df5bf..0000000 --- a/core/src/arc/sql/parser/SQLParser.g4 +++ /dev/null @@ -1,1331 +0,0 @@ -parser grammar SQLParser; - -options { - language=Java; - tokenVocab=SQLLexer; -} - -@header { -} - -@members { -} - -/* -=============================================================================== - SQL statement (Start Symbol) -=============================================================================== -*/ -sql - : statement (SEMI_COLON)? EOF - ; - -statement - : data_statement - | data_change_statement - | schema_statement - | index_statement - ; - -data_statement - : query_expression - ; - -data_change_statement - : insert_statement - ; - -schema_statement - : create_table_statement - | drop_table_statement - ; - -index_statement - : CREATE (u=UNIQUE)? INDEX n=identifier ON t=table_name (m=method_specifier)? - LEFT_PAREN s=sort_specifier_list RIGHT_PAREN p=param_clause? - ; - -create_table_statement - : CREATE EXTERNAL TABLE table_name table_elements USING file_type=identifier - (param_clause)? (table_partitioning_clauses)? (LOCATION path=Character_String_Literal) - | CREATE TABLE table_name table_elements (USING file_type=identifier)? - (param_clause)? (table_partitioning_clauses)? (AS query_expression)? - | CREATE TABLE table_name (USING file_type=identifier)? - (param_clause)? (table_partitioning_clauses)? AS query_expression - ; - -table_elements - : LEFT_PAREN field_element (COMMA field_element)* RIGHT_PAREN - ; - -field_element - : name=identifier field_type - ; - -field_type - : data_type - ; - -param_clause - : WITH LEFT_PAREN param (COMMA param)* RIGHT_PAREN - ; - -param - : key=Character_String_Literal EQUAL value=numeric_value_expression - ; - -method_specifier - : USING m=identifier - ; - -table_space_specifier - : TABLESPACE table_space_name - ; - -table_space_name - : identifier - ; - -table_partitioning_clauses - : range_partitions - | hash_partitions - | list_partitions - | column_partitions - ; - -range_partitions - : PARTITION BY RANGE LEFT_PAREN column_reference_list RIGHT_PAREN - LEFT_PAREN range_value_clause_list RIGHT_PAREN - ; - -range_value_clause_list - : range_value_clause (COMMA range_value_clause)* - ; - -range_value_clause - : PARTITION partition_name VALUES LESS THAN (LEFT_PAREN value_expression RIGHT_PAREN | LEFT_PAREN? MAXVALUE RIGHT_PAREN?) - ; - -hash_partitions - : PARTITION BY HASH LEFT_PAREN column_reference_list RIGHT_PAREN - (LEFT_PAREN individual_hash_partitions RIGHT_PAREN | hash_partitions_by_quantity) - ; - -individual_hash_partitions - : individual_hash_partition (COMMA individual_hash_partition)* - ; - -individual_hash_partition - : PARTITION partition_name - ; - -hash_partitions_by_quantity - : PARTITIONS quantity = numeric_value_expression - ; - -list_partitions - : PARTITION BY LIST LEFT_PAREN column_reference_list RIGHT_PAREN LEFT_PAREN list_value_clause_list RIGHT_PAREN - ; - -list_value_clause_list - : list_value_partition (COMMA list_value_partition)* - ; - -list_value_partition - : PARTITION partition_name VALUES (IN)? LEFT_PAREN in_value_list RIGHT_PAREN - ; - -column_partitions - : PARTITION BY COLUMN table_elements - ; - -partition_name - : identifier - ; - -/* -=============================================================================== - 11.21 -=============================================================================== -*/ - -drop_table_statement - : DROP TABLE table_name (PURGE)? - ; - -/* -=============================================================================== - 5.2 - - Specifying lexical units (tokens and separators) that participate in SQL language -=============================================================================== -*/ - -identifier - : Identifier - | nonreserved_keywords - ; - -nonreserved_keywords - : AVG - | BETWEEN - | BY - | CENTURY - | CHARACTER - | COALESCE - | COLLECT - | COLUMN - | COUNT - | CUBE - | DAY - | DEC - | DECADE - | DOW - | DOY - | DROP - | EPOCH - | EVERY - | EXISTS - | EXTERNAL - | EXTRACT - | FILTER - | FIRST - | FORMAT - | FUSION - | GROUPING - | HASH - | INDEX - | INSERT - | INTERSECTION - | ISODOW - | ISOYEAR - | LAST - | LESS - | LIST - | LOCATION - | MAX - | MAXVALUE - | MICROSECONDS - | MILLENNIUM - | MILLISECONDS - | MIN - | MINUTE - | MONTH - | NATIONAL - | NULLIF - | OVERWRITE - | PARTITION - | PARTITIONS - | PRECISION - | PURGE - | QUARTER - | RANGE - | REGEXP - | RLIKE - | ROLLUP - | SECOND - | SET - | SIMILAR - | STDDEV_POP - | STDDEV_SAMP - | SUBPARTITION - | SUM - | TABLESPACE - | THAN - | TIMEZONE - | TIMEZONE_HOUR - | TIMEZONE_MINUTE - | TRIM - | TO - | UNKNOWN - | VALUES - | VAR_POP - | VAR_SAMP - | VARYING - | WEEK - | YEAR - | ZONE - - | BIGINT - | BIT - | BLOB - | BOOL - | BOOLEAN - | BYTEA - | CHAR - | DATE - | DECIMAL - | DOUBLE - | FLOAT - | FLOAT4 - | FLOAT8 - | INET4 - | INT - | INT1 - | INT2 - | INT4 - | INT8 - | INTEGER - | NCHAR - | NUMERIC - | NVARCHAR - | REAL - | SMALLINT - | TEXT - | TIME - | TIMESTAMP - | TIMESTAMPTZ - | TIMETZ - | TINYINT - | VARBINARY - | VARBIT - | VARCHAR - ; - -/* -=============================================================================== - 5.3 -=============================================================================== -*/ - -unsigned_literal - : unsigned_numeric_literal - | general_literal - ; - -general_literal - : Character_String_Literal - | datetime_literal - | boolean_literal - ; - -datetime_literal - : timestamp_literal - | time_literal - | date_literal - ; - -time_literal - : TIME time_string=Character_String_Literal - ; - -timestamp_literal - : TIMESTAMP timestamp_string=Character_String_Literal - ; - -date_literal - : DATE date_string=Character_String_Literal - ; - -boolean_literal - : TRUE | FALSE | UNKNOWN - ; - -/* -=============================================================================== - 6.1 -=============================================================================== -*/ - -data_type - : predefined_type - ; - -predefined_type - : character_string_type - | national_character_string_type - | binary_large_object_string_type - | numeric_type - | boolean_type - | datetime_type - | bit_type - | binary_type - | network_type - ; - -network_type - : INET4 - ; - -character_string_type - : CHARACTER type_length? - | CHAR type_length? - | CHARACTER VARYING type_length? - | CHAR VARYING type_length? - | VARCHAR type_length? - | TEXT - ; - -type_length - : LEFT_PAREN NUMBER RIGHT_PAREN - ; - -national_character_string_type - : NATIONAL CHARACTER type_length? - | NATIONAL CHAR type_length? - | NCHAR type_length? - | NATIONAL CHARACTER VARYING type_length? - | NATIONAL CHAR VARYING type_length? - | NCHAR VARYING type_length? - | NVARCHAR type_length? - ; - -binary_large_object_string_type - : BLOB type_length? - | BYTEA type_length? - ; - -numeric_type - : exact_numeric_type | approximate_numeric_type - ; - -exact_numeric_type - : NUMERIC (precision_param)? - | DECIMAL (precision_param)? - | DEC (precision_param)? - | INT1 - | TINYINT - | INT2 - | SMALLINT - | INT4 - | INT - | INTEGER - | INT8 - | BIGINT - ; - -approximate_numeric_type - : FLOAT (precision_param)? - | FLOAT4 - | REAL - | FLOAT8 - | DOUBLE - | DOUBLE PRECISION - ; - -precision_param - : LEFT_PAREN precision=NUMBER RIGHT_PAREN - | LEFT_PAREN precision=NUMBER COMMA scale=NUMBER RIGHT_PAREN - ; - -boolean_type - : BOOLEAN - | BOOL - ; - -datetime_type - : DATE - | TIME - | TIME WITH TIME ZONE - | TIMETZ - | TIMESTAMP - | TIMESTAMP WITH TIME ZONE - | TIMESTAMPTZ - ; - -bit_type - : BIT type_length? - | VARBIT type_length? - | BIT VARYING type_length? - ; - -binary_type - : BINARY type_length? - | BINARY VARYING type_length? - | VARBINARY type_length? - ; - -/* -=============================================================================== - 6.3 -=============================================================================== -*/ -value_expression_primary - : parenthesized_value_expression - | nonparenthesized_value_expression_primary - ; - -parenthesized_value_expression - : LEFT_PAREN value_expression RIGHT_PAREN - ; - -nonparenthesized_value_expression_primary - : unsigned_value_specification - | column_reference - | set_function_specification - | scalar_subquery - | case_expression - | cast_specification - | routine_invocation - ; - -/* -=============================================================================== - 6.4 -=============================================================================== -*/ - -unsigned_value_specification - : unsigned_literal - ; - -unsigned_numeric_literal - : NUMBER - | REAL_NUMBER - ; - -signed_numerical_literal - : sign? unsigned_numeric_literal - ; - -/* -=============================================================================== - 6.9 - - Invoke an SQL-invoked routine. -=============================================================================== -*/ -set_function_specification - : aggregate_function - ; - -aggregate_function - : COUNT LEFT_PAREN MULTIPLY RIGHT_PAREN - | general_set_function filter_clause? - ; - -general_set_function - : set_function_type LEFT_PAREN set_qualifier? value_expression RIGHT_PAREN - ; - -set_function_type - : AVG - | MAX - | MIN - | SUM - | EVERY - | ANY - | SOME - | COUNT - | STDDEV_POP - | STDDEV_SAMP - | VAR_SAMP - | VAR_POP - | COLLECT - | FUSION - | INTERSECTION - ; - -filter_clause - : FILTER LEFT_PAREN WHERE search_condition RIGHT_PAREN - ; - -grouping_operation - : GROUPING LEFT_PAREN column_reference_list RIGHT_PAREN - ; - -/* -=============================================================================== - 6.11 -=============================================================================== -*/ - -case_expression - : case_specification - ; - -case_abbreviation - : NULLIF LEFT_PAREN numeric_value_expression COMMA boolean_value_expression RIGHT_PAREN - | COALESCE LEFT_PAREN numeric_value_expression ( COMMA boolean_value_expression )+ RIGHT_PAREN - ; - -case_specification - : simple_case - | searched_case - ; - -simple_case - : CASE boolean_value_expression ( simple_when_clause )+ ( else_clause )? END - ; - -searched_case - : CASE (searched_when_clause)+ (else_clause)? END - ; - -simple_when_clause : WHEN search_condition THEN result ; - -searched_when_clause - : WHEN c=search_condition THEN r=result - ; - -else_clause - : ELSE r=result - ; - -result - : value_expression | NULL - ; - -/* -=============================================================================== - 6.12 -=============================================================================== -*/ - -cast_specification - : CAST LEFT_PAREN cast_operand AS cast_target RIGHT_PAREN - ; - -cast_operand - : value_expression - ; - -cast_target - : data_type - ; - -/* -=============================================================================== - 6.25 -=============================================================================== -*/ -value_expression - : common_value_expression - | row_value_expression - | boolean_value_expression - ; - -common_value_expression - : numeric_value_expression - | string_value_expression - | NULL - ; - -/* -=============================================================================== - 6.26 - - Specify a comparison of two row values. -=============================================================================== -*/ - -numeric_value_expression - : left=term ((PLUS|MINUS) right=term)* - ; - -term - : left=factor ((MULTIPLY|DIVIDE|MODULAR) right=factor)* - ; - -factor - : (sign)? numeric_primary - ; - -array - : LEFT_PAREN numeric_value_expression (COMMA numeric_value_expression )* RIGHT_PAREN - ; - -numeric_primary - : value_expression_primary (CAST_EXPRESSION cast_target)* - | numeric_value_function - ; - -sign - : PLUS | MINUS - ; - -/* -=============================================================================== - 6.27 -=============================================================================== -*/ - -numeric_value_function - : extract_expression - ; - -extract_expression - : EXTRACT LEFT_PAREN extract_field_string=extract_field FROM extract_source RIGHT_PAREN - ; - -extract_field - : primary_datetime_field - | time_zone_field - | extended_datetime_field - ; - -time_zone_field - : TIMEZONE | TIMEZONE_HOUR | TIMEZONE_MINUTE - ; - -extract_source - : column_reference - | datetime_literal - ; - -/* -=============================================================================== - 6.28 -=============================================================================== -*/ - -string_value_expression - : character_value_expression - ; - -character_value_expression - : character_factor (CONCATENATION_OPERATOR character_factor)* - ; - -character_factor - : character_primary - ; - -character_primary - : value_expression_primary - | string_value_function - ; - -/* -=============================================================================== - 6.29 -=============================================================================== -*/ - -string_value_function - : trim_function - ; - -trim_function - : TRIM LEFT_PAREN trim_operands RIGHT_PAREN - ; - -trim_operands - : ((trim_specification)? (trim_character=character_value_expression)? FROM)? trim_source=character_value_expression - | trim_source=character_value_expression COMMA trim_character=character_value_expression - ; - -trim_specification - : LEADING | TRAILING | BOTH - ; - -/* -=============================================================================== - 6.34 -=============================================================================== -*/ - -boolean_value_expression - : or_predicate - ; - -or_predicate - : and_predicate (OR or_predicate)* - ; - -and_predicate - : boolean_factor (AND and_predicate)* - ; - -boolean_factor - : boolean_test - | NOT boolean_test - ; - -boolean_test - : boolean_primary is_clause? - ; - -is_clause - : IS NOT? t=truth_value - ; - -truth_value - : TRUE | FALSE | UNKNOWN - ; - -boolean_primary - : predicate - | boolean_predicand - ; - -boolean_predicand - : parenthesized_boolean_value_expression - | nonparenthesized_value_expression_primary - ; - -parenthesized_boolean_value_expression - : LEFT_PAREN boolean_value_expression RIGHT_PAREN - ; - -/* -=============================================================================== - 7.2 -=============================================================================== -*/ -row_value_expression - : row_value_special_case - | explicit_row_value_constructor - ; - -row_value_special_case - : nonparenthesized_value_expression_primary - ; - -explicit_row_value_constructor - : NULL - ; - -row_value_predicand - : row_value_special_case - | row_value_constructor_predicand - ; - -row_value_constructor_predicand - : common_value_expression - | boolean_predicand -// | explicit_row_value_constructor - ; - -/* -=============================================================================== - 7.4 -=============================================================================== -*/ - -table_expression - : from_clause - where_clause? - groupby_clause? - having_clause? - orderby_clause? - limit_clause? - ; - -/* -=============================================================================== - 7.5 -=============================================================================== -*/ - -from_clause - : FROM table_reference_list - ; - -table_reference_list - :table_reference (COMMA table_reference)* - ; - -/* -=============================================================================== - 7.6
-=============================================================================== -*/ - -table_reference - : joined_table - | table_primary - ; - -/* -=============================================================================== - 7.7 -=============================================================================== -*/ - -joined_table - : table_primary joined_table_primary+ - ; - -joined_table_primary - : CROSS JOIN right=table_primary - | (t=join_type)? JOIN right=table_primary s=join_specification - | NATURAL (t=join_type)? JOIN right=table_primary - | UNION JOIN right=table_primary - ; - -cross_join - : CROSS JOIN r=table_primary - ; - -qualified_join - : (t=join_type)? JOIN r=table_primary s=join_specification - ; - -natural_join - : NATURAL (t=join_type)? JOIN r=table_primary - ; - -union_join - : UNION JOIN r=table_primary - ; - -join_type - : INNER - | t=outer_join_type - ; - -outer_join_type - : outer_join_type_part2 OUTER? - ; - -outer_join_type_part2 - : LEFT - | RIGHT - | FULL - ; - -join_specification - : join_condition - | named_columns_join - ; - -join_condition - : ON search_condition - ; - -named_columns_join - : USING LEFT_PAREN f=column_reference_list RIGHT_PAREN - ; - -table_primary - : table_or_query_name ((AS)? alias=identifier)? (LEFT_PAREN column_name_list RIGHT_PAREN)? - | derived_table (AS)? name=identifier (LEFT_PAREN column_name_list RIGHT_PAREN)? - ; - -column_name_list - : identifier ( COMMA identifier )* - ; - -derived_table - : table_subquery - ; - -/* -=============================================================================== - 7.8 -=============================================================================== -*/ -where_clause - : WHERE search_condition - ; - -search_condition - : value_expression // instead of boolean_value_expression, we use value_expression for more flexibility. - ; - -/* -=============================================================================== - 7.9 -=============================================================================== -*/ -groupby_clause - : GROUP BY g=grouping_element_list - ; - -grouping_element_list - : grouping_element (COMMA grouping_element)* - ; - -grouping_element - : rollup_list - | cube_list - | empty_grouping_set - | ordinary_grouping_set - ; - -ordinary_grouping_set - : row_value_predicand - | LEFT_PAREN row_value_predicand_list RIGHT_PAREN - ; - -ordinary_grouping_set_list - : ordinary_grouping_set (COMMA ordinary_grouping_set)* - ; - -rollup_list - : ROLLUP LEFT_PAREN c=ordinary_grouping_set_list RIGHT_PAREN - ; - -cube_list - : CUBE LEFT_PAREN c=ordinary_grouping_set_list RIGHT_PAREN - ; - -empty_grouping_set - : LEFT_PAREN RIGHT_PAREN - ; - -having_clause - : HAVING boolean_value_expression - ; - -row_value_predicand_list - : row_value_predicand (COMMA row_value_predicand)* - ; - -/* -=============================================================================== - 7.13 -=============================================================================== -*/ -query_expression - : query_expression_body - ; - -query_expression_body - : non_join_query_expression - | joined_table - ; - -non_join_query_expression - : (non_join_query_term - | joined_table (UNION | EXCEPT) (ALL|DISTINCT)? query_term) - ((UNION | EXCEPT) (ALL|DISTINCT)? query_term)* - ; - -query_term - : non_join_query_term - | joined_table - ; - -non_join_query_term - : ( non_join_query_primary - | joined_table INTERSECT (ALL|DISTINCT)? query_primary) - (INTERSECT (ALL|DISTINCT)? query_primary)* - ; - -query_primary - : non_join_query_primary - | joined_table - ; - -non_join_query_primary - : simple_table - | LEFT_PAREN non_join_query_expression RIGHT_PAREN - ; - -simple_table - : query_specification - | explicit_table - ; - -explicit_table - : TABLE table_or_query_name - ; - -table_or_query_name - : table_name - | identifier - ; - -table_name - : identifier ( DOT identifier ( DOT identifier )? )? - ; - -query_specification - : SELECT set_qualifier? select_list table_expression? - ; - -select_list - : select_sublist (COMMA select_sublist)* - ; - -select_sublist - : derived_column - | qualified_asterisk - ; - -derived_column - : value_expression as_clause? - ; - -qualified_asterisk - : (tb_name=Identifier DOT)? MULTIPLY - ; - -set_qualifier - : DISTINCT - | ALL - ; - -column_reference - : (tb_name=identifier DOT)? name=identifier - ; - -as_clause - : (AS)? identifier - ; - -column_reference_list - : column_reference (COMMA column_reference)* - ; - -/* -============================================================================================== - 7.15 - - Specify a scalar value, a row, or a table derived from a query_expression . -============================================================================================== -*/ - -scalar_subquery - : subquery - ; - -row_subquery - : subquery - ; - -table_subquery - : subquery - ; - -subquery - : LEFT_PAREN query_expression RIGHT_PAREN - ; - -/* -=============================================================================== - 8.1 -=============================================================================== -*/ - -predicate - : comparison_predicate - | between_predicate - | in_predicate - | pattern_matching_predicate // like predicate and other similar predicates - | null_predicate - | exists_predicate - ; - -/* -=============================================================================== - 8.2 - - Specify a comparison of two row values. -=============================================================================== -*/ -comparison_predicate - : left=row_value_predicand c=comp_op right=row_value_predicand - ; - -comp_op - : EQUAL - | NOT_EQUAL - | LTH - | LEQ - | GTH - | GEQ - ; - -/* -=============================================================================== - 8.3 -=============================================================================== -*/ - -between_predicate - : predicand=row_value_predicand between_predicate_part_2 - ; - -between_predicate_part_2 - : (NOT)? BETWEEN (ASYMMETRIC | SYMMETRIC)? begin=row_value_predicand AND end=row_value_predicand - ; - - -/* -=============================================================================== - 8.4 -=============================================================================== -*/ - -in_predicate - : predicand=numeric_value_expression NOT? IN in_predicate_value - ; - -in_predicate_value - : table_subquery - | LEFT_PAREN in_value_list RIGHT_PAREN - ; - -in_value_list - : row_value_expression ( COMMA row_value_expression )* - ; - -/* -=============================================================================== - 8.5, 8.6 - - Specify a pattern-matching comparison. -=============================================================================== -*/ - -pattern_matching_predicate - : f=row_value_predicand pattern_matcher s=Character_String_Literal - ; - -pattern_matcher - : NOT? negativable_matcher - | regex_matcher - ; - -negativable_matcher - : LIKE - | ILIKE - | SIMILAR TO - | REGEXP - | RLIKE - ; - -regex_matcher - : Similar_To - | Not_Similar_To - | Similar_To_Case_Insensitive - | Not_Similar_To_Case_Insensitive - ; - -/* -=============================================================================== - 8.7 - - Specify a test for a null value. -=============================================================================== -*/ - -null_predicate - : predicand=row_value_predicand IS (n=NOT)? NULL - ; - -/* -============================================================================================== - 8.8 - - Specify a quantified comparison. -============================================================================================== -*/ - -quantified_comparison_predicate - : l=numeric_value_expression c=comp_op q=quantifier s=table_subquery - ; - -quantifier : all | some ; - -all : ALL; - -some : SOME | ANY; - -/* -============================================================================================== - 8.9 - - Specify a test for a non_empty set. -============================================================================================== -*/ - -exists_predicate - : NOT? EXISTS s=table_subquery - ; - - -/* -============================================================================================== - 8.10 - - Specify a test for the absence of duplicate rows -============================================================================================== -*/ - -unique_predicate - : UNIQUE s=table_subquery - ; - -/* -=============================================================================== - 10.1 - - Specify the precision of an interval data type. -=============================================================================== -*/ - -primary_datetime_field - : non_second_primary_datetime_field - | SECOND - ; - -non_second_primary_datetime_field - : YEAR | MONTH | DAY | HOUR | MINUTE - ; - -extended_datetime_field - : CENTURY | DECADE | DOW | DOY | EPOCH | ISODOW | ISOYEAR | MICROSECONDS | MILLENNIUM | MILLISECONDS | QUARTER | WEEK - ; - -/* -=============================================================================== - 10.4 - - Invoke an SQL-invoked routine. -=============================================================================== -*/ - -routine_invocation - : function_name LEFT_PAREN sql_argument_list? RIGHT_PAREN - ; - -function_names_for_reserved_words - : LEFT - | RIGHT - ; - -function_name - : identifier - | function_names_for_reserved_words - ; - -sql_argument_list - : value_expression (COMMA value_expression)* - ; - -/* -=============================================================================== - 14.1 -=============================================================================== -*/ - -orderby_clause - : ORDER BY sort_specifier_list - ; - -sort_specifier_list - : sort_specifier (COMMA sort_specifier)* - ; - -sort_specifier - : key=row_value_predicand order=order_specification? null_order=null_ordering? - ; - -order_specification - : ASC - | DESC - ; - -limit_clause - : LIMIT e=numeric_value_expression - ; - -null_ordering - : NULL FIRST - | NULL LAST - ; - -/* -=============================================================================== - 14.8 -=============================================================================== -*/ - -insert_statement - : INSERT (OVERWRITE)? INTO table_name (LEFT_PAREN column_name_list RIGHT_PAREN)? query_expression - | INSERT (OVERWRITE)? INTO LOCATION path=Character_String_Literal (USING file_type=identifier (param_clause)?)? query_expression - ; diff --git a/core/src/arc/sql/sql/SQLDriver.java b/core/src/arc/sql/sql/SQLDriver.java deleted file mode 100644 index f1980fd..0000000 --- a/core/src/arc/sql/sql/SQLDriver.java +++ /dev/null @@ -1,64 +0,0 @@ -/** - * Copyright 2017 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.sql; - -import java.util.Iterator; -import java.util.List; - -import org.antlr.v4.runtime.ANTLRInputStream; -import org.antlr.v4.runtime.CommonTokenStream; -import org.antlr.v4.runtime.tree.ParseTreeWalker; - -import com.srotya.sidewinder.core.sql.SQLParser.SqlContext; -import com.srotya.sidewinder.core.sql.operators.ComplexOperator; -import com.srotya.sidewinder.core.sql.operators.Operator; - -/** - * @author ambud - * - */ -public class SQLDriver { - - /** - * @param sql - * @return - */ - public static SQLParserBaseListener parseSQL(String sql) { - SQLLexer lexer = new SQLLexer(new ANTLRInputStream(sql)); - CommonTokenStream tokens = new CommonTokenStream(lexer); - SQLParser parser = new SQLParser(tokens); - SqlContext select_stmt = parser.sql(); - - ParseTreeWalker walker = new ParseTreeWalker(); - SQLParserBaseListener listener = new SQLParserBaseListener(); - walker.walk(listener, select_stmt); - - return listener; - } - - public static void prune(Operator tree) { - if (tree instanceof ComplexOperator) { - List operators = ((ComplexOperator) tree).getOperators(); - Iterator iterator = operators.iterator(); - while (iterator.hasNext()) { - Operator op = iterator.next(); - if (op.getClass().equals(tree.getClass())) { - ((ComplexOperator) tree).addOperator(op); - } - } - } - } -} diff --git a/core/src/arc/sql/sql/SQLLexer.java b/core/src/arc/sql/sql/SQLLexer.java deleted file mode 100644 index 9620999..0000000 --- a/core/src/arc/sql/sql/SQLLexer.java +++ /dev/null @@ -1,916 +0,0 @@ -package com.srotya.sidewinder.core.sql; - -// Generated from SQLLexer.g4 by ANTLR 4.6 - - -import org.antlr.v4.runtime.Lexer; -import org.antlr.v4.runtime.CharStream; -import org.antlr.v4.runtime.Token; -import org.antlr.v4.runtime.TokenStream; -import org.antlr.v4.runtime.*; -import org.antlr.v4.runtime.atn.*; -import org.antlr.v4.runtime.dfa.DFA; -import org.antlr.v4.runtime.misc.*; - -@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"}) -public class SQLLexer extends Lexer { - static { RuntimeMetaData.checkVersion("4.6", RuntimeMetaData.VERSION); } - - protected static final DFA[] _decisionToDFA; - protected static final PredictionContextCache _sharedContextCache = - new PredictionContextCache(); - public static final int - AS=1, ALL=2, AND=3, ANY=4, ASYMMETRIC=5, ASC=6, BOTH=7, CASE=8, CAST=9, - CREATE=10, CROSS=11, DESC=12, DISTINCT=13, END=14, ELSE=15, EXCEPT=16, - FALSE=17, FULL=18, FROM=19, GROUP=20, HAVING=21, ILIKE=22, IN=23, INNER=24, - INTERSECT=25, INTO=26, IS=27, JOIN=28, LEADING=29, LEFT=30, LIKE=31, LIMIT=32, - NATURAL=33, NOT=34, NULL=35, ON=36, OUTER=37, OR=38, ORDER=39, RIGHT=40, - SELECT=41, SOME=42, SYMMETRIC=43, TABLE=44, THEN=45, TRAILING=46, TRUE=47, - UNION=48, UNIQUE=49, USING=50, WHEN=51, WHERE=52, WITH=53, AVG=54, BETWEEN=55, - BY=56, CENTURY=57, CHARACTER=58, COLLECT=59, COALESCE=60, COLUMN=61, COUNT=62, - CUBE=63, DAY=64, DEC=65, DECADE=66, DOW=67, DOY=68, DROP=69, EPOCH=70, - EVERY=71, EXISTS=72, EXTERNAL=73, EXTRACT=74, FILTER=75, FIRST=76, FORMAT=77, - FUSION=78, GROUPING=79, HASH=80, HOUR=81, INDEX=82, INSERT=83, INTERSECTION=84, - ISODOW=85, ISOYEAR=86, LAST=87, LESS=88, LIST=89, LOCATION=90, MAX=91, - MAXVALUE=92, MICROSECONDS=93, MILLENNIUM=94, MILLISECONDS=95, MIN=96, - MINUTE=97, MONTH=98, NATIONAL=99, NULLIF=100, OVERWRITE=101, PARTITION=102, - PARTITIONS=103, PRECISION=104, PURGE=105, QUARTER=106, RANGE=107, REGEXP=108, - RLIKE=109, ROLLUP=110, SECOND=111, SET=112, SIMILAR=113, STDDEV_POP=114, - STDDEV_SAMP=115, SUBPARTITION=116, SUM=117, TABLESPACE=118, THAN=119, - TIMEZONE=120, TIMEZONE_HOUR=121, TIMEZONE_MINUTE=122, TRIM=123, TO=124, - UNKNOWN=125, VALUES=126, VAR_SAMP=127, VAR_POP=128, VARYING=129, WEEK=130, - YEAR=131, ZONE=132, BOOLEAN=133, BOOL=134, BIT=135, VARBIT=136, INT1=137, - INT2=138, INT4=139, INT8=140, TINYINT=141, SMALLINT=142, INT=143, INTEGER=144, - BIGINT=145, FLOAT4=146, FLOAT8=147, REAL=148, FLOAT=149, DOUBLE=150, NUMERIC=151, - DECIMAL=152, CHAR=153, VARCHAR=154, NCHAR=155, NVARCHAR=156, DATE=157, - TIME=158, TIMETZ=159, TIMESTAMP=160, TIMESTAMPTZ=161, TEXT=162, BINARY=163, - VARBINARY=164, BLOB=165, BYTEA=166, INET4=167, Similar_To=168, Not_Similar_To=169, - Similar_To_Case_Insensitive=170, Not_Similar_To_Case_Insensitive=171, - CAST_EXPRESSION=172, ASSIGN=173, EQUAL=174, COLON=175, SEMI_COLON=176, - COMMA=177, CONCATENATION_OPERATOR=178, NOT_EQUAL=179, LTH=180, LEQ=181, - GTH=182, GEQ=183, LEFT_PAREN=184, RIGHT_PAREN=185, PLUS=186, MINUS=187, - MULTIPLY=188, DIVIDE=189, MODULAR=190, DOT=191, UNDERLINE=192, VERTICAL_BAR=193, - QUOTE=194, DOUBLE_QUOTE=195, NUMBER=196, REAL_NUMBER=197, BlockComment=198, - LineComment=199, Identifier=200, Character_String_Literal=201, Space=202, - White_Space=203, BAD=204; - public static String[] modeNames = { - "DEFAULT_MODE" - }; - - public static final String[] ruleNames = { - "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", - "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "AS", "ALL", - "AND", "ANY", "ASYMMETRIC", "ASC", "BOTH", "CASE", "CAST", "CREATE", "CROSS", - "DESC", "DISTINCT", "END", "ELSE", "EXCEPT", "FALSE", "FULL", "FROM", - "GROUP", "HAVING", "ILIKE", "IN", "INNER", "INTERSECT", "INTO", "IS", - "JOIN", "LEADING", "LEFT", "LIKE", "LIMIT", "NATURAL", "NOT", "NULL", - "ON", "OUTER", "OR", "ORDER", "RIGHT", "SELECT", "SOME", "SYMMETRIC", - "TABLE", "THEN", "TRAILING", "TRUE", "UNION", "UNIQUE", "USING", "WHEN", - "WHERE", "WITH", "AVG", "BETWEEN", "BY", "CENTURY", "CHARACTER", "COLLECT", - "COALESCE", "COLUMN", "COUNT", "CUBE", "DAY", "DEC", "DECADE", "DOW", - "DOY", "DROP", "EPOCH", "EVERY", "EXISTS", "EXTERNAL", "EXTRACT", "FILTER", - "FIRST", "FORMAT", "FUSION", "GROUPING", "HASH", "HOUR", "INDEX", "INSERT", - "INTERSECTION", "ISODOW", "ISOYEAR", "LAST", "LESS", "LIST", "LOCATION", - "MAX", "MAXVALUE", "MICROSECONDS", "MILLENNIUM", "MILLISECONDS", "MIN", - "MINUTE", "MONTH", "NATIONAL", "NULLIF", "OVERWRITE", "PARTITION", "PARTITIONS", - "PRECISION", "PURGE", "QUARTER", "RANGE", "REGEXP", "RLIKE", "ROLLUP", - "SECOND", "SET", "SIMILAR", "STDDEV_POP", "STDDEV_SAMP", "SUBPARTITION", - "SUM", "TABLESPACE", "THAN", "TIMEZONE", "TIMEZONE_HOUR", "TIMEZONE_MINUTE", - "TRIM", "TO", "UNKNOWN", "VALUES", "VAR_SAMP", "VAR_POP", "VARYING", "WEEK", - "YEAR", "ZONE", "BOOLEAN", "BOOL", "BIT", "VARBIT", "INT1", "INT2", "INT4", - "INT8", "TINYINT", "SMALLINT", "INT", "INTEGER", "BIGINT", "FLOAT4", "FLOAT8", - "REAL", "FLOAT", "DOUBLE", "NUMERIC", "DECIMAL", "CHAR", "VARCHAR", "NCHAR", - "NVARCHAR", "DATE", "TIME", "TIMETZ", "TIMESTAMP", "TIMESTAMPTZ", "TEXT", - "BINARY", "VARBINARY", "BLOB", "BYTEA", "INET4", "Similar_To", "Not_Similar_To", - "Similar_To_Case_Insensitive", "Not_Similar_To_Case_Insensitive", "CAST_EXPRESSION", - "ASSIGN", "EQUAL", "COLON", "SEMI_COLON", "COMMA", "CONCATENATION_OPERATOR", - "NOT_EQUAL", "LTH", "LEQ", "GTH", "GEQ", "LEFT_PAREN", "RIGHT_PAREN", - "PLUS", "MINUS", "MULTIPLY", "DIVIDE", "MODULAR", "DOT", "UNDERLINE", - "VERTICAL_BAR", "QUOTE", "DOUBLE_QUOTE", "NUMBER", "Digit", "REAL_NUMBER", - "BlockComment", "LineComment", "Identifier", "Regular_Identifier", "Control_Characters", - "Extended_Control_Characters", "Character_String_Literal", "EXPONENT", - "HEX_DIGIT", "ESC_SEQ", "OCTAL_ESC", "UNICODE_ESC", "Space", "White_Space", - "BAD" - }; - - private static final String[] _LITERAL_NAMES = { - 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, 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, 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, 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, - 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, null, null, null, - "'~'", "'!~'", "'~*'", "'!~*'", null, "':='", "'='", "':'", "';'", "','", - null, null, "'<'", "'<='", "'>'", "'>='", "'('", "')'", "'+'", "'-'", - "'*'", "'/'", "'%'", "'.'", "'_'", "'|'", "'''", "'\"'", null, null, null, - null, null, null, "' '" - }; - private static final String[] _SYMBOLIC_NAMES = { - null, "AS", "ALL", "AND", "ANY", "ASYMMETRIC", "ASC", "BOTH", "CASE", - "CAST", "CREATE", "CROSS", "DESC", "DISTINCT", "END", "ELSE", "EXCEPT", - "FALSE", "FULL", "FROM", "GROUP", "HAVING", "ILIKE", "IN", "INNER", "INTERSECT", - "INTO", "IS", "JOIN", "LEADING", "LEFT", "LIKE", "LIMIT", "NATURAL", "NOT", - "NULL", "ON", "OUTER", "OR", "ORDER", "RIGHT", "SELECT", "SOME", "SYMMETRIC", - "TABLE", "THEN", "TRAILING", "TRUE", "UNION", "UNIQUE", "USING", "WHEN", - "WHERE", "WITH", "AVG", "BETWEEN", "BY", "CENTURY", "CHARACTER", "COLLECT", - "COALESCE", "COLUMN", "COUNT", "CUBE", "DAY", "DEC", "DECADE", "DOW", - "DOY", "DROP", "EPOCH", "EVERY", "EXISTS", "EXTERNAL", "EXTRACT", "FILTER", - "FIRST", "FORMAT", "FUSION", "GROUPING", "HASH", "HOUR", "INDEX", "INSERT", - "INTERSECTION", "ISODOW", "ISOYEAR", "LAST", "LESS", "LIST", "LOCATION", - "MAX", "MAXVALUE", "MICROSECONDS", "MILLENNIUM", "MILLISECONDS", "MIN", - "MINUTE", "MONTH", "NATIONAL", "NULLIF", "OVERWRITE", "PARTITION", "PARTITIONS", - "PRECISION", "PURGE", "QUARTER", "RANGE", "REGEXP", "RLIKE", "ROLLUP", - "SECOND", "SET", "SIMILAR", "STDDEV_POP", "STDDEV_SAMP", "SUBPARTITION", - "SUM", "TABLESPACE", "THAN", "TIMEZONE", "TIMEZONE_HOUR", "TIMEZONE_MINUTE", - "TRIM", "TO", "UNKNOWN", "VALUES", "VAR_SAMP", "VAR_POP", "VARYING", "WEEK", - "YEAR", "ZONE", "BOOLEAN", "BOOL", "BIT", "VARBIT", "INT1", "INT2", "INT4", - "INT8", "TINYINT", "SMALLINT", "INT", "INTEGER", "BIGINT", "FLOAT4", "FLOAT8", - "REAL", "FLOAT", "DOUBLE", "NUMERIC", "DECIMAL", "CHAR", "VARCHAR", "NCHAR", - "NVARCHAR", "DATE", "TIME", "TIMETZ", "TIMESTAMP", "TIMESTAMPTZ", "TEXT", - "BINARY", "VARBINARY", "BLOB", "BYTEA", "INET4", "Similar_To", "Not_Similar_To", - "Similar_To_Case_Insensitive", "Not_Similar_To_Case_Insensitive", "CAST_EXPRESSION", - "ASSIGN", "EQUAL", "COLON", "SEMI_COLON", "COMMA", "CONCATENATION_OPERATOR", - "NOT_EQUAL", "LTH", "LEQ", "GTH", "GEQ", "LEFT_PAREN", "RIGHT_PAREN", - "PLUS", "MINUS", "MULTIPLY", "DIVIDE", "MODULAR", "DOT", "UNDERLINE", - "VERTICAL_BAR", "QUOTE", "DOUBLE_QUOTE", "NUMBER", "REAL_NUMBER", "BlockComment", - "LineComment", "Identifier", "Character_String_Literal", "Space", "White_Space", - "BAD" - }; - public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES); - - /** - * @deprecated Use {@link #VOCABULARY} instead. - */ - @Deprecated - public static final String[] tokenNames; - static { - tokenNames = new String[_SYMBOLIC_NAMES.length]; - for (int i = 0; i < tokenNames.length; i++) { - tokenNames[i] = VOCABULARY.getLiteralName(i); - if (tokenNames[i] == null) { - tokenNames[i] = VOCABULARY.getSymbolicName(i); - } - - if (tokenNames[i] == null) { - tokenNames[i] = ""; - } - } - } - - @Override - @Deprecated - public String[] getTokenNames() { - return tokenNames; - } - - @Override - - public Vocabulary getVocabulary() { - return VOCABULARY; - } - - - - - public SQLLexer(CharStream input) { - super(input); - _interp = new LexerATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache); - } - - @Override - public String getGrammarFileName() { return "SQLLexer.g4"; } - - @Override - public String[] getRuleNames() { return ruleNames; } - - @Override - public String getSerializedATN() { return _serializedATN; } - - @Override - public String[] getModeNames() { return modeNames; } - - @Override - public ATN getATN() { return _ATN; } - - public static final String _serializedATN = - "\3\u0430\ud6d1\u8206\uad2d\u4417\uaef1\u8d80\uaadd\2\u00ce\u074a\b\1\4"+ - "\2\t\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\4\t\t\t\4\n\t\n"+ - "\4\13\t\13\4\f\t\f\4\r\t\r\4\16\t\16\4\17\t\17\4\20\t\20\4\21\t\21\4\22"+ - "\t\22\4\23\t\23\4\24\t\24\4\25\t\25\4\26\t\26\4\27\t\27\4\30\t\30\4\31"+ - "\t\31\4\32\t\32\4\33\t\33\4\34\t\34\4\35\t\35\4\36\t\36\4\37\t\37\4 \t"+ - " \4!\t!\4\"\t\"\4#\t#\4$\t$\4%\t%\4&\t&\4\'\t\'\4(\t(\4)\t)\4*\t*\4+\t"+ - "+\4,\t,\4-\t-\4.\t.\4/\t/\4\60\t\60\4\61\t\61\4\62\t\62\4\63\t\63\4\64"+ - "\t\64\4\65\t\65\4\66\t\66\4\67\t\67\48\t8\49\t9\4:\t:\4;\t;\4<\t<\4=\t"+ - "=\4>\t>\4?\t?\4@\t@\4A\tA\4B\tB\4C\tC\4D\tD\4E\tE\4F\tF\4G\tG\4H\tH\4"+ - "I\tI\4J\tJ\4K\tK\4L\tL\4M\tM\4N\tN\4O\tO\4P\tP\4Q\tQ\4R\tR\4S\tS\4T\t"+ - "T\4U\tU\4V\tV\4W\tW\4X\tX\4Y\tY\4Z\tZ\4[\t[\4\\\t\\\4]\t]\4^\t^\4_\t_"+ - "\4`\t`\4a\ta\4b\tb\4c\tc\4d\td\4e\te\4f\tf\4g\tg\4h\th\4i\ti\4j\tj\4k"+ - "\tk\4l\tl\4m\tm\4n\tn\4o\to\4p\tp\4q\tq\4r\tr\4s\ts\4t\tt\4u\tu\4v\tv"+ - "\4w\tw\4x\tx\4y\ty\4z\tz\4{\t{\4|\t|\4}\t}\4~\t~\4\177\t\177\4\u0080\t"+ - "\u0080\4\u0081\t\u0081\4\u0082\t\u0082\4\u0083\t\u0083\4\u0084\t\u0084"+ - "\4\u0085\t\u0085\4\u0086\t\u0086\4\u0087\t\u0087\4\u0088\t\u0088\4\u0089"+ - "\t\u0089\4\u008a\t\u008a\4\u008b\t\u008b\4\u008c\t\u008c\4\u008d\t\u008d"+ - "\4\u008e\t\u008e\4\u008f\t\u008f\4\u0090\t\u0090\4\u0091\t\u0091\4\u0092"+ - "\t\u0092\4\u0093\t\u0093\4\u0094\t\u0094\4\u0095\t\u0095\4\u0096\t\u0096"+ - "\4\u0097\t\u0097\4\u0098\t\u0098\4\u0099\t\u0099\4\u009a\t\u009a\4\u009b"+ - "\t\u009b\4\u009c\t\u009c\4\u009d\t\u009d\4\u009e\t\u009e\4\u009f\t\u009f"+ - "\4\u00a0\t\u00a0\4\u00a1\t\u00a1\4\u00a2\t\u00a2\4\u00a3\t\u00a3\4\u00a4"+ - "\t\u00a4\4\u00a5\t\u00a5\4\u00a6\t\u00a6\4\u00a7\t\u00a7\4\u00a8\t\u00a8"+ - "\4\u00a9\t\u00a9\4\u00aa\t\u00aa\4\u00ab\t\u00ab\4\u00ac\t\u00ac\4\u00ad"+ - "\t\u00ad\4\u00ae\t\u00ae\4\u00af\t\u00af\4\u00b0\t\u00b0\4\u00b1\t\u00b1"+ - "\4\u00b2\t\u00b2\4\u00b3\t\u00b3\4\u00b4\t\u00b4\4\u00b5\t\u00b5\4\u00b6"+ - "\t\u00b6\4\u00b7\t\u00b7\4\u00b8\t\u00b8\4\u00b9\t\u00b9\4\u00ba\t\u00ba"+ - "\4\u00bb\t\u00bb\4\u00bc\t\u00bc\4\u00bd\t\u00bd\4\u00be\t\u00be\4\u00bf"+ - "\t\u00bf\4\u00c0\t\u00c0\4\u00c1\t\u00c1\4\u00c2\t\u00c2\4\u00c3\t\u00c3"+ - "\4\u00c4\t\u00c4\4\u00c5\t\u00c5\4\u00c6\t\u00c6\4\u00c7\t\u00c7\4\u00c8"+ - "\t\u00c8\4\u00c9\t\u00c9\4\u00ca\t\u00ca\4\u00cb\t\u00cb\4\u00cc\t\u00cc"+ - "\4\u00cd\t\u00cd\4\u00ce\t\u00ce\4\u00cf\t\u00cf\4\u00d0\t\u00d0\4\u00d1"+ - "\t\u00d1\4\u00d2\t\u00d2\4\u00d3\t\u00d3\4\u00d4\t\u00d4\4\u00d5\t\u00d5"+ - "\4\u00d6\t\u00d6\4\u00d7\t\u00d7\4\u00d8\t\u00d8\4\u00d9\t\u00d9\4\u00da"+ - "\t\u00da\4\u00db\t\u00db\4\u00dc\t\u00dc\4\u00dd\t\u00dd\4\u00de\t\u00de"+ - "\4\u00df\t\u00df\4\u00e0\t\u00e0\4\u00e1\t\u00e1\4\u00e2\t\u00e2\4\u00e3"+ - "\t\u00e3\4\u00e4\t\u00e4\4\u00e5\t\u00e5\4\u00e6\t\u00e6\4\u00e7\t\u00e7"+ - "\4\u00e8\t\u00e8\4\u00e9\t\u00e9\4\u00ea\t\u00ea\4\u00eb\t\u00eb\4\u00ec"+ - "\t\u00ec\4\u00ed\t\u00ed\4\u00ee\t\u00ee\4\u00ef\t\u00ef\4\u00f0\t\u00f0"+ - "\3\2\3\2\3\3\3\3\3\4\3\4\3\5\3\5\3\6\3\6\3\7\3\7\3\b\3\b\3\t\3\t\3\n\3"+ - "\n\3\13\3\13\3\f\3\f\3\r\3\r\3\16\3\16\3\17\3\17\3\20\3\20\3\21\3\21\3"+ - "\22\3\22\3\23\3\23\3\24\3\24\3\25\3\25\3\26\3\26\3\27\3\27\3\30\3\30\3"+ - "\31\3\31\3\32\3\32\3\33\3\33\3\34\3\34\3\34\3\35\3\35\3\35\3\35\3\36\3"+ - "\36\3\36\3\36\3\37\3\37\3\37\3\37\3 \3 \3 \3 \3 \3 \3 \3 \3 \3 \3 \3!"+ - "\3!\3!\3!\3\"\3\"\3\"\3\"\3\"\3#\3#\3#\3#\3#\3$\3$\3$\3$\3$\3%\3%\3%\3"+ - "%\3%\3%\3%\3&\3&\3&\3&\3&\3&\3\'\3\'\3\'\3\'\3\'\3(\3(\3(\3(\3(\3(\3("+ - "\3(\3(\3)\3)\3)\3)\3*\3*\3*\3*\3*\3+\3+\3+\3+\3+\3+\3+\3,\3,\3,\3,\3,"+ - "\3,\3-\3-\3-\3-\3-\3.\3.\3.\3.\3.\3/\3/\3/\3/\3/\3/\3\60\3\60\3\60\3\60"+ - "\3\60\3\60\3\60\3\61\3\61\3\61\3\61\3\61\3\61\3\62\3\62\3\62\3\63\3\63"+ - "\3\63\3\63\3\63\3\63\3\64\3\64\3\64\3\64\3\64\3\64\3\64\3\64\3\64\3\64"+ - "\3\65\3\65\3\65\3\65\3\65\3\66\3\66\3\66\3\67\3\67\3\67\3\67\3\67\38\3"+ - "8\38\38\38\38\38\38\39\39\39\39\39\3:\3:\3:\3:\3:\3;\3;\3;\3;\3;\3;\3"+ - "<\3<\3<\3<\3<\3<\3<\3<\3=\3=\3=\3=\3>\3>\3>\3>\3>\3?\3?\3?\3@\3@\3@\3"+ - "@\3@\3@\3A\3A\3A\3B\3B\3B\3B\3B\3B\3C\3C\3C\3C\3C\3C\3D\3D\3D\3D\3D\3"+ - "D\3D\3E\3E\3E\3E\3E\3F\3F\3F\3F\3F\3F\3F\3F\3F\3F\3G\3G\3G\3G\3G\3G\3"+ - "H\3H\3H\3H\3H\3I\3I\3I\3I\3I\3I\3I\3I\3I\3J\3J\3J\3J\3J\3K\3K\3K\3K\3"+ - "K\3K\3L\3L\3L\3L\3L\3L\3L\3M\3M\3M\3M\3M\3M\3N\3N\3N\3N\3N\3O\3O\3O\3"+ - "O\3O\3O\3P\3P\3P\3P\3P\3Q\3Q\3Q\3Q\3R\3R\3R\3R\3R\3R\3R\3R\3S\3S\3S\3"+ - "T\3T\3T\3T\3T\3T\3T\3T\3U\3U\3U\3U\3U\3U\3U\3U\3U\3U\3V\3V\3V\3V\3V\3"+ - "V\3V\3V\3W\3W\3W\3W\3W\3W\3W\3W\3W\3X\3X\3X\3X\3X\3X\3X\3Y\3Y\3Y\3Y\3"+ - "Y\3Y\3Z\3Z\3Z\3Z\3Z\3[\3[\3[\3[\3\\\3\\\3\\\3\\\3]\3]\3]\3]\3]\3]\3]\3"+ - "^\3^\3^\3^\3_\3_\3_\3_\3`\3`\3`\3`\3`\3a\3a\3a\3a\3a\3a\3b\3b\3b\3b\3"+ - "b\3b\3c\3c\3c\3c\3c\3c\3c\3d\3d\3d\3d\3d\3d\3d\3d\3d\3e\3e\3e\3e\3e\3"+ - "e\3e\3e\3f\3f\3f\3f\3f\3f\3f\3g\3g\3g\3g\3g\3g\3h\3h\3h\3h\3h\3h\3h\3"+ - "i\3i\3i\3i\3i\3i\3i\3j\3j\3j\3j\3j\3j\3j\3j\3j\3k\3k\3k\3k\3k\3l\3l\3"+ - "l\3l\3l\3m\3m\3m\3m\3m\3m\3n\3n\3n\3n\3n\3n\3n\3o\3o\3o\3o\3o\3o\3o\3"+ - "o\3o\3o\3o\3o\3o\3p\3p\3p\3p\3p\3p\3p\3q\3q\3q\3q\3q\3q\3q\3q\3r\3r\3"+ - "r\3r\3r\3s\3s\3s\3s\3s\3t\3t\3t\3t\3t\3u\3u\3u\3u\3u\3u\3u\3u\3u\3v\3"+ - "v\3v\3v\3w\3w\3w\3w\3w\3w\3w\3w\3w\3x\3x\3x\3x\3x\3x\3x\3x\3x\3x\3x\3"+ - "x\3x\3y\3y\3y\3y\3y\3y\3y\3y\3y\3y\3y\3z\3z\3z\3z\3z\3z\3z\3z\3z\3z\3"+ - "z\3z\3z\3{\3{\3{\3{\3|\3|\3|\3|\3|\3|\3|\3}\3}\3}\3}\3}\3}\3~\3~\3~\3"+ - "~\3~\3~\3~\3~\3~\3\177\3\177\3\177\3\177\3\177\3\177\3\177\3\u0080\3\u0080"+ - "\3\u0080\3\u0080\3\u0080\3\u0080\3\u0080\3\u0080\3\u0080\3\u0080\3\u0081"+ - "\3\u0081\3\u0081\3\u0081\3\u0081\3\u0081\3\u0081\3\u0081\3\u0081\3\u0081"+ - "\3\u0082\3\u0082\3\u0082\3\u0082\3\u0082\3\u0082\3\u0082\3\u0082\3\u0082"+ - "\3\u0082\3\u0082\3\u0083\3\u0083\3\u0083\3\u0083\3\u0083\3\u0083\3\u0083"+ - "\3\u0083\3\u0083\3\u0083\3\u0084\3\u0084\3\u0084\3\u0084\3\u0084\3\u0084"+ - "\3\u0085\3\u0085\3\u0085\3\u0085\3\u0085\3\u0085\3\u0085\3\u0085\3\u0086"+ - "\3\u0086\3\u0086\3\u0086\3\u0086\3\u0086\3\u0087\3\u0087\3\u0087\3\u0087"+ - "\3\u0087\3\u0087\3\u0087\3\u0088\3\u0088\3\u0088\3\u0088\3\u0088\3\u0088"+ - "\3\u0089\3\u0089\3\u0089\3\u0089\3\u0089\3\u0089\3\u0089\3\u008a\3\u008a"+ - "\3\u008a\3\u008a\3\u008a\3\u008a\3\u008a\3\u008b\3\u008b\3\u008b\3\u008b"+ - "\3\u008c\3\u008c\3\u008c\3\u008c\3\u008c\3\u008c\3\u008c\3\u008c\3\u008d"+ - "\3\u008d\3\u008d\3\u008d\3\u008d\3\u008d\3\u008d\3\u008d\3\u008d\3\u008d"+ - "\3\u008d\3\u008e\3\u008e\3\u008e\3\u008e\3\u008e\3\u008e\3\u008e\3\u008e"+ - "\3\u008e\3\u008e\3\u008e\3\u008e\3\u008f\3\u008f\3\u008f\3\u008f\3\u008f"+ - "\3\u008f\3\u008f\3\u008f\3\u008f\3\u008f\3\u008f\3\u008f\3\u008f\3\u0090"+ - "\3\u0090\3\u0090\3\u0090\3\u0091\3\u0091\3\u0091\3\u0091\3\u0091\3\u0091"+ - "\3\u0091\3\u0091\3\u0091\3\u0091\3\u0091\3\u0092\3\u0092\3\u0092\3\u0092"+ - "\3\u0092\3\u0093\3\u0093\3\u0093\3\u0093\3\u0093\3\u0093\3\u0093\3\u0093"+ - "\3\u0093\3\u0094\3\u0094\3\u0094\3\u0094\3\u0094\3\u0094\3\u0094\3\u0094"+ - "\3\u0094\3\u0094\3\u0094\3\u0094\3\u0094\3\u0094\3\u0095\3\u0095\3\u0095"+ - "\3\u0095\3\u0095\3\u0095\3\u0095\3\u0095\3\u0095\3\u0095\3\u0095\3\u0095"+ - "\3\u0095\3\u0095\3\u0095\3\u0095\3\u0096\3\u0096\3\u0096\3\u0096\3\u0096"+ - "\3\u0097\3\u0097\3\u0097\3\u0098\3\u0098\3\u0098\3\u0098\3\u0098\3\u0098"+ - "\3\u0098\3\u0098\3\u0099\3\u0099\3\u0099\3\u0099\3\u0099\3\u0099\3\u0099"+ - "\3\u009a\3\u009a\3\u009a\3\u009a\3\u009a\3\u009a\3\u009a\3\u009a\3\u009a"+ - "\3\u009b\3\u009b\3\u009b\3\u009b\3\u009b\3\u009b\3\u009b\3\u009b\3\u009c"+ - "\3\u009c\3\u009c\3\u009c\3\u009c\3\u009c\3\u009c\3\u009c\3\u009d\3\u009d"+ - "\3\u009d\3\u009d\3\u009d\3\u009e\3\u009e\3\u009e\3\u009e\3\u009e\3\u009f"+ - "\3\u009f\3\u009f\3\u009f\3\u009f\3\u00a0\3\u00a0\3\u00a0\3\u00a0\3\u00a0"+ - "\3\u00a0\3\u00a0\3\u00a0\3\u00a1\3\u00a1\3\u00a1\3\u00a1\3\u00a1\3\u00a2"+ - "\3\u00a2\3\u00a2\3\u00a2\3\u00a3\3\u00a3\3\u00a3\3\u00a3\3\u00a3\3\u00a3"+ - "\3\u00a3\3\u00a4\3\u00a4\3\u00a4\3\u00a4\3\u00a4\3\u00a5\3\u00a5\3\u00a5"+ - "\3\u00a5\3\u00a5\3\u00a6\3\u00a6\3\u00a6\3\u00a6\3\u00a6\3\u00a7\3\u00a7"+ - "\3\u00a7\3\u00a7\3\u00a7\3\u00a8\3\u00a8\3\u00a8\3\u00a8\3\u00a8\3\u00a8"+ - "\3\u00a8\3\u00a8\3\u00a9\3\u00a9\3\u00a9\3\u00a9\3\u00a9\3\u00a9\3\u00a9"+ - "\3\u00a9\3\u00a9\3\u00aa\3\u00aa\3\u00aa\3\u00aa\3\u00ab\3\u00ab\3\u00ab"+ - "\3\u00ab\3\u00ab\3\u00ab\3\u00ab\3\u00ab\3\u00ac\3\u00ac\3\u00ac\3\u00ac"+ - "\3\u00ac\3\u00ac\3\u00ac\3\u00ad\3\u00ad\3\u00ad\3\u00ad\3\u00ad\3\u00ad"+ - "\3\u00ad\3\u00ae\3\u00ae\3\u00ae\3\u00ae\3\u00ae\3\u00ae\3\u00ae\3\u00af"+ - "\3\u00af\3\u00af\3\u00af\3\u00af\3\u00b0\3\u00b0\3\u00b0\3\u00b0\3\u00b0"+ - "\3\u00b0\3\u00b1\3\u00b1\3\u00b1\3\u00b1\3\u00b1\3\u00b1\3\u00b1\3\u00b2"+ - "\3\u00b2\3\u00b2\3\u00b2\3\u00b2\3\u00b2\3\u00b2\3\u00b2\3\u00b3\3\u00b3"+ - "\3\u00b3\3\u00b3\3\u00b3\3\u00b3\3\u00b3\3\u00b3\3\u00b4\3\u00b4\3\u00b4"+ - "\3\u00b4\3\u00b4\3\u00b5\3\u00b5\3\u00b5\3\u00b5\3\u00b5\3\u00b5\3\u00b5"+ - "\3\u00b5\3\u00b6\3\u00b6\3\u00b6\3\u00b6\3\u00b6\3\u00b6\3\u00b7\3\u00b7"+ - "\3\u00b7\3\u00b7\3\u00b7\3\u00b7\3\u00b7\3\u00b7\3\u00b7\3\u00b8\3\u00b8"+ - "\3\u00b8\3\u00b8\3\u00b8\3\u00b9\3\u00b9\3\u00b9\3\u00b9\3\u00b9\3\u00ba"+ - "\3\u00ba\3\u00ba\3\u00ba\3\u00ba\3\u00ba\3\u00ba\3\u00bb\3\u00bb\3\u00bb"+ - "\3\u00bb\3\u00bb\3\u00bb\3\u00bb\3\u00bb\3\u00bb\3\u00bb\3\u00bc\3\u00bc"+ - "\3\u00bc\3\u00bc\3\u00bc\3\u00bc\3\u00bc\3\u00bc\3\u00bc\3\u00bc\3\u00bc"+ - "\3\u00bc\3\u00bd\3\u00bd\3\u00bd\3\u00bd\3\u00bd\3\u00be\3\u00be\3\u00be"+ - "\3\u00be\3\u00be\3\u00be\3\u00be\3\u00bf\3\u00bf\3\u00bf\3\u00bf\3\u00bf"+ - "\3\u00bf\3\u00bf\3\u00bf\3\u00bf\3\u00bf\3\u00c0\3\u00c0\3\u00c0\3\u00c0"+ - "\3\u00c0\3\u00c1\3\u00c1\3\u00c1\3\u00c1\3\u00c1\3\u00c1\3\u00c2\3\u00c2"+ - "\3\u00c2\3\u00c2\3\u00c2\3\u00c2\3\u00c3\3\u00c3\3\u00c4\3\u00c4\3\u00c4"+ - "\3\u00c5\3\u00c5\3\u00c5\3\u00c6\3\u00c6\3\u00c6\3\u00c6\3\u00c7\3\u00c7"+ - "\3\u00c7\3\u00c8\3\u00c8\3\u00c8\3\u00c9\3\u00c9\3\u00ca\3\u00ca\3\u00cb"+ - "\3\u00cb\3\u00cc\3\u00cc\3\u00cd\3\u00cd\3\u00cd\3\u00ce\3\u00ce\3\u00ce"+ - "\3\u00ce\3\u00ce\3\u00ce\3\u00ce\3\u00ce\5\u00ce\u069b\n\u00ce\3\u00cf"+ - "\3\u00cf\3\u00d0\3\u00d0\3\u00d0\3\u00d1\3\u00d1\3\u00d2\3\u00d2\3\u00d2"+ - "\3\u00d3\3\u00d3\3\u00d4\3\u00d4\3\u00d5\3\u00d5\3\u00d6\3\u00d6\3\u00d7"+ - "\3\u00d7\3\u00d8\3\u00d8\3\u00d9\3\u00d9\3\u00da\3\u00da\3\u00db\3\u00db"+ - "\3\u00dc\3\u00dc\3\u00dd\3\u00dd\3\u00de\3\u00de\3\u00df\6\u00df\u06c0"+ - "\n\u00df\r\u00df\16\u00df\u06c1\3\u00e0\3\u00e0\3\u00e1\6\u00e1\u06c7"+ - "\n\u00e1\r\u00e1\16\u00e1\u06c8\3\u00e1\3\u00e1\7\u00e1\u06cd\n\u00e1"+ - "\f\u00e1\16\u00e1\u06d0\13\u00e1\3\u00e1\5\u00e1\u06d3\n\u00e1\3\u00e1"+ - "\3\u00e1\6\u00e1\u06d7\n\u00e1\r\u00e1\16\u00e1\u06d8\3\u00e1\5\u00e1"+ - "\u06dc\n\u00e1\3\u00e1\6\u00e1\u06df\n\u00e1\r\u00e1\16\u00e1\u06e0\3"+ - "\u00e1\5\u00e1\u06e4\n\u00e1\3\u00e2\3\u00e2\3\u00e2\3\u00e2\7\u00e2\u06ea"+ - "\n\u00e2\f\u00e2\16\u00e2\u06ed\13\u00e2\3\u00e2\3\u00e2\3\u00e2\3\u00e2"+ - "\3\u00e2\3\u00e3\3\u00e3\3\u00e3\3\u00e3\7\u00e3\u06f8\n\u00e3\f\u00e3"+ - "\16\u00e3\u06fb\13\u00e3\3\u00e3\3\u00e3\3\u00e4\3\u00e4\3\u00e5\3\u00e5"+ - "\3\u00e5\3\u00e5\7\u00e5\u0705\n\u00e5\f\u00e5\16\u00e5\u0708\13\u00e5"+ - "\3\u00e6\3\u00e6\3\u00e7\3\u00e7\3\u00e8\3\u00e8\3\u00e8\7\u00e8\u0711"+ - "\n\u00e8\f\u00e8\16\u00e8\u0714\13\u00e8\3\u00e8\3\u00e8\3\u00e9\3\u00e9"+ - "\5\u00e9\u071a\n\u00e9\3\u00e9\6\u00e9\u071d\n\u00e9\r\u00e9\16\u00e9"+ - "\u071e\3\u00ea\3\u00ea\3\u00eb\3\u00eb\3\u00eb\3\u00eb\5\u00eb\u0727\n"+ - "\u00eb\3\u00ec\3\u00ec\3\u00ec\3\u00ec\3\u00ec\3\u00ec\3\u00ec\3\u00ec"+ - "\3\u00ec\5\u00ec\u0732\n\u00ec\3\u00ed\3\u00ed\3\u00ed\3\u00ed\3\u00ed"+ - "\3\u00ed\3\u00ed\3\u00ee\3\u00ee\3\u00ee\3\u00ee\3\u00ef\3\u00ef\6\u00ef"+ - "\u0741\n\u00ef\r\u00ef\16\u00ef\u0742\3\u00ef\3\u00ef\3\u00f0\3\u00f0"+ - "\3\u00f0\3\u00f0\3\u06eb\2\u00f1\3\2\5\2\7\2\t\2\13\2\r\2\17\2\21\2\23"+ - "\2\25\2\27\2\31\2\33\2\35\2\37\2!\2#\2%\2\'\2)\2+\2-\2/\2\61\2\63\2\65"+ - "\2\67\39\4;\5=\6?\7A\bC\tE\nG\13I\fK\rM\16O\17Q\20S\21U\22W\23Y\24[\25"+ - "]\26_\27a\30c\31e\32g\33i\34k\35m\36o\37q s!u\"w#y${%}&\177\'\u0081(\u0083"+ - ")\u0085*\u0087+\u0089,\u008b-\u008d.\u008f/\u0091\60\u0093\61\u0095\62"+ - "\u0097\63\u0099\64\u009b\65\u009d\66\u009f\67\u00a18\u00a39\u00a5:\u00a7"+ - ";\u00a9<\u00ab=\u00ad>\u00af?\u00b1@\u00b3A\u00b5B\u00b7C\u00b9D\u00bb"+ - "E\u00bdF\u00bfG\u00c1H\u00c3I\u00c5J\u00c7K\u00c9L\u00cbM\u00cdN\u00cf"+ - "O\u00d1P\u00d3Q\u00d5R\u00d7S\u00d9T\u00dbU\u00ddV\u00dfW\u00e1X\u00e3"+ - "Y\u00e5Z\u00e7[\u00e9\\\u00eb]\u00ed^\u00ef_\u00f1`\u00f3a\u00f5b\u00f7"+ - "c\u00f9d\u00fbe\u00fdf\u00ffg\u0101h\u0103i\u0105j\u0107k\u0109l\u010b"+ - "m\u010dn\u010fo\u0111p\u0113q\u0115r\u0117s\u0119t\u011bu\u011dv\u011f"+ - "w\u0121x\u0123y\u0125z\u0127{\u0129|\u012b}\u012d~\u012f\177\u0131\u0080"+ - "\u0133\u0081\u0135\u0082\u0137\u0083\u0139\u0084\u013b\u0085\u013d\u0086"+ - "\u013f\u0087\u0141\u0088\u0143\u0089\u0145\u008a\u0147\u008b\u0149\u008c"+ - "\u014b\u008d\u014d\u008e\u014f\u008f\u0151\u0090\u0153\u0091\u0155\u0092"+ - "\u0157\u0093\u0159\u0094\u015b\u0095\u015d\u0096\u015f\u0097\u0161\u0098"+ - "\u0163\u0099\u0165\u009a\u0167\u009b\u0169\u009c\u016b\u009d\u016d\u009e"+ - "\u016f\u009f\u0171\u00a0\u0173\u00a1\u0175\u00a2\u0177\u00a3\u0179\u00a4"+ - "\u017b\u00a5\u017d\u00a6\u017f\u00a7\u0181\u00a8\u0183\u00a9\u0185\u00aa"+ - "\u0187\u00ab\u0189\u00ac\u018b\u00ad\u018d\u00ae\u018f\u00af\u0191\u00b0"+ - "\u0193\u00b1\u0195\u00b2\u0197\u00b3\u0199\u00b4\u019b\u00b5\u019d\u00b6"+ - "\u019f\u00b7\u01a1\u00b8\u01a3\u00b9\u01a5\u00ba\u01a7\u00bb\u01a9\u00bc"+ - "\u01ab\u00bd\u01ad\u00be\u01af\u00bf\u01b1\u00c0\u01b3\u00c1\u01b5\u00c2"+ - "\u01b7\u00c3\u01b9\u00c4\u01bb\u00c5\u01bd\u00c6\u01bf\2\u01c1\u00c7\u01c3"+ - "\u00c8\u01c5\u00c9\u01c7\u00ca\u01c9\2\u01cb\2\u01cd\2\u01cf\u00cb\u01d1"+ - "\2\u01d3\2\u01d5\2\u01d7\2\u01d9\2\u01db\u00cc\u01dd\u00cd\u01df\u00ce"+ - "\3\2#\4\2CCcc\4\2DDdd\4\2EEee\4\2FFff\4\2GGgg\4\2HHhh\4\2IIii\4\2JJjj"+ - "\4\2KKkk\4\2LLll\4\2MMmm\4\2NNnn\4\2OOoo\4\2PPpp\4\2QQqq\4\2RRrr\4\2S"+ - "Sss\4\2TTtt\4\2UUuu\4\2VVvv\4\2WWww\4\2XXxx\4\2YYyy\4\2ZZzz\4\2[[{{\4"+ - "\2\\\\||\4\2\f\f\17\17\5\2C\\aac|\4\2C\\c|\4\2))^^\4\2--//\5\2\62;CHc"+ - "h\n\2$$))^^ddhhppttvv\u0741\2\67\3\2\2\2\29\3\2\2\2\2;\3\2\2\2\2=\3\2"+ - "\2\2\2?\3\2\2\2\2A\3\2\2\2\2C\3\2\2\2\2E\3\2\2\2\2G\3\2\2\2\2I\3\2\2\2"+ - "\2K\3\2\2\2\2M\3\2\2\2\2O\3\2\2\2\2Q\3\2\2\2\2S\3\2\2\2\2U\3\2\2\2\2W"+ - "\3\2\2\2\2Y\3\2\2\2\2[\3\2\2\2\2]\3\2\2\2\2_\3\2\2\2\2a\3\2\2\2\2c\3\2"+ - "\2\2\2e\3\2\2\2\2g\3\2\2\2\2i\3\2\2\2\2k\3\2\2\2\2m\3\2\2\2\2o\3\2\2\2"+ - "\2q\3\2\2\2\2s\3\2\2\2\2u\3\2\2\2\2w\3\2\2\2\2y\3\2\2\2\2{\3\2\2\2\2}"+ - "\3\2\2\2\2\177\3\2\2\2\2\u0081\3\2\2\2\2\u0083\3\2\2\2\2\u0085\3\2\2\2"+ - "\2\u0087\3\2\2\2\2\u0089\3\2\2\2\2\u008b\3\2\2\2\2\u008d\3\2\2\2\2\u008f"+ - "\3\2\2\2\2\u0091\3\2\2\2\2\u0093\3\2\2\2\2\u0095\3\2\2\2\2\u0097\3\2\2"+ - "\2\2\u0099\3\2\2\2\2\u009b\3\2\2\2\2\u009d\3\2\2\2\2\u009f\3\2\2\2\2\u00a1"+ - "\3\2\2\2\2\u00a3\3\2\2\2\2\u00a5\3\2\2\2\2\u00a7\3\2\2\2\2\u00a9\3\2\2"+ - "\2\2\u00ab\3\2\2\2\2\u00ad\3\2\2\2\2\u00af\3\2\2\2\2\u00b1\3\2\2\2\2\u00b3"+ - "\3\2\2\2\2\u00b5\3\2\2\2\2\u00b7\3\2\2\2\2\u00b9\3\2\2\2\2\u00bb\3\2\2"+ - "\2\2\u00bd\3\2\2\2\2\u00bf\3\2\2\2\2\u00c1\3\2\2\2\2\u00c3\3\2\2\2\2\u00c5"+ - "\3\2\2\2\2\u00c7\3\2\2\2\2\u00c9\3\2\2\2\2\u00cb\3\2\2\2\2\u00cd\3\2\2"+ - "\2\2\u00cf\3\2\2\2\2\u00d1\3\2\2\2\2\u00d3\3\2\2\2\2\u00d5\3\2\2\2\2\u00d7"+ - "\3\2\2\2\2\u00d9\3\2\2\2\2\u00db\3\2\2\2\2\u00dd\3\2\2\2\2\u00df\3\2\2"+ - "\2\2\u00e1\3\2\2\2\2\u00e3\3\2\2\2\2\u00e5\3\2\2\2\2\u00e7\3\2\2\2\2\u00e9"+ - "\3\2\2\2\2\u00eb\3\2\2\2\2\u00ed\3\2\2\2\2\u00ef\3\2\2\2\2\u00f1\3\2\2"+ - "\2\2\u00f3\3\2\2\2\2\u00f5\3\2\2\2\2\u00f7\3\2\2\2\2\u00f9\3\2\2\2\2\u00fb"+ - "\3\2\2\2\2\u00fd\3\2\2\2\2\u00ff\3\2\2\2\2\u0101\3\2\2\2\2\u0103\3\2\2"+ - "\2\2\u0105\3\2\2\2\2\u0107\3\2\2\2\2\u0109\3\2\2\2\2\u010b\3\2\2\2\2\u010d"+ - "\3\2\2\2\2\u010f\3\2\2\2\2\u0111\3\2\2\2\2\u0113\3\2\2\2\2\u0115\3\2\2"+ - "\2\2\u0117\3\2\2\2\2\u0119\3\2\2\2\2\u011b\3\2\2\2\2\u011d\3\2\2\2\2\u011f"+ - "\3\2\2\2\2\u0121\3\2\2\2\2\u0123\3\2\2\2\2\u0125\3\2\2\2\2\u0127\3\2\2"+ - "\2\2\u0129\3\2\2\2\2\u012b\3\2\2\2\2\u012d\3\2\2\2\2\u012f\3\2\2\2\2\u0131"+ - "\3\2\2\2\2\u0133\3\2\2\2\2\u0135\3\2\2\2\2\u0137\3\2\2\2\2\u0139\3\2\2"+ - "\2\2\u013b\3\2\2\2\2\u013d\3\2\2\2\2\u013f\3\2\2\2\2\u0141\3\2\2\2\2\u0143"+ - "\3\2\2\2\2\u0145\3\2\2\2\2\u0147\3\2\2\2\2\u0149\3\2\2\2\2\u014b\3\2\2"+ - "\2\2\u014d\3\2\2\2\2\u014f\3\2\2\2\2\u0151\3\2\2\2\2\u0153\3\2\2\2\2\u0155"+ - "\3\2\2\2\2\u0157\3\2\2\2\2\u0159\3\2\2\2\2\u015b\3\2\2\2\2\u015d\3\2\2"+ - "\2\2\u015f\3\2\2\2\2\u0161\3\2\2\2\2\u0163\3\2\2\2\2\u0165\3\2\2\2\2\u0167"+ - "\3\2\2\2\2\u0169\3\2\2\2\2\u016b\3\2\2\2\2\u016d\3\2\2\2\2\u016f\3\2\2"+ - "\2\2\u0171\3\2\2\2\2\u0173\3\2\2\2\2\u0175\3\2\2\2\2\u0177\3\2\2\2\2\u0179"+ - "\3\2\2\2\2\u017b\3\2\2\2\2\u017d\3\2\2\2\2\u017f\3\2\2\2\2\u0181\3\2\2"+ - "\2\2\u0183\3\2\2\2\2\u0185\3\2\2\2\2\u0187\3\2\2\2\2\u0189\3\2\2\2\2\u018b"+ - "\3\2\2\2\2\u018d\3\2\2\2\2\u018f\3\2\2\2\2\u0191\3\2\2\2\2\u0193\3\2\2"+ - "\2\2\u0195\3\2\2\2\2\u0197\3\2\2\2\2\u0199\3\2\2\2\2\u019b\3\2\2\2\2\u019d"+ - "\3\2\2\2\2\u019f\3\2\2\2\2\u01a1\3\2\2\2\2\u01a3\3\2\2\2\2\u01a5\3\2\2"+ - "\2\2\u01a7\3\2\2\2\2\u01a9\3\2\2\2\2\u01ab\3\2\2\2\2\u01ad\3\2\2\2\2\u01af"+ - "\3\2\2\2\2\u01b1\3\2\2\2\2\u01b3\3\2\2\2\2\u01b5\3\2\2\2\2\u01b7\3\2\2"+ - "\2\2\u01b9\3\2\2\2\2\u01bb\3\2\2\2\2\u01bd\3\2\2\2\2\u01c1\3\2\2\2\2\u01c3"+ - "\3\2\2\2\2\u01c5\3\2\2\2\2\u01c7\3\2\2\2\2\u01cf\3\2\2\2\2\u01db\3\2\2"+ - "\2\2\u01dd\3\2\2\2\2\u01df\3\2\2\2\3\u01e1\3\2\2\2\5\u01e3\3\2\2\2\7\u01e5"+ - "\3\2\2\2\t\u01e7\3\2\2\2\13\u01e9\3\2\2\2\r\u01eb\3\2\2\2\17\u01ed\3\2"+ - "\2\2\21\u01ef\3\2\2\2\23\u01f1\3\2\2\2\25\u01f3\3\2\2\2\27\u01f5\3\2\2"+ - "\2\31\u01f7\3\2\2\2\33\u01f9\3\2\2\2\35\u01fb\3\2\2\2\37\u01fd\3\2\2\2"+ - "!\u01ff\3\2\2\2#\u0201\3\2\2\2%\u0203\3\2\2\2\'\u0205\3\2\2\2)\u0207\3"+ - "\2\2\2+\u0209\3\2\2\2-\u020b\3\2\2\2/\u020d\3\2\2\2\61\u020f\3\2\2\2\63"+ - "\u0211\3\2\2\2\65\u0213\3\2\2\2\67\u0215\3\2\2\29\u0218\3\2\2\2;\u021c"+ - "\3\2\2\2=\u0220\3\2\2\2?\u0224\3\2\2\2A\u022f\3\2\2\2C\u0233\3\2\2\2E"+ - "\u0238\3\2\2\2G\u023d\3\2\2\2I\u0242\3\2\2\2K\u0249\3\2\2\2M\u024f\3\2"+ - "\2\2O\u0254\3\2\2\2Q\u025d\3\2\2\2S\u0261\3\2\2\2U\u0266\3\2\2\2W\u026d"+ - "\3\2\2\2Y\u0273\3\2\2\2[\u0278\3\2\2\2]\u027d\3\2\2\2_\u0283\3\2\2\2a"+ - "\u028a\3\2\2\2c\u0290\3\2\2\2e\u0293\3\2\2\2g\u0299\3\2\2\2i\u02a3\3\2"+ - "\2\2k\u02a8\3\2\2\2m\u02ab\3\2\2\2o\u02b0\3\2\2\2q\u02b8\3\2\2\2s\u02bd"+ - "\3\2\2\2u\u02c2\3\2\2\2w\u02c8\3\2\2\2y\u02d0\3\2\2\2{\u02d4\3\2\2\2}"+ - "\u02d9\3\2\2\2\177\u02dc\3\2\2\2\u0081\u02e2\3\2\2\2\u0083\u02e5\3\2\2"+ - "\2\u0085\u02eb\3\2\2\2\u0087\u02f1\3\2\2\2\u0089\u02f8\3\2\2\2\u008b\u02fd"+ - "\3\2\2\2\u008d\u0307\3\2\2\2\u008f\u030d\3\2\2\2\u0091\u0312\3\2\2\2\u0093"+ - "\u031b\3\2\2\2\u0095\u0320\3\2\2\2\u0097\u0326\3\2\2\2\u0099\u032d\3\2"+ - "\2\2\u009b\u0333\3\2\2\2\u009d\u0338\3\2\2\2\u009f\u033e\3\2\2\2\u00a1"+ - "\u0343\3\2\2\2\u00a3\u0347\3\2\2\2\u00a5\u034f\3\2\2\2\u00a7\u0352\3\2"+ - "\2\2\u00a9\u035a\3\2\2\2\u00ab\u0364\3\2\2\2\u00ad\u036c\3\2\2\2\u00af"+ - "\u0375\3\2\2\2\u00b1\u037c\3\2\2\2\u00b3\u0382\3\2\2\2\u00b5\u0387\3\2"+ - "\2\2\u00b7\u038b\3\2\2\2\u00b9\u038f\3\2\2\2\u00bb\u0396\3\2\2\2\u00bd"+ - "\u039a\3\2\2\2\u00bf\u039e\3\2\2\2\u00c1\u03a3\3\2\2\2\u00c3\u03a9\3\2"+ - "\2\2\u00c5\u03af\3\2\2\2\u00c7\u03b6\3\2\2\2\u00c9\u03bf\3\2\2\2\u00cb"+ - "\u03c7\3\2\2\2\u00cd\u03ce\3\2\2\2\u00cf\u03d4\3\2\2\2\u00d1\u03db\3\2"+ - "\2\2\u00d3\u03e2\3\2\2\2\u00d5\u03eb\3\2\2\2\u00d7\u03f0\3\2\2\2\u00d9"+ - "\u03f5\3\2\2\2\u00db\u03fb\3\2\2\2\u00dd\u0402\3\2\2\2\u00df\u040f\3\2"+ - "\2\2\u00e1\u0416\3\2\2\2\u00e3\u041e\3\2\2\2\u00e5\u0423\3\2\2\2\u00e7"+ - "\u0428\3\2\2\2\u00e9\u042d\3\2\2\2\u00eb\u0436\3\2\2\2\u00ed\u043a\3\2"+ - "\2\2\u00ef\u0443\3\2\2\2\u00f1\u0450\3\2\2\2\u00f3\u045b\3\2\2\2\u00f5"+ - "\u0468\3\2\2\2\u00f7\u046c\3\2\2\2\u00f9\u0473\3\2\2\2\u00fb\u0479\3\2"+ - "\2\2\u00fd\u0482\3\2\2\2\u00ff\u0489\3\2\2\2\u0101\u0493\3\2\2\2\u0103"+ - "\u049d\3\2\2\2\u0105\u04a8\3\2\2\2\u0107\u04b2\3\2\2\2\u0109\u04b8\3\2"+ - "\2\2\u010b\u04c0\3\2\2\2\u010d\u04c6\3\2\2\2\u010f\u04cd\3\2\2\2\u0111"+ - "\u04d3\3\2\2\2\u0113\u04da\3\2\2\2\u0115\u04e1\3\2\2\2\u0117\u04e5\3\2"+ - "\2\2\u0119\u04ed\3\2\2\2\u011b\u04f8\3\2\2\2\u011d\u0504\3\2\2\2\u011f"+ - "\u0511\3\2\2\2\u0121\u0515\3\2\2\2\u0123\u0520\3\2\2\2\u0125\u0525\3\2"+ - "\2\2\u0127\u052e\3\2\2\2\u0129\u053c\3\2\2\2\u012b\u054c\3\2\2\2\u012d"+ - "\u0551\3\2\2\2\u012f\u0554\3\2\2\2\u0131\u055c\3\2\2\2\u0133\u0563\3\2"+ - "\2\2\u0135\u056c\3\2\2\2\u0137\u0574\3\2\2\2\u0139\u057c\3\2\2\2\u013b"+ - "\u0581\3\2\2\2\u013d\u0586\3\2\2\2\u013f\u058b\3\2\2\2\u0141\u0593\3\2"+ - "\2\2\u0143\u0598\3\2\2\2\u0145\u059c\3\2\2\2\u0147\u05a3\3\2\2\2\u0149"+ - "\u05a8\3\2\2\2\u014b\u05ad\3\2\2\2\u014d\u05b2\3\2\2\2\u014f\u05b7\3\2"+ - "\2\2\u0151\u05bf\3\2\2\2\u0153\u05c8\3\2\2\2\u0155\u05cc\3\2\2\2\u0157"+ - "\u05d4\3\2\2\2\u0159\u05db\3\2\2\2\u015b\u05e2\3\2\2\2\u015d\u05e9\3\2"+ - "\2\2\u015f\u05ee\3\2\2\2\u0161\u05f4\3\2\2\2\u0163\u05fb\3\2\2\2\u0165"+ - "\u0603\3\2\2\2\u0167\u060b\3\2\2\2\u0169\u0610\3\2\2\2\u016b\u0618\3\2"+ - "\2\2\u016d\u061e\3\2\2\2\u016f\u0627\3\2\2\2\u0171\u062c\3\2\2\2\u0173"+ - "\u0631\3\2\2\2\u0175\u0638\3\2\2\2\u0177\u0642\3\2\2\2\u0179\u064e\3\2"+ - "\2\2\u017b\u0653\3\2\2\2\u017d\u065a\3\2\2\2\u017f\u0664\3\2\2\2\u0181"+ - "\u0669\3\2\2\2\u0183\u066f\3\2\2\2\u0185\u0675\3\2\2\2\u0187\u0677\3\2"+ - "\2\2\u0189\u067a\3\2\2\2\u018b\u067d\3\2\2\2\u018d\u0681\3\2\2\2\u018f"+ - "\u0684\3\2\2\2\u0191\u0687\3\2\2\2\u0193\u0689\3\2\2\2\u0195\u068b\3\2"+ - "\2\2\u0197\u068d\3\2\2\2\u0199\u068f\3\2\2\2\u019b\u069a\3\2\2\2\u019d"+ - "\u069c\3\2\2\2\u019f\u069e\3\2\2\2\u01a1\u06a1\3\2\2\2\u01a3\u06a3\3\2"+ - "\2\2\u01a5\u06a6\3\2\2\2\u01a7\u06a8\3\2\2\2\u01a9\u06aa\3\2\2\2\u01ab"+ - "\u06ac\3\2\2\2\u01ad\u06ae\3\2\2\2\u01af\u06b0\3\2\2\2\u01b1\u06b2\3\2"+ - "\2\2\u01b3\u06b4\3\2\2\2\u01b5\u06b6\3\2\2\2\u01b7\u06b8\3\2\2\2\u01b9"+ - "\u06ba\3\2\2\2\u01bb\u06bc\3\2\2\2\u01bd\u06bf\3\2\2\2\u01bf\u06c3\3\2"+ - "\2\2\u01c1\u06e3\3\2\2\2\u01c3\u06e5\3\2\2\2\u01c5\u06f3\3\2\2\2\u01c7"+ - "\u06fe\3\2\2\2\u01c9\u0700\3\2\2\2\u01cb\u0709\3\2\2\2\u01cd\u070b\3\2"+ - "\2\2\u01cf\u070d\3\2\2\2\u01d1\u0717\3\2\2\2\u01d3\u0720\3\2\2\2\u01d5"+ - "\u0726\3\2\2\2\u01d7\u0731\3\2\2\2\u01d9\u0733\3\2\2\2\u01db\u073a\3\2"+ - "\2\2\u01dd\u0740\3\2\2\2\u01df\u0746\3\2\2\2\u01e1\u01e2\t\2\2\2\u01e2"+ - "\4\3\2\2\2\u01e3\u01e4\t\3\2\2\u01e4\6\3\2\2\2\u01e5\u01e6\t\4\2\2\u01e6"+ - "\b\3\2\2\2\u01e7\u01e8\t\5\2\2\u01e8\n\3\2\2\2\u01e9\u01ea\t\6\2\2\u01ea"+ - "\f\3\2\2\2\u01eb\u01ec\t\7\2\2\u01ec\16\3\2\2\2\u01ed\u01ee\t\b\2\2\u01ee"+ - "\20\3\2\2\2\u01ef\u01f0\t\t\2\2\u01f0\22\3\2\2\2\u01f1\u01f2\t\n\2\2\u01f2"+ - "\24\3\2\2\2\u01f3\u01f4\t\13\2\2\u01f4\26\3\2\2\2\u01f5\u01f6\t\f\2\2"+ - "\u01f6\30\3\2\2\2\u01f7\u01f8\t\r\2\2\u01f8\32\3\2\2\2\u01f9\u01fa\t\16"+ - "\2\2\u01fa\34\3\2\2\2\u01fb\u01fc\t\17\2\2\u01fc\36\3\2\2\2\u01fd\u01fe"+ - "\t\20\2\2\u01fe \3\2\2\2\u01ff\u0200\t\21\2\2\u0200\"\3\2\2\2\u0201\u0202"+ - "\t\22\2\2\u0202$\3\2\2\2\u0203\u0204\t\23\2\2\u0204&\3\2\2\2\u0205\u0206"+ - "\t\24\2\2\u0206(\3\2\2\2\u0207\u0208\t\25\2\2\u0208*\3\2\2\2\u0209\u020a"+ - "\t\26\2\2\u020a,\3\2\2\2\u020b\u020c\t\27\2\2\u020c.\3\2\2\2\u020d\u020e"+ - "\t\30\2\2\u020e\60\3\2\2\2\u020f\u0210\t\31\2\2\u0210\62\3\2\2\2\u0211"+ - "\u0212\t\32\2\2\u0212\64\3\2\2\2\u0213\u0214\t\33\2\2\u0214\66\3\2\2\2"+ - "\u0215\u0216\5\3\2\2\u0216\u0217\5\'\24\2\u02178\3\2\2\2\u0218\u0219\5"+ - "\3\2\2\u0219\u021a\5\31\r\2\u021a\u021b\5\31\r\2\u021b:\3\2\2\2\u021c"+ - "\u021d\5\3\2\2\u021d\u021e\5\35\17\2\u021e\u021f\5\t\5\2\u021f<\3\2\2"+ - "\2\u0220\u0221\5\3\2\2\u0221\u0222\5\35\17\2\u0222\u0223\5\63\32\2\u0223"+ - ">\3\2\2\2\u0224\u0225\5\3\2\2\u0225\u0226\5\'\24\2\u0226\u0227\5\63\32"+ - "\2\u0227\u0228\5\33\16\2\u0228\u0229\5\33\16\2\u0229\u022a\5\13\6\2\u022a"+ - "\u022b\5)\25\2\u022b\u022c\5%\23\2\u022c\u022d\5\23\n\2\u022d\u022e\5"+ - "\7\4\2\u022e@\3\2\2\2\u022f\u0230\5\3\2\2\u0230\u0231\5\'\24\2\u0231\u0232"+ - "\5\7\4\2\u0232B\3\2\2\2\u0233\u0234\5\5\3\2\u0234\u0235\5\37\20\2\u0235"+ - "\u0236\5)\25\2\u0236\u0237\5\21\t\2\u0237D\3\2\2\2\u0238\u0239\5\7\4\2"+ - "\u0239\u023a\5\3\2\2\u023a\u023b\5\'\24\2\u023b\u023c\5\13\6\2\u023cF"+ - "\3\2\2\2\u023d\u023e\5\7\4\2\u023e\u023f\5\3\2\2\u023f\u0240\5\'\24\2"+ - "\u0240\u0241\5)\25\2\u0241H\3\2\2\2\u0242\u0243\5\7\4\2\u0243\u0244\5"+ - "%\23\2\u0244\u0245\5\13\6\2\u0245\u0246\5\3\2\2\u0246\u0247\5)\25\2\u0247"+ - "\u0248\5\13\6\2\u0248J\3\2\2\2\u0249\u024a\5\7\4\2\u024a\u024b\5%\23\2"+ - "\u024b\u024c\5\37\20\2\u024c\u024d\5\'\24\2\u024d\u024e\5\'\24\2\u024e"+ - "L\3\2\2\2\u024f\u0250\5\t\5\2\u0250\u0251\5\13\6\2\u0251\u0252\5\'\24"+ - "\2\u0252\u0253\5\7\4\2\u0253N\3\2\2\2\u0254\u0255\5\t\5\2\u0255\u0256"+ - "\5\23\n\2\u0256\u0257\5\'\24\2\u0257\u0258\5)\25\2\u0258\u0259\5\23\n"+ - "\2\u0259\u025a\5\35\17\2\u025a\u025b\5\7\4\2\u025b\u025c\5)\25\2\u025c"+ - "P\3\2\2\2\u025d\u025e\5\13\6\2\u025e\u025f\5\35\17\2\u025f\u0260\5\t\5"+ - "\2\u0260R\3\2\2\2\u0261\u0262\5\13\6\2\u0262\u0263\5\31\r\2\u0263\u0264"+ - "\5\'\24\2\u0264\u0265\5\13\6\2\u0265T\3\2\2\2\u0266\u0267\5\13\6\2\u0267"+ - "\u0268\5\61\31\2\u0268\u0269\5\7\4\2\u0269\u026a\5\13\6\2\u026a\u026b"+ - "\5!\21\2\u026b\u026c\5)\25\2\u026cV\3\2\2\2\u026d\u026e\5\r\7\2\u026e"+ - "\u026f\5\3\2\2\u026f\u0270\5\31\r\2\u0270\u0271\5\'\24\2\u0271\u0272\5"+ - "\13\6\2\u0272X\3\2\2\2\u0273\u0274\5\r\7\2\u0274\u0275\5+\26\2\u0275\u0276"+ - "\5\31\r\2\u0276\u0277\5\31\r\2\u0277Z\3\2\2\2\u0278\u0279\5\r\7\2\u0279"+ - "\u027a\5%\23\2\u027a\u027b\5\37\20\2\u027b\u027c\5\33\16\2\u027c\\\3\2"+ - "\2\2\u027d\u027e\5\17\b\2\u027e\u027f\5%\23\2\u027f\u0280\5\37\20\2\u0280"+ - "\u0281\5+\26\2\u0281\u0282\5!\21\2\u0282^\3\2\2\2\u0283\u0284\5\21\t\2"+ - "\u0284\u0285\5\3\2\2\u0285\u0286\5-\27\2\u0286\u0287\5\23\n\2\u0287\u0288"+ - "\5\35\17\2\u0288\u0289\5\17\b\2\u0289`\3\2\2\2\u028a\u028b\5\23\n\2\u028b"+ - "\u028c\5\31\r\2\u028c\u028d\5\23\n\2\u028d\u028e\5\27\f\2\u028e\u028f"+ - "\5\13\6\2\u028fb\3\2\2\2\u0290\u0291\5\23\n\2\u0291\u0292\5\35\17\2\u0292"+ - "d\3\2\2\2\u0293\u0294\5\23\n\2\u0294\u0295\5\35\17\2\u0295\u0296\5\35"+ - "\17\2\u0296\u0297\5\13\6\2\u0297\u0298\5%\23\2\u0298f\3\2\2\2\u0299\u029a"+ - "\5\23\n\2\u029a\u029b\5\35\17\2\u029b\u029c\5)\25\2\u029c\u029d\5\13\6"+ - "\2\u029d\u029e\5%\23\2\u029e\u029f\5\'\24\2\u029f\u02a0\5\13\6\2\u02a0"+ - "\u02a1\5\7\4\2\u02a1\u02a2\5)\25\2\u02a2h\3\2\2\2\u02a3\u02a4\5\23\n\2"+ - "\u02a4\u02a5\5\35\17\2\u02a5\u02a6\5)\25\2\u02a6\u02a7\5\37\20\2\u02a7"+ - "j\3\2\2\2\u02a8\u02a9\5\23\n\2\u02a9\u02aa\5\'\24\2\u02aal\3\2\2\2\u02ab"+ - "\u02ac\5\25\13\2\u02ac\u02ad\5\37\20\2\u02ad\u02ae\5\23\n\2\u02ae\u02af"+ - "\5\35\17\2\u02afn\3\2\2\2\u02b0\u02b1\5\31\r\2\u02b1\u02b2\5\13\6\2\u02b2"+ - "\u02b3\5\3\2\2\u02b3\u02b4\5\t\5\2\u02b4\u02b5\5\23\n\2\u02b5\u02b6\5"+ - "\35\17\2\u02b6\u02b7\5\17\b\2\u02b7p\3\2\2\2\u02b8\u02b9\5\31\r\2\u02b9"+ - "\u02ba\5\13\6\2\u02ba\u02bb\5\r\7\2\u02bb\u02bc\5)\25\2\u02bcr\3\2\2\2"+ - "\u02bd\u02be\5\31\r\2\u02be\u02bf\5\23\n\2\u02bf\u02c0\5\27\f\2\u02c0"+ - "\u02c1\5\13\6\2\u02c1t\3\2\2\2\u02c2\u02c3\5\31\r\2\u02c3\u02c4\5\23\n"+ - "\2\u02c4\u02c5\5\33\16\2\u02c5\u02c6\5\23\n\2\u02c6\u02c7\5)\25\2\u02c7"+ - "v\3\2\2\2\u02c8\u02c9\5\35\17\2\u02c9\u02ca\5\3\2\2\u02ca\u02cb\5)\25"+ - "\2\u02cb\u02cc\5+\26\2\u02cc\u02cd\5%\23\2\u02cd\u02ce\5\3\2\2\u02ce\u02cf"+ - "\5\31\r\2\u02cfx\3\2\2\2\u02d0\u02d1\5\35\17\2\u02d1\u02d2\5\37\20\2\u02d2"+ - "\u02d3\5)\25\2\u02d3z\3\2\2\2\u02d4\u02d5\5\35\17\2\u02d5\u02d6\5+\26"+ - "\2\u02d6\u02d7\5\31\r\2\u02d7\u02d8\5\31\r\2\u02d8|\3\2\2\2\u02d9\u02da"+ - "\5\37\20\2\u02da\u02db\5\35\17\2\u02db~\3\2\2\2\u02dc\u02dd\5\37\20\2"+ - "\u02dd\u02de\5+\26\2\u02de\u02df\5)\25\2\u02df\u02e0\5\13\6\2\u02e0\u02e1"+ - "\5%\23\2\u02e1\u0080\3\2\2\2\u02e2\u02e3\5\37\20\2\u02e3\u02e4\5%\23\2"+ - "\u02e4\u0082\3\2\2\2\u02e5\u02e6\5\37\20\2\u02e6\u02e7\5%\23\2\u02e7\u02e8"+ - "\5\t\5\2\u02e8\u02e9\5\13\6\2\u02e9\u02ea\5%\23\2\u02ea\u0084\3\2\2\2"+ - "\u02eb\u02ec\5%\23\2\u02ec\u02ed\5\23\n\2\u02ed\u02ee\5\17\b\2\u02ee\u02ef"+ - "\5\21\t\2\u02ef\u02f0\5)\25\2\u02f0\u0086\3\2\2\2\u02f1\u02f2\5\'\24\2"+ - "\u02f2\u02f3\5\13\6\2\u02f3\u02f4\5\31\r\2\u02f4\u02f5\5\13\6\2\u02f5"+ - "\u02f6\5\7\4\2\u02f6\u02f7\5)\25\2\u02f7\u0088\3\2\2\2\u02f8\u02f9\5\'"+ - "\24\2\u02f9\u02fa\5\37\20\2\u02fa\u02fb\5\33\16\2\u02fb\u02fc\5\13\6\2"+ - "\u02fc\u008a\3\2\2\2\u02fd\u02fe\5\'\24\2\u02fe\u02ff\5\63\32\2\u02ff"+ - "\u0300\5\33\16\2\u0300\u0301\5\33\16\2\u0301\u0302\5\13\6\2\u0302\u0303"+ - "\5)\25\2\u0303\u0304\5%\23\2\u0304\u0305\5\23\n\2\u0305\u0306\5\7\4\2"+ - "\u0306\u008c\3\2\2\2\u0307\u0308\5)\25\2\u0308\u0309\5\3\2\2\u0309\u030a"+ - "\5\5\3\2\u030a\u030b\5\31\r\2\u030b\u030c\5\13\6\2\u030c\u008e\3\2\2\2"+ - "\u030d\u030e\5)\25\2\u030e\u030f\5\21\t\2\u030f\u0310\5\13\6\2\u0310\u0311"+ - "\5\35\17\2\u0311\u0090\3\2\2\2\u0312\u0313\5)\25\2\u0313\u0314\5%\23\2"+ - "\u0314\u0315\5\3\2\2\u0315\u0316\5\23\n\2\u0316\u0317\5\31\r\2\u0317\u0318"+ - "\5\23\n\2\u0318\u0319\5\35\17\2\u0319\u031a\5\17\b\2\u031a\u0092\3\2\2"+ - "\2\u031b\u031c\5)\25\2\u031c\u031d\5%\23\2\u031d\u031e\5+\26\2\u031e\u031f"+ - "\5\13\6\2\u031f\u0094\3\2\2\2\u0320\u0321\5+\26\2\u0321\u0322\5\35\17"+ - "\2\u0322\u0323\5\23\n\2\u0323\u0324\5\37\20\2\u0324\u0325\5\35\17\2\u0325"+ - "\u0096\3\2\2\2\u0326\u0327\5+\26\2\u0327\u0328\5\35\17\2\u0328\u0329\5"+ - "\23\n\2\u0329\u032a\5#\22\2\u032a\u032b\5+\26\2\u032b\u032c\5\13\6\2\u032c"+ - "\u0098\3\2\2\2\u032d\u032e\5+\26\2\u032e\u032f\5\'\24\2\u032f\u0330\5"+ - "\23\n\2\u0330\u0331\5\35\17\2\u0331\u0332\5\17\b\2\u0332\u009a\3\2\2\2"+ - "\u0333\u0334\5/\30\2\u0334\u0335\5\21\t\2\u0335\u0336\5\13\6\2\u0336\u0337"+ - "\5\35\17\2\u0337\u009c\3\2\2\2\u0338\u0339\5/\30\2\u0339\u033a\5\21\t"+ - "\2\u033a\u033b\5\13\6\2\u033b\u033c\5%\23\2\u033c\u033d\5\13\6\2\u033d"+ - "\u009e\3\2\2\2\u033e\u033f\5/\30\2\u033f\u0340\5\23\n\2\u0340\u0341\5"+ - ")\25\2\u0341\u0342\5\21\t\2\u0342\u00a0\3\2\2\2\u0343\u0344\5\3\2\2\u0344"+ - "\u0345\5-\27\2\u0345\u0346\5\17\b\2\u0346\u00a2\3\2\2\2\u0347\u0348\5"+ - "\5\3\2\u0348\u0349\5\13\6\2\u0349\u034a\5)\25\2\u034a\u034b\5/\30\2\u034b"+ - "\u034c\5\13\6\2\u034c\u034d\5\13\6\2\u034d\u034e\5\35\17\2\u034e\u00a4"+ - "\3\2\2\2\u034f\u0350\5\5\3\2\u0350\u0351\5\63\32\2\u0351\u00a6\3\2\2\2"+ - "\u0352\u0353\5\7\4\2\u0353\u0354\5\13\6\2\u0354\u0355\5\35\17\2\u0355"+ - "\u0356\5)\25\2\u0356\u0357\5+\26\2\u0357\u0358\5%\23\2\u0358\u0359\5\63"+ - "\32\2\u0359\u00a8\3\2\2\2\u035a\u035b\5\7\4\2\u035b\u035c\5\21\t\2\u035c"+ - "\u035d\5\3\2\2\u035d\u035e\5%\23\2\u035e\u035f\5\3\2\2\u035f\u0360\5\7"+ - "\4\2\u0360\u0361\5)\25\2\u0361\u0362\5\13\6\2\u0362\u0363\5%\23\2\u0363"+ - "\u00aa\3\2\2\2\u0364\u0365\5\7\4\2\u0365\u0366\5\37\20\2\u0366\u0367\5"+ - "\31\r\2\u0367\u0368\5\31\r\2\u0368\u0369\5\13\6\2\u0369\u036a\5\7\4\2"+ - "\u036a\u036b\5)\25\2\u036b\u00ac\3\2\2\2\u036c\u036d\5\7\4\2\u036d\u036e"+ - "\5\37\20\2\u036e\u036f\5\3\2\2\u036f\u0370\5\31\r\2\u0370\u0371\5\13\6"+ - "\2\u0371\u0372\5\'\24\2\u0372\u0373\5\7\4\2\u0373\u0374\5\13\6\2\u0374"+ - "\u00ae\3\2\2\2\u0375\u0376\5\7\4\2\u0376\u0377\5\37\20\2\u0377\u0378\5"+ - "\31\r\2\u0378\u0379\5+\26\2\u0379\u037a\5\33\16\2\u037a\u037b\5\35\17"+ - "\2\u037b\u00b0\3\2\2\2\u037c\u037d\5\7\4\2\u037d\u037e\5\37\20\2\u037e"+ - "\u037f\5+\26\2\u037f\u0380\5\35\17\2\u0380\u0381\5)\25\2\u0381\u00b2\3"+ - "\2\2\2\u0382\u0383\5\7\4\2\u0383\u0384\5+\26\2\u0384\u0385\5\5\3\2\u0385"+ - "\u0386\5\13\6\2\u0386\u00b4\3\2\2\2\u0387\u0388\5\t\5\2\u0388\u0389\5"+ - "\3\2\2\u0389\u038a\5\63\32\2\u038a\u00b6\3\2\2\2\u038b\u038c\5\t\5\2\u038c"+ - "\u038d\5\13\6\2\u038d\u038e\5\7\4\2\u038e\u00b8\3\2\2\2\u038f\u0390\5"+ - "\t\5\2\u0390\u0391\5\13\6\2\u0391\u0392\5\7\4\2\u0392\u0393\5\3\2\2\u0393"+ - "\u0394\5\t\5\2\u0394\u0395\5\13\6\2\u0395\u00ba\3\2\2\2\u0396\u0397\5"+ - "\t\5\2\u0397\u0398\5\37\20\2\u0398\u0399\5/\30\2\u0399\u00bc\3\2\2\2\u039a"+ - "\u039b\5\t\5\2\u039b\u039c\5\37\20\2\u039c\u039d\5\63\32\2\u039d\u00be"+ - "\3\2\2\2\u039e\u039f\5\t\5\2\u039f\u03a0\5%\23\2\u03a0\u03a1\5\37\20\2"+ - "\u03a1\u03a2\5!\21\2\u03a2\u00c0\3\2\2\2\u03a3\u03a4\5\13\6\2\u03a4\u03a5"+ - "\5!\21\2\u03a5\u03a6\5\37\20\2\u03a6\u03a7\5\7\4\2\u03a7\u03a8\5\21\t"+ - "\2\u03a8\u00c2\3\2\2\2\u03a9\u03aa\5\13\6\2\u03aa\u03ab\5-\27\2\u03ab"+ - "\u03ac\5\13\6\2\u03ac\u03ad\5%\23\2\u03ad\u03ae\5\63\32\2\u03ae\u00c4"+ - "\3\2\2\2\u03af\u03b0\5\13\6\2\u03b0\u03b1\5\61\31\2\u03b1\u03b2\5\23\n"+ - "\2\u03b2\u03b3\5\'\24\2\u03b3\u03b4\5)\25\2\u03b4\u03b5\5\'\24\2\u03b5"+ - "\u00c6\3\2\2\2\u03b6\u03b7\5\13\6\2\u03b7\u03b8\5\61\31\2\u03b8\u03b9"+ - "\5)\25\2\u03b9\u03ba\5\13\6\2\u03ba\u03bb\5%\23\2\u03bb\u03bc\5\35\17"+ - "\2\u03bc\u03bd\5\3\2\2\u03bd\u03be\5\31\r\2\u03be\u00c8\3\2\2\2\u03bf"+ - "\u03c0\5\13\6\2\u03c0\u03c1\5\61\31\2\u03c1\u03c2\5)\25\2\u03c2\u03c3"+ - "\5%\23\2\u03c3\u03c4\5\3\2\2\u03c4\u03c5\5\7\4\2\u03c5\u03c6\5)\25\2\u03c6"+ - "\u00ca\3\2\2\2\u03c7\u03c8\5\r\7\2\u03c8\u03c9\5\23\n\2\u03c9\u03ca\5"+ - "\31\r\2\u03ca\u03cb\5)\25\2\u03cb\u03cc\5\13\6\2\u03cc\u03cd\5%\23\2\u03cd"+ - "\u00cc\3\2\2\2\u03ce\u03cf\5\r\7\2\u03cf\u03d0\5\23\n\2\u03d0\u03d1\5"+ - "%\23\2\u03d1\u03d2\5\'\24\2\u03d2\u03d3\5)\25\2\u03d3\u00ce\3\2\2\2\u03d4"+ - "\u03d5\5\r\7\2\u03d5\u03d6\5\37\20\2\u03d6\u03d7\5%\23\2\u03d7\u03d8\5"+ - "\33\16\2\u03d8\u03d9\5\3\2\2\u03d9\u03da\5)\25\2\u03da\u00d0\3\2\2\2\u03db"+ - "\u03dc\5\r\7\2\u03dc\u03dd\5+\26\2\u03dd\u03de\5\'\24\2\u03de\u03df\5"+ - "\23\n\2\u03df\u03e0\5\37\20\2\u03e0\u03e1\5\35\17\2\u03e1\u00d2\3\2\2"+ - "\2\u03e2\u03e3\5\17\b\2\u03e3\u03e4\5%\23\2\u03e4\u03e5\5\37\20\2\u03e5"+ - "\u03e6\5+\26\2\u03e6\u03e7\5!\21\2\u03e7\u03e8\5\23\n\2\u03e8\u03e9\5"+ - "\35\17\2\u03e9\u03ea\5\17\b\2\u03ea\u00d4\3\2\2\2\u03eb\u03ec\5\21\t\2"+ - "\u03ec\u03ed\5\3\2\2\u03ed\u03ee\5\'\24\2\u03ee\u03ef\5\21\t\2\u03ef\u00d6"+ - "\3\2\2\2\u03f0\u03f1\5\21\t\2\u03f1\u03f2\5\37\20\2\u03f2\u03f3\5+\26"+ - "\2\u03f3\u03f4\5%\23\2\u03f4\u00d8\3\2\2\2\u03f5\u03f6\5\23\n\2\u03f6"+ - "\u03f7\5\35\17\2\u03f7\u03f8\5\t\5\2\u03f8\u03f9\5\13\6\2\u03f9\u03fa"+ - "\5\61\31\2\u03fa\u00da\3\2\2\2\u03fb\u03fc\5\23\n\2\u03fc\u03fd\5\35\17"+ - "\2\u03fd\u03fe\5\'\24\2\u03fe\u03ff\5\13\6\2\u03ff\u0400\5%\23\2\u0400"+ - "\u0401\5)\25\2\u0401\u00dc\3\2\2\2\u0402\u0403\5\23\n\2\u0403\u0404\5"+ - "\35\17\2\u0404\u0405\5)\25\2\u0405\u0406\5\13\6\2\u0406\u0407\5%\23\2"+ - "\u0407\u0408\5\'\24\2\u0408\u0409\5\13\6\2\u0409\u040a\5\7\4\2\u040a\u040b"+ - "\5)\25\2\u040b\u040c\5\23\n\2\u040c\u040d\5\37\20\2\u040d\u040e\5\35\17"+ - "\2\u040e\u00de\3\2\2\2\u040f\u0410\5\23\n\2\u0410\u0411\5\'\24\2\u0411"+ - "\u0412\5\37\20\2\u0412\u0413\5\t\5\2\u0413\u0414\5\37\20\2\u0414\u0415"+ - "\5/\30\2\u0415\u00e0\3\2\2\2\u0416\u0417\5\23\n\2\u0417\u0418\5\'\24\2"+ - "\u0418\u0419\5\37\20\2\u0419\u041a\5\63\32\2\u041a\u041b\5\13\6\2\u041b"+ - "\u041c\5\3\2\2\u041c\u041d\5%\23\2\u041d\u00e2\3\2\2\2\u041e\u041f\5\31"+ - "\r\2\u041f\u0420\5\3\2\2\u0420\u0421\5\'\24\2\u0421\u0422\5)\25\2\u0422"+ - "\u00e4\3\2\2\2\u0423\u0424\5\31\r\2\u0424\u0425\5\13\6\2\u0425\u0426\5"+ - "\'\24\2\u0426\u0427\5\'\24\2\u0427\u00e6\3\2\2\2\u0428\u0429\5\31\r\2"+ - "\u0429\u042a\5\23\n\2\u042a\u042b\5\'\24\2\u042b\u042c\5)\25\2\u042c\u00e8"+ - "\3\2\2\2\u042d\u042e\5\31\r\2\u042e\u042f\5\37\20\2\u042f\u0430\5\7\4"+ - "\2\u0430\u0431\5\3\2\2\u0431\u0432\5)\25\2\u0432\u0433\5\23\n\2\u0433"+ - "\u0434\5\37\20\2\u0434\u0435\5\35\17\2\u0435\u00ea\3\2\2\2\u0436\u0437"+ - "\5\33\16\2\u0437\u0438\5\3\2\2\u0438\u0439\5\61\31\2\u0439\u00ec\3\2\2"+ - "\2\u043a\u043b\5\33\16\2\u043b\u043c\5\3\2\2\u043c\u043d\5\61\31\2\u043d"+ - "\u043e\5-\27\2\u043e\u043f\5\3\2\2\u043f\u0440\5\31\r\2\u0440\u0441\5"+ - "+\26\2\u0441\u0442\5\13\6\2\u0442\u00ee\3\2\2\2\u0443\u0444\5\33\16\2"+ - "\u0444\u0445\5\23\n\2\u0445\u0446\5\7\4\2\u0446\u0447\5%\23\2\u0447\u0448"+ - "\5\37\20\2\u0448\u0449\5\'\24\2\u0449\u044a\5\13\6\2\u044a\u044b\5\7\4"+ - "\2\u044b\u044c\5\37\20\2\u044c\u044d\5\35\17\2\u044d\u044e\5\t\5\2\u044e"+ - "\u044f\5\'\24\2\u044f\u00f0\3\2\2\2\u0450\u0451\5\33\16\2\u0451\u0452"+ - "\5\23\n\2\u0452\u0453\5\31\r\2\u0453\u0454\5\31\r\2\u0454\u0455\5\13\6"+ - "\2\u0455\u0456\5\35\17\2\u0456\u0457\5\35\17\2\u0457\u0458\5\23\n\2\u0458"+ - "\u0459\5+\26\2\u0459\u045a\5\33\16\2\u045a\u00f2\3\2\2\2\u045b\u045c\5"+ - "\33\16\2\u045c\u045d\5\23\n\2\u045d\u045e\5\31\r\2\u045e\u045f\5\31\r"+ - "\2\u045f\u0460\5\23\n\2\u0460\u0461\5\'\24\2\u0461\u0462\5\13\6\2\u0462"+ - "\u0463\5\7\4\2\u0463\u0464\5\37\20\2\u0464\u0465\5\35\17\2\u0465\u0466"+ - "\5\t\5\2\u0466\u0467\5\'\24\2\u0467\u00f4\3\2\2\2\u0468\u0469\5\33\16"+ - "\2\u0469\u046a\5\23\n\2\u046a\u046b\5\35\17\2\u046b\u00f6\3\2\2\2\u046c"+ - "\u046d\5\33\16\2\u046d\u046e\5\23\n\2\u046e\u046f\5\35\17\2\u046f\u0470"+ - "\5+\26\2\u0470\u0471\5)\25\2\u0471\u0472\5\13\6\2\u0472\u00f8\3\2\2\2"+ - "\u0473\u0474\5\33\16\2\u0474\u0475\5\37\20\2\u0475\u0476\5\35\17\2\u0476"+ - "\u0477\5)\25\2\u0477\u0478\5\21\t\2\u0478\u00fa\3\2\2\2\u0479\u047a\5"+ - "\35\17\2\u047a\u047b\5\3\2\2\u047b\u047c\5)\25\2\u047c\u047d\5\23\n\2"+ - "\u047d\u047e\5\37\20\2\u047e\u047f\5\35\17\2\u047f\u0480\5\3\2\2\u0480"+ - "\u0481\5\31\r\2\u0481\u00fc\3\2\2\2\u0482\u0483\5\35\17\2\u0483\u0484"+ - "\5+\26\2\u0484\u0485\5\31\r\2\u0485\u0486\5\31\r\2\u0486\u0487\5\23\n"+ - "\2\u0487\u0488\5\r\7\2\u0488\u00fe\3\2\2\2\u0489\u048a\5\37\20\2\u048a"+ - "\u048b\5-\27\2\u048b\u048c\5\13\6\2\u048c\u048d\5%\23\2\u048d\u048e\5"+ - "/\30\2\u048e\u048f\5%\23\2\u048f\u0490\5\23\n\2\u0490\u0491\5)\25\2\u0491"+ - "\u0492\5\13\6\2\u0492\u0100\3\2\2\2\u0493\u0494\5!\21\2\u0494\u0495\5"+ - "\3\2\2\u0495\u0496\5%\23\2\u0496\u0497\5)\25\2\u0497\u0498\5\23\n\2\u0498"+ - "\u0499\5)\25\2\u0499\u049a\5\23\n\2\u049a\u049b\5\37\20\2\u049b\u049c"+ - "\5\35\17\2\u049c\u0102\3\2\2\2\u049d\u049e\5!\21\2\u049e\u049f\5\3\2\2"+ - "\u049f\u04a0\5%\23\2\u04a0\u04a1\5)\25\2\u04a1\u04a2\5\23\n\2\u04a2\u04a3"+ - "\5)\25\2\u04a3\u04a4\5\23\n\2\u04a4\u04a5\5\37\20\2\u04a5\u04a6\5\35\17"+ - "\2\u04a6\u04a7\5\'\24\2\u04a7\u0104\3\2\2\2\u04a8\u04a9\5!\21\2\u04a9"+ - "\u04aa\5%\23\2\u04aa\u04ab\5\13\6\2\u04ab\u04ac\5\7\4\2\u04ac\u04ad\5"+ - "\23\n\2\u04ad\u04ae\5\'\24\2\u04ae\u04af\5\23\n\2\u04af\u04b0\5\37\20"+ - "\2\u04b0\u04b1\5\35\17\2\u04b1\u0106\3\2\2\2\u04b2\u04b3\5!\21\2\u04b3"+ - "\u04b4\5+\26\2\u04b4\u04b5\5%\23\2\u04b5\u04b6\5\17\b\2\u04b6\u04b7\5"+ - "\13\6\2\u04b7\u0108\3\2\2\2\u04b8\u04b9\5#\22\2\u04b9\u04ba\5+\26\2\u04ba"+ - "\u04bb\5\3\2\2\u04bb\u04bc\5%\23\2\u04bc\u04bd\5)\25\2\u04bd\u04be\5\13"+ - "\6\2\u04be\u04bf\5%\23\2\u04bf\u010a\3\2\2\2\u04c0\u04c1\5%\23\2\u04c1"+ - "\u04c2\5\3\2\2\u04c2\u04c3\5\35\17\2\u04c3\u04c4\5\17\b\2\u04c4\u04c5"+ - "\5\13\6\2\u04c5\u010c\3\2\2\2\u04c6\u04c7\5%\23\2\u04c7\u04c8\5\13\6\2"+ - "\u04c8\u04c9\5\17\b\2\u04c9\u04ca\5\13\6\2\u04ca\u04cb\5\61\31\2\u04cb"+ - "\u04cc\5!\21\2\u04cc\u010e\3\2\2\2\u04cd\u04ce\5%\23\2\u04ce\u04cf\5\31"+ - "\r\2\u04cf\u04d0\5\23\n\2\u04d0\u04d1\5\27\f\2\u04d1\u04d2\5\13\6\2\u04d2"+ - "\u0110\3\2\2\2\u04d3\u04d4\5%\23\2\u04d4\u04d5\5\37\20\2\u04d5\u04d6\5"+ - "\31\r\2\u04d6\u04d7\5\31\r\2\u04d7\u04d8\5+\26\2\u04d8\u04d9\5!\21\2\u04d9"+ - "\u0112\3\2\2\2\u04da\u04db\5\'\24\2\u04db\u04dc\5\13\6\2\u04dc\u04dd\5"+ - "\7\4\2\u04dd\u04de\5\37\20\2\u04de\u04df\5\35\17\2\u04df\u04e0\5\t\5\2"+ - "\u04e0\u0114\3\2\2\2\u04e1\u04e2\5\'\24\2\u04e2\u04e3\5\13\6\2\u04e3\u04e4"+ - "\5)\25\2\u04e4\u0116\3\2\2\2\u04e5\u04e6\5\'\24\2\u04e6\u04e7\5\23\n\2"+ - "\u04e7\u04e8\5\33\16\2\u04e8\u04e9\5\23\n\2\u04e9\u04ea\5\31\r\2\u04ea"+ - "\u04eb\5\3\2\2\u04eb\u04ec\5%\23\2\u04ec\u0118\3\2\2\2\u04ed\u04ee\5\'"+ - "\24\2\u04ee\u04ef\5)\25\2\u04ef\u04f0\5\t\5\2\u04f0\u04f1\5\t\5\2\u04f1"+ - "\u04f2\5\13\6\2\u04f2\u04f3\5-\27\2\u04f3\u04f4\5\u01b5\u00db\2\u04f4"+ - "\u04f5\5!\21\2\u04f5\u04f6\5\37\20\2\u04f6\u04f7\5!\21\2\u04f7\u011a\3"+ - "\2\2\2\u04f8\u04f9\5\'\24\2\u04f9\u04fa\5)\25\2\u04fa\u04fb\5\t\5\2\u04fb"+ - "\u04fc\5\t\5\2\u04fc\u04fd\5\13\6\2\u04fd\u04fe\5-\27\2\u04fe\u04ff\5"+ - "\u01b5\u00db\2\u04ff\u0500\5\'\24\2\u0500\u0501\5\3\2\2\u0501\u0502\5"+ - "\33\16\2\u0502\u0503\5!\21\2\u0503\u011c\3\2\2\2\u0504\u0505\5\'\24\2"+ - "\u0505\u0506\5+\26\2\u0506\u0507\5\5\3\2\u0507\u0508\5!\21\2\u0508\u0509"+ - "\5\3\2\2\u0509\u050a\5%\23\2\u050a\u050b\5)\25\2\u050b\u050c\5\23\n\2"+ - "\u050c\u050d\5)\25\2\u050d\u050e\5\23\n\2\u050e\u050f\5\37\20\2\u050f"+ - "\u0510\5\35\17\2\u0510\u011e\3\2\2\2\u0511\u0512\5\'\24\2\u0512\u0513"+ - "\5+\26\2\u0513\u0514\5\33\16\2\u0514\u0120\3\2\2\2\u0515\u0516\5)\25\2"+ - "\u0516\u0517\5\3\2\2\u0517\u0518\5\5\3\2\u0518\u0519\5\31\r\2\u0519\u051a"+ - "\5\13\6\2\u051a\u051b\5\'\24\2\u051b\u051c\5!\21\2\u051c\u051d\5\3\2\2"+ - "\u051d\u051e\5\7\4\2\u051e\u051f\5\13\6\2\u051f\u0122\3\2\2\2\u0520\u0521"+ - "\5)\25\2\u0521\u0522\5\21\t\2\u0522\u0523\5\3\2\2\u0523\u0524\5\35\17"+ - "\2\u0524\u0124\3\2\2\2\u0525\u0526\5)\25\2\u0526\u0527\5\23\n\2\u0527"+ - "\u0528\5\33\16\2\u0528\u0529\5\13\6\2\u0529\u052a\5\65\33\2\u052a\u052b"+ - "\5\37\20\2\u052b\u052c\5\35\17\2\u052c\u052d\5\13\6\2\u052d\u0126\3\2"+ - "\2\2\u052e\u052f\5)\25\2\u052f\u0530\5\23\n\2\u0530\u0531\5\33\16\2\u0531"+ - "\u0532\5\13\6\2\u0532\u0533\5\65\33\2\u0533\u0534\5\37\20\2\u0534\u0535"+ - "\5\35\17\2\u0535\u0536\5\13\6\2\u0536\u0537\5\u01b5\u00db\2\u0537\u0538"+ - "\5\21\t\2\u0538\u0539\5\37\20\2\u0539\u053a\5+\26\2\u053a\u053b\5%\23"+ - "\2\u053b\u0128\3\2\2\2\u053c\u053d\5)\25\2\u053d\u053e\5\23\n\2\u053e"+ - "\u053f\5\33\16\2\u053f\u0540\5\13\6\2\u0540\u0541\5\65\33\2\u0541\u0542"+ - "\5\37\20\2\u0542\u0543\5\35\17\2\u0543\u0544\5\13\6\2\u0544\u0545\5\u01b5"+ - "\u00db\2\u0545\u0546\5\33\16\2\u0546\u0547\5\23\n\2\u0547\u0548\5\35\17"+ - "\2\u0548\u0549\5+\26\2\u0549\u054a\5)\25\2\u054a\u054b\5\13\6\2\u054b"+ - "\u012a\3\2\2\2\u054c\u054d\5)\25\2\u054d\u054e\5%\23\2\u054e\u054f\5\23"+ - "\n\2\u054f\u0550\5\33\16\2\u0550\u012c\3\2\2\2\u0551\u0552\5)\25\2\u0552"+ - "\u0553\5\37\20\2\u0553\u012e\3\2\2\2\u0554\u0555\5+\26\2\u0555\u0556\5"+ - "\35\17\2\u0556\u0557\5\27\f\2\u0557\u0558\5\35\17\2\u0558\u0559\5\37\20"+ - "\2\u0559\u055a\5/\30\2\u055a\u055b\5\35\17\2\u055b\u0130\3\2\2\2\u055c"+ - "\u055d\5-\27\2\u055d\u055e\5\3\2\2\u055e\u055f\5\31\r\2\u055f\u0560\5"+ - "+\26\2\u0560\u0561\5\13\6\2\u0561\u0562\5\'\24\2\u0562\u0132\3\2\2\2\u0563"+ - "\u0564\5-\27\2\u0564\u0565\5\3\2\2\u0565\u0566\5%\23\2\u0566\u0567\5\u01b5"+ - "\u00db\2\u0567\u0568\5\'\24\2\u0568\u0569\5\3\2\2\u0569\u056a\5\33\16"+ - "\2\u056a\u056b\5!\21\2\u056b\u0134\3\2\2\2\u056c\u056d\5-\27\2\u056d\u056e"+ - "\5\3\2\2\u056e\u056f\5%\23\2\u056f\u0570\5\u01b5\u00db\2\u0570\u0571\5"+ - "!\21\2\u0571\u0572\5\37\20\2\u0572\u0573\5!\21\2\u0573\u0136\3\2\2\2\u0574"+ - "\u0575\5-\27\2\u0575\u0576\5\3\2\2\u0576\u0577\5%\23\2\u0577\u0578\5\63"+ - "\32\2\u0578\u0579\5\23\n\2\u0579\u057a\5\35\17\2\u057a\u057b\5\17\b\2"+ - "\u057b\u0138\3\2\2\2\u057c\u057d\5/\30\2\u057d\u057e\5\13\6\2\u057e\u057f"+ - "\5\13\6\2\u057f\u0580\5\27\f\2\u0580\u013a\3\2\2\2\u0581\u0582\5\63\32"+ - "\2\u0582\u0583\5\13\6\2\u0583\u0584\5\3\2\2\u0584\u0585\5%\23\2\u0585"+ - "\u013c\3\2\2\2\u0586\u0587\5\65\33\2\u0587\u0588\5\37\20\2\u0588\u0589"+ - "\5\35\17\2\u0589\u058a\5\13\6\2\u058a\u013e\3\2\2\2\u058b\u058c\5\5\3"+ - "\2\u058c\u058d\5\37\20\2\u058d\u058e\5\37\20\2\u058e\u058f\5\31\r\2\u058f"+ - "\u0590\5\13\6\2\u0590\u0591\5\3\2\2\u0591\u0592\5\35\17\2\u0592\u0140"+ - "\3\2\2\2\u0593\u0594\5\5\3\2\u0594\u0595\5\37\20\2\u0595\u0596\5\37\20"+ - "\2\u0596\u0597\5\31\r\2\u0597\u0142\3\2\2\2\u0598\u0599\5\5\3\2\u0599"+ - "\u059a\5\23\n\2\u059a\u059b\5)\25\2\u059b\u0144\3\2\2\2\u059c\u059d\5"+ - "-\27\2\u059d\u059e\5\3\2\2\u059e\u059f\5%\23\2\u059f\u05a0\5\5\3\2\u05a0"+ - "\u05a1\5\23\n\2\u05a1\u05a2\5)\25\2\u05a2\u0146\3\2\2\2\u05a3\u05a4\5"+ - "\23\n\2\u05a4\u05a5\5\35\17\2\u05a5\u05a6\5)\25\2\u05a6\u05a7\7\63\2\2"+ - "\u05a7\u0148\3\2\2\2\u05a8\u05a9\5\23\n\2\u05a9\u05aa\5\35\17\2\u05aa"+ - "\u05ab\5)\25\2\u05ab\u05ac\7\64\2\2\u05ac\u014a\3\2\2\2\u05ad\u05ae\5"+ - "\23\n\2\u05ae\u05af\5\35\17\2\u05af\u05b0\5)\25\2\u05b0\u05b1\7\66\2\2"+ - "\u05b1\u014c\3\2\2\2\u05b2\u05b3\5\23\n\2\u05b3\u05b4\5\35\17\2\u05b4"+ - "\u05b5\5)\25\2\u05b5\u05b6\7:\2\2\u05b6\u014e\3\2\2\2\u05b7\u05b8\5)\25"+ - "\2\u05b8\u05b9\5\23\n\2\u05b9\u05ba\5\35\17\2\u05ba\u05bb\5\63\32\2\u05bb"+ - "\u05bc\5\23\n\2\u05bc\u05bd\5\35\17\2\u05bd\u05be\5)\25\2\u05be\u0150"+ - "\3\2\2\2\u05bf\u05c0\5\'\24\2\u05c0\u05c1\5\33\16\2\u05c1\u05c2\5\3\2"+ - "\2\u05c2\u05c3\5\31\r\2\u05c3\u05c4\5\31\r\2\u05c4\u05c5\5\23\n\2\u05c5"+ - "\u05c6\5\35\17\2\u05c6\u05c7\5)\25\2\u05c7\u0152\3\2\2\2\u05c8\u05c9\5"+ - "\23\n\2\u05c9\u05ca\5\35\17\2\u05ca\u05cb\5)\25\2\u05cb\u0154\3\2\2\2"+ - "\u05cc\u05cd\5\23\n\2\u05cd\u05ce\5\35\17\2\u05ce\u05cf\5)\25\2\u05cf"+ - "\u05d0\5\13\6\2\u05d0\u05d1\5\17\b\2\u05d1\u05d2\5\13\6\2\u05d2\u05d3"+ - "\5%\23\2\u05d3\u0156\3\2\2\2\u05d4\u05d5\5\5\3\2\u05d5\u05d6\5\23\n\2"+ - "\u05d6\u05d7\5\17\b\2\u05d7\u05d8\5\23\n\2\u05d8\u05d9\5\35\17\2\u05d9"+ - "\u05da\5)\25\2\u05da\u0158\3\2\2\2\u05db\u05dc\5\r\7\2\u05dc\u05dd\5\31"+ - "\r\2\u05dd\u05de\5\37\20\2\u05de\u05df\5\3\2\2\u05df\u05e0\5)\25\2\u05e0"+ - "\u05e1\7\66\2\2\u05e1\u015a\3\2\2\2\u05e2\u05e3\5\r\7\2\u05e3\u05e4\5"+ - "\31\r\2\u05e4\u05e5\5\37\20\2\u05e5\u05e6\5\3\2\2\u05e6\u05e7\5)\25\2"+ - "\u05e7\u05e8\7:\2\2\u05e8\u015c\3\2\2\2\u05e9\u05ea\5%\23\2\u05ea\u05eb"+ - "\5\13\6\2\u05eb\u05ec\5\3\2\2\u05ec\u05ed\5\31\r\2\u05ed\u015e\3\2\2\2"+ - "\u05ee\u05ef\5\r\7\2\u05ef\u05f0\5\31\r\2\u05f0\u05f1\5\37\20\2\u05f1"+ - "\u05f2\5\3\2\2\u05f2\u05f3\5)\25\2\u05f3\u0160\3\2\2\2\u05f4\u05f5\5\t"+ - "\5\2\u05f5\u05f6\5\37\20\2\u05f6\u05f7\5+\26\2\u05f7\u05f8\5\5\3\2\u05f8"+ - "\u05f9\5\31\r\2\u05f9\u05fa\5\13\6\2\u05fa\u0162\3\2\2\2\u05fb\u05fc\5"+ - "\35\17\2\u05fc\u05fd\5+\26\2\u05fd\u05fe\5\33\16\2\u05fe\u05ff\5\13\6"+ - "\2\u05ff\u0600\5%\23\2\u0600\u0601\5\23\n\2\u0601\u0602\5\7\4\2\u0602"+ - "\u0164\3\2\2\2\u0603\u0604\5\t\5\2\u0604\u0605\5\13\6\2\u0605\u0606\5"+ - "\7\4\2\u0606\u0607\5\23\n\2\u0607\u0608\5\33\16\2\u0608\u0609\5\3\2\2"+ - "\u0609\u060a\5\31\r\2\u060a\u0166\3\2\2\2\u060b\u060c\5\7\4\2\u060c\u060d"+ - "\5\21\t\2\u060d\u060e\5\3\2\2\u060e\u060f\5%\23\2\u060f\u0168\3\2\2\2"+ - "\u0610\u0611\5-\27\2\u0611\u0612\5\3\2\2\u0612\u0613\5%\23\2\u0613\u0614"+ - "\5\7\4\2\u0614\u0615\5\21\t\2\u0615\u0616\5\3\2\2\u0616\u0617\5%\23\2"+ - "\u0617\u016a\3\2\2\2\u0618\u0619\5\35\17\2\u0619\u061a\5\7\4\2\u061a\u061b"+ - "\5\21\t\2\u061b\u061c\5\3\2\2\u061c\u061d\5%\23\2\u061d\u016c\3\2\2\2"+ - "\u061e\u061f\5\35\17\2\u061f\u0620\5-\27\2\u0620\u0621\5\3\2\2\u0621\u0622"+ - "\5%\23\2\u0622\u0623\5\7\4\2\u0623\u0624\5\21\t\2\u0624\u0625\5\3\2\2"+ - "\u0625\u0626\5%\23\2\u0626\u016e\3\2\2\2\u0627\u0628\5\t\5\2\u0628\u0629"+ - "\5\3\2\2\u0629\u062a\5)\25\2\u062a\u062b\5\13\6\2\u062b\u0170\3\2\2\2"+ - "\u062c\u062d\5)\25\2\u062d\u062e\5\23\n\2\u062e\u062f\5\33\16\2\u062f"+ - "\u0630\5\13\6\2\u0630\u0172\3\2\2\2\u0631\u0632\5)\25\2\u0632\u0633\5"+ - "\23\n\2\u0633\u0634\5\33\16\2\u0634\u0635\5\13\6\2\u0635\u0636\5)\25\2"+ - "\u0636\u0637\5\65\33\2\u0637\u0174\3\2\2\2\u0638\u0639\5)\25\2\u0639\u063a"+ - "\5\23\n\2\u063a\u063b\5\33\16\2\u063b\u063c\5\13\6\2\u063c\u063d\5\'\24"+ - "\2\u063d\u063e\5)\25\2\u063e\u063f\5\3\2\2\u063f\u0640\5\33\16\2\u0640"+ - "\u0641\5!\21\2\u0641\u0176\3\2\2\2\u0642\u0643\5)\25\2\u0643\u0644\5\23"+ - "\n\2\u0644\u0645\5\33\16\2\u0645\u0646\5\13\6\2\u0646\u0647\5\'\24\2\u0647"+ - "\u0648\5)\25\2\u0648\u0649\5\3\2\2\u0649\u064a\5\33\16\2\u064a\u064b\5"+ - "!\21\2\u064b\u064c\5)\25\2\u064c\u064d\5\65\33\2\u064d\u0178\3\2\2\2\u064e"+ - "\u064f\5)\25\2\u064f\u0650\5\13\6\2\u0650\u0651\5\61\31\2\u0651\u0652"+ - "\5)\25\2\u0652\u017a\3\2\2\2\u0653\u0654\5\5\3\2\u0654\u0655\5\23\n\2"+ - "\u0655\u0656\5\35\17\2\u0656\u0657\5\3\2\2\u0657\u0658\5%\23\2\u0658\u0659"+ - "\5\63\32\2\u0659\u017c\3\2\2\2\u065a\u065b\5-\27\2\u065b\u065c\5\3\2\2"+ - "\u065c\u065d\5%\23\2\u065d\u065e\5\5\3\2\u065e\u065f\5\23\n\2\u065f\u0660"+ - "\5\35\17\2\u0660\u0661\5\3\2\2\u0661\u0662\5%\23\2\u0662\u0663\5\63\32"+ - "\2\u0663\u017e\3\2\2\2\u0664\u0665\5\5\3\2\u0665\u0666\5\31\r\2\u0666"+ - "\u0667\5\37\20\2\u0667\u0668\5\5\3\2\u0668\u0180\3\2\2\2\u0669\u066a\5"+ - "\5\3\2\u066a\u066b\5\63\32\2\u066b\u066c\5)\25\2\u066c\u066d\5\13\6\2"+ - "\u066d\u066e\5\3\2\2\u066e\u0182\3\2\2\2\u066f\u0670\5\23\n\2\u0670\u0671"+ - "\5\35\17\2\u0671\u0672\5\13\6\2\u0672\u0673\5)\25\2\u0673\u0674\7\66\2"+ - "\2\u0674\u0184\3\2\2\2\u0675\u0676\7\u0080\2\2\u0676\u0186\3\2\2\2\u0677"+ - "\u0678\7#\2\2\u0678\u0679\7\u0080\2\2\u0679\u0188\3\2\2\2\u067a\u067b"+ - "\7\u0080\2\2\u067b\u067c\7,\2\2\u067c\u018a\3\2\2\2\u067d\u067e\7#\2\2"+ - "\u067e\u067f\7\u0080\2\2\u067f\u0680\7,\2\2\u0680\u018c\3\2\2\2\u0681"+ - "\u0682\5\u0193\u00ca\2\u0682\u0683\5\u0193\u00ca\2\u0683\u018e\3\2\2\2"+ - "\u0684\u0685\7<\2\2\u0685\u0686\7?\2\2\u0686\u0190\3\2\2\2\u0687\u0688"+ - "\7?\2\2\u0688\u0192\3\2\2\2\u0689\u068a\7<\2\2\u068a\u0194\3\2\2\2\u068b"+ - "\u068c\7=\2\2\u068c\u0196\3\2\2\2\u068d\u068e\7.\2\2\u068e\u0198\3\2\2"+ - "\2\u068f\u0690\5\u01b7\u00dc\2\u0690\u0691\5\u01b7\u00dc\2\u0691\u019a"+ - "\3\2\2\2\u0692\u0693\7>\2\2\u0693\u069b\7@\2\2\u0694\u0695\7#\2\2\u0695"+ - "\u069b\7?\2\2\u0696\u0697\7\u0080\2\2\u0697\u069b\7?\2\2\u0698\u0699\7"+ - "`\2\2\u0699\u069b\7?\2\2\u069a\u0692\3\2\2\2\u069a\u0694\3\2\2\2\u069a"+ - "\u0696\3\2\2\2\u069a\u0698\3\2\2\2\u069b\u019c\3\2\2\2\u069c\u069d\7>"+ - "\2\2\u069d\u019e\3\2\2\2\u069e\u069f\7>\2\2\u069f\u06a0\7?\2\2\u06a0\u01a0"+ - "\3\2\2\2\u06a1\u06a2\7@\2\2\u06a2\u01a2\3\2\2\2\u06a3\u06a4\7@\2\2\u06a4"+ - "\u06a5\7?\2\2\u06a5\u01a4\3\2\2\2\u06a6\u06a7\7*\2\2\u06a7\u01a6\3\2\2"+ - "\2\u06a8\u06a9\7+\2\2\u06a9\u01a8\3\2\2\2\u06aa\u06ab\7-\2\2\u06ab\u01aa"+ - "\3\2\2\2\u06ac\u06ad\7/\2\2\u06ad\u01ac\3\2\2\2\u06ae\u06af\7,\2\2\u06af"+ - "\u01ae\3\2\2\2\u06b0\u06b1\7\61\2\2\u06b1\u01b0\3\2\2\2\u06b2\u06b3\7"+ - "\'\2\2\u06b3\u01b2\3\2\2\2\u06b4\u06b5\7\60\2\2\u06b5\u01b4\3\2\2\2\u06b6"+ - "\u06b7\7a\2\2\u06b7\u01b6\3\2\2\2\u06b8\u06b9\7~\2\2\u06b9\u01b8\3\2\2"+ - "\2\u06ba\u06bb\7)\2\2\u06bb\u01ba\3\2\2\2\u06bc\u06bd\7$\2\2\u06bd\u01bc"+ - "\3\2\2\2\u06be\u06c0\5\u01bf\u00e0\2\u06bf\u06be\3\2\2\2\u06c0\u06c1\3"+ - "\2\2\2\u06c1\u06bf\3\2\2\2\u06c1\u06c2\3\2\2\2\u06c2\u01be\3\2\2\2\u06c3"+ - "\u06c4\4\62;\2\u06c4\u01c0\3\2\2\2\u06c5\u06c7\4\62;\2\u06c6\u06c5\3\2"+ - "\2\2\u06c7\u06c8\3\2\2\2\u06c8\u06c6\3\2\2\2\u06c8\u06c9\3\2\2\2\u06c9"+ - "\u06ca\3\2\2\2\u06ca\u06ce\7\60\2\2\u06cb\u06cd\4\62;\2\u06cc\u06cb\3"+ - "\2\2\2\u06cd\u06d0\3\2\2\2\u06ce\u06cc\3\2\2\2\u06ce\u06cf\3\2\2\2\u06cf"+ - "\u06d2\3\2\2\2\u06d0\u06ce\3\2\2\2\u06d1\u06d3\5\u01d1\u00e9\2\u06d2\u06d1"+ - "\3\2\2\2\u06d2\u06d3\3\2\2\2\u06d3\u06e4\3\2\2\2\u06d4\u06d6\7\60\2\2"+ - "\u06d5\u06d7\4\62;\2\u06d6\u06d5\3\2\2\2\u06d7\u06d8\3\2\2\2\u06d8\u06d6"+ - "\3\2\2\2\u06d8\u06d9\3\2\2\2\u06d9\u06db\3\2\2\2\u06da\u06dc\5\u01d1\u00e9"+ - "\2\u06db\u06da\3\2\2\2\u06db\u06dc\3\2\2\2\u06dc\u06e4\3\2\2\2\u06dd\u06df"+ - "\4\62;\2\u06de\u06dd\3\2\2\2\u06df\u06e0\3\2\2\2\u06e0\u06de\3\2\2\2\u06e0"+ - "\u06e1\3\2\2\2\u06e1\u06e2\3\2\2\2\u06e2\u06e4\5\u01d1\u00e9\2\u06e3\u06c6"+ - "\3\2\2\2\u06e3\u06d4\3\2\2\2\u06e3\u06de\3\2\2\2\u06e4\u01c2\3\2\2\2\u06e5"+ - "\u06e6\7\61\2\2\u06e6\u06e7\7,\2\2\u06e7\u06eb\3\2\2\2\u06e8\u06ea\13"+ - "\2\2\2\u06e9\u06e8\3\2\2\2\u06ea\u06ed\3\2\2\2\u06eb\u06ec\3\2\2\2\u06eb"+ - "\u06e9\3\2\2\2\u06ec\u06ee\3\2\2\2\u06ed\u06eb\3\2\2\2\u06ee\u06ef\7,"+ - "\2\2\u06ef\u06f0\7\61\2\2\u06f0\u06f1\3\2\2\2\u06f1\u06f2\b\u00e2\2\2"+ - "\u06f2\u01c4\3\2\2\2\u06f3\u06f4\7/\2\2\u06f4\u06f5\7/\2\2\u06f5\u06f9"+ - "\3\2\2\2\u06f6\u06f8\n\34\2\2\u06f7\u06f6\3\2\2\2\u06f8\u06fb\3\2\2\2"+ - "\u06f9\u06f7\3\2\2\2\u06f9\u06fa\3\2\2\2\u06fa\u06fc\3\2\2\2\u06fb\u06f9"+ - "\3\2\2\2\u06fc\u06fd\b\u00e3\2\2\u06fd\u01c6\3\2\2\2\u06fe\u06ff\5\u01c9"+ - "\u00e5\2\u06ff\u01c8\3\2\2\2\u0700\u0706\t\35\2\2\u0701\u0705\t\36\2\2"+ - "\u0702\u0705\5\u01bf\u00e0\2\u0703\u0705\7a\2\2\u0704\u0701\3\2\2\2\u0704"+ - "\u0702\3\2\2\2\u0704\u0703\3\2\2\2\u0705\u0708\3\2\2\2\u0706\u0704\3\2"+ - "\2\2\u0706\u0707\3\2\2\2\u0707\u01ca\3\2\2\2\u0708\u0706\3\2\2\2\u0709"+ - "\u070a\4\3!\2\u070a\u01cc\3\2\2\2\u070b\u070c\4\u0082\u00a1\2\u070c\u01ce"+ - "\3\2\2\2\u070d\u0712\5\u01b9\u00dd\2\u070e\u0711\5\u01d5\u00eb\2\u070f"+ - "\u0711\n\37\2\2\u0710\u070e\3\2\2\2\u0710\u070f\3\2\2\2\u0711\u0714\3"+ - "\2\2\2\u0712\u0710\3\2\2\2\u0712\u0713\3\2\2\2\u0713\u0715\3\2\2\2\u0714"+ - "\u0712\3\2\2\2\u0715\u0716\5\u01b9\u00dd\2\u0716\u01d0\3\2\2\2\u0717\u0719"+ - "\t\6\2\2\u0718\u071a\t \2\2\u0719\u0718\3\2\2\2\u0719\u071a\3\2\2\2\u071a"+ - "\u071c\3\2\2\2\u071b\u071d\4\62;\2\u071c\u071b\3\2\2\2\u071d\u071e\3\2"+ - "\2\2\u071e\u071c\3\2\2\2\u071e\u071f\3\2\2\2\u071f\u01d2\3\2\2\2\u0720"+ - "\u0721\t!\2\2\u0721\u01d4\3\2\2\2\u0722\u0723\7^\2\2\u0723\u0727\t\"\2"+ - "\2\u0724\u0727\5\u01d9\u00ed\2\u0725\u0727\5\u01d7\u00ec\2\u0726\u0722"+ - "\3\2\2\2\u0726\u0724\3\2\2\2\u0726\u0725\3\2\2\2\u0727\u01d6\3\2\2\2\u0728"+ - "\u0729\7^\2\2\u0729\u072a\4\62\65\2\u072a\u072b\4\629\2\u072b\u0732\4"+ - "\629\2\u072c\u072d\7^\2\2\u072d\u072e\4\629\2\u072e\u0732\4\629\2\u072f"+ - "\u0730\7^\2\2\u0730\u0732\4\629\2\u0731\u0728\3\2\2\2\u0731\u072c\3\2"+ - "\2\2\u0731\u072f\3\2\2\2\u0732\u01d8\3\2\2\2\u0733\u0734\7^\2\2\u0734"+ - "\u0735\7w\2\2\u0735\u0736\5\u01d3\u00ea\2\u0736\u0737\5\u01d3\u00ea\2"+ - "\u0737\u0738\5\u01d3\u00ea\2\u0738\u0739\5\u01d3\u00ea\2\u0739\u01da\3"+ - "\2\2\2\u073a\u073b\7\"\2\2\u073b\u073c\3\2\2\2\u073c\u073d\b\u00ee\2\2"+ - "\u073d\u01dc\3\2\2\2\u073e\u0741\5\u01cb\u00e6\2\u073f\u0741\5\u01cd\u00e7"+ - "\2\u0740\u073e\3\2\2\2\u0740\u073f\3\2\2\2\u0741\u0742\3\2\2\2\u0742\u0740"+ - "\3\2\2\2\u0742\u0743\3\2\2\2\u0743\u0744\3\2\2\2\u0744\u0745\b\u00ef\2"+ - "\2\u0745\u01de\3\2\2\2\u0746\u0747\13\2\2\2\u0747\u0748\3\2\2\2\u0748"+ - "\u0749\b\u00f0\2\2\u0749\u01e0\3\2\2\2\30\2\u069a\u06c1\u06c8\u06ce\u06d2"+ - "\u06d8\u06db\u06e0\u06e3\u06eb\u06f9\u0704\u0706\u0710\u0712\u0719\u071e"+ - "\u0726\u0731\u0740\u0742\3\b\2\2"; - public static final ATN _ATN = - new ATNDeserializer().deserialize(_serializedATN.toCharArray()); - static { - _decisionToDFA = new DFA[_ATN.getNumberOfDecisions()]; - for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) { - _decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i); - } - } -} \ No newline at end of file diff --git a/core/src/arc/sql/sql/SQLParser.java b/core/src/arc/sql/sql/SQLParser.java deleted file mode 100644 index e9c50d6..0000000 --- a/core/src/arc/sql/sql/SQLParser.java +++ /dev/null @@ -1,13982 +0,0 @@ -package com.srotya.sidewinder.core.sql; - -// Generated from SQLParser.g4 by ANTLR 4.6 - - -import org.antlr.v4.runtime.atn.*; -import org.antlr.v4.runtime.dfa.DFA; -import org.antlr.v4.runtime.*; -import org.antlr.v4.runtime.misc.*; -import org.antlr.v4.runtime.tree.*; - -import com.srotya.sidewinder.core.sql.SQLParserListener; - -import java.util.List; -import java.util.Iterator; -import java.util.ArrayList; - -@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"}) -public class SQLParser extends Parser { - static { RuntimeMetaData.checkVersion("4.6", RuntimeMetaData.VERSION); } - - protected static final DFA[] _decisionToDFA; - protected static final PredictionContextCache _sharedContextCache = - new PredictionContextCache(); - public static final int - AS=1, ALL=2, AND=3, ANY=4, ASYMMETRIC=5, ASC=6, BOTH=7, CASE=8, CAST=9, - CREATE=10, CROSS=11, DESC=12, DISTINCT=13, END=14, ELSE=15, EXCEPT=16, - FALSE=17, FULL=18, FROM=19, GROUP=20, HAVING=21, ILIKE=22, IN=23, INNER=24, - INTERSECT=25, INTO=26, IS=27, JOIN=28, LEADING=29, LEFT=30, LIKE=31, LIMIT=32, - NATURAL=33, NOT=34, NULL=35, ON=36, OUTER=37, OR=38, ORDER=39, RIGHT=40, - SELECT=41, SOME=42, SYMMETRIC=43, TABLE=44, THEN=45, TRAILING=46, TRUE=47, - UNION=48, UNIQUE=49, USING=50, WHEN=51, WHERE=52, WITH=53, AVG=54, BETWEEN=55, - BY=56, CENTURY=57, CHARACTER=58, COLLECT=59, COALESCE=60, COLUMN=61, COUNT=62, - CUBE=63, DAY=64, DEC=65, DECADE=66, DOW=67, DOY=68, DROP=69, EPOCH=70, - EVERY=71, EXISTS=72, EXTERNAL=73, EXTRACT=74, FILTER=75, FIRST=76, FORMAT=77, - FUSION=78, GROUPING=79, HASH=80, HOUR=81, INDEX=82, INSERT=83, INTERSECTION=84, - ISODOW=85, ISOYEAR=86, LAST=87, LESS=88, LIST=89, LOCATION=90, MAX=91, - MAXVALUE=92, MICROSECONDS=93, MILLENNIUM=94, MILLISECONDS=95, MIN=96, - MINUTE=97, MONTH=98, NATIONAL=99, NULLIF=100, OVERWRITE=101, PARTITION=102, - PARTITIONS=103, PRECISION=104, PURGE=105, QUARTER=106, RANGE=107, REGEXP=108, - RLIKE=109, ROLLUP=110, SECOND=111, SET=112, SIMILAR=113, STDDEV_POP=114, - STDDEV_SAMP=115, SUBPARTITION=116, SUM=117, TABLESPACE=118, THAN=119, - TIMEZONE=120, TIMEZONE_HOUR=121, TIMEZONE_MINUTE=122, TRIM=123, TO=124, - UNKNOWN=125, VALUES=126, VAR_SAMP=127, VAR_POP=128, VARYING=129, WEEK=130, - YEAR=131, ZONE=132, BOOLEAN=133, BOOL=134, BIT=135, VARBIT=136, INT1=137, - INT2=138, INT4=139, INT8=140, TINYINT=141, SMALLINT=142, INT=143, INTEGER=144, - BIGINT=145, FLOAT4=146, FLOAT8=147, REAL=148, FLOAT=149, DOUBLE=150, NUMERIC=151, - DECIMAL=152, CHAR=153, VARCHAR=154, NCHAR=155, NVARCHAR=156, DATE=157, - TIME=158, TIMETZ=159, TIMESTAMP=160, TIMESTAMPTZ=161, TEXT=162, BINARY=163, - VARBINARY=164, BLOB=165, BYTEA=166, INET4=167, Similar_To=168, Not_Similar_To=169, - Similar_To_Case_Insensitive=170, Not_Similar_To_Case_Insensitive=171, - CAST_EXPRESSION=172, ASSIGN=173, EQUAL=174, COLON=175, SEMI_COLON=176, - COMMA=177, CONCATENATION_OPERATOR=178, NOT_EQUAL=179, LTH=180, LEQ=181, - GTH=182, GEQ=183, LEFT_PAREN=184, RIGHT_PAREN=185, PLUS=186, MINUS=187, - MULTIPLY=188, DIVIDE=189, MODULAR=190, DOT=191, UNDERLINE=192, VERTICAL_BAR=193, - QUOTE=194, DOUBLE_QUOTE=195, NUMBER=196, REAL_NUMBER=197, BlockComment=198, - LineComment=199, Identifier=200, Character_String_Literal=201, Space=202, - White_Space=203, BAD=204; - public static final int - RULE_sql = 0, RULE_statement = 1, RULE_data_statement = 2, RULE_data_change_statement = 3, - RULE_schema_statement = 4, RULE_index_statement = 5, RULE_create_table_statement = 6, - RULE_table_elements = 7, RULE_field_element = 8, RULE_field_type = 9, - RULE_param_clause = 10, RULE_param = 11, RULE_method_specifier = 12, RULE_table_space_specifier = 13, - RULE_table_space_name = 14, RULE_table_partitioning_clauses = 15, RULE_range_partitions = 16, - RULE_range_value_clause_list = 17, RULE_range_value_clause = 18, RULE_hash_partitions = 19, - RULE_individual_hash_partitions = 20, RULE_individual_hash_partition = 21, - RULE_hash_partitions_by_quantity = 22, RULE_list_partitions = 23, RULE_list_value_clause_list = 24, - RULE_list_value_partition = 25, RULE_column_partitions = 26, RULE_partition_name = 27, - RULE_drop_table_statement = 28, RULE_identifier = 29, RULE_nonreserved_keywords = 30, - RULE_unsigned_literal = 31, RULE_general_literal = 32, RULE_datetime_literal = 33, - RULE_time_literal = 34, RULE_timestamp_literal = 35, RULE_date_literal = 36, - RULE_boolean_literal = 37, RULE_data_type = 38, RULE_predefined_type = 39, - RULE_network_type = 40, RULE_character_string_type = 41, RULE_type_length = 42, - RULE_national_character_string_type = 43, RULE_binary_large_object_string_type = 44, - RULE_numeric_type = 45, RULE_exact_numeric_type = 46, RULE_approximate_numeric_type = 47, - RULE_precision_param = 48, RULE_boolean_type = 49, RULE_datetime_type = 50, - RULE_bit_type = 51, RULE_binary_type = 52, RULE_value_expression_primary = 53, - RULE_parenthesized_value_expression = 54, RULE_nonparenthesized_value_expression_primary = 55, - RULE_unsigned_value_specification = 56, RULE_unsigned_numeric_literal = 57, - RULE_signed_numerical_literal = 58, RULE_set_function_specification = 59, - RULE_aggregate_function = 60, RULE_general_set_function = 61, RULE_set_function_type = 62, - RULE_filter_clause = 63, RULE_grouping_operation = 64, RULE_case_expression = 65, - RULE_case_abbreviation = 66, RULE_case_specification = 67, RULE_simple_case = 68, - RULE_searched_case = 69, RULE_simple_when_clause = 70, RULE_searched_when_clause = 71, - RULE_else_clause = 72, RULE_result = 73, RULE_cast_specification = 74, - RULE_cast_operand = 75, RULE_cast_target = 76, RULE_value_expression = 77, - RULE_common_value_expression = 78, RULE_numeric_value_expression = 79, - RULE_term = 80, RULE_factor = 81, RULE_array = 82, RULE_numeric_primary = 83, - RULE_sign = 84, RULE_numeric_value_function = 85, RULE_extract_expression = 86, - RULE_extract_field = 87, RULE_time_zone_field = 88, RULE_extract_source = 89, - RULE_string_value_expression = 90, RULE_character_value_expression = 91, - RULE_character_factor = 92, RULE_character_primary = 93, RULE_string_value_function = 94, - RULE_trim_function = 95, RULE_trim_operands = 96, RULE_trim_specification = 97, - RULE_boolean_value_expression = 98, RULE_or_predicate = 99, RULE_and_predicate = 100, - RULE_boolean_factor = 101, RULE_boolean_test = 102, RULE_is_clause = 103, - RULE_truth_value = 104, RULE_boolean_primary = 105, RULE_boolean_predicand = 106, - RULE_parenthesized_boolean_value_expression = 107, RULE_row_value_expression = 108, - RULE_row_value_special_case = 109, RULE_explicit_row_value_constructor = 110, - RULE_row_value_predicand = 111, RULE_row_value_constructor_predicand = 112, - RULE_table_expression = 113, RULE_from_clause = 114, RULE_table_reference_list = 115, - RULE_table_reference = 116, RULE_joined_table = 117, RULE_joined_table_primary = 118, - RULE_cross_join = 119, RULE_qualified_join = 120, RULE_natural_join = 121, - RULE_union_join = 122, RULE_join_type = 123, RULE_outer_join_type = 124, - RULE_outer_join_type_part2 = 125, RULE_join_specification = 126, RULE_join_condition = 127, - RULE_named_columns_join = 128, RULE_table_primary = 129, RULE_column_name_list = 130, - RULE_derived_table = 131, RULE_where_clause = 132, RULE_search_condition = 133, - RULE_groupby_clause = 134, RULE_grouping_element_list = 135, RULE_grouping_element = 136, - RULE_ordinary_grouping_set = 137, RULE_ordinary_grouping_set_list = 138, - RULE_rollup_list = 139, RULE_cube_list = 140, RULE_empty_grouping_set = 141, - RULE_having_clause = 142, RULE_row_value_predicand_list = 143, RULE_query_expression = 144, - RULE_query_expression_body = 145, RULE_non_join_query_expression = 146, - RULE_query_term = 147, RULE_non_join_query_term = 148, RULE_query_primary = 149, - RULE_non_join_query_primary = 150, RULE_simple_table = 151, RULE_explicit_table = 152, - RULE_table_or_query_name = 153, RULE_table_name = 154, RULE_query_specification = 155, - RULE_select_list = 156, RULE_select_sublist = 157, RULE_derived_column = 158, - RULE_qualified_asterisk = 159, RULE_set_qualifier = 160, RULE_column_reference = 161, - RULE_as_clause = 162, RULE_column_reference_list = 163, RULE_scalar_subquery = 164, - RULE_row_subquery = 165, RULE_table_subquery = 166, RULE_subquery = 167, - RULE_predicate = 168, RULE_comparison_predicate = 169, RULE_comp_op = 170, - RULE_between_predicate = 171, RULE_between_predicate_part_2 = 172, RULE_in_predicate = 173, - RULE_in_predicate_value = 174, RULE_in_value_list = 175, RULE_pattern_matching_predicate = 176, - RULE_pattern_matcher = 177, RULE_negativable_matcher = 178, RULE_regex_matcher = 179, - RULE_null_predicate = 180, RULE_quantified_comparison_predicate = 181, - RULE_quantifier = 182, RULE_all = 183, RULE_some = 184, RULE_exists_predicate = 185, - RULE_unique_predicate = 186, RULE_primary_datetime_field = 187, RULE_non_second_primary_datetime_field = 188, - RULE_extended_datetime_field = 189, RULE_routine_invocation = 190, RULE_function_names_for_reserved_words = 191, - RULE_function_name = 192, RULE_sql_argument_list = 193, RULE_orderby_clause = 194, - RULE_sort_specifier_list = 195, RULE_sort_specifier = 196, RULE_order_specification = 197, - RULE_limit_clause = 198, RULE_null_ordering = 199, RULE_insert_statement = 200; - public static final String[] ruleNames = { - "sql", "statement", "data_statement", "data_change_statement", "schema_statement", - "index_statement", "create_table_statement", "table_elements", "field_element", - "field_type", "param_clause", "param", "method_specifier", "table_space_specifier", - "table_space_name", "table_partitioning_clauses", "range_partitions", - "range_value_clause_list", "range_value_clause", "hash_partitions", "individual_hash_partitions", - "individual_hash_partition", "hash_partitions_by_quantity", "list_partitions", - "list_value_clause_list", "list_value_partition", "column_partitions", - "partition_name", "drop_table_statement", "identifier", "nonreserved_keywords", - "unsigned_literal", "general_literal", "datetime_literal", "time_literal", - "timestamp_literal", "date_literal", "boolean_literal", "data_type", "predefined_type", - "network_type", "character_string_type", "type_length", "national_character_string_type", - "binary_large_object_string_type", "numeric_type", "exact_numeric_type", - "approximate_numeric_type", "precision_param", "boolean_type", "datetime_type", - "bit_type", "binary_type", "value_expression_primary", "parenthesized_value_expression", - "nonparenthesized_value_expression_primary", "unsigned_value_specification", - "unsigned_numeric_literal", "signed_numerical_literal", "set_function_specification", - "aggregate_function", "general_set_function", "set_function_type", "filter_clause", - "grouping_operation", "case_expression", "case_abbreviation", "case_specification", - "simple_case", "searched_case", "simple_when_clause", "searched_when_clause", - "else_clause", "result", "cast_specification", "cast_operand", "cast_target", - "value_expression", "common_value_expression", "numeric_value_expression", - "term", "factor", "array", "numeric_primary", "sign", "numeric_value_function", - "extract_expression", "extract_field", "time_zone_field", "extract_source", - "string_value_expression", "character_value_expression", "character_factor", - "character_primary", "string_value_function", "trim_function", "trim_operands", - "trim_specification", "boolean_value_expression", "or_predicate", "and_predicate", - "boolean_factor", "boolean_test", "is_clause", "truth_value", "boolean_primary", - "boolean_predicand", "parenthesized_boolean_value_expression", "row_value_expression", - "row_value_special_case", "explicit_row_value_constructor", "row_value_predicand", - "row_value_constructor_predicand", "table_expression", "from_clause", - "table_reference_list", "table_reference", "joined_table", "joined_table_primary", - "cross_join", "qualified_join", "natural_join", "union_join", "join_type", - "outer_join_type", "outer_join_type_part2", "join_specification", "join_condition", - "named_columns_join", "table_primary", "column_name_list", "derived_table", - "where_clause", "search_condition", "groupby_clause", "grouping_element_list", - "grouping_element", "ordinary_grouping_set", "ordinary_grouping_set_list", - "rollup_list", "cube_list", "empty_grouping_set", "having_clause", "row_value_predicand_list", - "query_expression", "query_expression_body", "non_join_query_expression", - "query_term", "non_join_query_term", "query_primary", "non_join_query_primary", - "simple_table", "explicit_table", "table_or_query_name", "table_name", - "query_specification", "select_list", "select_sublist", "derived_column", - "qualified_asterisk", "set_qualifier", "column_reference", "as_clause", - "column_reference_list", "scalar_subquery", "row_subquery", "table_subquery", - "subquery", "predicate", "comparison_predicate", "comp_op", "between_predicate", - "between_predicate_part_2", "in_predicate", "in_predicate_value", "in_value_list", - "pattern_matching_predicate", "pattern_matcher", "negativable_matcher", - "regex_matcher", "null_predicate", "quantified_comparison_predicate", - "quantifier", "all", "some", "exists_predicate", "unique_predicate", "primary_datetime_field", - "non_second_primary_datetime_field", "extended_datetime_field", "routine_invocation", - "function_names_for_reserved_words", "function_name", "sql_argument_list", - "orderby_clause", "sort_specifier_list", "sort_specifier", "order_specification", - "limit_clause", "null_ordering", "insert_statement" - }; - - private static final String[] _LITERAL_NAMES = { - 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, 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, 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, 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, - 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, null, null, null, - "'~'", "'!~'", "'~*'", "'!~*'", null, "':='", "'='", "':'", "';'", "','", - null, null, "'<'", "'<='", "'>'", "'>='", "'('", "')'", "'+'", "'-'", - "'*'", "'/'", "'%'", "'.'", "'_'", "'|'", "'''", "'\"'", null, null, null, - null, null, null, "' '" - }; - private static final String[] _SYMBOLIC_NAMES = { - null, "AS", "ALL", "AND", "ANY", "ASYMMETRIC", "ASC", "BOTH", "CASE", - "CAST", "CREATE", "CROSS", "DESC", "DISTINCT", "END", "ELSE", "EXCEPT", - "FALSE", "FULL", "FROM", "GROUP", "HAVING", "ILIKE", "IN", "INNER", "INTERSECT", - "INTO", "IS", "JOIN", "LEADING", "LEFT", "LIKE", "LIMIT", "NATURAL", "NOT", - "NULL", "ON", "OUTER", "OR", "ORDER", "RIGHT", "SELECT", "SOME", "SYMMETRIC", - "TABLE", "THEN", "TRAILING", "TRUE", "UNION", "UNIQUE", "USING", "WHEN", - "WHERE", "WITH", "AVG", "BETWEEN", "BY", "CENTURY", "CHARACTER", "COLLECT", - "COALESCE", "COLUMN", "COUNT", "CUBE", "DAY", "DEC", "DECADE", "DOW", - "DOY", "DROP", "EPOCH", "EVERY", "EXISTS", "EXTERNAL", "EXTRACT", "FILTER", - "FIRST", "FORMAT", "FUSION", "GROUPING", "HASH", "HOUR", "INDEX", "INSERT", - "INTERSECTION", "ISODOW", "ISOYEAR", "LAST", "LESS", "LIST", "LOCATION", - "MAX", "MAXVALUE", "MICROSECONDS", "MILLENNIUM", "MILLISECONDS", "MIN", - "MINUTE", "MONTH", "NATIONAL", "NULLIF", "OVERWRITE", "PARTITION", "PARTITIONS", - "PRECISION", "PURGE", "QUARTER", "RANGE", "REGEXP", "RLIKE", "ROLLUP", - "SECOND", "SET", "SIMILAR", "STDDEV_POP", "STDDEV_SAMP", "SUBPARTITION", - "SUM", "TABLESPACE", "THAN", "TIMEZONE", "TIMEZONE_HOUR", "TIMEZONE_MINUTE", - "TRIM", "TO", "UNKNOWN", "VALUES", "VAR_SAMP", "VAR_POP", "VARYING", "WEEK", - "YEAR", "ZONE", "BOOLEAN", "BOOL", "BIT", "VARBIT", "INT1", "INT2", "INT4", - "INT8", "TINYINT", "SMALLINT", "INT", "INTEGER", "BIGINT", "FLOAT4", "FLOAT8", - "REAL", "FLOAT", "DOUBLE", "NUMERIC", "DECIMAL", "CHAR", "VARCHAR", "NCHAR", - "NVARCHAR", "DATE", "TIME", "TIMETZ", "TIMESTAMP", "TIMESTAMPTZ", "TEXT", - "BINARY", "VARBINARY", "BLOB", "BYTEA", "INET4", "Similar_To", "Not_Similar_To", - "Similar_To_Case_Insensitive", "Not_Similar_To_Case_Insensitive", "CAST_EXPRESSION", - "ASSIGN", "EQUAL", "COLON", "SEMI_COLON", "COMMA", "CONCATENATION_OPERATOR", - "NOT_EQUAL", "LTH", "LEQ", "GTH", "GEQ", "LEFT_PAREN", "RIGHT_PAREN", - "PLUS", "MINUS", "MULTIPLY", "DIVIDE", "MODULAR", "DOT", "UNDERLINE", - "VERTICAL_BAR", "QUOTE", "DOUBLE_QUOTE", "NUMBER", "REAL_NUMBER", "BlockComment", - "LineComment", "Identifier", "Character_String_Literal", "Space", "White_Space", - "BAD" - }; - public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES); - - /** - * @deprecated Use {@link #VOCABULARY} instead. - */ - @Deprecated - public static final String[] tokenNames; - static { - tokenNames = new String[_SYMBOLIC_NAMES.length]; - for (int i = 0; i < tokenNames.length; i++) { - tokenNames[i] = VOCABULARY.getLiteralName(i); - if (tokenNames[i] == null) { - tokenNames[i] = VOCABULARY.getSymbolicName(i); - } - - if (tokenNames[i] == null) { - tokenNames[i] = ""; - } - } - } - - @Override - @Deprecated - public String[] getTokenNames() { - return tokenNames; - } - - @Override - - public Vocabulary getVocabulary() { - return VOCABULARY; - } - - @Override - public String getGrammarFileName() { return "SQLParser.g4"; } - - @Override - public String[] getRuleNames() { return ruleNames; } - - @Override - public String getSerializedATN() { return _serializedATN; } - - @Override - public ATN getATN() { return _ATN; } - - - - public SQLParser(TokenStream input) { - super(input); - _interp = new ParserATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache); - } - public static class SqlContext extends ParserRuleContext { - public StatementContext statement() { - return getRuleContext(StatementContext.class,0); - } - public TerminalNode EOF() { return getToken(SQLParser.EOF, 0); } - public TerminalNode SEMI_COLON() { return getToken(SQLParser.SEMI_COLON, 0); } - public SqlContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_sql; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterSql(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitSql(this); - } - } - - public final SqlContext sql() throws RecognitionException { - SqlContext _localctx = new SqlContext(_ctx, getState()); - enterRule(_localctx, 0, RULE_sql); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(402); - statement(); - setState(404); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==SEMI_COLON) { - { - setState(403); - match(SEMI_COLON); - } - } - - setState(406); - match(EOF); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class StatementContext extends ParserRuleContext { - public Data_statementContext data_statement() { - return getRuleContext(Data_statementContext.class,0); - } - public Data_change_statementContext data_change_statement() { - return getRuleContext(Data_change_statementContext.class,0); - } - public Schema_statementContext schema_statement() { - return getRuleContext(Schema_statementContext.class,0); - } - public Index_statementContext index_statement() { - return getRuleContext(Index_statementContext.class,0); - } - public StatementContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_statement; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterStatement(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitStatement(this); - } - } - - public final StatementContext statement() throws RecognitionException { - StatementContext _localctx = new StatementContext(_ctx, getState()); - enterRule(_localctx, 2, RULE_statement); - try { - setState(412); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,1,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(408); - data_statement(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(409); - data_change_statement(); - } - break; - case 3: - enterOuterAlt(_localctx, 3); - { - setState(410); - schema_statement(); - } - break; - case 4: - enterOuterAlt(_localctx, 4); - { - setState(411); - index_statement(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Data_statementContext extends ParserRuleContext { - public Query_expressionContext query_expression() { - return getRuleContext(Query_expressionContext.class,0); - } - public Data_statementContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_data_statement; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterData_statement(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitData_statement(this); - } - } - - public final Data_statementContext data_statement() throws RecognitionException { - Data_statementContext _localctx = new Data_statementContext(_ctx, getState()); - enterRule(_localctx, 4, RULE_data_statement); - try { - enterOuterAlt(_localctx, 1); - { - setState(414); - query_expression(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Data_change_statementContext extends ParserRuleContext { - public Insert_statementContext insert_statement() { - return getRuleContext(Insert_statementContext.class,0); - } - public Data_change_statementContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_data_change_statement; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterData_change_statement(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitData_change_statement(this); - } - } - - public final Data_change_statementContext data_change_statement() throws RecognitionException { - Data_change_statementContext _localctx = new Data_change_statementContext(_ctx, getState()); - enterRule(_localctx, 6, RULE_data_change_statement); - try { - enterOuterAlt(_localctx, 1); - { - setState(416); - insert_statement(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Schema_statementContext extends ParserRuleContext { - public Create_table_statementContext create_table_statement() { - return getRuleContext(Create_table_statementContext.class,0); - } - public Drop_table_statementContext drop_table_statement() { - return getRuleContext(Drop_table_statementContext.class,0); - } - public Schema_statementContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_schema_statement; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterSchema_statement(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitSchema_statement(this); - } - } - - public final Schema_statementContext schema_statement() throws RecognitionException { - Schema_statementContext _localctx = new Schema_statementContext(_ctx, getState()); - enterRule(_localctx, 8, RULE_schema_statement); - try { - setState(420); - _errHandler.sync(this); - switch (_input.LA(1)) { - case CREATE: - enterOuterAlt(_localctx, 1); - { - setState(418); - create_table_statement(); - } - break; - case DROP: - enterOuterAlt(_localctx, 2); - { - setState(419); - drop_table_statement(); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Index_statementContext extends ParserRuleContext { - public Token u; - public IdentifierContext n; - public Table_nameContext t; - public Method_specifierContext m; - public Sort_specifier_listContext s; - public Param_clauseContext p; - public TerminalNode CREATE() { return getToken(SQLParser.CREATE, 0); } - public TerminalNode INDEX() { return getToken(SQLParser.INDEX, 0); } - public TerminalNode ON() { return getToken(SQLParser.ON, 0); } - public TerminalNode LEFT_PAREN() { return getToken(SQLParser.LEFT_PAREN, 0); } - public TerminalNode RIGHT_PAREN() { return getToken(SQLParser.RIGHT_PAREN, 0); } - public IdentifierContext identifier() { - return getRuleContext(IdentifierContext.class,0); - } - public Table_nameContext table_name() { - return getRuleContext(Table_nameContext.class,0); - } - public Sort_specifier_listContext sort_specifier_list() { - return getRuleContext(Sort_specifier_listContext.class,0); - } - public TerminalNode UNIQUE() { return getToken(SQLParser.UNIQUE, 0); } - public Method_specifierContext method_specifier() { - return getRuleContext(Method_specifierContext.class,0); - } - public Param_clauseContext param_clause() { - return getRuleContext(Param_clauseContext.class,0); - } - public Index_statementContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_index_statement; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterIndex_statement(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitIndex_statement(this); - } - } - - public final Index_statementContext index_statement() throws RecognitionException { - Index_statementContext _localctx = new Index_statementContext(_ctx, getState()); - enterRule(_localctx, 10, RULE_index_statement); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(422); - match(CREATE); - setState(424); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==UNIQUE) { - { - setState(423); - ((Index_statementContext)_localctx).u = match(UNIQUE); - } - } - - setState(426); - match(INDEX); - setState(427); - ((Index_statementContext)_localctx).n = identifier(); - setState(428); - match(ON); - setState(429); - ((Index_statementContext)_localctx).t = table_name(); - setState(431); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==USING) { - { - setState(430); - ((Index_statementContext)_localctx).m = method_specifier(); - } - } - - setState(433); - match(LEFT_PAREN); - setState(434); - ((Index_statementContext)_localctx).s = sort_specifier_list(); - setState(435); - match(RIGHT_PAREN); - setState(437); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==WITH) { - { - setState(436); - ((Index_statementContext)_localctx).p = param_clause(); - } - } - - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Create_table_statementContext extends ParserRuleContext { - public IdentifierContext file_type; - public Token path; - public TerminalNode CREATE() { return getToken(SQLParser.CREATE, 0); } - public TerminalNode EXTERNAL() { return getToken(SQLParser.EXTERNAL, 0); } - public TerminalNode TABLE() { return getToken(SQLParser.TABLE, 0); } - public Table_nameContext table_name() { - return getRuleContext(Table_nameContext.class,0); - } - public Table_elementsContext table_elements() { - return getRuleContext(Table_elementsContext.class,0); - } - public TerminalNode USING() { return getToken(SQLParser.USING, 0); } - public IdentifierContext identifier() { - return getRuleContext(IdentifierContext.class,0); - } - public TerminalNode LOCATION() { return getToken(SQLParser.LOCATION, 0); } - public Param_clauseContext param_clause() { - return getRuleContext(Param_clauseContext.class,0); - } - public Table_partitioning_clausesContext table_partitioning_clauses() { - return getRuleContext(Table_partitioning_clausesContext.class,0); - } - public TerminalNode Character_String_Literal() { return getToken(SQLParser.Character_String_Literal, 0); } - public TerminalNode AS() { return getToken(SQLParser.AS, 0); } - public Query_expressionContext query_expression() { - return getRuleContext(Query_expressionContext.class,0); - } - public Create_table_statementContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_create_table_statement; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterCreate_table_statement(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitCreate_table_statement(this); - } - } - - public final Create_table_statementContext create_table_statement() throws RecognitionException { - Create_table_statementContext _localctx = new Create_table_statementContext(_ctx, getState()); - enterRule(_localctx, 12, RULE_create_table_statement); - int _la; - try { - setState(489); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,15,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(439); - match(CREATE); - setState(440); - match(EXTERNAL); - setState(441); - match(TABLE); - setState(442); - table_name(); - setState(443); - table_elements(); - setState(444); - match(USING); - setState(445); - ((Create_table_statementContext)_localctx).file_type = identifier(); - setState(447); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==WITH) { - { - setState(446); - param_clause(); - } - } - - setState(450); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==PARTITION) { - { - setState(449); - table_partitioning_clauses(); - } - } - - { - setState(452); - match(LOCATION); - setState(453); - ((Create_table_statementContext)_localctx).path = match(Character_String_Literal); - } - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(455); - match(CREATE); - setState(456); - match(TABLE); - setState(457); - table_name(); - setState(458); - table_elements(); - setState(461); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==USING) { - { - setState(459); - match(USING); - setState(460); - ((Create_table_statementContext)_localctx).file_type = identifier(); - } - } - - setState(464); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==WITH) { - { - setState(463); - param_clause(); - } - } - - setState(467); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==PARTITION) { - { - setState(466); - table_partitioning_clauses(); - } - } - - setState(471); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==AS) { - { - setState(469); - match(AS); - setState(470); - query_expression(); - } - } - - } - break; - case 3: - enterOuterAlt(_localctx, 3); - { - setState(473); - match(CREATE); - setState(474); - match(TABLE); - setState(475); - table_name(); - setState(478); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==USING) { - { - setState(476); - match(USING); - setState(477); - ((Create_table_statementContext)_localctx).file_type = identifier(); - } - } - - setState(481); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==WITH) { - { - setState(480); - param_clause(); - } - } - - setState(484); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==PARTITION) { - { - setState(483); - table_partitioning_clauses(); - } - } - - setState(486); - match(AS); - setState(487); - query_expression(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Table_elementsContext extends ParserRuleContext { - public TerminalNode LEFT_PAREN() { return getToken(SQLParser.LEFT_PAREN, 0); } - public List field_element() { - return getRuleContexts(Field_elementContext.class); - } - public Field_elementContext field_element(int i) { - return getRuleContext(Field_elementContext.class,i); - } - public TerminalNode RIGHT_PAREN() { return getToken(SQLParser.RIGHT_PAREN, 0); } - public List COMMA() { return getTokens(SQLParser.COMMA); } - public TerminalNode COMMA(int i) { - return getToken(SQLParser.COMMA, i); - } - public Table_elementsContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_table_elements; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterTable_elements(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitTable_elements(this); - } - } - - public final Table_elementsContext table_elements() throws RecognitionException { - Table_elementsContext _localctx = new Table_elementsContext(_ctx, getState()); - enterRule(_localctx, 14, RULE_table_elements); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(491); - match(LEFT_PAREN); - setState(492); - field_element(); - setState(497); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==COMMA) { - { - { - setState(493); - match(COMMA); - setState(494); - field_element(); - } - } - setState(499); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(500); - match(RIGHT_PAREN); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Field_elementContext extends ParserRuleContext { - public IdentifierContext name; - public Field_typeContext field_type() { - return getRuleContext(Field_typeContext.class,0); - } - public IdentifierContext identifier() { - return getRuleContext(IdentifierContext.class,0); - } - public Field_elementContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_field_element; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterField_element(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitField_element(this); - } - } - - public final Field_elementContext field_element() throws RecognitionException { - Field_elementContext _localctx = new Field_elementContext(_ctx, getState()); - enterRule(_localctx, 16, RULE_field_element); - try { - enterOuterAlt(_localctx, 1); - { - setState(502); - ((Field_elementContext)_localctx).name = identifier(); - setState(503); - field_type(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Field_typeContext extends ParserRuleContext { - public Data_typeContext data_type() { - return getRuleContext(Data_typeContext.class,0); - } - public Field_typeContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_field_type; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterField_type(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitField_type(this); - } - } - - public final Field_typeContext field_type() throws RecognitionException { - Field_typeContext _localctx = new Field_typeContext(_ctx, getState()); - enterRule(_localctx, 18, RULE_field_type); - try { - enterOuterAlt(_localctx, 1); - { - setState(505); - data_type(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Param_clauseContext extends ParserRuleContext { - public TerminalNode WITH() { return getToken(SQLParser.WITH, 0); } - public TerminalNode LEFT_PAREN() { return getToken(SQLParser.LEFT_PAREN, 0); } - public List param() { - return getRuleContexts(ParamContext.class); - } - public ParamContext param(int i) { - return getRuleContext(ParamContext.class,i); - } - public TerminalNode RIGHT_PAREN() { return getToken(SQLParser.RIGHT_PAREN, 0); } - public List COMMA() { return getTokens(SQLParser.COMMA); } - public TerminalNode COMMA(int i) { - return getToken(SQLParser.COMMA, i); - } - public Param_clauseContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_param_clause; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterParam_clause(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitParam_clause(this); - } - } - - public final Param_clauseContext param_clause() throws RecognitionException { - Param_clauseContext _localctx = new Param_clauseContext(_ctx, getState()); - enterRule(_localctx, 20, RULE_param_clause); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(507); - match(WITH); - setState(508); - match(LEFT_PAREN); - setState(509); - param(); - setState(514); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==COMMA) { - { - { - setState(510); - match(COMMA); - setState(511); - param(); - } - } - setState(516); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(517); - match(RIGHT_PAREN); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class ParamContext extends ParserRuleContext { - public Token key; - public Numeric_value_expressionContext value; - public TerminalNode EQUAL() { return getToken(SQLParser.EQUAL, 0); } - public TerminalNode Character_String_Literal() { return getToken(SQLParser.Character_String_Literal, 0); } - public Numeric_value_expressionContext numeric_value_expression() { - return getRuleContext(Numeric_value_expressionContext.class,0); - } - public ParamContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_param; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterParam(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitParam(this); - } - } - - public final ParamContext param() throws RecognitionException { - ParamContext _localctx = new ParamContext(_ctx, getState()); - enterRule(_localctx, 22, RULE_param); - try { - enterOuterAlt(_localctx, 1); - { - setState(519); - ((ParamContext)_localctx).key = match(Character_String_Literal); - setState(520); - match(EQUAL); - setState(521); - ((ParamContext)_localctx).value = numeric_value_expression(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Method_specifierContext extends ParserRuleContext { - public IdentifierContext m; - public TerminalNode USING() { return getToken(SQLParser.USING, 0); } - public IdentifierContext identifier() { - return getRuleContext(IdentifierContext.class,0); - } - public Method_specifierContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_method_specifier; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterMethod_specifier(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitMethod_specifier(this); - } - } - - public final Method_specifierContext method_specifier() throws RecognitionException { - Method_specifierContext _localctx = new Method_specifierContext(_ctx, getState()); - enterRule(_localctx, 24, RULE_method_specifier); - try { - enterOuterAlt(_localctx, 1); - { - setState(523); - match(USING); - setState(524); - ((Method_specifierContext)_localctx).m = identifier(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Table_space_specifierContext extends ParserRuleContext { - public TerminalNode TABLESPACE() { return getToken(SQLParser.TABLESPACE, 0); } - public Table_space_nameContext table_space_name() { - return getRuleContext(Table_space_nameContext.class,0); - } - public Table_space_specifierContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_table_space_specifier; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterTable_space_specifier(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitTable_space_specifier(this); - } - } - - public final Table_space_specifierContext table_space_specifier() throws RecognitionException { - Table_space_specifierContext _localctx = new Table_space_specifierContext(_ctx, getState()); - enterRule(_localctx, 26, RULE_table_space_specifier); - try { - enterOuterAlt(_localctx, 1); - { - setState(526); - match(TABLESPACE); - setState(527); - table_space_name(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Table_space_nameContext extends ParserRuleContext { - public IdentifierContext identifier() { - return getRuleContext(IdentifierContext.class,0); - } - public Table_space_nameContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_table_space_name; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterTable_space_name(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitTable_space_name(this); - } - } - - public final Table_space_nameContext table_space_name() throws RecognitionException { - Table_space_nameContext _localctx = new Table_space_nameContext(_ctx, getState()); - enterRule(_localctx, 28, RULE_table_space_name); - try { - enterOuterAlt(_localctx, 1); - { - setState(529); - identifier(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Table_partitioning_clausesContext extends ParserRuleContext { - public Range_partitionsContext range_partitions() { - return getRuleContext(Range_partitionsContext.class,0); - } - public Hash_partitionsContext hash_partitions() { - return getRuleContext(Hash_partitionsContext.class,0); - } - public List_partitionsContext list_partitions() { - return getRuleContext(List_partitionsContext.class,0); - } - public Column_partitionsContext column_partitions() { - return getRuleContext(Column_partitionsContext.class,0); - } - public Table_partitioning_clausesContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_table_partitioning_clauses; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterTable_partitioning_clauses(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitTable_partitioning_clauses(this); - } - } - - public final Table_partitioning_clausesContext table_partitioning_clauses() throws RecognitionException { - Table_partitioning_clausesContext _localctx = new Table_partitioning_clausesContext(_ctx, getState()); - enterRule(_localctx, 30, RULE_table_partitioning_clauses); - try { - setState(535); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,18,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(531); - range_partitions(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(532); - hash_partitions(); - } - break; - case 3: - enterOuterAlt(_localctx, 3); - { - setState(533); - list_partitions(); - } - break; - case 4: - enterOuterAlt(_localctx, 4); - { - setState(534); - column_partitions(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Range_partitionsContext extends ParserRuleContext { - public TerminalNode PARTITION() { return getToken(SQLParser.PARTITION, 0); } - public TerminalNode BY() { return getToken(SQLParser.BY, 0); } - public TerminalNode RANGE() { return getToken(SQLParser.RANGE, 0); } - public List LEFT_PAREN() { return getTokens(SQLParser.LEFT_PAREN); } - public TerminalNode LEFT_PAREN(int i) { - return getToken(SQLParser.LEFT_PAREN, i); - } - public Column_reference_listContext column_reference_list() { - return getRuleContext(Column_reference_listContext.class,0); - } - public List RIGHT_PAREN() { return getTokens(SQLParser.RIGHT_PAREN); } - public TerminalNode RIGHT_PAREN(int i) { - return getToken(SQLParser.RIGHT_PAREN, i); - } - public Range_value_clause_listContext range_value_clause_list() { - return getRuleContext(Range_value_clause_listContext.class,0); - } - public Range_partitionsContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_range_partitions; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterRange_partitions(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitRange_partitions(this); - } - } - - public final Range_partitionsContext range_partitions() throws RecognitionException { - Range_partitionsContext _localctx = new Range_partitionsContext(_ctx, getState()); - enterRule(_localctx, 32, RULE_range_partitions); - try { - enterOuterAlt(_localctx, 1); - { - setState(537); - match(PARTITION); - setState(538); - match(BY); - setState(539); - match(RANGE); - setState(540); - match(LEFT_PAREN); - setState(541); - column_reference_list(); - setState(542); - match(RIGHT_PAREN); - setState(543); - match(LEFT_PAREN); - setState(544); - range_value_clause_list(); - setState(545); - match(RIGHT_PAREN); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Range_value_clause_listContext extends ParserRuleContext { - public List range_value_clause() { - return getRuleContexts(Range_value_clauseContext.class); - } - public Range_value_clauseContext range_value_clause(int i) { - return getRuleContext(Range_value_clauseContext.class,i); - } - public List COMMA() { return getTokens(SQLParser.COMMA); } - public TerminalNode COMMA(int i) { - return getToken(SQLParser.COMMA, i); - } - public Range_value_clause_listContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_range_value_clause_list; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterRange_value_clause_list(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitRange_value_clause_list(this); - } - } - - public final Range_value_clause_listContext range_value_clause_list() throws RecognitionException { - Range_value_clause_listContext _localctx = new Range_value_clause_listContext(_ctx, getState()); - enterRule(_localctx, 34, RULE_range_value_clause_list); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(547); - range_value_clause(); - setState(552); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==COMMA) { - { - { - setState(548); - match(COMMA); - setState(549); - range_value_clause(); - } - } - setState(554); - _errHandler.sync(this); - _la = _input.LA(1); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Range_value_clauseContext extends ParserRuleContext { - public TerminalNode PARTITION() { return getToken(SQLParser.PARTITION, 0); } - public Partition_nameContext partition_name() { - return getRuleContext(Partition_nameContext.class,0); - } - public TerminalNode VALUES() { return getToken(SQLParser.VALUES, 0); } - public TerminalNode LESS() { return getToken(SQLParser.LESS, 0); } - public TerminalNode THAN() { return getToken(SQLParser.THAN, 0); } - public TerminalNode LEFT_PAREN() { return getToken(SQLParser.LEFT_PAREN, 0); } - public Value_expressionContext value_expression() { - return getRuleContext(Value_expressionContext.class,0); - } - public TerminalNode RIGHT_PAREN() { return getToken(SQLParser.RIGHT_PAREN, 0); } - public TerminalNode MAXVALUE() { return getToken(SQLParser.MAXVALUE, 0); } - public Range_value_clauseContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_range_value_clause; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterRange_value_clause(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitRange_value_clause(this); - } - } - - public final Range_value_clauseContext range_value_clause() throws RecognitionException { - Range_value_clauseContext _localctx = new Range_value_clauseContext(_ctx, getState()); - enterRule(_localctx, 36, RULE_range_value_clause); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(555); - match(PARTITION); - setState(556); - partition_name(); - setState(557); - match(VALUES); - setState(558); - match(LESS); - setState(559); - match(THAN); - setState(571); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,22,_ctx) ) { - case 1: - { - setState(560); - match(LEFT_PAREN); - setState(561); - value_expression(); - setState(562); - match(RIGHT_PAREN); - } - break; - case 2: - { - setState(565); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LEFT_PAREN) { - { - setState(564); - match(LEFT_PAREN); - } - } - - setState(567); - match(MAXVALUE); - setState(569); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,21,_ctx) ) { - case 1: - { - setState(568); - match(RIGHT_PAREN); - } - break; - } - } - break; - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Hash_partitionsContext extends ParserRuleContext { - public TerminalNode PARTITION() { return getToken(SQLParser.PARTITION, 0); } - public TerminalNode BY() { return getToken(SQLParser.BY, 0); } - public TerminalNode HASH() { return getToken(SQLParser.HASH, 0); } - public List LEFT_PAREN() { return getTokens(SQLParser.LEFT_PAREN); } - public TerminalNode LEFT_PAREN(int i) { - return getToken(SQLParser.LEFT_PAREN, i); - } - public Column_reference_listContext column_reference_list() { - return getRuleContext(Column_reference_listContext.class,0); - } - public List RIGHT_PAREN() { return getTokens(SQLParser.RIGHT_PAREN); } - public TerminalNode RIGHT_PAREN(int i) { - return getToken(SQLParser.RIGHT_PAREN, i); - } - public Individual_hash_partitionsContext individual_hash_partitions() { - return getRuleContext(Individual_hash_partitionsContext.class,0); - } - public Hash_partitions_by_quantityContext hash_partitions_by_quantity() { - return getRuleContext(Hash_partitions_by_quantityContext.class,0); - } - public Hash_partitionsContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_hash_partitions; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterHash_partitions(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitHash_partitions(this); - } - } - - public final Hash_partitionsContext hash_partitions() throws RecognitionException { - Hash_partitionsContext _localctx = new Hash_partitionsContext(_ctx, getState()); - enterRule(_localctx, 38, RULE_hash_partitions); - try { - enterOuterAlt(_localctx, 1); - { - setState(573); - match(PARTITION); - setState(574); - match(BY); - setState(575); - match(HASH); - setState(576); - match(LEFT_PAREN); - setState(577); - column_reference_list(); - setState(578); - match(RIGHT_PAREN); - setState(584); - _errHandler.sync(this); - switch (_input.LA(1)) { - case LEFT_PAREN: - { - setState(579); - match(LEFT_PAREN); - setState(580); - individual_hash_partitions(); - setState(581); - match(RIGHT_PAREN); - } - break; - case PARTITIONS: - { - setState(583); - hash_partitions_by_quantity(); - } - break; - default: - throw new NoViableAltException(this); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Individual_hash_partitionsContext extends ParserRuleContext { - public List individual_hash_partition() { - return getRuleContexts(Individual_hash_partitionContext.class); - } - public Individual_hash_partitionContext individual_hash_partition(int i) { - return getRuleContext(Individual_hash_partitionContext.class,i); - } - public List COMMA() { return getTokens(SQLParser.COMMA); } - public TerminalNode COMMA(int i) { - return getToken(SQLParser.COMMA, i); - } - public Individual_hash_partitionsContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_individual_hash_partitions; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterIndividual_hash_partitions(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitIndividual_hash_partitions(this); - } - } - - public final Individual_hash_partitionsContext individual_hash_partitions() throws RecognitionException { - Individual_hash_partitionsContext _localctx = new Individual_hash_partitionsContext(_ctx, getState()); - enterRule(_localctx, 40, RULE_individual_hash_partitions); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(586); - individual_hash_partition(); - setState(591); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==COMMA) { - { - { - setState(587); - match(COMMA); - setState(588); - individual_hash_partition(); - } - } - setState(593); - _errHandler.sync(this); - _la = _input.LA(1); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Individual_hash_partitionContext extends ParserRuleContext { - public TerminalNode PARTITION() { return getToken(SQLParser.PARTITION, 0); } - public Partition_nameContext partition_name() { - return getRuleContext(Partition_nameContext.class,0); - } - public Individual_hash_partitionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_individual_hash_partition; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterIndividual_hash_partition(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitIndividual_hash_partition(this); - } - } - - public final Individual_hash_partitionContext individual_hash_partition() throws RecognitionException { - Individual_hash_partitionContext _localctx = new Individual_hash_partitionContext(_ctx, getState()); - enterRule(_localctx, 42, RULE_individual_hash_partition); - try { - enterOuterAlt(_localctx, 1); - { - setState(594); - match(PARTITION); - setState(595); - partition_name(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Hash_partitions_by_quantityContext extends ParserRuleContext { - public Numeric_value_expressionContext quantity; - public TerminalNode PARTITIONS() { return getToken(SQLParser.PARTITIONS, 0); } - public Numeric_value_expressionContext numeric_value_expression() { - return getRuleContext(Numeric_value_expressionContext.class,0); - } - public Hash_partitions_by_quantityContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_hash_partitions_by_quantity; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterHash_partitions_by_quantity(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitHash_partitions_by_quantity(this); - } - } - - public final Hash_partitions_by_quantityContext hash_partitions_by_quantity() throws RecognitionException { - Hash_partitions_by_quantityContext _localctx = new Hash_partitions_by_quantityContext(_ctx, getState()); - enterRule(_localctx, 44, RULE_hash_partitions_by_quantity); - try { - enterOuterAlt(_localctx, 1); - { - setState(597); - match(PARTITIONS); - setState(598); - ((Hash_partitions_by_quantityContext)_localctx).quantity = numeric_value_expression(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class List_partitionsContext extends ParserRuleContext { - public TerminalNode PARTITION() { return getToken(SQLParser.PARTITION, 0); } - public TerminalNode BY() { return getToken(SQLParser.BY, 0); } - public TerminalNode LIST() { return getToken(SQLParser.LIST, 0); } - public List LEFT_PAREN() { return getTokens(SQLParser.LEFT_PAREN); } - public TerminalNode LEFT_PAREN(int i) { - return getToken(SQLParser.LEFT_PAREN, i); - } - public Column_reference_listContext column_reference_list() { - return getRuleContext(Column_reference_listContext.class,0); - } - public List RIGHT_PAREN() { return getTokens(SQLParser.RIGHT_PAREN); } - public TerminalNode RIGHT_PAREN(int i) { - return getToken(SQLParser.RIGHT_PAREN, i); - } - public List_value_clause_listContext list_value_clause_list() { - return getRuleContext(List_value_clause_listContext.class,0); - } - public List_partitionsContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_list_partitions; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterList_partitions(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitList_partitions(this); - } - } - - public final List_partitionsContext list_partitions() throws RecognitionException { - List_partitionsContext _localctx = new List_partitionsContext(_ctx, getState()); - enterRule(_localctx, 46, RULE_list_partitions); - try { - enterOuterAlt(_localctx, 1); - { - setState(600); - match(PARTITION); - setState(601); - match(BY); - setState(602); - match(LIST); - setState(603); - match(LEFT_PAREN); - setState(604); - column_reference_list(); - setState(605); - match(RIGHT_PAREN); - setState(606); - match(LEFT_PAREN); - setState(607); - list_value_clause_list(); - setState(608); - match(RIGHT_PAREN); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class List_value_clause_listContext extends ParserRuleContext { - public List list_value_partition() { - return getRuleContexts(List_value_partitionContext.class); - } - public List_value_partitionContext list_value_partition(int i) { - return getRuleContext(List_value_partitionContext.class,i); - } - public List COMMA() { return getTokens(SQLParser.COMMA); } - public TerminalNode COMMA(int i) { - return getToken(SQLParser.COMMA, i); - } - public List_value_clause_listContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_list_value_clause_list; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterList_value_clause_list(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitList_value_clause_list(this); - } - } - - public final List_value_clause_listContext list_value_clause_list() throws RecognitionException { - List_value_clause_listContext _localctx = new List_value_clause_listContext(_ctx, getState()); - enterRule(_localctx, 48, RULE_list_value_clause_list); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(610); - list_value_partition(); - setState(615); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==COMMA) { - { - { - setState(611); - match(COMMA); - setState(612); - list_value_partition(); - } - } - setState(617); - _errHandler.sync(this); - _la = _input.LA(1); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class List_value_partitionContext extends ParserRuleContext { - public TerminalNode PARTITION() { return getToken(SQLParser.PARTITION, 0); } - public Partition_nameContext partition_name() { - return getRuleContext(Partition_nameContext.class,0); - } - public TerminalNode VALUES() { return getToken(SQLParser.VALUES, 0); } - public TerminalNode LEFT_PAREN() { return getToken(SQLParser.LEFT_PAREN, 0); } - public In_value_listContext in_value_list() { - return getRuleContext(In_value_listContext.class,0); - } - public TerminalNode RIGHT_PAREN() { return getToken(SQLParser.RIGHT_PAREN, 0); } - public TerminalNode IN() { return getToken(SQLParser.IN, 0); } - public List_value_partitionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_list_value_partition; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterList_value_partition(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitList_value_partition(this); - } - } - - public final List_value_partitionContext list_value_partition() throws RecognitionException { - List_value_partitionContext _localctx = new List_value_partitionContext(_ctx, getState()); - enterRule(_localctx, 50, RULE_list_value_partition); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(618); - match(PARTITION); - setState(619); - partition_name(); - setState(620); - match(VALUES); - setState(622); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==IN) { - { - setState(621); - match(IN); - } - } - - setState(624); - match(LEFT_PAREN); - setState(625); - in_value_list(); - setState(626); - match(RIGHT_PAREN); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Column_partitionsContext extends ParserRuleContext { - public TerminalNode PARTITION() { return getToken(SQLParser.PARTITION, 0); } - public TerminalNode BY() { return getToken(SQLParser.BY, 0); } - public TerminalNode COLUMN() { return getToken(SQLParser.COLUMN, 0); } - public Table_elementsContext table_elements() { - return getRuleContext(Table_elementsContext.class,0); - } - public Column_partitionsContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_column_partitions; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterColumn_partitions(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitColumn_partitions(this); - } - } - - public final Column_partitionsContext column_partitions() throws RecognitionException { - Column_partitionsContext _localctx = new Column_partitionsContext(_ctx, getState()); - enterRule(_localctx, 52, RULE_column_partitions); - try { - enterOuterAlt(_localctx, 1); - { - setState(628); - match(PARTITION); - setState(629); - match(BY); - setState(630); - match(COLUMN); - setState(631); - table_elements(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Partition_nameContext extends ParserRuleContext { - public IdentifierContext identifier() { - return getRuleContext(IdentifierContext.class,0); - } - public Partition_nameContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_partition_name; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterPartition_name(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitPartition_name(this); - } - } - - public final Partition_nameContext partition_name() throws RecognitionException { - Partition_nameContext _localctx = new Partition_nameContext(_ctx, getState()); - enterRule(_localctx, 54, RULE_partition_name); - try { - enterOuterAlt(_localctx, 1); - { - setState(633); - identifier(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Drop_table_statementContext extends ParserRuleContext { - public TerminalNode DROP() { return getToken(SQLParser.DROP, 0); } - public TerminalNode TABLE() { return getToken(SQLParser.TABLE, 0); } - public Table_nameContext table_name() { - return getRuleContext(Table_nameContext.class,0); - } - public TerminalNode PURGE() { return getToken(SQLParser.PURGE, 0); } - public Drop_table_statementContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_drop_table_statement; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterDrop_table_statement(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitDrop_table_statement(this); - } - } - - public final Drop_table_statementContext drop_table_statement() throws RecognitionException { - Drop_table_statementContext _localctx = new Drop_table_statementContext(_ctx, getState()); - enterRule(_localctx, 56, RULE_drop_table_statement); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(635); - match(DROP); - setState(636); - match(TABLE); - setState(637); - table_name(); - setState(639); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==PURGE) { - { - setState(638); - match(PURGE); - } - } - - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class IdentifierContext extends ParserRuleContext { - public TerminalNode Identifier() { return getToken(SQLParser.Identifier, 0); } - public Nonreserved_keywordsContext nonreserved_keywords() { - return getRuleContext(Nonreserved_keywordsContext.class,0); - } - public IdentifierContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_identifier; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterIdentifier(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitIdentifier(this); - } - } - - public final IdentifierContext identifier() throws RecognitionException { - IdentifierContext _localctx = new IdentifierContext(_ctx, getState()); - enterRule(_localctx, 58, RULE_identifier); - try { - setState(643); - _errHandler.sync(this); - switch (_input.LA(1)) { - case Identifier: - enterOuterAlt(_localctx, 1); - { - setState(641); - match(Identifier); - } - break; - case AVG: - case BETWEEN: - case BY: - case CENTURY: - case CHARACTER: - case COLLECT: - case COALESCE: - case COLUMN: - case COUNT: - case CUBE: - case DAY: - case DEC: - case DECADE: - case DOW: - case DOY: - case DROP: - case EPOCH: - case EVERY: - case EXISTS: - case EXTERNAL: - case EXTRACT: - case FILTER: - case FIRST: - case FORMAT: - case FUSION: - case GROUPING: - case HASH: - case INDEX: - case INSERT: - case INTERSECTION: - case ISODOW: - case ISOYEAR: - case LAST: - case LESS: - case LIST: - case LOCATION: - case MAX: - case MAXVALUE: - case MICROSECONDS: - case MILLENNIUM: - case MILLISECONDS: - case MIN: - case MINUTE: - case MONTH: - case NATIONAL: - case NULLIF: - case OVERWRITE: - case PARTITION: - case PARTITIONS: - case PRECISION: - case PURGE: - case QUARTER: - case RANGE: - case REGEXP: - case RLIKE: - case ROLLUP: - case SECOND: - case SET: - case SIMILAR: - case STDDEV_POP: - case STDDEV_SAMP: - case SUBPARTITION: - case SUM: - case TABLESPACE: - case THAN: - case TIMEZONE: - case TIMEZONE_HOUR: - case TIMEZONE_MINUTE: - case TRIM: - case TO: - case UNKNOWN: - case VALUES: - case VAR_SAMP: - case VAR_POP: - case VARYING: - case WEEK: - case YEAR: - case ZONE: - case BOOLEAN: - case BOOL: - case BIT: - case VARBIT: - case INT1: - case INT2: - case INT4: - case INT8: - case TINYINT: - case SMALLINT: - case INT: - case INTEGER: - case BIGINT: - case FLOAT4: - case FLOAT8: - case REAL: - case FLOAT: - case DOUBLE: - case NUMERIC: - case DECIMAL: - case CHAR: - case VARCHAR: - case NCHAR: - case NVARCHAR: - case DATE: - case TIME: - case TIMETZ: - case TIMESTAMP: - case TIMESTAMPTZ: - case TEXT: - case VARBINARY: - case BLOB: - case BYTEA: - case INET4: - enterOuterAlt(_localctx, 2); - { - setState(642); - nonreserved_keywords(); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Nonreserved_keywordsContext extends ParserRuleContext { - public TerminalNode AVG() { return getToken(SQLParser.AVG, 0); } - public TerminalNode BETWEEN() { return getToken(SQLParser.BETWEEN, 0); } - public TerminalNode BY() { return getToken(SQLParser.BY, 0); } - public TerminalNode CENTURY() { return getToken(SQLParser.CENTURY, 0); } - public TerminalNode CHARACTER() { return getToken(SQLParser.CHARACTER, 0); } - public TerminalNode COALESCE() { return getToken(SQLParser.COALESCE, 0); } - public TerminalNode COLLECT() { return getToken(SQLParser.COLLECT, 0); } - public TerminalNode COLUMN() { return getToken(SQLParser.COLUMN, 0); } - public TerminalNode COUNT() { return getToken(SQLParser.COUNT, 0); } - public TerminalNode CUBE() { return getToken(SQLParser.CUBE, 0); } - public TerminalNode DAY() { return getToken(SQLParser.DAY, 0); } - public TerminalNode DEC() { return getToken(SQLParser.DEC, 0); } - public TerminalNode DECADE() { return getToken(SQLParser.DECADE, 0); } - public TerminalNode DOW() { return getToken(SQLParser.DOW, 0); } - public TerminalNode DOY() { return getToken(SQLParser.DOY, 0); } - public TerminalNode DROP() { return getToken(SQLParser.DROP, 0); } - public TerminalNode EPOCH() { return getToken(SQLParser.EPOCH, 0); } - public TerminalNode EVERY() { return getToken(SQLParser.EVERY, 0); } - public TerminalNode EXISTS() { return getToken(SQLParser.EXISTS, 0); } - public TerminalNode EXTERNAL() { return getToken(SQLParser.EXTERNAL, 0); } - public TerminalNode EXTRACT() { return getToken(SQLParser.EXTRACT, 0); } - public TerminalNode FILTER() { return getToken(SQLParser.FILTER, 0); } - public TerminalNode FIRST() { return getToken(SQLParser.FIRST, 0); } - public TerminalNode FORMAT() { return getToken(SQLParser.FORMAT, 0); } - public TerminalNode FUSION() { return getToken(SQLParser.FUSION, 0); } - public TerminalNode GROUPING() { return getToken(SQLParser.GROUPING, 0); } - public TerminalNode HASH() { return getToken(SQLParser.HASH, 0); } - public TerminalNode INDEX() { return getToken(SQLParser.INDEX, 0); } - public TerminalNode INSERT() { return getToken(SQLParser.INSERT, 0); } - public TerminalNode INTERSECTION() { return getToken(SQLParser.INTERSECTION, 0); } - public TerminalNode ISODOW() { return getToken(SQLParser.ISODOW, 0); } - public TerminalNode ISOYEAR() { return getToken(SQLParser.ISOYEAR, 0); } - public TerminalNode LAST() { return getToken(SQLParser.LAST, 0); } - public TerminalNode LESS() { return getToken(SQLParser.LESS, 0); } - public TerminalNode LIST() { return getToken(SQLParser.LIST, 0); } - public TerminalNode LOCATION() { return getToken(SQLParser.LOCATION, 0); } - public TerminalNode MAX() { return getToken(SQLParser.MAX, 0); } - public TerminalNode MAXVALUE() { return getToken(SQLParser.MAXVALUE, 0); } - public TerminalNode MICROSECONDS() { return getToken(SQLParser.MICROSECONDS, 0); } - public TerminalNode MILLENNIUM() { return getToken(SQLParser.MILLENNIUM, 0); } - public TerminalNode MILLISECONDS() { return getToken(SQLParser.MILLISECONDS, 0); } - public TerminalNode MIN() { return getToken(SQLParser.MIN, 0); } - public TerminalNode MINUTE() { return getToken(SQLParser.MINUTE, 0); } - public TerminalNode MONTH() { return getToken(SQLParser.MONTH, 0); } - public TerminalNode NATIONAL() { return getToken(SQLParser.NATIONAL, 0); } - public TerminalNode NULLIF() { return getToken(SQLParser.NULLIF, 0); } - public TerminalNode OVERWRITE() { return getToken(SQLParser.OVERWRITE, 0); } - public TerminalNode PARTITION() { return getToken(SQLParser.PARTITION, 0); } - public TerminalNode PARTITIONS() { return getToken(SQLParser.PARTITIONS, 0); } - public TerminalNode PRECISION() { return getToken(SQLParser.PRECISION, 0); } - public TerminalNode PURGE() { return getToken(SQLParser.PURGE, 0); } - public TerminalNode QUARTER() { return getToken(SQLParser.QUARTER, 0); } - public TerminalNode RANGE() { return getToken(SQLParser.RANGE, 0); } - public TerminalNode REGEXP() { return getToken(SQLParser.REGEXP, 0); } - public TerminalNode RLIKE() { return getToken(SQLParser.RLIKE, 0); } - public TerminalNode ROLLUP() { return getToken(SQLParser.ROLLUP, 0); } - public TerminalNode SECOND() { return getToken(SQLParser.SECOND, 0); } - public TerminalNode SET() { return getToken(SQLParser.SET, 0); } - public TerminalNode SIMILAR() { return getToken(SQLParser.SIMILAR, 0); } - public TerminalNode STDDEV_POP() { return getToken(SQLParser.STDDEV_POP, 0); } - public TerminalNode STDDEV_SAMP() { return getToken(SQLParser.STDDEV_SAMP, 0); } - public TerminalNode SUBPARTITION() { return getToken(SQLParser.SUBPARTITION, 0); } - public TerminalNode SUM() { return getToken(SQLParser.SUM, 0); } - public TerminalNode TABLESPACE() { return getToken(SQLParser.TABLESPACE, 0); } - public TerminalNode THAN() { return getToken(SQLParser.THAN, 0); } - public TerminalNode TIMEZONE() { return getToken(SQLParser.TIMEZONE, 0); } - public TerminalNode TIMEZONE_HOUR() { return getToken(SQLParser.TIMEZONE_HOUR, 0); } - public TerminalNode TIMEZONE_MINUTE() { return getToken(SQLParser.TIMEZONE_MINUTE, 0); } - public TerminalNode TRIM() { return getToken(SQLParser.TRIM, 0); } - public TerminalNode TO() { return getToken(SQLParser.TO, 0); } - public TerminalNode UNKNOWN() { return getToken(SQLParser.UNKNOWN, 0); } - public TerminalNode VALUES() { return getToken(SQLParser.VALUES, 0); } - public TerminalNode VAR_POP() { return getToken(SQLParser.VAR_POP, 0); } - public TerminalNode VAR_SAMP() { return getToken(SQLParser.VAR_SAMP, 0); } - public TerminalNode VARYING() { return getToken(SQLParser.VARYING, 0); } - public TerminalNode WEEK() { return getToken(SQLParser.WEEK, 0); } - public TerminalNode YEAR() { return getToken(SQLParser.YEAR, 0); } - public TerminalNode ZONE() { return getToken(SQLParser.ZONE, 0); } - public TerminalNode BIGINT() { return getToken(SQLParser.BIGINT, 0); } - public TerminalNode BIT() { return getToken(SQLParser.BIT, 0); } - public TerminalNode BLOB() { return getToken(SQLParser.BLOB, 0); } - public TerminalNode BOOL() { return getToken(SQLParser.BOOL, 0); } - public TerminalNode BOOLEAN() { return getToken(SQLParser.BOOLEAN, 0); } - public TerminalNode BYTEA() { return getToken(SQLParser.BYTEA, 0); } - public TerminalNode CHAR() { return getToken(SQLParser.CHAR, 0); } - public TerminalNode DATE() { return getToken(SQLParser.DATE, 0); } - public TerminalNode DECIMAL() { return getToken(SQLParser.DECIMAL, 0); } - public TerminalNode DOUBLE() { return getToken(SQLParser.DOUBLE, 0); } - public TerminalNode FLOAT() { return getToken(SQLParser.FLOAT, 0); } - public TerminalNode FLOAT4() { return getToken(SQLParser.FLOAT4, 0); } - public TerminalNode FLOAT8() { return getToken(SQLParser.FLOAT8, 0); } - public TerminalNode INET4() { return getToken(SQLParser.INET4, 0); } - public TerminalNode INT() { return getToken(SQLParser.INT, 0); } - public TerminalNode INT1() { return getToken(SQLParser.INT1, 0); } - public TerminalNode INT2() { return getToken(SQLParser.INT2, 0); } - public TerminalNode INT4() { return getToken(SQLParser.INT4, 0); } - public TerminalNode INT8() { return getToken(SQLParser.INT8, 0); } - public TerminalNode INTEGER() { return getToken(SQLParser.INTEGER, 0); } - public TerminalNode NCHAR() { return getToken(SQLParser.NCHAR, 0); } - public TerminalNode NUMERIC() { return getToken(SQLParser.NUMERIC, 0); } - public TerminalNode NVARCHAR() { return getToken(SQLParser.NVARCHAR, 0); } - public TerminalNode REAL() { return getToken(SQLParser.REAL, 0); } - public TerminalNode SMALLINT() { return getToken(SQLParser.SMALLINT, 0); } - public TerminalNode TEXT() { return getToken(SQLParser.TEXT, 0); } - public TerminalNode TIME() { return getToken(SQLParser.TIME, 0); } - public TerminalNode TIMESTAMP() { return getToken(SQLParser.TIMESTAMP, 0); } - public TerminalNode TIMESTAMPTZ() { return getToken(SQLParser.TIMESTAMPTZ, 0); } - public TerminalNode TIMETZ() { return getToken(SQLParser.TIMETZ, 0); } - public TerminalNode TINYINT() { return getToken(SQLParser.TINYINT, 0); } - public TerminalNode VARBINARY() { return getToken(SQLParser.VARBINARY, 0); } - public TerminalNode VARBIT() { return getToken(SQLParser.VARBIT, 0); } - public TerminalNode VARCHAR() { return getToken(SQLParser.VARCHAR, 0); } - public Nonreserved_keywordsContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_nonreserved_keywords; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterNonreserved_keywords(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitNonreserved_keywords(this); - } - } - - public final Nonreserved_keywordsContext nonreserved_keywords() throws RecognitionException { - Nonreserved_keywordsContext _localctx = new Nonreserved_keywordsContext(_ctx, getState()); - enterRule(_localctx, 60, RULE_nonreserved_keywords); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(645); - _la = _input.LA(1); - if ( !(((((_la - 54)) & ~0x3f) == 0 && ((1L << (_la - 54)) & ((1L << (AVG - 54)) | (1L << (BETWEEN - 54)) | (1L << (BY - 54)) | (1L << (CENTURY - 54)) | (1L << (CHARACTER - 54)) | (1L << (COLLECT - 54)) | (1L << (COALESCE - 54)) | (1L << (COLUMN - 54)) | (1L << (COUNT - 54)) | (1L << (CUBE - 54)) | (1L << (DAY - 54)) | (1L << (DEC - 54)) | (1L << (DECADE - 54)) | (1L << (DOW - 54)) | (1L << (DOY - 54)) | (1L << (DROP - 54)) | (1L << (EPOCH - 54)) | (1L << (EVERY - 54)) | (1L << (EXISTS - 54)) | (1L << (EXTERNAL - 54)) | (1L << (EXTRACT - 54)) | (1L << (FILTER - 54)) | (1L << (FIRST - 54)) | (1L << (FORMAT - 54)) | (1L << (FUSION - 54)) | (1L << (GROUPING - 54)) | (1L << (HASH - 54)) | (1L << (INDEX - 54)) | (1L << (INSERT - 54)) | (1L << (INTERSECTION - 54)) | (1L << (ISODOW - 54)) | (1L << (ISOYEAR - 54)) | (1L << (LAST - 54)) | (1L << (LESS - 54)) | (1L << (LIST - 54)) | (1L << (LOCATION - 54)) | (1L << (MAX - 54)) | (1L << (MAXVALUE - 54)) | (1L << (MICROSECONDS - 54)) | (1L << (MILLENNIUM - 54)) | (1L << (MILLISECONDS - 54)) | (1L << (MIN - 54)) | (1L << (MINUTE - 54)) | (1L << (MONTH - 54)) | (1L << (NATIONAL - 54)) | (1L << (NULLIF - 54)) | (1L << (OVERWRITE - 54)) | (1L << (PARTITION - 54)) | (1L << (PARTITIONS - 54)) | (1L << (PRECISION - 54)) | (1L << (PURGE - 54)) | (1L << (QUARTER - 54)) | (1L << (RANGE - 54)) | (1L << (REGEXP - 54)) | (1L << (RLIKE - 54)) | (1L << (ROLLUP - 54)) | (1L << (SECOND - 54)) | (1L << (SET - 54)) | (1L << (SIMILAR - 54)) | (1L << (STDDEV_POP - 54)) | (1L << (STDDEV_SAMP - 54)) | (1L << (SUBPARTITION - 54)) | (1L << (SUM - 54)))) != 0) || ((((_la - 118)) & ~0x3f) == 0 && ((1L << (_la - 118)) & ((1L << (TABLESPACE - 118)) | (1L << (THAN - 118)) | (1L << (TIMEZONE - 118)) | (1L << (TIMEZONE_HOUR - 118)) | (1L << (TIMEZONE_MINUTE - 118)) | (1L << (TRIM - 118)) | (1L << (TO - 118)) | (1L << (UNKNOWN - 118)) | (1L << (VALUES - 118)) | (1L << (VAR_SAMP - 118)) | (1L << (VAR_POP - 118)) | (1L << (VARYING - 118)) | (1L << (WEEK - 118)) | (1L << (YEAR - 118)) | (1L << (ZONE - 118)) | (1L << (BOOLEAN - 118)) | (1L << (BOOL - 118)) | (1L << (BIT - 118)) | (1L << (VARBIT - 118)) | (1L << (INT1 - 118)) | (1L << (INT2 - 118)) | (1L << (INT4 - 118)) | (1L << (INT8 - 118)) | (1L << (TINYINT - 118)) | (1L << (SMALLINT - 118)) | (1L << (INT - 118)) | (1L << (INTEGER - 118)) | (1L << (BIGINT - 118)) | (1L << (FLOAT4 - 118)) | (1L << (FLOAT8 - 118)) | (1L << (REAL - 118)) | (1L << (FLOAT - 118)) | (1L << (DOUBLE - 118)) | (1L << (NUMERIC - 118)) | (1L << (DECIMAL - 118)) | (1L << (CHAR - 118)) | (1L << (VARCHAR - 118)) | (1L << (NCHAR - 118)) | (1L << (NVARCHAR - 118)) | (1L << (DATE - 118)) | (1L << (TIME - 118)) | (1L << (TIMETZ - 118)) | (1L << (TIMESTAMP - 118)) | (1L << (TIMESTAMPTZ - 118)) | (1L << (TEXT - 118)) | (1L << (VARBINARY - 118)) | (1L << (BLOB - 118)) | (1L << (BYTEA - 118)) | (1L << (INET4 - 118)))) != 0)) ) { - _errHandler.recoverInline(this); - } - else { - if ( _input.LA(1)==Token.EOF ) matchedEOF = true; - _errHandler.reportMatch(this); - consume(); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Unsigned_literalContext extends ParserRuleContext { - public Unsigned_numeric_literalContext unsigned_numeric_literal() { - return getRuleContext(Unsigned_numeric_literalContext.class,0); - } - public General_literalContext general_literal() { - return getRuleContext(General_literalContext.class,0); - } - public Unsigned_literalContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_unsigned_literal; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterUnsigned_literal(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitUnsigned_literal(this); - } - } - - public final Unsigned_literalContext unsigned_literal() throws RecognitionException { - Unsigned_literalContext _localctx = new Unsigned_literalContext(_ctx, getState()); - enterRule(_localctx, 62, RULE_unsigned_literal); - try { - setState(649); - _errHandler.sync(this); - switch (_input.LA(1)) { - case NUMBER: - case REAL_NUMBER: - enterOuterAlt(_localctx, 1); - { - setState(647); - unsigned_numeric_literal(); - } - break; - case FALSE: - case TRUE: - case UNKNOWN: - case DATE: - case TIME: - case TIMESTAMP: - case Character_String_Literal: - enterOuterAlt(_localctx, 2); - { - setState(648); - general_literal(); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class General_literalContext extends ParserRuleContext { - public TerminalNode Character_String_Literal() { return getToken(SQLParser.Character_String_Literal, 0); } - public Datetime_literalContext datetime_literal() { - return getRuleContext(Datetime_literalContext.class,0); - } - public Boolean_literalContext boolean_literal() { - return getRuleContext(Boolean_literalContext.class,0); - } - public General_literalContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_general_literal; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterGeneral_literal(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitGeneral_literal(this); - } - } - - public final General_literalContext general_literal() throws RecognitionException { - General_literalContext _localctx = new General_literalContext(_ctx, getState()); - enterRule(_localctx, 64, RULE_general_literal); - try { - setState(654); - _errHandler.sync(this); - switch (_input.LA(1)) { - case Character_String_Literal: - enterOuterAlt(_localctx, 1); - { - setState(651); - match(Character_String_Literal); - } - break; - case DATE: - case TIME: - case TIMESTAMP: - enterOuterAlt(_localctx, 2); - { - setState(652); - datetime_literal(); - } - break; - case FALSE: - case TRUE: - case UNKNOWN: - enterOuterAlt(_localctx, 3); - { - setState(653); - boolean_literal(); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Datetime_literalContext extends ParserRuleContext { - public Timestamp_literalContext timestamp_literal() { - return getRuleContext(Timestamp_literalContext.class,0); - } - public Time_literalContext time_literal() { - return getRuleContext(Time_literalContext.class,0); - } - public Date_literalContext date_literal() { - return getRuleContext(Date_literalContext.class,0); - } - public Datetime_literalContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_datetime_literal; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterDatetime_literal(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitDatetime_literal(this); - } - } - - public final Datetime_literalContext datetime_literal() throws RecognitionException { - Datetime_literalContext _localctx = new Datetime_literalContext(_ctx, getState()); - enterRule(_localctx, 66, RULE_datetime_literal); - try { - setState(659); - _errHandler.sync(this); - switch (_input.LA(1)) { - case TIMESTAMP: - enterOuterAlt(_localctx, 1); - { - setState(656); - timestamp_literal(); - } - break; - case TIME: - enterOuterAlt(_localctx, 2); - { - setState(657); - time_literal(); - } - break; - case DATE: - enterOuterAlt(_localctx, 3); - { - setState(658); - date_literal(); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Time_literalContext extends ParserRuleContext { - public Token time_string; - public TerminalNode TIME() { return getToken(SQLParser.TIME, 0); } - public TerminalNode Character_String_Literal() { return getToken(SQLParser.Character_String_Literal, 0); } - public Time_literalContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_time_literal; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterTime_literal(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitTime_literal(this); - } - } - - public final Time_literalContext time_literal() throws RecognitionException { - Time_literalContext _localctx = new Time_literalContext(_ctx, getState()); - enterRule(_localctx, 68, RULE_time_literal); - try { - enterOuterAlt(_localctx, 1); - { - setState(661); - match(TIME); - setState(662); - ((Time_literalContext)_localctx).time_string = match(Character_String_Literal); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Timestamp_literalContext extends ParserRuleContext { - public Token timestamp_string; - public TerminalNode TIMESTAMP() { return getToken(SQLParser.TIMESTAMP, 0); } - public TerminalNode Character_String_Literal() { return getToken(SQLParser.Character_String_Literal, 0); } - public Timestamp_literalContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_timestamp_literal; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterTimestamp_literal(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitTimestamp_literal(this); - } - } - - public final Timestamp_literalContext timestamp_literal() throws RecognitionException { - Timestamp_literalContext _localctx = new Timestamp_literalContext(_ctx, getState()); - enterRule(_localctx, 70, RULE_timestamp_literal); - try { - enterOuterAlt(_localctx, 1); - { - setState(664); - match(TIMESTAMP); - setState(665); - ((Timestamp_literalContext)_localctx).timestamp_string = match(Character_String_Literal); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Date_literalContext extends ParserRuleContext { - public Token date_string; - public TerminalNode DATE() { return getToken(SQLParser.DATE, 0); } - public TerminalNode Character_String_Literal() { return getToken(SQLParser.Character_String_Literal, 0); } - public Date_literalContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_date_literal; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterDate_literal(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitDate_literal(this); - } - } - - public final Date_literalContext date_literal() throws RecognitionException { - Date_literalContext _localctx = new Date_literalContext(_ctx, getState()); - enterRule(_localctx, 72, RULE_date_literal); - try { - enterOuterAlt(_localctx, 1); - { - setState(667); - match(DATE); - setState(668); - ((Date_literalContext)_localctx).date_string = match(Character_String_Literal); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Boolean_literalContext extends ParserRuleContext { - public TerminalNode TRUE() { return getToken(SQLParser.TRUE, 0); } - public TerminalNode FALSE() { return getToken(SQLParser.FALSE, 0); } - public TerminalNode UNKNOWN() { return getToken(SQLParser.UNKNOWN, 0); } - public Boolean_literalContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_boolean_literal; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterBoolean_literal(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitBoolean_literal(this); - } - } - - public final Boolean_literalContext boolean_literal() throws RecognitionException { - Boolean_literalContext _localctx = new Boolean_literalContext(_ctx, getState()); - enterRule(_localctx, 74, RULE_boolean_literal); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(670); - _la = _input.LA(1); - if ( !(_la==FALSE || _la==TRUE || _la==UNKNOWN) ) { - _errHandler.recoverInline(this); - } - else { - if ( _input.LA(1)==Token.EOF ) matchedEOF = true; - _errHandler.reportMatch(this); - consume(); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Data_typeContext extends ParserRuleContext { - public Predefined_typeContext predefined_type() { - return getRuleContext(Predefined_typeContext.class,0); - } - public Data_typeContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_data_type; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterData_type(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitData_type(this); - } - } - - public final Data_typeContext data_type() throws RecognitionException { - Data_typeContext _localctx = new Data_typeContext(_ctx, getState()); - enterRule(_localctx, 76, RULE_data_type); - try { - enterOuterAlt(_localctx, 1); - { - setState(672); - predefined_type(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Predefined_typeContext extends ParserRuleContext { - public Character_string_typeContext character_string_type() { - return getRuleContext(Character_string_typeContext.class,0); - } - public National_character_string_typeContext national_character_string_type() { - return getRuleContext(National_character_string_typeContext.class,0); - } - public Binary_large_object_string_typeContext binary_large_object_string_type() { - return getRuleContext(Binary_large_object_string_typeContext.class,0); - } - public Numeric_typeContext numeric_type() { - return getRuleContext(Numeric_typeContext.class,0); - } - public Boolean_typeContext boolean_type() { - return getRuleContext(Boolean_typeContext.class,0); - } - public Datetime_typeContext datetime_type() { - return getRuleContext(Datetime_typeContext.class,0); - } - public Bit_typeContext bit_type() { - return getRuleContext(Bit_typeContext.class,0); - } - public Binary_typeContext binary_type() { - return getRuleContext(Binary_typeContext.class,0); - } - public Network_typeContext network_type() { - return getRuleContext(Network_typeContext.class,0); - } - public Predefined_typeContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_predefined_type; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterPredefined_type(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitPredefined_type(this); - } - } - - public final Predefined_typeContext predefined_type() throws RecognitionException { - Predefined_typeContext _localctx = new Predefined_typeContext(_ctx, getState()); - enterRule(_localctx, 78, RULE_predefined_type); - try { - setState(683); - _errHandler.sync(this); - switch (_input.LA(1)) { - case CHARACTER: - case CHAR: - case VARCHAR: - case TEXT: - enterOuterAlt(_localctx, 1); - { - setState(674); - character_string_type(); - } - break; - case NATIONAL: - case NCHAR: - case NVARCHAR: - enterOuterAlt(_localctx, 2); - { - setState(675); - national_character_string_type(); - } - break; - case BLOB: - case BYTEA: - enterOuterAlt(_localctx, 3); - { - setState(676); - binary_large_object_string_type(); - } - break; - case DEC: - case INT1: - case INT2: - case INT4: - case INT8: - case TINYINT: - case SMALLINT: - case INT: - case INTEGER: - case BIGINT: - case FLOAT4: - case FLOAT8: - case REAL: - case FLOAT: - case DOUBLE: - case NUMERIC: - case DECIMAL: - enterOuterAlt(_localctx, 4); - { - setState(677); - numeric_type(); - } - break; - case BOOLEAN: - case BOOL: - enterOuterAlt(_localctx, 5); - { - setState(678); - boolean_type(); - } - break; - case DATE: - case TIME: - case TIMETZ: - case TIMESTAMP: - case TIMESTAMPTZ: - enterOuterAlt(_localctx, 6); - { - setState(679); - datetime_type(); - } - break; - case BIT: - case VARBIT: - enterOuterAlt(_localctx, 7); - { - setState(680); - bit_type(); - } - break; - case BINARY: - case VARBINARY: - enterOuterAlt(_localctx, 8); - { - setState(681); - binary_type(); - } - break; - case INET4: - enterOuterAlt(_localctx, 9); - { - setState(682); - network_type(); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Network_typeContext extends ParserRuleContext { - public TerminalNode INET4() { return getToken(SQLParser.INET4, 0); } - public Network_typeContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_network_type; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterNetwork_type(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitNetwork_type(this); - } - } - - public final Network_typeContext network_type() throws RecognitionException { - Network_typeContext _localctx = new Network_typeContext(_ctx, getState()); - enterRule(_localctx, 80, RULE_network_type); - try { - enterOuterAlt(_localctx, 1); - { - setState(685); - match(INET4); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Character_string_typeContext extends ParserRuleContext { - public TerminalNode CHARACTER() { return getToken(SQLParser.CHARACTER, 0); } - public Type_lengthContext type_length() { - return getRuleContext(Type_lengthContext.class,0); - } - public TerminalNode CHAR() { return getToken(SQLParser.CHAR, 0); } - public TerminalNode VARYING() { return getToken(SQLParser.VARYING, 0); } - public TerminalNode VARCHAR() { return getToken(SQLParser.VARCHAR, 0); } - public TerminalNode TEXT() { return getToken(SQLParser.TEXT, 0); } - public Character_string_typeContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_character_string_type; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterCharacter_string_type(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitCharacter_string_type(this); - } - } - - public final Character_string_typeContext character_string_type() throws RecognitionException { - Character_string_typeContext _localctx = new Character_string_typeContext(_ctx, getState()); - enterRule(_localctx, 82, RULE_character_string_type); - int _la; - try { - setState(710); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,38,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(687); - match(CHARACTER); - setState(689); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LEFT_PAREN) { - { - setState(688); - type_length(); - } - } - - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(691); - match(CHAR); - setState(693); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LEFT_PAREN) { - { - setState(692); - type_length(); - } - } - - } - break; - case 3: - enterOuterAlt(_localctx, 3); - { - setState(695); - match(CHARACTER); - setState(696); - match(VARYING); - setState(698); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LEFT_PAREN) { - { - setState(697); - type_length(); - } - } - - } - break; - case 4: - enterOuterAlt(_localctx, 4); - { - setState(700); - match(CHAR); - setState(701); - match(VARYING); - setState(703); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LEFT_PAREN) { - { - setState(702); - type_length(); - } - } - - } - break; - case 5: - enterOuterAlt(_localctx, 5); - { - setState(705); - match(VARCHAR); - setState(707); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LEFT_PAREN) { - { - setState(706); - type_length(); - } - } - - } - break; - case 6: - enterOuterAlt(_localctx, 6); - { - setState(709); - match(TEXT); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Type_lengthContext extends ParserRuleContext { - public TerminalNode LEFT_PAREN() { return getToken(SQLParser.LEFT_PAREN, 0); } - public TerminalNode NUMBER() { return getToken(SQLParser.NUMBER, 0); } - public TerminalNode RIGHT_PAREN() { return getToken(SQLParser.RIGHT_PAREN, 0); } - public Type_lengthContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_type_length; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterType_length(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitType_length(this); - } - } - - public final Type_lengthContext type_length() throws RecognitionException { - Type_lengthContext _localctx = new Type_lengthContext(_ctx, getState()); - enterRule(_localctx, 84, RULE_type_length); - try { - enterOuterAlt(_localctx, 1); - { - setState(712); - match(LEFT_PAREN); - setState(713); - match(NUMBER); - setState(714); - match(RIGHT_PAREN); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class National_character_string_typeContext extends ParserRuleContext { - public TerminalNode NATIONAL() { return getToken(SQLParser.NATIONAL, 0); } - public TerminalNode CHARACTER() { return getToken(SQLParser.CHARACTER, 0); } - public Type_lengthContext type_length() { - return getRuleContext(Type_lengthContext.class,0); - } - public TerminalNode CHAR() { return getToken(SQLParser.CHAR, 0); } - public TerminalNode NCHAR() { return getToken(SQLParser.NCHAR, 0); } - public TerminalNode VARYING() { return getToken(SQLParser.VARYING, 0); } - public TerminalNode NVARCHAR() { return getToken(SQLParser.NVARCHAR, 0); } - public National_character_string_typeContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_national_character_string_type; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterNational_character_string_type(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitNational_character_string_type(this); - } - } - - public final National_character_string_typeContext national_character_string_type() throws RecognitionException { - National_character_string_typeContext _localctx = new National_character_string_typeContext(_ctx, getState()); - enterRule(_localctx, 86, RULE_national_character_string_type); - int _la; - try { - setState(751); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,46,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(716); - match(NATIONAL); - setState(717); - match(CHARACTER); - setState(719); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LEFT_PAREN) { - { - setState(718); - type_length(); - } - } - - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(721); - match(NATIONAL); - setState(722); - match(CHAR); - setState(724); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LEFT_PAREN) { - { - setState(723); - type_length(); - } - } - - } - break; - case 3: - enterOuterAlt(_localctx, 3); - { - setState(726); - match(NCHAR); - setState(728); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LEFT_PAREN) { - { - setState(727); - type_length(); - } - } - - } - break; - case 4: - enterOuterAlt(_localctx, 4); - { - setState(730); - match(NATIONAL); - setState(731); - match(CHARACTER); - setState(732); - match(VARYING); - setState(734); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LEFT_PAREN) { - { - setState(733); - type_length(); - } - } - - } - break; - case 5: - enterOuterAlt(_localctx, 5); - { - setState(736); - match(NATIONAL); - setState(737); - match(CHAR); - setState(738); - match(VARYING); - setState(740); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LEFT_PAREN) { - { - setState(739); - type_length(); - } - } - - } - break; - case 6: - enterOuterAlt(_localctx, 6); - { - setState(742); - match(NCHAR); - setState(743); - match(VARYING); - setState(745); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LEFT_PAREN) { - { - setState(744); - type_length(); - } - } - - } - break; - case 7: - enterOuterAlt(_localctx, 7); - { - setState(747); - match(NVARCHAR); - setState(749); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LEFT_PAREN) { - { - setState(748); - type_length(); - } - } - - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Binary_large_object_string_typeContext extends ParserRuleContext { - public TerminalNode BLOB() { return getToken(SQLParser.BLOB, 0); } - public Type_lengthContext type_length() { - return getRuleContext(Type_lengthContext.class,0); - } - public TerminalNode BYTEA() { return getToken(SQLParser.BYTEA, 0); } - public Binary_large_object_string_typeContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_binary_large_object_string_type; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterBinary_large_object_string_type(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitBinary_large_object_string_type(this); - } - } - - public final Binary_large_object_string_typeContext binary_large_object_string_type() throws RecognitionException { - Binary_large_object_string_typeContext _localctx = new Binary_large_object_string_typeContext(_ctx, getState()); - enterRule(_localctx, 88, RULE_binary_large_object_string_type); - int _la; - try { - setState(761); - _errHandler.sync(this); - switch (_input.LA(1)) { - case BLOB: - enterOuterAlt(_localctx, 1); - { - setState(753); - match(BLOB); - setState(755); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LEFT_PAREN) { - { - setState(754); - type_length(); - } - } - - } - break; - case BYTEA: - enterOuterAlt(_localctx, 2); - { - setState(757); - match(BYTEA); - setState(759); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LEFT_PAREN) { - { - setState(758); - type_length(); - } - } - - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Numeric_typeContext extends ParserRuleContext { - public Exact_numeric_typeContext exact_numeric_type() { - return getRuleContext(Exact_numeric_typeContext.class,0); - } - public Approximate_numeric_typeContext approximate_numeric_type() { - return getRuleContext(Approximate_numeric_typeContext.class,0); - } - public Numeric_typeContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_numeric_type; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterNumeric_type(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitNumeric_type(this); - } - } - - public final Numeric_typeContext numeric_type() throws RecognitionException { - Numeric_typeContext _localctx = new Numeric_typeContext(_ctx, getState()); - enterRule(_localctx, 90, RULE_numeric_type); - try { - setState(765); - _errHandler.sync(this); - switch (_input.LA(1)) { - case DEC: - case INT1: - case INT2: - case INT4: - case INT8: - case TINYINT: - case SMALLINT: - case INT: - case INTEGER: - case BIGINT: - case NUMERIC: - case DECIMAL: - enterOuterAlt(_localctx, 1); - { - setState(763); - exact_numeric_type(); - } - break; - case FLOAT4: - case FLOAT8: - case REAL: - case FLOAT: - case DOUBLE: - enterOuterAlt(_localctx, 2); - { - setState(764); - approximate_numeric_type(); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Exact_numeric_typeContext extends ParserRuleContext { - public TerminalNode NUMERIC() { return getToken(SQLParser.NUMERIC, 0); } - public Precision_paramContext precision_param() { - return getRuleContext(Precision_paramContext.class,0); - } - public TerminalNode DECIMAL() { return getToken(SQLParser.DECIMAL, 0); } - public TerminalNode DEC() { return getToken(SQLParser.DEC, 0); } - public TerminalNode INT1() { return getToken(SQLParser.INT1, 0); } - public TerminalNode TINYINT() { return getToken(SQLParser.TINYINT, 0); } - public TerminalNode INT2() { return getToken(SQLParser.INT2, 0); } - public TerminalNode SMALLINT() { return getToken(SQLParser.SMALLINT, 0); } - public TerminalNode INT4() { return getToken(SQLParser.INT4, 0); } - public TerminalNode INT() { return getToken(SQLParser.INT, 0); } - public TerminalNode INTEGER() { return getToken(SQLParser.INTEGER, 0); } - public TerminalNode INT8() { return getToken(SQLParser.INT8, 0); } - public TerminalNode BIGINT() { return getToken(SQLParser.BIGINT, 0); } - public Exact_numeric_typeContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_exact_numeric_type; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterExact_numeric_type(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitExact_numeric_type(this); - } - } - - public final Exact_numeric_typeContext exact_numeric_type() throws RecognitionException { - Exact_numeric_typeContext _localctx = new Exact_numeric_typeContext(_ctx, getState()); - enterRule(_localctx, 92, RULE_exact_numeric_type); - int _la; - try { - setState(788); - _errHandler.sync(this); - switch (_input.LA(1)) { - case NUMERIC: - enterOuterAlt(_localctx, 1); - { - setState(767); - match(NUMERIC); - setState(769); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LEFT_PAREN) { - { - setState(768); - precision_param(); - } - } - - } - break; - case DECIMAL: - enterOuterAlt(_localctx, 2); - { - setState(771); - match(DECIMAL); - setState(773); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LEFT_PAREN) { - { - setState(772); - precision_param(); - } - } - - } - break; - case DEC: - enterOuterAlt(_localctx, 3); - { - setState(775); - match(DEC); - setState(777); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LEFT_PAREN) { - { - setState(776); - precision_param(); - } - } - - } - break; - case INT1: - enterOuterAlt(_localctx, 4); - { - setState(779); - match(INT1); - } - break; - case TINYINT: - enterOuterAlt(_localctx, 5); - { - setState(780); - match(TINYINT); - } - break; - case INT2: - enterOuterAlt(_localctx, 6); - { - setState(781); - match(INT2); - } - break; - case SMALLINT: - enterOuterAlt(_localctx, 7); - { - setState(782); - match(SMALLINT); - } - break; - case INT4: - enterOuterAlt(_localctx, 8); - { - setState(783); - match(INT4); - } - break; - case INT: - enterOuterAlt(_localctx, 9); - { - setState(784); - match(INT); - } - break; - case INTEGER: - enterOuterAlt(_localctx, 10); - { - setState(785); - match(INTEGER); - } - break; - case INT8: - enterOuterAlt(_localctx, 11); - { - setState(786); - match(INT8); - } - break; - case BIGINT: - enterOuterAlt(_localctx, 12); - { - setState(787); - match(BIGINT); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Approximate_numeric_typeContext extends ParserRuleContext { - public TerminalNode FLOAT() { return getToken(SQLParser.FLOAT, 0); } - public Precision_paramContext precision_param() { - return getRuleContext(Precision_paramContext.class,0); - } - public TerminalNode FLOAT4() { return getToken(SQLParser.FLOAT4, 0); } - public TerminalNode REAL() { return getToken(SQLParser.REAL, 0); } - public TerminalNode FLOAT8() { return getToken(SQLParser.FLOAT8, 0); } - public TerminalNode DOUBLE() { return getToken(SQLParser.DOUBLE, 0); } - public TerminalNode PRECISION() { return getToken(SQLParser.PRECISION, 0); } - public Approximate_numeric_typeContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_approximate_numeric_type; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterApproximate_numeric_type(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitApproximate_numeric_type(this); - } - } - - public final Approximate_numeric_typeContext approximate_numeric_type() throws RecognitionException { - Approximate_numeric_typeContext _localctx = new Approximate_numeric_typeContext(_ctx, getState()); - enterRule(_localctx, 94, RULE_approximate_numeric_type); - int _la; - try { - setState(800); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,56,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(790); - match(FLOAT); - setState(792); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LEFT_PAREN) { - { - setState(791); - precision_param(); - } - } - - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(794); - match(FLOAT4); - } - break; - case 3: - enterOuterAlt(_localctx, 3); - { - setState(795); - match(REAL); - } - break; - case 4: - enterOuterAlt(_localctx, 4); - { - setState(796); - match(FLOAT8); - } - break; - case 5: - enterOuterAlt(_localctx, 5); - { - setState(797); - match(DOUBLE); - } - break; - case 6: - enterOuterAlt(_localctx, 6); - { - setState(798); - match(DOUBLE); - setState(799); - match(PRECISION); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Precision_paramContext extends ParserRuleContext { - public Token precision; - public Token scale; - public TerminalNode LEFT_PAREN() { return getToken(SQLParser.LEFT_PAREN, 0); } - public TerminalNode RIGHT_PAREN() { return getToken(SQLParser.RIGHT_PAREN, 0); } - public List NUMBER() { return getTokens(SQLParser.NUMBER); } - public TerminalNode NUMBER(int i) { - return getToken(SQLParser.NUMBER, i); - } - public TerminalNode COMMA() { return getToken(SQLParser.COMMA, 0); } - public Precision_paramContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_precision_param; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterPrecision_param(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitPrecision_param(this); - } - } - - public final Precision_paramContext precision_param() throws RecognitionException { - Precision_paramContext _localctx = new Precision_paramContext(_ctx, getState()); - enterRule(_localctx, 96, RULE_precision_param); - try { - setState(810); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,57,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(802); - match(LEFT_PAREN); - setState(803); - ((Precision_paramContext)_localctx).precision = match(NUMBER); - setState(804); - match(RIGHT_PAREN); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(805); - match(LEFT_PAREN); - setState(806); - ((Precision_paramContext)_localctx).precision = match(NUMBER); - setState(807); - match(COMMA); - setState(808); - ((Precision_paramContext)_localctx).scale = match(NUMBER); - setState(809); - match(RIGHT_PAREN); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Boolean_typeContext extends ParserRuleContext { - public TerminalNode BOOLEAN() { return getToken(SQLParser.BOOLEAN, 0); } - public TerminalNode BOOL() { return getToken(SQLParser.BOOL, 0); } - public Boolean_typeContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_boolean_type; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterBoolean_type(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitBoolean_type(this); - } - } - - public final Boolean_typeContext boolean_type() throws RecognitionException { - Boolean_typeContext _localctx = new Boolean_typeContext(_ctx, getState()); - enterRule(_localctx, 98, RULE_boolean_type); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(812); - _la = _input.LA(1); - if ( !(_la==BOOLEAN || _la==BOOL) ) { - _errHandler.recoverInline(this); - } - else { - if ( _input.LA(1)==Token.EOF ) matchedEOF = true; - _errHandler.reportMatch(this); - consume(); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Datetime_typeContext extends ParserRuleContext { - public TerminalNode DATE() { return getToken(SQLParser.DATE, 0); } - public List TIME() { return getTokens(SQLParser.TIME); } - public TerminalNode TIME(int i) { - return getToken(SQLParser.TIME, i); - } - public TerminalNode WITH() { return getToken(SQLParser.WITH, 0); } - public TerminalNode ZONE() { return getToken(SQLParser.ZONE, 0); } - public TerminalNode TIMETZ() { return getToken(SQLParser.TIMETZ, 0); } - public TerminalNode TIMESTAMP() { return getToken(SQLParser.TIMESTAMP, 0); } - public TerminalNode TIMESTAMPTZ() { return getToken(SQLParser.TIMESTAMPTZ, 0); } - public Datetime_typeContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_datetime_type; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterDatetime_type(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitDatetime_type(this); - } - } - - public final Datetime_typeContext datetime_type() throws RecognitionException { - Datetime_typeContext _localctx = new Datetime_typeContext(_ctx, getState()); - enterRule(_localctx, 100, RULE_datetime_type); - try { - setState(827); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,58,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(814); - match(DATE); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(815); - match(TIME); - } - break; - case 3: - enterOuterAlt(_localctx, 3); - { - setState(816); - match(TIME); - setState(817); - match(WITH); - setState(818); - match(TIME); - setState(819); - match(ZONE); - } - break; - case 4: - enterOuterAlt(_localctx, 4); - { - setState(820); - match(TIMETZ); - } - break; - case 5: - enterOuterAlt(_localctx, 5); - { - setState(821); - match(TIMESTAMP); - } - break; - case 6: - enterOuterAlt(_localctx, 6); - { - setState(822); - match(TIMESTAMP); - setState(823); - match(WITH); - setState(824); - match(TIME); - setState(825); - match(ZONE); - } - break; - case 7: - enterOuterAlt(_localctx, 7); - { - setState(826); - match(TIMESTAMPTZ); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Bit_typeContext extends ParserRuleContext { - public TerminalNode BIT() { return getToken(SQLParser.BIT, 0); } - public Type_lengthContext type_length() { - return getRuleContext(Type_lengthContext.class,0); - } - public TerminalNode VARBIT() { return getToken(SQLParser.VARBIT, 0); } - public TerminalNode VARYING() { return getToken(SQLParser.VARYING, 0); } - public Bit_typeContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_bit_type; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterBit_type(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitBit_type(this); - } - } - - public final Bit_typeContext bit_type() throws RecognitionException { - Bit_typeContext _localctx = new Bit_typeContext(_ctx, getState()); - enterRule(_localctx, 102, RULE_bit_type); - int _la; - try { - setState(842); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,62,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(829); - match(BIT); - setState(831); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LEFT_PAREN) { - { - setState(830); - type_length(); - } - } - - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(833); - match(VARBIT); - setState(835); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LEFT_PAREN) { - { - setState(834); - type_length(); - } - } - - } - break; - case 3: - enterOuterAlt(_localctx, 3); - { - setState(837); - match(BIT); - setState(838); - match(VARYING); - setState(840); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LEFT_PAREN) { - { - setState(839); - type_length(); - } - } - - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Binary_typeContext extends ParserRuleContext { - public TerminalNode BINARY() { return getToken(SQLParser.BINARY, 0); } - public Type_lengthContext type_length() { - return getRuleContext(Type_lengthContext.class,0); - } - public TerminalNode VARYING() { return getToken(SQLParser.VARYING, 0); } - public TerminalNode VARBINARY() { return getToken(SQLParser.VARBINARY, 0); } - public Binary_typeContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_binary_type; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterBinary_type(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitBinary_type(this); - } - } - - public final Binary_typeContext binary_type() throws RecognitionException { - Binary_typeContext _localctx = new Binary_typeContext(_ctx, getState()); - enterRule(_localctx, 104, RULE_binary_type); - int _la; - try { - setState(857); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,66,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(844); - match(BINARY); - setState(846); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LEFT_PAREN) { - { - setState(845); - type_length(); - } - } - - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(848); - match(BINARY); - setState(849); - match(VARYING); - setState(851); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LEFT_PAREN) { - { - setState(850); - type_length(); - } - } - - } - break; - case 3: - enterOuterAlt(_localctx, 3); - { - setState(853); - match(VARBINARY); - setState(855); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LEFT_PAREN) { - { - setState(854); - type_length(); - } - } - - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Value_expression_primaryContext extends ParserRuleContext { - public Parenthesized_value_expressionContext parenthesized_value_expression() { - return getRuleContext(Parenthesized_value_expressionContext.class,0); - } - public Nonparenthesized_value_expression_primaryContext nonparenthesized_value_expression_primary() { - return getRuleContext(Nonparenthesized_value_expression_primaryContext.class,0); - } - public Value_expression_primaryContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_value_expression_primary; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterValue_expression_primary(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitValue_expression_primary(this); - } - } - - public final Value_expression_primaryContext value_expression_primary() throws RecognitionException { - Value_expression_primaryContext _localctx = new Value_expression_primaryContext(_ctx, getState()); - enterRule(_localctx, 106, RULE_value_expression_primary); - try { - setState(861); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,67,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(859); - parenthesized_value_expression(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(860); - nonparenthesized_value_expression_primary(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Parenthesized_value_expressionContext extends ParserRuleContext { - public TerminalNode LEFT_PAREN() { return getToken(SQLParser.LEFT_PAREN, 0); } - public Value_expressionContext value_expression() { - return getRuleContext(Value_expressionContext.class,0); - } - public TerminalNode RIGHT_PAREN() { return getToken(SQLParser.RIGHT_PAREN, 0); } - public Parenthesized_value_expressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_parenthesized_value_expression; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterParenthesized_value_expression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitParenthesized_value_expression(this); - } - } - - public final Parenthesized_value_expressionContext parenthesized_value_expression() throws RecognitionException { - Parenthesized_value_expressionContext _localctx = new Parenthesized_value_expressionContext(_ctx, getState()); - enterRule(_localctx, 108, RULE_parenthesized_value_expression); - try { - enterOuterAlt(_localctx, 1); - { - setState(863); - match(LEFT_PAREN); - setState(864); - value_expression(); - setState(865); - match(RIGHT_PAREN); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Nonparenthesized_value_expression_primaryContext extends ParserRuleContext { - public Unsigned_value_specificationContext unsigned_value_specification() { - return getRuleContext(Unsigned_value_specificationContext.class,0); - } - public Column_referenceContext column_reference() { - return getRuleContext(Column_referenceContext.class,0); - } - public Set_function_specificationContext set_function_specification() { - return getRuleContext(Set_function_specificationContext.class,0); - } - public Scalar_subqueryContext scalar_subquery() { - return getRuleContext(Scalar_subqueryContext.class,0); - } - public Case_expressionContext case_expression() { - return getRuleContext(Case_expressionContext.class,0); - } - public Cast_specificationContext cast_specification() { - return getRuleContext(Cast_specificationContext.class,0); - } - public Routine_invocationContext routine_invocation() { - return getRuleContext(Routine_invocationContext.class,0); - } - public Nonparenthesized_value_expression_primaryContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_nonparenthesized_value_expression_primary; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterNonparenthesized_value_expression_primary(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitNonparenthesized_value_expression_primary(this); - } - } - - public final Nonparenthesized_value_expression_primaryContext nonparenthesized_value_expression_primary() throws RecognitionException { - Nonparenthesized_value_expression_primaryContext _localctx = new Nonparenthesized_value_expression_primaryContext(_ctx, getState()); - enterRule(_localctx, 110, RULE_nonparenthesized_value_expression_primary); - try { - setState(874); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,68,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(867); - unsigned_value_specification(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(868); - column_reference(); - } - break; - case 3: - enterOuterAlt(_localctx, 3); - { - setState(869); - set_function_specification(); - } - break; - case 4: - enterOuterAlt(_localctx, 4); - { - setState(870); - scalar_subquery(); - } - break; - case 5: - enterOuterAlt(_localctx, 5); - { - setState(871); - case_expression(); - } - break; - case 6: - enterOuterAlt(_localctx, 6); - { - setState(872); - cast_specification(); - } - break; - case 7: - enterOuterAlt(_localctx, 7); - { - setState(873); - routine_invocation(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Unsigned_value_specificationContext extends ParserRuleContext { - public Unsigned_literalContext unsigned_literal() { - return getRuleContext(Unsigned_literalContext.class,0); - } - public Unsigned_value_specificationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_unsigned_value_specification; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterUnsigned_value_specification(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitUnsigned_value_specification(this); - } - } - - public final Unsigned_value_specificationContext unsigned_value_specification() throws RecognitionException { - Unsigned_value_specificationContext _localctx = new Unsigned_value_specificationContext(_ctx, getState()); - enterRule(_localctx, 112, RULE_unsigned_value_specification); - try { - enterOuterAlt(_localctx, 1); - { - setState(876); - unsigned_literal(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Unsigned_numeric_literalContext extends ParserRuleContext { - public TerminalNode NUMBER() { return getToken(SQLParser.NUMBER, 0); } - public TerminalNode REAL_NUMBER() { return getToken(SQLParser.REAL_NUMBER, 0); } - public Unsigned_numeric_literalContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_unsigned_numeric_literal; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterUnsigned_numeric_literal(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitUnsigned_numeric_literal(this); - } - } - - public final Unsigned_numeric_literalContext unsigned_numeric_literal() throws RecognitionException { - Unsigned_numeric_literalContext _localctx = new Unsigned_numeric_literalContext(_ctx, getState()); - enterRule(_localctx, 114, RULE_unsigned_numeric_literal); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(878); - _la = _input.LA(1); - if ( !(_la==NUMBER || _la==REAL_NUMBER) ) { - _errHandler.recoverInline(this); - } - else { - if ( _input.LA(1)==Token.EOF ) matchedEOF = true; - _errHandler.reportMatch(this); - consume(); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Signed_numerical_literalContext extends ParserRuleContext { - public Unsigned_numeric_literalContext unsigned_numeric_literal() { - return getRuleContext(Unsigned_numeric_literalContext.class,0); - } - public SignContext sign() { - return getRuleContext(SignContext.class,0); - } - public Signed_numerical_literalContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_signed_numerical_literal; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterSigned_numerical_literal(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitSigned_numerical_literal(this); - } - } - - public final Signed_numerical_literalContext signed_numerical_literal() throws RecognitionException { - Signed_numerical_literalContext _localctx = new Signed_numerical_literalContext(_ctx, getState()); - enterRule(_localctx, 116, RULE_signed_numerical_literal); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(881); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==PLUS || _la==MINUS) { - { - setState(880); - sign(); - } - } - - setState(883); - unsigned_numeric_literal(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Set_function_specificationContext extends ParserRuleContext { - public Aggregate_functionContext aggregate_function() { - return getRuleContext(Aggregate_functionContext.class,0); - } - public Set_function_specificationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_set_function_specification; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterSet_function_specification(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitSet_function_specification(this); - } - } - - public final Set_function_specificationContext set_function_specification() throws RecognitionException { - Set_function_specificationContext _localctx = new Set_function_specificationContext(_ctx, getState()); - enterRule(_localctx, 118, RULE_set_function_specification); - try { - enterOuterAlt(_localctx, 1); - { - setState(885); - aggregate_function(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Aggregate_functionContext extends ParserRuleContext { - public TerminalNode COUNT() { return getToken(SQLParser.COUNT, 0); } - public TerminalNode LEFT_PAREN() { return getToken(SQLParser.LEFT_PAREN, 0); } - public TerminalNode MULTIPLY() { return getToken(SQLParser.MULTIPLY, 0); } - public TerminalNode RIGHT_PAREN() { return getToken(SQLParser.RIGHT_PAREN, 0); } - public General_set_functionContext general_set_function() { - return getRuleContext(General_set_functionContext.class,0); - } - public Filter_clauseContext filter_clause() { - return getRuleContext(Filter_clauseContext.class,0); - } - public Aggregate_functionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_aggregate_function; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterAggregate_function(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitAggregate_function(this); - } - } - - public final Aggregate_functionContext aggregate_function() throws RecognitionException { - Aggregate_functionContext _localctx = new Aggregate_functionContext(_ctx, getState()); - enterRule(_localctx, 120, RULE_aggregate_function); - try { - setState(895); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,71,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(887); - match(COUNT); - setState(888); - match(LEFT_PAREN); - setState(889); - match(MULTIPLY); - setState(890); - match(RIGHT_PAREN); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(891); - general_set_function(); - setState(893); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,70,_ctx) ) { - case 1: - { - setState(892); - filter_clause(); - } - break; - } - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class General_set_functionContext extends ParserRuleContext { - public Set_function_typeContext set_function_type() { - return getRuleContext(Set_function_typeContext.class,0); - } - public TerminalNode LEFT_PAREN() { return getToken(SQLParser.LEFT_PAREN, 0); } - public Value_expressionContext value_expression() { - return getRuleContext(Value_expressionContext.class,0); - } - public TerminalNode RIGHT_PAREN() { return getToken(SQLParser.RIGHT_PAREN, 0); } - public Set_qualifierContext set_qualifier() { - return getRuleContext(Set_qualifierContext.class,0); - } - public General_set_functionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_general_set_function; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterGeneral_set_function(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitGeneral_set_function(this); - } - } - - public final General_set_functionContext general_set_function() throws RecognitionException { - General_set_functionContext _localctx = new General_set_functionContext(_ctx, getState()); - enterRule(_localctx, 122, RULE_general_set_function); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(897); - set_function_type(); - setState(898); - match(LEFT_PAREN); - setState(900); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==ALL || _la==DISTINCT) { - { - setState(899); - set_qualifier(); - } - } - - setState(902); - value_expression(); - setState(903); - match(RIGHT_PAREN); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Set_function_typeContext extends ParserRuleContext { - public TerminalNode AVG() { return getToken(SQLParser.AVG, 0); } - public TerminalNode MAX() { return getToken(SQLParser.MAX, 0); } - public TerminalNode MIN() { return getToken(SQLParser.MIN, 0); } - public TerminalNode SUM() { return getToken(SQLParser.SUM, 0); } - public TerminalNode EVERY() { return getToken(SQLParser.EVERY, 0); } - public TerminalNode ANY() { return getToken(SQLParser.ANY, 0); } - public TerminalNode SOME() { return getToken(SQLParser.SOME, 0); } - public TerminalNode COUNT() { return getToken(SQLParser.COUNT, 0); } - public TerminalNode STDDEV_POP() { return getToken(SQLParser.STDDEV_POP, 0); } - public TerminalNode STDDEV_SAMP() { return getToken(SQLParser.STDDEV_SAMP, 0); } - public TerminalNode VAR_SAMP() { return getToken(SQLParser.VAR_SAMP, 0); } - public TerminalNode VAR_POP() { return getToken(SQLParser.VAR_POP, 0); } - public TerminalNode COLLECT() { return getToken(SQLParser.COLLECT, 0); } - public TerminalNode FUSION() { return getToken(SQLParser.FUSION, 0); } - public TerminalNode INTERSECTION() { return getToken(SQLParser.INTERSECTION, 0); } - public Set_function_typeContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_set_function_type; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterSet_function_type(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitSet_function_type(this); - } - } - - public final Set_function_typeContext set_function_type() throws RecognitionException { - Set_function_typeContext _localctx = new Set_function_typeContext(_ctx, getState()); - enterRule(_localctx, 124, RULE_set_function_type); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(905); - _la = _input.LA(1); - if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << ANY) | (1L << SOME) | (1L << AVG) | (1L << COLLECT) | (1L << COUNT))) != 0) || ((((_la - 71)) & ~0x3f) == 0 && ((1L << (_la - 71)) & ((1L << (EVERY - 71)) | (1L << (FUSION - 71)) | (1L << (INTERSECTION - 71)) | (1L << (MAX - 71)) | (1L << (MIN - 71)) | (1L << (STDDEV_POP - 71)) | (1L << (STDDEV_SAMP - 71)) | (1L << (SUM - 71)) | (1L << (VAR_SAMP - 71)) | (1L << (VAR_POP - 71)))) != 0)) ) { - _errHandler.recoverInline(this); - } - else { - if ( _input.LA(1)==Token.EOF ) matchedEOF = true; - _errHandler.reportMatch(this); - consume(); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Filter_clauseContext extends ParserRuleContext { - public TerminalNode FILTER() { return getToken(SQLParser.FILTER, 0); } - public TerminalNode LEFT_PAREN() { return getToken(SQLParser.LEFT_PAREN, 0); } - public TerminalNode WHERE() { return getToken(SQLParser.WHERE, 0); } - public Search_conditionContext search_condition() { - return getRuleContext(Search_conditionContext.class,0); - } - public TerminalNode RIGHT_PAREN() { return getToken(SQLParser.RIGHT_PAREN, 0); } - public Filter_clauseContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_filter_clause; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterFilter_clause(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitFilter_clause(this); - } - } - - public final Filter_clauseContext filter_clause() throws RecognitionException { - Filter_clauseContext _localctx = new Filter_clauseContext(_ctx, getState()); - enterRule(_localctx, 126, RULE_filter_clause); - try { - enterOuterAlt(_localctx, 1); - { - setState(907); - match(FILTER); - setState(908); - match(LEFT_PAREN); - setState(909); - match(WHERE); - setState(910); - search_condition(); - setState(911); - match(RIGHT_PAREN); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Grouping_operationContext extends ParserRuleContext { - public TerminalNode GROUPING() { return getToken(SQLParser.GROUPING, 0); } - public TerminalNode LEFT_PAREN() { return getToken(SQLParser.LEFT_PAREN, 0); } - public Column_reference_listContext column_reference_list() { - return getRuleContext(Column_reference_listContext.class,0); - } - public TerminalNode RIGHT_PAREN() { return getToken(SQLParser.RIGHT_PAREN, 0); } - public Grouping_operationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_grouping_operation; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterGrouping_operation(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitGrouping_operation(this); - } - } - - public final Grouping_operationContext grouping_operation() throws RecognitionException { - Grouping_operationContext _localctx = new Grouping_operationContext(_ctx, getState()); - enterRule(_localctx, 128, RULE_grouping_operation); - try { - enterOuterAlt(_localctx, 1); - { - setState(913); - match(GROUPING); - setState(914); - match(LEFT_PAREN); - setState(915); - column_reference_list(); - setState(916); - match(RIGHT_PAREN); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Case_expressionContext extends ParserRuleContext { - public Case_specificationContext case_specification() { - return getRuleContext(Case_specificationContext.class,0); - } - public Case_expressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_case_expression; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterCase_expression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitCase_expression(this); - } - } - - public final Case_expressionContext case_expression() throws RecognitionException { - Case_expressionContext _localctx = new Case_expressionContext(_ctx, getState()); - enterRule(_localctx, 130, RULE_case_expression); - try { - enterOuterAlt(_localctx, 1); - { - setState(918); - case_specification(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Case_abbreviationContext extends ParserRuleContext { - public TerminalNode NULLIF() { return getToken(SQLParser.NULLIF, 0); } - public TerminalNode LEFT_PAREN() { return getToken(SQLParser.LEFT_PAREN, 0); } - public Numeric_value_expressionContext numeric_value_expression() { - return getRuleContext(Numeric_value_expressionContext.class,0); - } - public List COMMA() { return getTokens(SQLParser.COMMA); } - public TerminalNode COMMA(int i) { - return getToken(SQLParser.COMMA, i); - } - public List boolean_value_expression() { - return getRuleContexts(Boolean_value_expressionContext.class); - } - public Boolean_value_expressionContext boolean_value_expression(int i) { - return getRuleContext(Boolean_value_expressionContext.class,i); - } - public TerminalNode RIGHT_PAREN() { return getToken(SQLParser.RIGHT_PAREN, 0); } - public TerminalNode COALESCE() { return getToken(SQLParser.COALESCE, 0); } - public Case_abbreviationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_case_abbreviation; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterCase_abbreviation(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitCase_abbreviation(this); - } - } - - public final Case_abbreviationContext case_abbreviation() throws RecognitionException { - Case_abbreviationContext _localctx = new Case_abbreviationContext(_ctx, getState()); - enterRule(_localctx, 132, RULE_case_abbreviation); - int _la; - try { - setState(938); - _errHandler.sync(this); - switch (_input.LA(1)) { - case NULLIF: - enterOuterAlt(_localctx, 1); - { - setState(920); - match(NULLIF); - setState(921); - match(LEFT_PAREN); - setState(922); - numeric_value_expression(); - setState(923); - match(COMMA); - setState(924); - boolean_value_expression(); - setState(925); - match(RIGHT_PAREN); - } - break; - case COALESCE: - enterOuterAlt(_localctx, 2); - { - setState(927); - match(COALESCE); - setState(928); - match(LEFT_PAREN); - setState(929); - numeric_value_expression(); - setState(932); - _errHandler.sync(this); - _la = _input.LA(1); - do { - { - { - setState(930); - match(COMMA); - setState(931); - boolean_value_expression(); - } - } - setState(934); - _errHandler.sync(this); - _la = _input.LA(1); - } while ( _la==COMMA ); - setState(936); - match(RIGHT_PAREN); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Case_specificationContext extends ParserRuleContext { - public Simple_caseContext simple_case() { - return getRuleContext(Simple_caseContext.class,0); - } - public Searched_caseContext searched_case() { - return getRuleContext(Searched_caseContext.class,0); - } - public Case_specificationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_case_specification; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterCase_specification(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitCase_specification(this); - } - } - - public final Case_specificationContext case_specification() throws RecognitionException { - Case_specificationContext _localctx = new Case_specificationContext(_ctx, getState()); - enterRule(_localctx, 134, RULE_case_specification); - try { - setState(942); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,75,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(940); - simple_case(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(941); - searched_case(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Simple_caseContext extends ParserRuleContext { - public TerminalNode CASE() { return getToken(SQLParser.CASE, 0); } - public Boolean_value_expressionContext boolean_value_expression() { - return getRuleContext(Boolean_value_expressionContext.class,0); - } - public TerminalNode END() { return getToken(SQLParser.END, 0); } - public List simple_when_clause() { - return getRuleContexts(Simple_when_clauseContext.class); - } - public Simple_when_clauseContext simple_when_clause(int i) { - return getRuleContext(Simple_when_clauseContext.class,i); - } - public Else_clauseContext else_clause() { - return getRuleContext(Else_clauseContext.class,0); - } - public Simple_caseContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_simple_case; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterSimple_case(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitSimple_case(this); - } - } - - public final Simple_caseContext simple_case() throws RecognitionException { - Simple_caseContext _localctx = new Simple_caseContext(_ctx, getState()); - enterRule(_localctx, 136, RULE_simple_case); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(944); - match(CASE); - setState(945); - boolean_value_expression(); - setState(947); - _errHandler.sync(this); - _la = _input.LA(1); - do { - { - { - setState(946); - simple_when_clause(); - } - } - setState(949); - _errHandler.sync(this); - _la = _input.LA(1); - } while ( _la==WHEN ); - setState(952); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==ELSE) { - { - setState(951); - else_clause(); - } - } - - setState(954); - match(END); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Searched_caseContext extends ParserRuleContext { - public TerminalNode CASE() { return getToken(SQLParser.CASE, 0); } - public TerminalNode END() { return getToken(SQLParser.END, 0); } - public List searched_when_clause() { - return getRuleContexts(Searched_when_clauseContext.class); - } - public Searched_when_clauseContext searched_when_clause(int i) { - return getRuleContext(Searched_when_clauseContext.class,i); - } - public Else_clauseContext else_clause() { - return getRuleContext(Else_clauseContext.class,0); - } - public Searched_caseContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_searched_case; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterSearched_case(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitSearched_case(this); - } - } - - public final Searched_caseContext searched_case() throws RecognitionException { - Searched_caseContext _localctx = new Searched_caseContext(_ctx, getState()); - enterRule(_localctx, 138, RULE_searched_case); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(956); - match(CASE); - setState(958); - _errHandler.sync(this); - _la = _input.LA(1); - do { - { - { - setState(957); - searched_when_clause(); - } - } - setState(960); - _errHandler.sync(this); - _la = _input.LA(1); - } while ( _la==WHEN ); - setState(963); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==ELSE) { - { - setState(962); - else_clause(); - } - } - - setState(965); - match(END); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Simple_when_clauseContext extends ParserRuleContext { - public TerminalNode WHEN() { return getToken(SQLParser.WHEN, 0); } - public Search_conditionContext search_condition() { - return getRuleContext(Search_conditionContext.class,0); - } - public TerminalNode THEN() { return getToken(SQLParser.THEN, 0); } - public ResultContext result() { - return getRuleContext(ResultContext.class,0); - } - public Simple_when_clauseContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_simple_when_clause; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterSimple_when_clause(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitSimple_when_clause(this); - } - } - - public final Simple_when_clauseContext simple_when_clause() throws RecognitionException { - Simple_when_clauseContext _localctx = new Simple_when_clauseContext(_ctx, getState()); - enterRule(_localctx, 140, RULE_simple_when_clause); - try { - enterOuterAlt(_localctx, 1); - { - setState(967); - match(WHEN); - setState(968); - search_condition(); - setState(969); - match(THEN); - setState(970); - result(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Searched_when_clauseContext extends ParserRuleContext { - public Search_conditionContext c; - public ResultContext r; - public TerminalNode WHEN() { return getToken(SQLParser.WHEN, 0); } - public TerminalNode THEN() { return getToken(SQLParser.THEN, 0); } - public Search_conditionContext search_condition() { - return getRuleContext(Search_conditionContext.class,0); - } - public ResultContext result() { - return getRuleContext(ResultContext.class,0); - } - public Searched_when_clauseContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_searched_when_clause; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterSearched_when_clause(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitSearched_when_clause(this); - } - } - - public final Searched_when_clauseContext searched_when_clause() throws RecognitionException { - Searched_when_clauseContext _localctx = new Searched_when_clauseContext(_ctx, getState()); - enterRule(_localctx, 142, RULE_searched_when_clause); - try { - enterOuterAlt(_localctx, 1); - { - setState(972); - match(WHEN); - setState(973); - ((Searched_when_clauseContext)_localctx).c = search_condition(); - setState(974); - match(THEN); - setState(975); - ((Searched_when_clauseContext)_localctx).r = result(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Else_clauseContext extends ParserRuleContext { - public ResultContext r; - public TerminalNode ELSE() { return getToken(SQLParser.ELSE, 0); } - public ResultContext result() { - return getRuleContext(ResultContext.class,0); - } - public Else_clauseContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_else_clause; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterElse_clause(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitElse_clause(this); - } - } - - public final Else_clauseContext else_clause() throws RecognitionException { - Else_clauseContext _localctx = new Else_clauseContext(_ctx, getState()); - enterRule(_localctx, 144, RULE_else_clause); - try { - enterOuterAlt(_localctx, 1); - { - setState(977); - match(ELSE); - setState(978); - ((Else_clauseContext)_localctx).r = result(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class ResultContext extends ParserRuleContext { - public Value_expressionContext value_expression() { - return getRuleContext(Value_expressionContext.class,0); - } - public TerminalNode NULL() { return getToken(SQLParser.NULL, 0); } - public ResultContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_result; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterResult(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitResult(this); - } - } - - public final ResultContext result() throws RecognitionException { - ResultContext _localctx = new ResultContext(_ctx, getState()); - enterRule(_localctx, 146, RULE_result); - try { - setState(982); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,80,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(980); - value_expression(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(981); - match(NULL); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Cast_specificationContext extends ParserRuleContext { - public TerminalNode CAST() { return getToken(SQLParser.CAST, 0); } - public TerminalNode LEFT_PAREN() { return getToken(SQLParser.LEFT_PAREN, 0); } - public Cast_operandContext cast_operand() { - return getRuleContext(Cast_operandContext.class,0); - } - public TerminalNode AS() { return getToken(SQLParser.AS, 0); } - public Cast_targetContext cast_target() { - return getRuleContext(Cast_targetContext.class,0); - } - public TerminalNode RIGHT_PAREN() { return getToken(SQLParser.RIGHT_PAREN, 0); } - public Cast_specificationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_cast_specification; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterCast_specification(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitCast_specification(this); - } - } - - public final Cast_specificationContext cast_specification() throws RecognitionException { - Cast_specificationContext _localctx = new Cast_specificationContext(_ctx, getState()); - enterRule(_localctx, 148, RULE_cast_specification); - try { - enterOuterAlt(_localctx, 1); - { - setState(984); - match(CAST); - setState(985); - match(LEFT_PAREN); - setState(986); - cast_operand(); - setState(987); - match(AS); - setState(988); - cast_target(); - setState(989); - match(RIGHT_PAREN); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Cast_operandContext extends ParserRuleContext { - public Value_expressionContext value_expression() { - return getRuleContext(Value_expressionContext.class,0); - } - public Cast_operandContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_cast_operand; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterCast_operand(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitCast_operand(this); - } - } - - public final Cast_operandContext cast_operand() throws RecognitionException { - Cast_operandContext _localctx = new Cast_operandContext(_ctx, getState()); - enterRule(_localctx, 150, RULE_cast_operand); - try { - enterOuterAlt(_localctx, 1); - { - setState(991); - value_expression(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Cast_targetContext extends ParserRuleContext { - public Data_typeContext data_type() { - return getRuleContext(Data_typeContext.class,0); - } - public Cast_targetContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_cast_target; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterCast_target(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitCast_target(this); - } - } - - public final Cast_targetContext cast_target() throws RecognitionException { - Cast_targetContext _localctx = new Cast_targetContext(_ctx, getState()); - enterRule(_localctx, 152, RULE_cast_target); - try { - enterOuterAlt(_localctx, 1); - { - setState(993); - data_type(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Value_expressionContext extends ParserRuleContext { - public Common_value_expressionContext common_value_expression() { - return getRuleContext(Common_value_expressionContext.class,0); - } - public Row_value_expressionContext row_value_expression() { - return getRuleContext(Row_value_expressionContext.class,0); - } - public Boolean_value_expressionContext boolean_value_expression() { - return getRuleContext(Boolean_value_expressionContext.class,0); - } - public Value_expressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_value_expression; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterValue_expression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitValue_expression(this); - } - } - - public final Value_expressionContext value_expression() throws RecognitionException { - Value_expressionContext _localctx = new Value_expressionContext(_ctx, getState()); - enterRule(_localctx, 154, RULE_value_expression); - try { - setState(998); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,81,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(995); - common_value_expression(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(996); - row_value_expression(); - } - break; - case 3: - enterOuterAlt(_localctx, 3); - { - setState(997); - boolean_value_expression(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Common_value_expressionContext extends ParserRuleContext { - public Numeric_value_expressionContext numeric_value_expression() { - return getRuleContext(Numeric_value_expressionContext.class,0); - } - public String_value_expressionContext string_value_expression() { - return getRuleContext(String_value_expressionContext.class,0); - } - public TerminalNode NULL() { return getToken(SQLParser.NULL, 0); } - public Common_value_expressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_common_value_expression; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterCommon_value_expression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitCommon_value_expression(this); - } - } - - public final Common_value_expressionContext common_value_expression() throws RecognitionException { - Common_value_expressionContext _localctx = new Common_value_expressionContext(_ctx, getState()); - enterRule(_localctx, 156, RULE_common_value_expression); - try { - setState(1003); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,82,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(1000); - numeric_value_expression(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(1001); - string_value_expression(); - } - break; - case 3: - enterOuterAlt(_localctx, 3); - { - setState(1002); - match(NULL); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Numeric_value_expressionContext extends ParserRuleContext { - public TermContext left; - public TermContext right; - public List term() { - return getRuleContexts(TermContext.class); - } - public TermContext term(int i) { - return getRuleContext(TermContext.class,i); - } - public List PLUS() { return getTokens(SQLParser.PLUS); } - public TerminalNode PLUS(int i) { - return getToken(SQLParser.PLUS, i); - } - public List MINUS() { return getTokens(SQLParser.MINUS); } - public TerminalNode MINUS(int i) { - return getToken(SQLParser.MINUS, i); - } - public Numeric_value_expressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_numeric_value_expression; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterNumeric_value_expression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitNumeric_value_expression(this); - } - } - - public final Numeric_value_expressionContext numeric_value_expression() throws RecognitionException { - Numeric_value_expressionContext _localctx = new Numeric_value_expressionContext(_ctx, getState()); - enterRule(_localctx, 158, RULE_numeric_value_expression); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1005); - ((Numeric_value_expressionContext)_localctx).left = term(); - setState(1010); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==PLUS || _la==MINUS) { - { - { - setState(1006); - _la = _input.LA(1); - if ( !(_la==PLUS || _la==MINUS) ) { - _errHandler.recoverInline(this); - } - else { - if ( _input.LA(1)==Token.EOF ) matchedEOF = true; - _errHandler.reportMatch(this); - consume(); - } - setState(1007); - ((Numeric_value_expressionContext)_localctx).right = term(); - } - } - setState(1012); - _errHandler.sync(this); - _la = _input.LA(1); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class TermContext extends ParserRuleContext { - public FactorContext left; - public FactorContext right; - public List factor() { - return getRuleContexts(FactorContext.class); - } - public FactorContext factor(int i) { - return getRuleContext(FactorContext.class,i); - } - public List MULTIPLY() { return getTokens(SQLParser.MULTIPLY); } - public TerminalNode MULTIPLY(int i) { - return getToken(SQLParser.MULTIPLY, i); - } - public List DIVIDE() { return getTokens(SQLParser.DIVIDE); } - public TerminalNode DIVIDE(int i) { - return getToken(SQLParser.DIVIDE, i); - } - public List MODULAR() { return getTokens(SQLParser.MODULAR); } - public TerminalNode MODULAR(int i) { - return getToken(SQLParser.MODULAR, i); - } - public TermContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_term; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterTerm(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitTerm(this); - } - } - - public final TermContext term() throws RecognitionException { - TermContext _localctx = new TermContext(_ctx, getState()); - enterRule(_localctx, 160, RULE_term); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1013); - ((TermContext)_localctx).left = factor(); - setState(1018); - _errHandler.sync(this); - _la = _input.LA(1); - while (((((_la - 188)) & ~0x3f) == 0 && ((1L << (_la - 188)) & ((1L << (MULTIPLY - 188)) | (1L << (DIVIDE - 188)) | (1L << (MODULAR - 188)))) != 0)) { - { - { - setState(1014); - _la = _input.LA(1); - if ( !(((((_la - 188)) & ~0x3f) == 0 && ((1L << (_la - 188)) & ((1L << (MULTIPLY - 188)) | (1L << (DIVIDE - 188)) | (1L << (MODULAR - 188)))) != 0)) ) { - _errHandler.recoverInline(this); - } - else { - if ( _input.LA(1)==Token.EOF ) matchedEOF = true; - _errHandler.reportMatch(this); - consume(); - } - setState(1015); - ((TermContext)_localctx).right = factor(); - } - } - setState(1020); - _errHandler.sync(this); - _la = _input.LA(1); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class FactorContext extends ParserRuleContext { - public Numeric_primaryContext numeric_primary() { - return getRuleContext(Numeric_primaryContext.class,0); - } - public SignContext sign() { - return getRuleContext(SignContext.class,0); - } - public FactorContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_factor; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterFactor(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitFactor(this); - } - } - - public final FactorContext factor() throws RecognitionException { - FactorContext _localctx = new FactorContext(_ctx, getState()); - enterRule(_localctx, 162, RULE_factor); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1022); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==PLUS || _la==MINUS) { - { - setState(1021); - sign(); - } - } - - setState(1024); - numeric_primary(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class ArrayContext extends ParserRuleContext { - public TerminalNode LEFT_PAREN() { return getToken(SQLParser.LEFT_PAREN, 0); } - public List numeric_value_expression() { - return getRuleContexts(Numeric_value_expressionContext.class); - } - public Numeric_value_expressionContext numeric_value_expression(int i) { - return getRuleContext(Numeric_value_expressionContext.class,i); - } - public TerminalNode RIGHT_PAREN() { return getToken(SQLParser.RIGHT_PAREN, 0); } - public List COMMA() { return getTokens(SQLParser.COMMA); } - public TerminalNode COMMA(int i) { - return getToken(SQLParser.COMMA, i); - } - public ArrayContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_array; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterArray(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitArray(this); - } - } - - public final ArrayContext array() throws RecognitionException { - ArrayContext _localctx = new ArrayContext(_ctx, getState()); - enterRule(_localctx, 164, RULE_array); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1026); - match(LEFT_PAREN); - setState(1027); - numeric_value_expression(); - setState(1032); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==COMMA) { - { - { - setState(1028); - match(COMMA); - setState(1029); - numeric_value_expression(); - } - } - setState(1034); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(1035); - match(RIGHT_PAREN); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Numeric_primaryContext extends ParserRuleContext { - public Value_expression_primaryContext value_expression_primary() { - return getRuleContext(Value_expression_primaryContext.class,0); - } - public List CAST_EXPRESSION() { return getTokens(SQLParser.CAST_EXPRESSION); } - public TerminalNode CAST_EXPRESSION(int i) { - return getToken(SQLParser.CAST_EXPRESSION, i); - } - public List cast_target() { - return getRuleContexts(Cast_targetContext.class); - } - public Cast_targetContext cast_target(int i) { - return getRuleContext(Cast_targetContext.class,i); - } - public Numeric_value_functionContext numeric_value_function() { - return getRuleContext(Numeric_value_functionContext.class,0); - } - public Numeric_primaryContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_numeric_primary; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterNumeric_primary(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitNumeric_primary(this); - } - } - - public final Numeric_primaryContext numeric_primary() throws RecognitionException { - Numeric_primaryContext _localctx = new Numeric_primaryContext(_ctx, getState()); - enterRule(_localctx, 166, RULE_numeric_primary); - int _la; - try { - setState(1046); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,88,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(1037); - value_expression_primary(); - setState(1042); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==CAST_EXPRESSION) { - { - { - setState(1038); - match(CAST_EXPRESSION); - setState(1039); - cast_target(); - } - } - setState(1044); - _errHandler.sync(this); - _la = _input.LA(1); - } - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(1045); - numeric_value_function(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class SignContext extends ParserRuleContext { - public TerminalNode PLUS() { return getToken(SQLParser.PLUS, 0); } - public TerminalNode MINUS() { return getToken(SQLParser.MINUS, 0); } - public SignContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_sign; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterSign(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitSign(this); - } - } - - public final SignContext sign() throws RecognitionException { - SignContext _localctx = new SignContext(_ctx, getState()); - enterRule(_localctx, 168, RULE_sign); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1048); - _la = _input.LA(1); - if ( !(_la==PLUS || _la==MINUS) ) { - _errHandler.recoverInline(this); - } - else { - if ( _input.LA(1)==Token.EOF ) matchedEOF = true; - _errHandler.reportMatch(this); - consume(); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Numeric_value_functionContext extends ParserRuleContext { - public Extract_expressionContext extract_expression() { - return getRuleContext(Extract_expressionContext.class,0); - } - public Numeric_value_functionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_numeric_value_function; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterNumeric_value_function(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitNumeric_value_function(this); - } - } - - public final Numeric_value_functionContext numeric_value_function() throws RecognitionException { - Numeric_value_functionContext _localctx = new Numeric_value_functionContext(_ctx, getState()); - enterRule(_localctx, 170, RULE_numeric_value_function); - try { - enterOuterAlt(_localctx, 1); - { - setState(1050); - extract_expression(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Extract_expressionContext extends ParserRuleContext { - public Extract_fieldContext extract_field_string; - public TerminalNode EXTRACT() { return getToken(SQLParser.EXTRACT, 0); } - public TerminalNode LEFT_PAREN() { return getToken(SQLParser.LEFT_PAREN, 0); } - public TerminalNode FROM() { return getToken(SQLParser.FROM, 0); } - public Extract_sourceContext extract_source() { - return getRuleContext(Extract_sourceContext.class,0); - } - public TerminalNode RIGHT_PAREN() { return getToken(SQLParser.RIGHT_PAREN, 0); } - public Extract_fieldContext extract_field() { - return getRuleContext(Extract_fieldContext.class,0); - } - public Extract_expressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_extract_expression; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterExtract_expression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitExtract_expression(this); - } - } - - public final Extract_expressionContext extract_expression() throws RecognitionException { - Extract_expressionContext _localctx = new Extract_expressionContext(_ctx, getState()); - enterRule(_localctx, 172, RULE_extract_expression); - try { - enterOuterAlt(_localctx, 1); - { - setState(1052); - match(EXTRACT); - setState(1053); - match(LEFT_PAREN); - setState(1054); - ((Extract_expressionContext)_localctx).extract_field_string = extract_field(); - setState(1055); - match(FROM); - setState(1056); - extract_source(); - setState(1057); - match(RIGHT_PAREN); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Extract_fieldContext extends ParserRuleContext { - public Primary_datetime_fieldContext primary_datetime_field() { - return getRuleContext(Primary_datetime_fieldContext.class,0); - } - public Time_zone_fieldContext time_zone_field() { - return getRuleContext(Time_zone_fieldContext.class,0); - } - public Extended_datetime_fieldContext extended_datetime_field() { - return getRuleContext(Extended_datetime_fieldContext.class,0); - } - public Extract_fieldContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_extract_field; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterExtract_field(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitExtract_field(this); - } - } - - public final Extract_fieldContext extract_field() throws RecognitionException { - Extract_fieldContext _localctx = new Extract_fieldContext(_ctx, getState()); - enterRule(_localctx, 174, RULE_extract_field); - try { - setState(1062); - _errHandler.sync(this); - switch (_input.LA(1)) { - case DAY: - case HOUR: - case MINUTE: - case MONTH: - case SECOND: - case YEAR: - enterOuterAlt(_localctx, 1); - { - setState(1059); - primary_datetime_field(); - } - break; - case TIMEZONE: - case TIMEZONE_HOUR: - case TIMEZONE_MINUTE: - enterOuterAlt(_localctx, 2); - { - setState(1060); - time_zone_field(); - } - break; - case CENTURY: - case DECADE: - case DOW: - case DOY: - case EPOCH: - case ISODOW: - case ISOYEAR: - case MICROSECONDS: - case MILLENNIUM: - case MILLISECONDS: - case QUARTER: - case WEEK: - enterOuterAlt(_localctx, 3); - { - setState(1061); - extended_datetime_field(); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Time_zone_fieldContext extends ParserRuleContext { - public TerminalNode TIMEZONE() { return getToken(SQLParser.TIMEZONE, 0); } - public TerminalNode TIMEZONE_HOUR() { return getToken(SQLParser.TIMEZONE_HOUR, 0); } - public TerminalNode TIMEZONE_MINUTE() { return getToken(SQLParser.TIMEZONE_MINUTE, 0); } - public Time_zone_fieldContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_time_zone_field; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterTime_zone_field(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitTime_zone_field(this); - } - } - - public final Time_zone_fieldContext time_zone_field() throws RecognitionException { - Time_zone_fieldContext _localctx = new Time_zone_fieldContext(_ctx, getState()); - enterRule(_localctx, 176, RULE_time_zone_field); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1064); - _la = _input.LA(1); - if ( !(((((_la - 120)) & ~0x3f) == 0 && ((1L << (_la - 120)) & ((1L << (TIMEZONE - 120)) | (1L << (TIMEZONE_HOUR - 120)) | (1L << (TIMEZONE_MINUTE - 120)))) != 0)) ) { - _errHandler.recoverInline(this); - } - else { - if ( _input.LA(1)==Token.EOF ) matchedEOF = true; - _errHandler.reportMatch(this); - consume(); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Extract_sourceContext extends ParserRuleContext { - public Column_referenceContext column_reference() { - return getRuleContext(Column_referenceContext.class,0); - } - public Datetime_literalContext datetime_literal() { - return getRuleContext(Datetime_literalContext.class,0); - } - public Extract_sourceContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_extract_source; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterExtract_source(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitExtract_source(this); - } - } - - public final Extract_sourceContext extract_source() throws RecognitionException { - Extract_sourceContext _localctx = new Extract_sourceContext(_ctx, getState()); - enterRule(_localctx, 178, RULE_extract_source); - try { - setState(1068); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,90,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(1066); - column_reference(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(1067); - datetime_literal(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class String_value_expressionContext extends ParserRuleContext { - public Character_value_expressionContext character_value_expression() { - return getRuleContext(Character_value_expressionContext.class,0); - } - public String_value_expressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_string_value_expression; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterString_value_expression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitString_value_expression(this); - } - } - - public final String_value_expressionContext string_value_expression() throws RecognitionException { - String_value_expressionContext _localctx = new String_value_expressionContext(_ctx, getState()); - enterRule(_localctx, 180, RULE_string_value_expression); - try { - enterOuterAlt(_localctx, 1); - { - setState(1070); - character_value_expression(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Character_value_expressionContext extends ParserRuleContext { - public List character_factor() { - return getRuleContexts(Character_factorContext.class); - } - public Character_factorContext character_factor(int i) { - return getRuleContext(Character_factorContext.class,i); - } - public List CONCATENATION_OPERATOR() { return getTokens(SQLParser.CONCATENATION_OPERATOR); } - public TerminalNode CONCATENATION_OPERATOR(int i) { - return getToken(SQLParser.CONCATENATION_OPERATOR, i); - } - public Character_value_expressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_character_value_expression; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterCharacter_value_expression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitCharacter_value_expression(this); - } - } - - public final Character_value_expressionContext character_value_expression() throws RecognitionException { - Character_value_expressionContext _localctx = new Character_value_expressionContext(_ctx, getState()); - enterRule(_localctx, 182, RULE_character_value_expression); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1072); - character_factor(); - setState(1077); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==CONCATENATION_OPERATOR) { - { - { - setState(1073); - match(CONCATENATION_OPERATOR); - setState(1074); - character_factor(); - } - } - setState(1079); - _errHandler.sync(this); - _la = _input.LA(1); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Character_factorContext extends ParserRuleContext { - public Character_primaryContext character_primary() { - return getRuleContext(Character_primaryContext.class,0); - } - public Character_factorContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_character_factor; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterCharacter_factor(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitCharacter_factor(this); - } - } - - public final Character_factorContext character_factor() throws RecognitionException { - Character_factorContext _localctx = new Character_factorContext(_ctx, getState()); - enterRule(_localctx, 184, RULE_character_factor); - try { - enterOuterAlt(_localctx, 1); - { - setState(1080); - character_primary(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Character_primaryContext extends ParserRuleContext { - public Value_expression_primaryContext value_expression_primary() { - return getRuleContext(Value_expression_primaryContext.class,0); - } - public String_value_functionContext string_value_function() { - return getRuleContext(String_value_functionContext.class,0); - } - public Character_primaryContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_character_primary; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterCharacter_primary(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitCharacter_primary(this); - } - } - - public final Character_primaryContext character_primary() throws RecognitionException { - Character_primaryContext _localctx = new Character_primaryContext(_ctx, getState()); - enterRule(_localctx, 186, RULE_character_primary); - try { - setState(1084); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,92,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(1082); - value_expression_primary(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(1083); - string_value_function(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class String_value_functionContext extends ParserRuleContext { - public Trim_functionContext trim_function() { - return getRuleContext(Trim_functionContext.class,0); - } - public String_value_functionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_string_value_function; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterString_value_function(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitString_value_function(this); - } - } - - public final String_value_functionContext string_value_function() throws RecognitionException { - String_value_functionContext _localctx = new String_value_functionContext(_ctx, getState()); - enterRule(_localctx, 188, RULE_string_value_function); - try { - enterOuterAlt(_localctx, 1); - { - setState(1086); - trim_function(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Trim_functionContext extends ParserRuleContext { - public TerminalNode TRIM() { return getToken(SQLParser.TRIM, 0); } - public TerminalNode LEFT_PAREN() { return getToken(SQLParser.LEFT_PAREN, 0); } - public Trim_operandsContext trim_operands() { - return getRuleContext(Trim_operandsContext.class,0); - } - public TerminalNode RIGHT_PAREN() { return getToken(SQLParser.RIGHT_PAREN, 0); } - public Trim_functionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_trim_function; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterTrim_function(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitTrim_function(this); - } - } - - public final Trim_functionContext trim_function() throws RecognitionException { - Trim_functionContext _localctx = new Trim_functionContext(_ctx, getState()); - enterRule(_localctx, 190, RULE_trim_function); - try { - enterOuterAlt(_localctx, 1); - { - setState(1088); - match(TRIM); - setState(1089); - match(LEFT_PAREN); - setState(1090); - trim_operands(); - setState(1091); - match(RIGHT_PAREN); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Trim_operandsContext extends ParserRuleContext { - public Character_value_expressionContext trim_character; - public Character_value_expressionContext trim_source; - public List character_value_expression() { - return getRuleContexts(Character_value_expressionContext.class); - } - public Character_value_expressionContext character_value_expression(int i) { - return getRuleContext(Character_value_expressionContext.class,i); - } - public TerminalNode FROM() { return getToken(SQLParser.FROM, 0); } - public Trim_specificationContext trim_specification() { - return getRuleContext(Trim_specificationContext.class,0); - } - public TerminalNode COMMA() { return getToken(SQLParser.COMMA, 0); } - public Trim_operandsContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_trim_operands; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterTrim_operands(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitTrim_operands(this); - } - } - - public final Trim_operandsContext trim_operands() throws RecognitionException { - Trim_operandsContext _localctx = new Trim_operandsContext(_ctx, getState()); - enterRule(_localctx, 192, RULE_trim_operands); - int _la; - try { - setState(1107); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,96,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(1100); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,95,_ctx) ) { - case 1: - { - setState(1094); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << BOTH) | (1L << LEADING) | (1L << TRAILING))) != 0)) { - { - setState(1093); - trim_specification(); - } - } - - setState(1097); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << ANY) | (1L << CASE) | (1L << CAST) | (1L << FALSE) | (1L << LEFT) | (1L << RIGHT) | (1L << SOME) | (1L << TRUE) | (1L << AVG) | (1L << BETWEEN) | (1L << BY) | (1L << CENTURY) | (1L << CHARACTER) | (1L << COLLECT) | (1L << COALESCE) | (1L << COLUMN) | (1L << COUNT) | (1L << CUBE))) != 0) || ((((_la - 64)) & ~0x3f) == 0 && ((1L << (_la - 64)) & ((1L << (DAY - 64)) | (1L << (DEC - 64)) | (1L << (DECADE - 64)) | (1L << (DOW - 64)) | (1L << (DOY - 64)) | (1L << (DROP - 64)) | (1L << (EPOCH - 64)) | (1L << (EVERY - 64)) | (1L << (EXISTS - 64)) | (1L << (EXTERNAL - 64)) | (1L << (EXTRACT - 64)) | (1L << (FILTER - 64)) | (1L << (FIRST - 64)) | (1L << (FORMAT - 64)) | (1L << (FUSION - 64)) | (1L << (GROUPING - 64)) | (1L << (HASH - 64)) | (1L << (INDEX - 64)) | (1L << (INSERT - 64)) | (1L << (INTERSECTION - 64)) | (1L << (ISODOW - 64)) | (1L << (ISOYEAR - 64)) | (1L << (LAST - 64)) | (1L << (LESS - 64)) | (1L << (LIST - 64)) | (1L << (LOCATION - 64)) | (1L << (MAX - 64)) | (1L << (MAXVALUE - 64)) | (1L << (MICROSECONDS - 64)) | (1L << (MILLENNIUM - 64)) | (1L << (MILLISECONDS - 64)) | (1L << (MIN - 64)) | (1L << (MINUTE - 64)) | (1L << (MONTH - 64)) | (1L << (NATIONAL - 64)) | (1L << (NULLIF - 64)) | (1L << (OVERWRITE - 64)) | (1L << (PARTITION - 64)) | (1L << (PARTITIONS - 64)) | (1L << (PRECISION - 64)) | (1L << (PURGE - 64)) | (1L << (QUARTER - 64)) | (1L << (RANGE - 64)) | (1L << (REGEXP - 64)) | (1L << (RLIKE - 64)) | (1L << (ROLLUP - 64)) | (1L << (SECOND - 64)) | (1L << (SET - 64)) | (1L << (SIMILAR - 64)) | (1L << (STDDEV_POP - 64)) | (1L << (STDDEV_SAMP - 64)) | (1L << (SUBPARTITION - 64)) | (1L << (SUM - 64)) | (1L << (TABLESPACE - 64)) | (1L << (THAN - 64)) | (1L << (TIMEZONE - 64)) | (1L << (TIMEZONE_HOUR - 64)) | (1L << (TIMEZONE_MINUTE - 64)) | (1L << (TRIM - 64)) | (1L << (TO - 64)) | (1L << (UNKNOWN - 64)) | (1L << (VALUES - 64)) | (1L << (VAR_SAMP - 64)))) != 0) || ((((_la - 128)) & ~0x3f) == 0 && ((1L << (_la - 128)) & ((1L << (VAR_POP - 128)) | (1L << (VARYING - 128)) | (1L << (WEEK - 128)) | (1L << (YEAR - 128)) | (1L << (ZONE - 128)) | (1L << (BOOLEAN - 128)) | (1L << (BOOL - 128)) | (1L << (BIT - 128)) | (1L << (VARBIT - 128)) | (1L << (INT1 - 128)) | (1L << (INT2 - 128)) | (1L << (INT4 - 128)) | (1L << (INT8 - 128)) | (1L << (TINYINT - 128)) | (1L << (SMALLINT - 128)) | (1L << (INT - 128)) | (1L << (INTEGER - 128)) | (1L << (BIGINT - 128)) | (1L << (FLOAT4 - 128)) | (1L << (FLOAT8 - 128)) | (1L << (REAL - 128)) | (1L << (FLOAT - 128)) | (1L << (DOUBLE - 128)) | (1L << (NUMERIC - 128)) | (1L << (DECIMAL - 128)) | (1L << (CHAR - 128)) | (1L << (VARCHAR - 128)) | (1L << (NCHAR - 128)) | (1L << (NVARCHAR - 128)) | (1L << (DATE - 128)) | (1L << (TIME - 128)) | (1L << (TIMETZ - 128)) | (1L << (TIMESTAMP - 128)) | (1L << (TIMESTAMPTZ - 128)) | (1L << (TEXT - 128)) | (1L << (VARBINARY - 128)) | (1L << (BLOB - 128)) | (1L << (BYTEA - 128)) | (1L << (INET4 - 128)) | (1L << (LEFT_PAREN - 128)))) != 0) || ((((_la - 196)) & ~0x3f) == 0 && ((1L << (_la - 196)) & ((1L << (NUMBER - 196)) | (1L << (REAL_NUMBER - 196)) | (1L << (Identifier - 196)) | (1L << (Character_String_Literal - 196)))) != 0)) { - { - setState(1096); - ((Trim_operandsContext)_localctx).trim_character = character_value_expression(); - } - } - - setState(1099); - match(FROM); - } - break; - } - setState(1102); - ((Trim_operandsContext)_localctx).trim_source = character_value_expression(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(1103); - ((Trim_operandsContext)_localctx).trim_source = character_value_expression(); - setState(1104); - match(COMMA); - setState(1105); - ((Trim_operandsContext)_localctx).trim_character = character_value_expression(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Trim_specificationContext extends ParserRuleContext { - public TerminalNode LEADING() { return getToken(SQLParser.LEADING, 0); } - public TerminalNode TRAILING() { return getToken(SQLParser.TRAILING, 0); } - public TerminalNode BOTH() { return getToken(SQLParser.BOTH, 0); } - public Trim_specificationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_trim_specification; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterTrim_specification(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitTrim_specification(this); - } - } - - public final Trim_specificationContext trim_specification() throws RecognitionException { - Trim_specificationContext _localctx = new Trim_specificationContext(_ctx, getState()); - enterRule(_localctx, 194, RULE_trim_specification); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1109); - _la = _input.LA(1); - if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << BOTH) | (1L << LEADING) | (1L << TRAILING))) != 0)) ) { - _errHandler.recoverInline(this); - } - else { - if ( _input.LA(1)==Token.EOF ) matchedEOF = true; - _errHandler.reportMatch(this); - consume(); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Boolean_value_expressionContext extends ParserRuleContext { - public Or_predicateContext or_predicate() { - return getRuleContext(Or_predicateContext.class,0); - } - public Boolean_value_expressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_boolean_value_expression; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterBoolean_value_expression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitBoolean_value_expression(this); - } - } - - public final Boolean_value_expressionContext boolean_value_expression() throws RecognitionException { - Boolean_value_expressionContext _localctx = new Boolean_value_expressionContext(_ctx, getState()); - enterRule(_localctx, 196, RULE_boolean_value_expression); - try { - enterOuterAlt(_localctx, 1); - { - setState(1111); - or_predicate(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Or_predicateContext extends ParserRuleContext { - public And_predicateContext and_predicate() { - return getRuleContext(And_predicateContext.class,0); - } - public List OR() { return getTokens(SQLParser.OR); } - public TerminalNode OR(int i) { - return getToken(SQLParser.OR, i); - } - public List or_predicate() { - return getRuleContexts(Or_predicateContext.class); - } - public Or_predicateContext or_predicate(int i) { - return getRuleContext(Or_predicateContext.class,i); - } - public Or_predicateContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_or_predicate; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterOr_predicate(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitOr_predicate(this); - } - } - - public final Or_predicateContext or_predicate() throws RecognitionException { - Or_predicateContext _localctx = new Or_predicateContext(_ctx, getState()); - enterRule(_localctx, 198, RULE_or_predicate); - try { - int _alt; - enterOuterAlt(_localctx, 1); - { - setState(1113); - and_predicate(); - setState(1118); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,97,_ctx); - while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { - if ( _alt==1 ) { - { - { - setState(1114); - match(OR); - setState(1115); - or_predicate(); - } - } - } - setState(1120); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,97,_ctx); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class And_predicateContext extends ParserRuleContext { - public Boolean_factorContext boolean_factor() { - return getRuleContext(Boolean_factorContext.class,0); - } - public List AND() { return getTokens(SQLParser.AND); } - public TerminalNode AND(int i) { - return getToken(SQLParser.AND, i); - } - public List and_predicate() { - return getRuleContexts(And_predicateContext.class); - } - public And_predicateContext and_predicate(int i) { - return getRuleContext(And_predicateContext.class,i); - } - public And_predicateContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_and_predicate; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterAnd_predicate(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitAnd_predicate(this); - } - } - - public final And_predicateContext and_predicate() throws RecognitionException { - And_predicateContext _localctx = new And_predicateContext(_ctx, getState()); - enterRule(_localctx, 200, RULE_and_predicate); - try { - int _alt; - enterOuterAlt(_localctx, 1); - { - setState(1121); - boolean_factor(); - setState(1126); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,98,_ctx); - while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { - if ( _alt==1 ) { - { - { - setState(1122); - match(AND); - setState(1123); - and_predicate(); - } - } - } - setState(1128); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,98,_ctx); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Boolean_factorContext extends ParserRuleContext { - public Boolean_testContext boolean_test() { - return getRuleContext(Boolean_testContext.class,0); - } - public TerminalNode NOT() { return getToken(SQLParser.NOT, 0); } - public Boolean_factorContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_boolean_factor; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterBoolean_factor(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitBoolean_factor(this); - } - } - - public final Boolean_factorContext boolean_factor() throws RecognitionException { - Boolean_factorContext _localctx = new Boolean_factorContext(_ctx, getState()); - enterRule(_localctx, 202, RULE_boolean_factor); - try { - setState(1132); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,99,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(1129); - boolean_test(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(1130); - match(NOT); - setState(1131); - boolean_test(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Boolean_testContext extends ParserRuleContext { - public Boolean_primaryContext boolean_primary() { - return getRuleContext(Boolean_primaryContext.class,0); - } - public Is_clauseContext is_clause() { - return getRuleContext(Is_clauseContext.class,0); - } - public Boolean_testContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_boolean_test; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterBoolean_test(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitBoolean_test(this); - } - } - - public final Boolean_testContext boolean_test() throws RecognitionException { - Boolean_testContext _localctx = new Boolean_testContext(_ctx, getState()); - enterRule(_localctx, 204, RULE_boolean_test); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1134); - boolean_primary(); - setState(1136); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==IS) { - { - setState(1135); - is_clause(); - } - } - - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Is_clauseContext extends ParserRuleContext { - public Truth_valueContext t; - public TerminalNode IS() { return getToken(SQLParser.IS, 0); } - public Truth_valueContext truth_value() { - return getRuleContext(Truth_valueContext.class,0); - } - public TerminalNode NOT() { return getToken(SQLParser.NOT, 0); } - public Is_clauseContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_is_clause; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterIs_clause(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitIs_clause(this); - } - } - - public final Is_clauseContext is_clause() throws RecognitionException { - Is_clauseContext _localctx = new Is_clauseContext(_ctx, getState()); - enterRule(_localctx, 206, RULE_is_clause); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1138); - match(IS); - setState(1140); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==NOT) { - { - setState(1139); - match(NOT); - } - } - - setState(1142); - ((Is_clauseContext)_localctx).t = truth_value(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Truth_valueContext extends ParserRuleContext { - public TerminalNode TRUE() { return getToken(SQLParser.TRUE, 0); } - public TerminalNode FALSE() { return getToken(SQLParser.FALSE, 0); } - public TerminalNode UNKNOWN() { return getToken(SQLParser.UNKNOWN, 0); } - public Truth_valueContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_truth_value; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterTruth_value(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitTruth_value(this); - } - } - - public final Truth_valueContext truth_value() throws RecognitionException { - Truth_valueContext _localctx = new Truth_valueContext(_ctx, getState()); - enterRule(_localctx, 208, RULE_truth_value); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1144); - _la = _input.LA(1); - if ( !(_la==FALSE || _la==TRUE || _la==UNKNOWN) ) { - _errHandler.recoverInline(this); - } - else { - if ( _input.LA(1)==Token.EOF ) matchedEOF = true; - _errHandler.reportMatch(this); - consume(); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Boolean_primaryContext extends ParserRuleContext { - public PredicateContext predicate() { - return getRuleContext(PredicateContext.class,0); - } - public Boolean_predicandContext boolean_predicand() { - return getRuleContext(Boolean_predicandContext.class,0); - } - public Boolean_primaryContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_boolean_primary; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterBoolean_primary(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitBoolean_primary(this); - } - } - - public final Boolean_primaryContext boolean_primary() throws RecognitionException { - Boolean_primaryContext _localctx = new Boolean_primaryContext(_ctx, getState()); - enterRule(_localctx, 210, RULE_boolean_primary); - try { - setState(1148); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,102,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(1146); - predicate(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(1147); - boolean_predicand(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Boolean_predicandContext extends ParserRuleContext { - public Parenthesized_boolean_value_expressionContext parenthesized_boolean_value_expression() { - return getRuleContext(Parenthesized_boolean_value_expressionContext.class,0); - } - public Nonparenthesized_value_expression_primaryContext nonparenthesized_value_expression_primary() { - return getRuleContext(Nonparenthesized_value_expression_primaryContext.class,0); - } - public Boolean_predicandContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_boolean_predicand; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterBoolean_predicand(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitBoolean_predicand(this); - } - } - - public final Boolean_predicandContext boolean_predicand() throws RecognitionException { - Boolean_predicandContext _localctx = new Boolean_predicandContext(_ctx, getState()); - enterRule(_localctx, 212, RULE_boolean_predicand); - try { - setState(1152); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,103,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(1150); - parenthesized_boolean_value_expression(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(1151); - nonparenthesized_value_expression_primary(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Parenthesized_boolean_value_expressionContext extends ParserRuleContext { - public TerminalNode LEFT_PAREN() { return getToken(SQLParser.LEFT_PAREN, 0); } - public Boolean_value_expressionContext boolean_value_expression() { - return getRuleContext(Boolean_value_expressionContext.class,0); - } - public TerminalNode RIGHT_PAREN() { return getToken(SQLParser.RIGHT_PAREN, 0); } - public Parenthesized_boolean_value_expressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_parenthesized_boolean_value_expression; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterParenthesized_boolean_value_expression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitParenthesized_boolean_value_expression(this); - } - } - - public final Parenthesized_boolean_value_expressionContext parenthesized_boolean_value_expression() throws RecognitionException { - Parenthesized_boolean_value_expressionContext _localctx = new Parenthesized_boolean_value_expressionContext(_ctx, getState()); - enterRule(_localctx, 214, RULE_parenthesized_boolean_value_expression); - try { - enterOuterAlt(_localctx, 1); - { - setState(1154); - match(LEFT_PAREN); - setState(1155); - boolean_value_expression(); - setState(1156); - match(RIGHT_PAREN); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Row_value_expressionContext extends ParserRuleContext { - public Row_value_special_caseContext row_value_special_case() { - return getRuleContext(Row_value_special_caseContext.class,0); - } - public Explicit_row_value_constructorContext explicit_row_value_constructor() { - return getRuleContext(Explicit_row_value_constructorContext.class,0); - } - public Row_value_expressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_row_value_expression; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterRow_value_expression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitRow_value_expression(this); - } - } - - public final Row_value_expressionContext row_value_expression() throws RecognitionException { - Row_value_expressionContext _localctx = new Row_value_expressionContext(_ctx, getState()); - enterRule(_localctx, 216, RULE_row_value_expression); - try { - setState(1160); - _errHandler.sync(this); - switch (_input.LA(1)) { - case ANY: - case CASE: - case CAST: - case FALSE: - case LEFT: - case RIGHT: - case SOME: - case TRUE: - case AVG: - case BETWEEN: - case BY: - case CENTURY: - case CHARACTER: - case COLLECT: - case COALESCE: - case COLUMN: - case COUNT: - case CUBE: - case DAY: - case DEC: - case DECADE: - case DOW: - case DOY: - case DROP: - case EPOCH: - case EVERY: - case EXISTS: - case EXTERNAL: - case EXTRACT: - case FILTER: - case FIRST: - case FORMAT: - case FUSION: - case GROUPING: - case HASH: - case INDEX: - case INSERT: - case INTERSECTION: - case ISODOW: - case ISOYEAR: - case LAST: - case LESS: - case LIST: - case LOCATION: - case MAX: - case MAXVALUE: - case MICROSECONDS: - case MILLENNIUM: - case MILLISECONDS: - case MIN: - case MINUTE: - case MONTH: - case NATIONAL: - case NULLIF: - case OVERWRITE: - case PARTITION: - case PARTITIONS: - case PRECISION: - case PURGE: - case QUARTER: - case RANGE: - case REGEXP: - case RLIKE: - case ROLLUP: - case SECOND: - case SET: - case SIMILAR: - case STDDEV_POP: - case STDDEV_SAMP: - case SUBPARTITION: - case SUM: - case TABLESPACE: - case THAN: - case TIMEZONE: - case TIMEZONE_HOUR: - case TIMEZONE_MINUTE: - case TRIM: - case TO: - case UNKNOWN: - case VALUES: - case VAR_SAMP: - case VAR_POP: - case VARYING: - case WEEK: - case YEAR: - case ZONE: - case BOOLEAN: - case BOOL: - case BIT: - case VARBIT: - case INT1: - case INT2: - case INT4: - case INT8: - case TINYINT: - case SMALLINT: - case INT: - case INTEGER: - case BIGINT: - case FLOAT4: - case FLOAT8: - case REAL: - case FLOAT: - case DOUBLE: - case NUMERIC: - case DECIMAL: - case CHAR: - case VARCHAR: - case NCHAR: - case NVARCHAR: - case DATE: - case TIME: - case TIMETZ: - case TIMESTAMP: - case TIMESTAMPTZ: - case TEXT: - case VARBINARY: - case BLOB: - case BYTEA: - case INET4: - case LEFT_PAREN: - case NUMBER: - case REAL_NUMBER: - case Identifier: - case Character_String_Literal: - enterOuterAlt(_localctx, 1); - { - setState(1158); - row_value_special_case(); - } - break; - case NULL: - enterOuterAlt(_localctx, 2); - { - setState(1159); - explicit_row_value_constructor(); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Row_value_special_caseContext extends ParserRuleContext { - public Nonparenthesized_value_expression_primaryContext nonparenthesized_value_expression_primary() { - return getRuleContext(Nonparenthesized_value_expression_primaryContext.class,0); - } - public Row_value_special_caseContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_row_value_special_case; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterRow_value_special_case(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitRow_value_special_case(this); - } - } - - public final Row_value_special_caseContext row_value_special_case() throws RecognitionException { - Row_value_special_caseContext _localctx = new Row_value_special_caseContext(_ctx, getState()); - enterRule(_localctx, 218, RULE_row_value_special_case); - try { - enterOuterAlt(_localctx, 1); - { - setState(1162); - nonparenthesized_value_expression_primary(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Explicit_row_value_constructorContext extends ParserRuleContext { - public TerminalNode NULL() { return getToken(SQLParser.NULL, 0); } - public Explicit_row_value_constructorContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_explicit_row_value_constructor; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterExplicit_row_value_constructor(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitExplicit_row_value_constructor(this); - } - } - - public final Explicit_row_value_constructorContext explicit_row_value_constructor() throws RecognitionException { - Explicit_row_value_constructorContext _localctx = new Explicit_row_value_constructorContext(_ctx, getState()); - enterRule(_localctx, 220, RULE_explicit_row_value_constructor); - try { - enterOuterAlt(_localctx, 1); - { - setState(1164); - match(NULL); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Row_value_predicandContext extends ParserRuleContext { - public Row_value_special_caseContext row_value_special_case() { - return getRuleContext(Row_value_special_caseContext.class,0); - } - public Row_value_constructor_predicandContext row_value_constructor_predicand() { - return getRuleContext(Row_value_constructor_predicandContext.class,0); - } - public Row_value_predicandContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_row_value_predicand; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterRow_value_predicand(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitRow_value_predicand(this); - } - } - - public final Row_value_predicandContext row_value_predicand() throws RecognitionException { - Row_value_predicandContext _localctx = new Row_value_predicandContext(_ctx, getState()); - enterRule(_localctx, 222, RULE_row_value_predicand); - try { - setState(1168); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,105,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(1166); - row_value_special_case(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(1167); - row_value_constructor_predicand(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Row_value_constructor_predicandContext extends ParserRuleContext { - public Common_value_expressionContext common_value_expression() { - return getRuleContext(Common_value_expressionContext.class,0); - } - public Boolean_predicandContext boolean_predicand() { - return getRuleContext(Boolean_predicandContext.class,0); - } - public Row_value_constructor_predicandContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_row_value_constructor_predicand; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterRow_value_constructor_predicand(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitRow_value_constructor_predicand(this); - } - } - - public final Row_value_constructor_predicandContext row_value_constructor_predicand() throws RecognitionException { - Row_value_constructor_predicandContext _localctx = new Row_value_constructor_predicandContext(_ctx, getState()); - enterRule(_localctx, 224, RULE_row_value_constructor_predicand); - try { - setState(1172); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,106,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(1170); - common_value_expression(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(1171); - boolean_predicand(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Table_expressionContext extends ParserRuleContext { - public From_clauseContext from_clause() { - return getRuleContext(From_clauseContext.class,0); - } - public Where_clauseContext where_clause() { - return getRuleContext(Where_clauseContext.class,0); - } - public Groupby_clauseContext groupby_clause() { - return getRuleContext(Groupby_clauseContext.class,0); - } - public Having_clauseContext having_clause() { - return getRuleContext(Having_clauseContext.class,0); - } - public Orderby_clauseContext orderby_clause() { - return getRuleContext(Orderby_clauseContext.class,0); - } - public Limit_clauseContext limit_clause() { - return getRuleContext(Limit_clauseContext.class,0); - } - public Table_expressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_table_expression; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterTable_expression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitTable_expression(this); - } - } - - public final Table_expressionContext table_expression() throws RecognitionException { - Table_expressionContext _localctx = new Table_expressionContext(_ctx, getState()); - enterRule(_localctx, 226, RULE_table_expression); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1174); - from_clause(); - setState(1176); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==WHERE) { - { - setState(1175); - where_clause(); - } - } - - setState(1179); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==GROUP) { - { - setState(1178); - groupby_clause(); - } - } - - setState(1182); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==HAVING) { - { - setState(1181); - having_clause(); - } - } - - setState(1185); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==ORDER) { - { - setState(1184); - orderby_clause(); - } - } - - setState(1188); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LIMIT) { - { - setState(1187); - limit_clause(); - } - } - - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class From_clauseContext extends ParserRuleContext { - public TerminalNode FROM() { return getToken(SQLParser.FROM, 0); } - public Table_reference_listContext table_reference_list() { - return getRuleContext(Table_reference_listContext.class,0); - } - public From_clauseContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_from_clause; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterFrom_clause(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitFrom_clause(this); - } - } - - public final From_clauseContext from_clause() throws RecognitionException { - From_clauseContext _localctx = new From_clauseContext(_ctx, getState()); - enterRule(_localctx, 228, RULE_from_clause); - try { - enterOuterAlt(_localctx, 1); - { - setState(1190); - match(FROM); - setState(1191); - table_reference_list(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Table_reference_listContext extends ParserRuleContext { - public List table_reference() { - return getRuleContexts(Table_referenceContext.class); - } - public Table_referenceContext table_reference(int i) { - return getRuleContext(Table_referenceContext.class,i); - } - public List COMMA() { return getTokens(SQLParser.COMMA); } - public TerminalNode COMMA(int i) { - return getToken(SQLParser.COMMA, i); - } - public Table_reference_listContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_table_reference_list; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterTable_reference_list(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitTable_reference_list(this); - } - } - - public final Table_reference_listContext table_reference_list() throws RecognitionException { - Table_reference_listContext _localctx = new Table_reference_listContext(_ctx, getState()); - enterRule(_localctx, 230, RULE_table_reference_list); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1193); - table_reference(); - setState(1198); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==COMMA) { - { - { - setState(1194); - match(COMMA); - setState(1195); - table_reference(); - } - } - setState(1200); - _errHandler.sync(this); - _la = _input.LA(1); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Table_referenceContext extends ParserRuleContext { - public Joined_tableContext joined_table() { - return getRuleContext(Joined_tableContext.class,0); - } - public Table_primaryContext table_primary() { - return getRuleContext(Table_primaryContext.class,0); - } - public Table_referenceContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_table_reference; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterTable_reference(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitTable_reference(this); - } - } - - public final Table_referenceContext table_reference() throws RecognitionException { - Table_referenceContext _localctx = new Table_referenceContext(_ctx, getState()); - enterRule(_localctx, 232, RULE_table_reference); - try { - setState(1203); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,113,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(1201); - joined_table(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(1202); - table_primary(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Joined_tableContext extends ParserRuleContext { - public Table_primaryContext table_primary() { - return getRuleContext(Table_primaryContext.class,0); - } - public List joined_table_primary() { - return getRuleContexts(Joined_table_primaryContext.class); - } - public Joined_table_primaryContext joined_table_primary(int i) { - return getRuleContext(Joined_table_primaryContext.class,i); - } - public Joined_tableContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_joined_table; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterJoined_table(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitJoined_table(this); - } - } - - public final Joined_tableContext joined_table() throws RecognitionException { - Joined_tableContext _localctx = new Joined_tableContext(_ctx, getState()); - enterRule(_localctx, 234, RULE_joined_table); - try { - int _alt; - enterOuterAlt(_localctx, 1); - { - setState(1205); - table_primary(); - setState(1207); - _errHandler.sync(this); - _alt = 1; - do { - switch (_alt) { - case 1: - { - { - setState(1206); - joined_table_primary(); - } - } - break; - default: - throw new NoViableAltException(this); - } - setState(1209); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,114,_ctx); - } while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Joined_table_primaryContext extends ParserRuleContext { - public Table_primaryContext right; - public Join_typeContext t; - public Join_specificationContext s; - public TerminalNode CROSS() { return getToken(SQLParser.CROSS, 0); } - public TerminalNode JOIN() { return getToken(SQLParser.JOIN, 0); } - public Table_primaryContext table_primary() { - return getRuleContext(Table_primaryContext.class,0); - } - public Join_specificationContext join_specification() { - return getRuleContext(Join_specificationContext.class,0); - } - public Join_typeContext join_type() { - return getRuleContext(Join_typeContext.class,0); - } - public TerminalNode NATURAL() { return getToken(SQLParser.NATURAL, 0); } - public TerminalNode UNION() { return getToken(SQLParser.UNION, 0); } - public Joined_table_primaryContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_joined_table_primary; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterJoined_table_primary(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitJoined_table_primary(this); - } - } - - public final Joined_table_primaryContext joined_table_primary() throws RecognitionException { - Joined_table_primaryContext _localctx = new Joined_table_primaryContext(_ctx, getState()); - enterRule(_localctx, 236, RULE_joined_table_primary); - int _la; - try { - setState(1230); - _errHandler.sync(this); - switch (_input.LA(1)) { - case CROSS: - enterOuterAlt(_localctx, 1); - { - setState(1211); - match(CROSS); - setState(1212); - match(JOIN); - setState(1213); - ((Joined_table_primaryContext)_localctx).right = table_primary(); - } - break; - case FULL: - case INNER: - case JOIN: - case LEFT: - case RIGHT: - enterOuterAlt(_localctx, 2); - { - setState(1215); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << FULL) | (1L << INNER) | (1L << LEFT) | (1L << RIGHT))) != 0)) { - { - setState(1214); - ((Joined_table_primaryContext)_localctx).t = join_type(); - } - } - - setState(1217); - match(JOIN); - setState(1218); - ((Joined_table_primaryContext)_localctx).right = table_primary(); - setState(1219); - ((Joined_table_primaryContext)_localctx).s = join_specification(); - } - break; - case NATURAL: - enterOuterAlt(_localctx, 3); - { - setState(1221); - match(NATURAL); - setState(1223); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << FULL) | (1L << INNER) | (1L << LEFT) | (1L << RIGHT))) != 0)) { - { - setState(1222); - ((Joined_table_primaryContext)_localctx).t = join_type(); - } - } - - setState(1225); - match(JOIN); - setState(1226); - ((Joined_table_primaryContext)_localctx).right = table_primary(); - } - break; - case UNION: - enterOuterAlt(_localctx, 4); - { - setState(1227); - match(UNION); - setState(1228); - match(JOIN); - setState(1229); - ((Joined_table_primaryContext)_localctx).right = table_primary(); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Cross_joinContext extends ParserRuleContext { - public Table_primaryContext r; - public TerminalNode CROSS() { return getToken(SQLParser.CROSS, 0); } - public TerminalNode JOIN() { return getToken(SQLParser.JOIN, 0); } - public Table_primaryContext table_primary() { - return getRuleContext(Table_primaryContext.class,0); - } - public Cross_joinContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_cross_join; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterCross_join(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitCross_join(this); - } - } - - public final Cross_joinContext cross_join() throws RecognitionException { - Cross_joinContext _localctx = new Cross_joinContext(_ctx, getState()); - enterRule(_localctx, 238, RULE_cross_join); - try { - enterOuterAlt(_localctx, 1); - { - setState(1232); - match(CROSS); - setState(1233); - match(JOIN); - setState(1234); - ((Cross_joinContext)_localctx).r = table_primary(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Qualified_joinContext extends ParserRuleContext { - public Join_typeContext t; - public Table_primaryContext r; - public Join_specificationContext s; - public TerminalNode JOIN() { return getToken(SQLParser.JOIN, 0); } - public Table_primaryContext table_primary() { - return getRuleContext(Table_primaryContext.class,0); - } - public Join_specificationContext join_specification() { - return getRuleContext(Join_specificationContext.class,0); - } - public Join_typeContext join_type() { - return getRuleContext(Join_typeContext.class,0); - } - public Qualified_joinContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_qualified_join; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterQualified_join(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitQualified_join(this); - } - } - - public final Qualified_joinContext qualified_join() throws RecognitionException { - Qualified_joinContext _localctx = new Qualified_joinContext(_ctx, getState()); - enterRule(_localctx, 240, RULE_qualified_join); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1237); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << FULL) | (1L << INNER) | (1L << LEFT) | (1L << RIGHT))) != 0)) { - { - setState(1236); - ((Qualified_joinContext)_localctx).t = join_type(); - } - } - - setState(1239); - match(JOIN); - setState(1240); - ((Qualified_joinContext)_localctx).r = table_primary(); - setState(1241); - ((Qualified_joinContext)_localctx).s = join_specification(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Natural_joinContext extends ParserRuleContext { - public Join_typeContext t; - public Table_primaryContext r; - public TerminalNode NATURAL() { return getToken(SQLParser.NATURAL, 0); } - public TerminalNode JOIN() { return getToken(SQLParser.JOIN, 0); } - public Table_primaryContext table_primary() { - return getRuleContext(Table_primaryContext.class,0); - } - public Join_typeContext join_type() { - return getRuleContext(Join_typeContext.class,0); - } - public Natural_joinContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_natural_join; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterNatural_join(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitNatural_join(this); - } - } - - public final Natural_joinContext natural_join() throws RecognitionException { - Natural_joinContext _localctx = new Natural_joinContext(_ctx, getState()); - enterRule(_localctx, 242, RULE_natural_join); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1243); - match(NATURAL); - setState(1245); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << FULL) | (1L << INNER) | (1L << LEFT) | (1L << RIGHT))) != 0)) { - { - setState(1244); - ((Natural_joinContext)_localctx).t = join_type(); - } - } - - setState(1247); - match(JOIN); - setState(1248); - ((Natural_joinContext)_localctx).r = table_primary(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Union_joinContext extends ParserRuleContext { - public Table_primaryContext r; - public TerminalNode UNION() { return getToken(SQLParser.UNION, 0); } - public TerminalNode JOIN() { return getToken(SQLParser.JOIN, 0); } - public Table_primaryContext table_primary() { - return getRuleContext(Table_primaryContext.class,0); - } - public Union_joinContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_union_join; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterUnion_join(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitUnion_join(this); - } - } - - public final Union_joinContext union_join() throws RecognitionException { - Union_joinContext _localctx = new Union_joinContext(_ctx, getState()); - enterRule(_localctx, 244, RULE_union_join); - try { - enterOuterAlt(_localctx, 1); - { - setState(1250); - match(UNION); - setState(1251); - match(JOIN); - setState(1252); - ((Union_joinContext)_localctx).r = table_primary(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Join_typeContext extends ParserRuleContext { - public Outer_join_typeContext t; - public TerminalNode INNER() { return getToken(SQLParser.INNER, 0); } - public Outer_join_typeContext outer_join_type() { - return getRuleContext(Outer_join_typeContext.class,0); - } - public Join_typeContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_join_type; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterJoin_type(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitJoin_type(this); - } - } - - public final Join_typeContext join_type() throws RecognitionException { - Join_typeContext _localctx = new Join_typeContext(_ctx, getState()); - enterRule(_localctx, 246, RULE_join_type); - try { - setState(1256); - _errHandler.sync(this); - switch (_input.LA(1)) { - case INNER: - enterOuterAlt(_localctx, 1); - { - setState(1254); - match(INNER); - } - break; - case FULL: - case LEFT: - case RIGHT: - enterOuterAlt(_localctx, 2); - { - setState(1255); - ((Join_typeContext)_localctx).t = outer_join_type(); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Outer_join_typeContext extends ParserRuleContext { - public Outer_join_type_part2Context outer_join_type_part2() { - return getRuleContext(Outer_join_type_part2Context.class,0); - } - public TerminalNode OUTER() { return getToken(SQLParser.OUTER, 0); } - public Outer_join_typeContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_outer_join_type; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterOuter_join_type(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitOuter_join_type(this); - } - } - - public final Outer_join_typeContext outer_join_type() throws RecognitionException { - Outer_join_typeContext _localctx = new Outer_join_typeContext(_ctx, getState()); - enterRule(_localctx, 248, RULE_outer_join_type); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1258); - outer_join_type_part2(); - setState(1260); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==OUTER) { - { - setState(1259); - match(OUTER); - } - } - - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Outer_join_type_part2Context extends ParserRuleContext { - public TerminalNode LEFT() { return getToken(SQLParser.LEFT, 0); } - public TerminalNode RIGHT() { return getToken(SQLParser.RIGHT, 0); } - public TerminalNode FULL() { return getToken(SQLParser.FULL, 0); } - public Outer_join_type_part2Context(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_outer_join_type_part2; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterOuter_join_type_part2(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitOuter_join_type_part2(this); - } - } - - public final Outer_join_type_part2Context outer_join_type_part2() throws RecognitionException { - Outer_join_type_part2Context _localctx = new Outer_join_type_part2Context(_ctx, getState()); - enterRule(_localctx, 250, RULE_outer_join_type_part2); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1262); - _la = _input.LA(1); - if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << FULL) | (1L << LEFT) | (1L << RIGHT))) != 0)) ) { - _errHandler.recoverInline(this); - } - else { - if ( _input.LA(1)==Token.EOF ) matchedEOF = true; - _errHandler.reportMatch(this); - consume(); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Join_specificationContext extends ParserRuleContext { - public Join_conditionContext join_condition() { - return getRuleContext(Join_conditionContext.class,0); - } - public Named_columns_joinContext named_columns_join() { - return getRuleContext(Named_columns_joinContext.class,0); - } - public Join_specificationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_join_specification; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterJoin_specification(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitJoin_specification(this); - } - } - - public final Join_specificationContext join_specification() throws RecognitionException { - Join_specificationContext _localctx = new Join_specificationContext(_ctx, getState()); - enterRule(_localctx, 252, RULE_join_specification); - try { - setState(1266); - _errHandler.sync(this); - switch (_input.LA(1)) { - case ON: - enterOuterAlt(_localctx, 1); - { - setState(1264); - join_condition(); - } - break; - case USING: - enterOuterAlt(_localctx, 2); - { - setState(1265); - named_columns_join(); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Join_conditionContext extends ParserRuleContext { - public TerminalNode ON() { return getToken(SQLParser.ON, 0); } - public Search_conditionContext search_condition() { - return getRuleContext(Search_conditionContext.class,0); - } - public Join_conditionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_join_condition; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterJoin_condition(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitJoin_condition(this); - } - } - - public final Join_conditionContext join_condition() throws RecognitionException { - Join_conditionContext _localctx = new Join_conditionContext(_ctx, getState()); - enterRule(_localctx, 254, RULE_join_condition); - try { - enterOuterAlt(_localctx, 1); - { - setState(1268); - match(ON); - setState(1269); - search_condition(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Named_columns_joinContext extends ParserRuleContext { - public Column_reference_listContext f; - public TerminalNode USING() { return getToken(SQLParser.USING, 0); } - public TerminalNode LEFT_PAREN() { return getToken(SQLParser.LEFT_PAREN, 0); } - public TerminalNode RIGHT_PAREN() { return getToken(SQLParser.RIGHT_PAREN, 0); } - public Column_reference_listContext column_reference_list() { - return getRuleContext(Column_reference_listContext.class,0); - } - public Named_columns_joinContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_named_columns_join; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterNamed_columns_join(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitNamed_columns_join(this); - } - } - - public final Named_columns_joinContext named_columns_join() throws RecognitionException { - Named_columns_joinContext _localctx = new Named_columns_joinContext(_ctx, getState()); - enterRule(_localctx, 256, RULE_named_columns_join); - try { - enterOuterAlt(_localctx, 1); - { - setState(1271); - match(USING); - setState(1272); - match(LEFT_PAREN); - setState(1273); - ((Named_columns_joinContext)_localctx).f = column_reference_list(); - setState(1274); - match(RIGHT_PAREN); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Table_primaryContext extends ParserRuleContext { - public IdentifierContext alias; - public IdentifierContext name; - public Table_or_query_nameContext table_or_query_name() { - return getRuleContext(Table_or_query_nameContext.class,0); - } - public TerminalNode LEFT_PAREN() { return getToken(SQLParser.LEFT_PAREN, 0); } - public Column_name_listContext column_name_list() { - return getRuleContext(Column_name_listContext.class,0); - } - public TerminalNode RIGHT_PAREN() { return getToken(SQLParser.RIGHT_PAREN, 0); } - public IdentifierContext identifier() { - return getRuleContext(IdentifierContext.class,0); - } - public TerminalNode AS() { return getToken(SQLParser.AS, 0); } - public Derived_tableContext derived_table() { - return getRuleContext(Derived_tableContext.class,0); - } - public Table_primaryContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_table_primary; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterTable_primary(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitTable_primary(this); - } - } - - public final Table_primaryContext table_primary() throws RecognitionException { - Table_primaryContext _localctx = new Table_primaryContext(_ctx, getState()); - enterRule(_localctx, 258, RULE_table_primary); - int _la; - try { - setState(1300); - _errHandler.sync(this); - switch (_input.LA(1)) { - case AVG: - case BETWEEN: - case BY: - case CENTURY: - case CHARACTER: - case COLLECT: - case COALESCE: - case COLUMN: - case COUNT: - case CUBE: - case DAY: - case DEC: - case DECADE: - case DOW: - case DOY: - case DROP: - case EPOCH: - case EVERY: - case EXISTS: - case EXTERNAL: - case EXTRACT: - case FILTER: - case FIRST: - case FORMAT: - case FUSION: - case GROUPING: - case HASH: - case INDEX: - case INSERT: - case INTERSECTION: - case ISODOW: - case ISOYEAR: - case LAST: - case LESS: - case LIST: - case LOCATION: - case MAX: - case MAXVALUE: - case MICROSECONDS: - case MILLENNIUM: - case MILLISECONDS: - case MIN: - case MINUTE: - case MONTH: - case NATIONAL: - case NULLIF: - case OVERWRITE: - case PARTITION: - case PARTITIONS: - case PRECISION: - case PURGE: - case QUARTER: - case RANGE: - case REGEXP: - case RLIKE: - case ROLLUP: - case SECOND: - case SET: - case SIMILAR: - case STDDEV_POP: - case STDDEV_SAMP: - case SUBPARTITION: - case SUM: - case TABLESPACE: - case THAN: - case TIMEZONE: - case TIMEZONE_HOUR: - case TIMEZONE_MINUTE: - case TRIM: - case TO: - case UNKNOWN: - case VALUES: - case VAR_SAMP: - case VAR_POP: - case VARYING: - case WEEK: - case YEAR: - case ZONE: - case BOOLEAN: - case BOOL: - case BIT: - case VARBIT: - case INT1: - case INT2: - case INT4: - case INT8: - case TINYINT: - case SMALLINT: - case INT: - case INTEGER: - case BIGINT: - case FLOAT4: - case FLOAT8: - case REAL: - case FLOAT: - case DOUBLE: - case NUMERIC: - case DECIMAL: - case CHAR: - case VARCHAR: - case NCHAR: - case NVARCHAR: - case DATE: - case TIME: - case TIMETZ: - case TIMESTAMP: - case TIMESTAMPTZ: - case TEXT: - case VARBINARY: - case BLOB: - case BYTEA: - case INET4: - case Identifier: - enterOuterAlt(_localctx, 1); - { - setState(1276); - table_or_query_name(); - setState(1281); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << AS) | (1L << AVG) | (1L << BETWEEN) | (1L << BY) | (1L << CENTURY) | (1L << CHARACTER) | (1L << COLLECT) | (1L << COALESCE) | (1L << COLUMN) | (1L << COUNT) | (1L << CUBE))) != 0) || ((((_la - 64)) & ~0x3f) == 0 && ((1L << (_la - 64)) & ((1L << (DAY - 64)) | (1L << (DEC - 64)) | (1L << (DECADE - 64)) | (1L << (DOW - 64)) | (1L << (DOY - 64)) | (1L << (DROP - 64)) | (1L << (EPOCH - 64)) | (1L << (EVERY - 64)) | (1L << (EXISTS - 64)) | (1L << (EXTERNAL - 64)) | (1L << (EXTRACT - 64)) | (1L << (FILTER - 64)) | (1L << (FIRST - 64)) | (1L << (FORMAT - 64)) | (1L << (FUSION - 64)) | (1L << (GROUPING - 64)) | (1L << (HASH - 64)) | (1L << (INDEX - 64)) | (1L << (INSERT - 64)) | (1L << (INTERSECTION - 64)) | (1L << (ISODOW - 64)) | (1L << (ISOYEAR - 64)) | (1L << (LAST - 64)) | (1L << (LESS - 64)) | (1L << (LIST - 64)) | (1L << (LOCATION - 64)) | (1L << (MAX - 64)) | (1L << (MAXVALUE - 64)) | (1L << (MICROSECONDS - 64)) | (1L << (MILLENNIUM - 64)) | (1L << (MILLISECONDS - 64)) | (1L << (MIN - 64)) | (1L << (MINUTE - 64)) | (1L << (MONTH - 64)) | (1L << (NATIONAL - 64)) | (1L << (NULLIF - 64)) | (1L << (OVERWRITE - 64)) | (1L << (PARTITION - 64)) | (1L << (PARTITIONS - 64)) | (1L << (PRECISION - 64)) | (1L << (PURGE - 64)) | (1L << (QUARTER - 64)) | (1L << (RANGE - 64)) | (1L << (REGEXP - 64)) | (1L << (RLIKE - 64)) | (1L << (ROLLUP - 64)) | (1L << (SECOND - 64)) | (1L << (SET - 64)) | (1L << (SIMILAR - 64)) | (1L << (STDDEV_POP - 64)) | (1L << (STDDEV_SAMP - 64)) | (1L << (SUBPARTITION - 64)) | (1L << (SUM - 64)) | (1L << (TABLESPACE - 64)) | (1L << (THAN - 64)) | (1L << (TIMEZONE - 64)) | (1L << (TIMEZONE_HOUR - 64)) | (1L << (TIMEZONE_MINUTE - 64)) | (1L << (TRIM - 64)) | (1L << (TO - 64)) | (1L << (UNKNOWN - 64)) | (1L << (VALUES - 64)) | (1L << (VAR_SAMP - 64)))) != 0) || ((((_la - 128)) & ~0x3f) == 0 && ((1L << (_la - 128)) & ((1L << (VAR_POP - 128)) | (1L << (VARYING - 128)) | (1L << (WEEK - 128)) | (1L << (YEAR - 128)) | (1L << (ZONE - 128)) | (1L << (BOOLEAN - 128)) | (1L << (BOOL - 128)) | (1L << (BIT - 128)) | (1L << (VARBIT - 128)) | (1L << (INT1 - 128)) | (1L << (INT2 - 128)) | (1L << (INT4 - 128)) | (1L << (INT8 - 128)) | (1L << (TINYINT - 128)) | (1L << (SMALLINT - 128)) | (1L << (INT - 128)) | (1L << (INTEGER - 128)) | (1L << (BIGINT - 128)) | (1L << (FLOAT4 - 128)) | (1L << (FLOAT8 - 128)) | (1L << (REAL - 128)) | (1L << (FLOAT - 128)) | (1L << (DOUBLE - 128)) | (1L << (NUMERIC - 128)) | (1L << (DECIMAL - 128)) | (1L << (CHAR - 128)) | (1L << (VARCHAR - 128)) | (1L << (NCHAR - 128)) | (1L << (NVARCHAR - 128)) | (1L << (DATE - 128)) | (1L << (TIME - 128)) | (1L << (TIMETZ - 128)) | (1L << (TIMESTAMP - 128)) | (1L << (TIMESTAMPTZ - 128)) | (1L << (TEXT - 128)) | (1L << (VARBINARY - 128)) | (1L << (BLOB - 128)) | (1L << (BYTEA - 128)) | (1L << (INET4 - 128)))) != 0) || _la==Identifier) { - { - setState(1278); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==AS) { - { - setState(1277); - match(AS); - } - } - - setState(1280); - ((Table_primaryContext)_localctx).alias = identifier(); - } - } - - setState(1287); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LEFT_PAREN) { - { - setState(1283); - match(LEFT_PAREN); - setState(1284); - column_name_list(); - setState(1285); - match(RIGHT_PAREN); - } - } - - } - break; - case LEFT_PAREN: - enterOuterAlt(_localctx, 2); - { - setState(1289); - derived_table(); - setState(1291); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==AS) { - { - setState(1290); - match(AS); - } - } - - setState(1293); - ((Table_primaryContext)_localctx).name = identifier(); - setState(1298); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LEFT_PAREN) { - { - setState(1294); - match(LEFT_PAREN); - setState(1295); - column_name_list(); - setState(1296); - match(RIGHT_PAREN); - } - } - - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Column_name_listContext extends ParserRuleContext { - public List identifier() { - return getRuleContexts(IdentifierContext.class); - } - public IdentifierContext identifier(int i) { - return getRuleContext(IdentifierContext.class,i); - } - public List COMMA() { return getTokens(SQLParser.COMMA); } - public TerminalNode COMMA(int i) { - return getToken(SQLParser.COMMA, i); - } - public Column_name_listContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_column_name_list; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterColumn_name_list(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitColumn_name_list(this); - } - } - - public final Column_name_listContext column_name_list() throws RecognitionException { - Column_name_listContext _localctx = new Column_name_listContext(_ctx, getState()); - enterRule(_localctx, 260, RULE_column_name_list); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1302); - identifier(); - setState(1307); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==COMMA) { - { - { - setState(1303); - match(COMMA); - setState(1304); - identifier(); - } - } - setState(1309); - _errHandler.sync(this); - _la = _input.LA(1); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Derived_tableContext extends ParserRuleContext { - public Table_subqueryContext table_subquery() { - return getRuleContext(Table_subqueryContext.class,0); - } - public Derived_tableContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_derived_table; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterDerived_table(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitDerived_table(this); - } - } - - public final Derived_tableContext derived_table() throws RecognitionException { - Derived_tableContext _localctx = new Derived_tableContext(_ctx, getState()); - enterRule(_localctx, 262, RULE_derived_table); - try { - enterOuterAlt(_localctx, 1); - { - setState(1310); - table_subquery(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Where_clauseContext extends ParserRuleContext { - public TerminalNode WHERE() { return getToken(SQLParser.WHERE, 0); } - public Search_conditionContext search_condition() { - return getRuleContext(Search_conditionContext.class,0); - } - public Where_clauseContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_where_clause; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterWhere_clause(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitWhere_clause(this); - } - } - - public final Where_clauseContext where_clause() throws RecognitionException { - Where_clauseContext _localctx = new Where_clauseContext(_ctx, getState()); - enterRule(_localctx, 264, RULE_where_clause); - try { - enterOuterAlt(_localctx, 1); - { - setState(1312); - match(WHERE); - setState(1313); - search_condition(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Search_conditionContext extends ParserRuleContext { - public Value_expressionContext value_expression() { - return getRuleContext(Value_expressionContext.class,0); - } - public Search_conditionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_search_condition; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterSearch_condition(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitSearch_condition(this); - } - } - - public final Search_conditionContext search_condition() throws RecognitionException { - Search_conditionContext _localctx = new Search_conditionContext(_ctx, getState()); - enterRule(_localctx, 266, RULE_search_condition); - try { - enterOuterAlt(_localctx, 1); - { - setState(1315); - value_expression(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Groupby_clauseContext extends ParserRuleContext { - public Grouping_element_listContext g; - public TerminalNode GROUP() { return getToken(SQLParser.GROUP, 0); } - public TerminalNode BY() { return getToken(SQLParser.BY, 0); } - public Grouping_element_listContext grouping_element_list() { - return getRuleContext(Grouping_element_listContext.class,0); - } - public Groupby_clauseContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_groupby_clause; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterGroupby_clause(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitGroupby_clause(this); - } - } - - public final Groupby_clauseContext groupby_clause() throws RecognitionException { - Groupby_clauseContext _localctx = new Groupby_clauseContext(_ctx, getState()); - enterRule(_localctx, 268, RULE_groupby_clause); - try { - enterOuterAlt(_localctx, 1); - { - setState(1317); - match(GROUP); - setState(1318); - match(BY); - setState(1319); - ((Groupby_clauseContext)_localctx).g = grouping_element_list(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Grouping_element_listContext extends ParserRuleContext { - public List grouping_element() { - return getRuleContexts(Grouping_elementContext.class); - } - public Grouping_elementContext grouping_element(int i) { - return getRuleContext(Grouping_elementContext.class,i); - } - public List COMMA() { return getTokens(SQLParser.COMMA); } - public TerminalNode COMMA(int i) { - return getToken(SQLParser.COMMA, i); - } - public Grouping_element_listContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_grouping_element_list; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterGrouping_element_list(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitGrouping_element_list(this); - } - } - - public final Grouping_element_listContext grouping_element_list() throws RecognitionException { - Grouping_element_listContext _localctx = new Grouping_element_listContext(_ctx, getState()); - enterRule(_localctx, 270, RULE_grouping_element_list); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1321); - grouping_element(); - setState(1326); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==COMMA) { - { - { - setState(1322); - match(COMMA); - setState(1323); - grouping_element(); - } - } - setState(1328); - _errHandler.sync(this); - _la = _input.LA(1); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Grouping_elementContext extends ParserRuleContext { - public Rollup_listContext rollup_list() { - return getRuleContext(Rollup_listContext.class,0); - } - public Cube_listContext cube_list() { - return getRuleContext(Cube_listContext.class,0); - } - public Empty_grouping_setContext empty_grouping_set() { - return getRuleContext(Empty_grouping_setContext.class,0); - } - public Ordinary_grouping_setContext ordinary_grouping_set() { - return getRuleContext(Ordinary_grouping_setContext.class,0); - } - public Grouping_elementContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_grouping_element; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterGrouping_element(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitGrouping_element(this); - } - } - - public final Grouping_elementContext grouping_element() throws RecognitionException { - Grouping_elementContext _localctx = new Grouping_elementContext(_ctx, getState()); - enterRule(_localctx, 272, RULE_grouping_element); - try { - setState(1333); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,131,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(1329); - rollup_list(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(1330); - cube_list(); - } - break; - case 3: - enterOuterAlt(_localctx, 3); - { - setState(1331); - empty_grouping_set(); - } - break; - case 4: - enterOuterAlt(_localctx, 4); - { - setState(1332); - ordinary_grouping_set(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Ordinary_grouping_setContext extends ParserRuleContext { - public Row_value_predicandContext row_value_predicand() { - return getRuleContext(Row_value_predicandContext.class,0); - } - public TerminalNode LEFT_PAREN() { return getToken(SQLParser.LEFT_PAREN, 0); } - public Row_value_predicand_listContext row_value_predicand_list() { - return getRuleContext(Row_value_predicand_listContext.class,0); - } - public TerminalNode RIGHT_PAREN() { return getToken(SQLParser.RIGHT_PAREN, 0); } - public Ordinary_grouping_setContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_ordinary_grouping_set; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterOrdinary_grouping_set(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitOrdinary_grouping_set(this); - } - } - - public final Ordinary_grouping_setContext ordinary_grouping_set() throws RecognitionException { - Ordinary_grouping_setContext _localctx = new Ordinary_grouping_setContext(_ctx, getState()); - enterRule(_localctx, 274, RULE_ordinary_grouping_set); - try { - setState(1340); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,132,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(1335); - row_value_predicand(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(1336); - match(LEFT_PAREN); - setState(1337); - row_value_predicand_list(); - setState(1338); - match(RIGHT_PAREN); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Ordinary_grouping_set_listContext extends ParserRuleContext { - public List ordinary_grouping_set() { - return getRuleContexts(Ordinary_grouping_setContext.class); - } - public Ordinary_grouping_setContext ordinary_grouping_set(int i) { - return getRuleContext(Ordinary_grouping_setContext.class,i); - } - public List COMMA() { return getTokens(SQLParser.COMMA); } - public TerminalNode COMMA(int i) { - return getToken(SQLParser.COMMA, i); - } - public Ordinary_grouping_set_listContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_ordinary_grouping_set_list; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterOrdinary_grouping_set_list(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitOrdinary_grouping_set_list(this); - } - } - - public final Ordinary_grouping_set_listContext ordinary_grouping_set_list() throws RecognitionException { - Ordinary_grouping_set_listContext _localctx = new Ordinary_grouping_set_listContext(_ctx, getState()); - enterRule(_localctx, 276, RULE_ordinary_grouping_set_list); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1342); - ordinary_grouping_set(); - setState(1347); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==COMMA) { - { - { - setState(1343); - match(COMMA); - setState(1344); - ordinary_grouping_set(); - } - } - setState(1349); - _errHandler.sync(this); - _la = _input.LA(1); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Rollup_listContext extends ParserRuleContext { - public Ordinary_grouping_set_listContext c; - public TerminalNode ROLLUP() { return getToken(SQLParser.ROLLUP, 0); } - public TerminalNode LEFT_PAREN() { return getToken(SQLParser.LEFT_PAREN, 0); } - public TerminalNode RIGHT_PAREN() { return getToken(SQLParser.RIGHT_PAREN, 0); } - public Ordinary_grouping_set_listContext ordinary_grouping_set_list() { - return getRuleContext(Ordinary_grouping_set_listContext.class,0); - } - public Rollup_listContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_rollup_list; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterRollup_list(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitRollup_list(this); - } - } - - public final Rollup_listContext rollup_list() throws RecognitionException { - Rollup_listContext _localctx = new Rollup_listContext(_ctx, getState()); - enterRule(_localctx, 278, RULE_rollup_list); - try { - enterOuterAlt(_localctx, 1); - { - setState(1350); - match(ROLLUP); - setState(1351); - match(LEFT_PAREN); - setState(1352); - ((Rollup_listContext)_localctx).c = ordinary_grouping_set_list(); - setState(1353); - match(RIGHT_PAREN); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Cube_listContext extends ParserRuleContext { - public Ordinary_grouping_set_listContext c; - public TerminalNode CUBE() { return getToken(SQLParser.CUBE, 0); } - public TerminalNode LEFT_PAREN() { return getToken(SQLParser.LEFT_PAREN, 0); } - public TerminalNode RIGHT_PAREN() { return getToken(SQLParser.RIGHT_PAREN, 0); } - public Ordinary_grouping_set_listContext ordinary_grouping_set_list() { - return getRuleContext(Ordinary_grouping_set_listContext.class,0); - } - public Cube_listContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_cube_list; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterCube_list(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitCube_list(this); - } - } - - public final Cube_listContext cube_list() throws RecognitionException { - Cube_listContext _localctx = new Cube_listContext(_ctx, getState()); - enterRule(_localctx, 280, RULE_cube_list); - try { - enterOuterAlt(_localctx, 1); - { - setState(1355); - match(CUBE); - setState(1356); - match(LEFT_PAREN); - setState(1357); - ((Cube_listContext)_localctx).c = ordinary_grouping_set_list(); - setState(1358); - match(RIGHT_PAREN); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Empty_grouping_setContext extends ParserRuleContext { - public TerminalNode LEFT_PAREN() { return getToken(SQLParser.LEFT_PAREN, 0); } - public TerminalNode RIGHT_PAREN() { return getToken(SQLParser.RIGHT_PAREN, 0); } - public Empty_grouping_setContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_empty_grouping_set; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterEmpty_grouping_set(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitEmpty_grouping_set(this); - } - } - - public final Empty_grouping_setContext empty_grouping_set() throws RecognitionException { - Empty_grouping_setContext _localctx = new Empty_grouping_setContext(_ctx, getState()); - enterRule(_localctx, 282, RULE_empty_grouping_set); - try { - enterOuterAlt(_localctx, 1); - { - setState(1360); - match(LEFT_PAREN); - setState(1361); - match(RIGHT_PAREN); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Having_clauseContext extends ParserRuleContext { - public TerminalNode HAVING() { return getToken(SQLParser.HAVING, 0); } - public Boolean_value_expressionContext boolean_value_expression() { - return getRuleContext(Boolean_value_expressionContext.class,0); - } - public Having_clauseContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_having_clause; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterHaving_clause(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitHaving_clause(this); - } - } - - public final Having_clauseContext having_clause() throws RecognitionException { - Having_clauseContext _localctx = new Having_clauseContext(_ctx, getState()); - enterRule(_localctx, 284, RULE_having_clause); - try { - enterOuterAlt(_localctx, 1); - { - setState(1363); - match(HAVING); - setState(1364); - boolean_value_expression(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Row_value_predicand_listContext extends ParserRuleContext { - public List row_value_predicand() { - return getRuleContexts(Row_value_predicandContext.class); - } - public Row_value_predicandContext row_value_predicand(int i) { - return getRuleContext(Row_value_predicandContext.class,i); - } - public List COMMA() { return getTokens(SQLParser.COMMA); } - public TerminalNode COMMA(int i) { - return getToken(SQLParser.COMMA, i); - } - public Row_value_predicand_listContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_row_value_predicand_list; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterRow_value_predicand_list(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitRow_value_predicand_list(this); - } - } - - public final Row_value_predicand_listContext row_value_predicand_list() throws RecognitionException { - Row_value_predicand_listContext _localctx = new Row_value_predicand_listContext(_ctx, getState()); - enterRule(_localctx, 286, RULE_row_value_predicand_list); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1366); - row_value_predicand(); - setState(1371); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==COMMA) { - { - { - setState(1367); - match(COMMA); - setState(1368); - row_value_predicand(); - } - } - setState(1373); - _errHandler.sync(this); - _la = _input.LA(1); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Query_expressionContext extends ParserRuleContext { - public Query_expression_bodyContext query_expression_body() { - return getRuleContext(Query_expression_bodyContext.class,0); - } - public Query_expressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_query_expression; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterQuery_expression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitQuery_expression(this); - } - } - - public final Query_expressionContext query_expression() throws RecognitionException { - Query_expressionContext _localctx = new Query_expressionContext(_ctx, getState()); - enterRule(_localctx, 288, RULE_query_expression); - try { - enterOuterAlt(_localctx, 1); - { - setState(1374); - query_expression_body(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Query_expression_bodyContext extends ParserRuleContext { - public Non_join_query_expressionContext non_join_query_expression() { - return getRuleContext(Non_join_query_expressionContext.class,0); - } - public Joined_tableContext joined_table() { - return getRuleContext(Joined_tableContext.class,0); - } - public Query_expression_bodyContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_query_expression_body; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterQuery_expression_body(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitQuery_expression_body(this); - } - } - - public final Query_expression_bodyContext query_expression_body() throws RecognitionException { - Query_expression_bodyContext _localctx = new Query_expression_bodyContext(_ctx, getState()); - enterRule(_localctx, 290, RULE_query_expression_body); - try { - setState(1378); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,135,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(1376); - non_join_query_expression(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(1377); - joined_table(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Non_join_query_expressionContext extends ParserRuleContext { - public Non_join_query_termContext non_join_query_term() { - return getRuleContext(Non_join_query_termContext.class,0); - } - public Joined_tableContext joined_table() { - return getRuleContext(Joined_tableContext.class,0); - } - public List query_term() { - return getRuleContexts(Query_termContext.class); - } - public Query_termContext query_term(int i) { - return getRuleContext(Query_termContext.class,i); - } - public List UNION() { return getTokens(SQLParser.UNION); } - public TerminalNode UNION(int i) { - return getToken(SQLParser.UNION, i); - } - public List EXCEPT() { return getTokens(SQLParser.EXCEPT); } - public TerminalNode EXCEPT(int i) { - return getToken(SQLParser.EXCEPT, i); - } - public List ALL() { return getTokens(SQLParser.ALL); } - public TerminalNode ALL(int i) { - return getToken(SQLParser.ALL, i); - } - public List DISTINCT() { return getTokens(SQLParser.DISTINCT); } - public TerminalNode DISTINCT(int i) { - return getToken(SQLParser.DISTINCT, i); - } - public Non_join_query_expressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_non_join_query_expression; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterNon_join_query_expression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitNon_join_query_expression(this); - } - } - - public final Non_join_query_expressionContext non_join_query_expression() throws RecognitionException { - Non_join_query_expressionContext _localctx = new Non_join_query_expressionContext(_ctx, getState()); - enterRule(_localctx, 292, RULE_non_join_query_expression); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1388); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,137,_ctx) ) { - case 1: - { - setState(1380); - non_join_query_term(); - } - break; - case 2: - { - setState(1381); - joined_table(); - setState(1382); - _la = _input.LA(1); - if ( !(_la==EXCEPT || _la==UNION) ) { - _errHandler.recoverInline(this); - } - else { - if ( _input.LA(1)==Token.EOF ) matchedEOF = true; - _errHandler.reportMatch(this); - consume(); - } - setState(1384); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==ALL || _la==DISTINCT) { - { - setState(1383); - _la = _input.LA(1); - if ( !(_la==ALL || _la==DISTINCT) ) { - _errHandler.recoverInline(this); - } - else { - if ( _input.LA(1)==Token.EOF ) matchedEOF = true; - _errHandler.reportMatch(this); - consume(); - } - } - } - - setState(1386); - query_term(); - } - break; - } - setState(1397); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==EXCEPT || _la==UNION) { - { - { - setState(1390); - _la = _input.LA(1); - if ( !(_la==EXCEPT || _la==UNION) ) { - _errHandler.recoverInline(this); - } - else { - if ( _input.LA(1)==Token.EOF ) matchedEOF = true; - _errHandler.reportMatch(this); - consume(); - } - setState(1392); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==ALL || _la==DISTINCT) { - { - setState(1391); - _la = _input.LA(1); - if ( !(_la==ALL || _la==DISTINCT) ) { - _errHandler.recoverInline(this); - } - else { - if ( _input.LA(1)==Token.EOF ) matchedEOF = true; - _errHandler.reportMatch(this); - consume(); - } - } - } - - setState(1394); - query_term(); - } - } - setState(1399); - _errHandler.sync(this); - _la = _input.LA(1); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Query_termContext extends ParserRuleContext { - public Non_join_query_termContext non_join_query_term() { - return getRuleContext(Non_join_query_termContext.class,0); - } - public Joined_tableContext joined_table() { - return getRuleContext(Joined_tableContext.class,0); - } - public Query_termContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_query_term; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterQuery_term(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitQuery_term(this); - } - } - - public final Query_termContext query_term() throws RecognitionException { - Query_termContext _localctx = new Query_termContext(_ctx, getState()); - enterRule(_localctx, 294, RULE_query_term); - try { - setState(1402); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,140,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(1400); - non_join_query_term(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(1401); - joined_table(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Non_join_query_termContext extends ParserRuleContext { - public Non_join_query_primaryContext non_join_query_primary() { - return getRuleContext(Non_join_query_primaryContext.class,0); - } - public Joined_tableContext joined_table() { - return getRuleContext(Joined_tableContext.class,0); - } - public List INTERSECT() { return getTokens(SQLParser.INTERSECT); } - public TerminalNode INTERSECT(int i) { - return getToken(SQLParser.INTERSECT, i); - } - public List query_primary() { - return getRuleContexts(Query_primaryContext.class); - } - public Query_primaryContext query_primary(int i) { - return getRuleContext(Query_primaryContext.class,i); - } - public List ALL() { return getTokens(SQLParser.ALL); } - public TerminalNode ALL(int i) { - return getToken(SQLParser.ALL, i); - } - public List DISTINCT() { return getTokens(SQLParser.DISTINCT); } - public TerminalNode DISTINCT(int i) { - return getToken(SQLParser.DISTINCT, i); - } - public Non_join_query_termContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_non_join_query_term; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterNon_join_query_term(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitNon_join_query_term(this); - } - } - - public final Non_join_query_termContext non_join_query_term() throws RecognitionException { - Non_join_query_termContext _localctx = new Non_join_query_termContext(_ctx, getState()); - enterRule(_localctx, 296, RULE_non_join_query_term); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1412); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,142,_ctx) ) { - case 1: - { - setState(1404); - non_join_query_primary(); - } - break; - case 2: - { - setState(1405); - joined_table(); - setState(1406); - match(INTERSECT); - setState(1408); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==ALL || _la==DISTINCT) { - { - setState(1407); - _la = _input.LA(1); - if ( !(_la==ALL || _la==DISTINCT) ) { - _errHandler.recoverInline(this); - } - else { - if ( _input.LA(1)==Token.EOF ) matchedEOF = true; - _errHandler.reportMatch(this); - consume(); - } - } - } - - setState(1410); - query_primary(); - } - break; - } - setState(1421); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==INTERSECT) { - { - { - setState(1414); - match(INTERSECT); - setState(1416); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==ALL || _la==DISTINCT) { - { - setState(1415); - _la = _input.LA(1); - if ( !(_la==ALL || _la==DISTINCT) ) { - _errHandler.recoverInline(this); - } - else { - if ( _input.LA(1)==Token.EOF ) matchedEOF = true; - _errHandler.reportMatch(this); - consume(); - } - } - } - - setState(1418); - query_primary(); - } - } - setState(1423); - _errHandler.sync(this); - _la = _input.LA(1); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Query_primaryContext extends ParserRuleContext { - public Non_join_query_primaryContext non_join_query_primary() { - return getRuleContext(Non_join_query_primaryContext.class,0); - } - public Joined_tableContext joined_table() { - return getRuleContext(Joined_tableContext.class,0); - } - public Query_primaryContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_query_primary; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterQuery_primary(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitQuery_primary(this); - } - } - - public final Query_primaryContext query_primary() throws RecognitionException { - Query_primaryContext _localctx = new Query_primaryContext(_ctx, getState()); - enterRule(_localctx, 298, RULE_query_primary); - try { - setState(1426); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,145,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(1424); - non_join_query_primary(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(1425); - joined_table(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Non_join_query_primaryContext extends ParserRuleContext { - public Simple_tableContext simple_table() { - return getRuleContext(Simple_tableContext.class,0); - } - public TerminalNode LEFT_PAREN() { return getToken(SQLParser.LEFT_PAREN, 0); } - public Non_join_query_expressionContext non_join_query_expression() { - return getRuleContext(Non_join_query_expressionContext.class,0); - } - public TerminalNode RIGHT_PAREN() { return getToken(SQLParser.RIGHT_PAREN, 0); } - public Non_join_query_primaryContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_non_join_query_primary; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterNon_join_query_primary(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitNon_join_query_primary(this); - } - } - - public final Non_join_query_primaryContext non_join_query_primary() throws RecognitionException { - Non_join_query_primaryContext _localctx = new Non_join_query_primaryContext(_ctx, getState()); - enterRule(_localctx, 300, RULE_non_join_query_primary); - try { - setState(1433); - _errHandler.sync(this); - switch (_input.LA(1)) { - case SELECT: - case TABLE: - enterOuterAlt(_localctx, 1); - { - setState(1428); - simple_table(); - } - break; - case LEFT_PAREN: - enterOuterAlt(_localctx, 2); - { - setState(1429); - match(LEFT_PAREN); - setState(1430); - non_join_query_expression(); - setState(1431); - match(RIGHT_PAREN); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Simple_tableContext extends ParserRuleContext { - public Query_specificationContext query_specification() { - return getRuleContext(Query_specificationContext.class,0); - } - public Explicit_tableContext explicit_table() { - return getRuleContext(Explicit_tableContext.class,0); - } - public Simple_tableContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_simple_table; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterSimple_table(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitSimple_table(this); - } - } - - public final Simple_tableContext simple_table() throws RecognitionException { - Simple_tableContext _localctx = new Simple_tableContext(_ctx, getState()); - enterRule(_localctx, 302, RULE_simple_table); - try { - setState(1437); - _errHandler.sync(this); - switch (_input.LA(1)) { - case SELECT: - enterOuterAlt(_localctx, 1); - { - setState(1435); - query_specification(); - } - break; - case TABLE: - enterOuterAlt(_localctx, 2); - { - setState(1436); - explicit_table(); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Explicit_tableContext extends ParserRuleContext { - public TerminalNode TABLE() { return getToken(SQLParser.TABLE, 0); } - public Table_or_query_nameContext table_or_query_name() { - return getRuleContext(Table_or_query_nameContext.class,0); - } - public Explicit_tableContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_explicit_table; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterExplicit_table(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitExplicit_table(this); - } - } - - public final Explicit_tableContext explicit_table() throws RecognitionException { - Explicit_tableContext _localctx = new Explicit_tableContext(_ctx, getState()); - enterRule(_localctx, 304, RULE_explicit_table); - try { - enterOuterAlt(_localctx, 1); - { - setState(1439); - match(TABLE); - setState(1440); - table_or_query_name(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Table_or_query_nameContext extends ParserRuleContext { - public Table_nameContext table_name() { - return getRuleContext(Table_nameContext.class,0); - } - public IdentifierContext identifier() { - return getRuleContext(IdentifierContext.class,0); - } - public Table_or_query_nameContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_table_or_query_name; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterTable_or_query_name(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitTable_or_query_name(this); - } - } - - public final Table_or_query_nameContext table_or_query_name() throws RecognitionException { - Table_or_query_nameContext _localctx = new Table_or_query_nameContext(_ctx, getState()); - enterRule(_localctx, 306, RULE_table_or_query_name); - try { - setState(1444); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,148,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(1442); - table_name(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(1443); - identifier(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Table_nameContext extends ParserRuleContext { - public List identifier() { - return getRuleContexts(IdentifierContext.class); - } - public IdentifierContext identifier(int i) { - return getRuleContext(IdentifierContext.class,i); - } - public List DOT() { return getTokens(SQLParser.DOT); } - public TerminalNode DOT(int i) { - return getToken(SQLParser.DOT, i); - } - public Table_nameContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_table_name; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterTable_name(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitTable_name(this); - } - } - - public final Table_nameContext table_name() throws RecognitionException { - Table_nameContext _localctx = new Table_nameContext(_ctx, getState()); - enterRule(_localctx, 308, RULE_table_name); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1446); - identifier(); - setState(1453); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==DOT) { - { - setState(1447); - match(DOT); - setState(1448); - identifier(); - setState(1451); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==DOT) { - { - setState(1449); - match(DOT); - setState(1450); - identifier(); - } - } - - } - } - - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Query_specificationContext extends ParserRuleContext { - public TerminalNode SELECT() { return getToken(SQLParser.SELECT, 0); } - public Select_listContext select_list() { - return getRuleContext(Select_listContext.class,0); - } - public Set_qualifierContext set_qualifier() { - return getRuleContext(Set_qualifierContext.class,0); - } - public Table_expressionContext table_expression() { - return getRuleContext(Table_expressionContext.class,0); - } - public Query_specificationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_query_specification; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterQuery_specification(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitQuery_specification(this); - } - } - - public final Query_specificationContext query_specification() throws RecognitionException { - Query_specificationContext _localctx = new Query_specificationContext(_ctx, getState()); - enterRule(_localctx, 310, RULE_query_specification); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1455); - match(SELECT); - setState(1457); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==ALL || _la==DISTINCT) { - { - setState(1456); - set_qualifier(); - } - } - - setState(1459); - select_list(); - setState(1461); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==FROM) { - { - setState(1460); - table_expression(); - } - } - - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Select_listContext extends ParserRuleContext { - public List select_sublist() { - return getRuleContexts(Select_sublistContext.class); - } - public Select_sublistContext select_sublist(int i) { - return getRuleContext(Select_sublistContext.class,i); - } - public List COMMA() { return getTokens(SQLParser.COMMA); } - public TerminalNode COMMA(int i) { - return getToken(SQLParser.COMMA, i); - } - public Select_listContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_select_list; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterSelect_list(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitSelect_list(this); - } - } - - public final Select_listContext select_list() throws RecognitionException { - Select_listContext _localctx = new Select_listContext(_ctx, getState()); - enterRule(_localctx, 312, RULE_select_list); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1463); - select_sublist(); - setState(1468); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==COMMA) { - { - { - setState(1464); - match(COMMA); - setState(1465); - select_sublist(); - } - } - setState(1470); - _errHandler.sync(this); - _la = _input.LA(1); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Select_sublistContext extends ParserRuleContext { - public Derived_columnContext derived_column() { - return getRuleContext(Derived_columnContext.class,0); - } - public Qualified_asteriskContext qualified_asterisk() { - return getRuleContext(Qualified_asteriskContext.class,0); - } - public Select_sublistContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_select_sublist; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterSelect_sublist(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitSelect_sublist(this); - } - } - - public final Select_sublistContext select_sublist() throws RecognitionException { - Select_sublistContext _localctx = new Select_sublistContext(_ctx, getState()); - enterRule(_localctx, 314, RULE_select_sublist); - try { - setState(1473); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,154,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(1471); - derived_column(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(1472); - qualified_asterisk(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Derived_columnContext extends ParserRuleContext { - public Value_expressionContext value_expression() { - return getRuleContext(Value_expressionContext.class,0); - } - public As_clauseContext as_clause() { - return getRuleContext(As_clauseContext.class,0); - } - public Derived_columnContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_derived_column; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterDerived_column(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitDerived_column(this); - } - } - - public final Derived_columnContext derived_column() throws RecognitionException { - Derived_columnContext _localctx = new Derived_columnContext(_ctx, getState()); - enterRule(_localctx, 316, RULE_derived_column); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1475); - value_expression(); - setState(1477); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << AS) | (1L << AVG) | (1L << BETWEEN) | (1L << BY) | (1L << CENTURY) | (1L << CHARACTER) | (1L << COLLECT) | (1L << COALESCE) | (1L << COLUMN) | (1L << COUNT) | (1L << CUBE))) != 0) || ((((_la - 64)) & ~0x3f) == 0 && ((1L << (_la - 64)) & ((1L << (DAY - 64)) | (1L << (DEC - 64)) | (1L << (DECADE - 64)) | (1L << (DOW - 64)) | (1L << (DOY - 64)) | (1L << (DROP - 64)) | (1L << (EPOCH - 64)) | (1L << (EVERY - 64)) | (1L << (EXISTS - 64)) | (1L << (EXTERNAL - 64)) | (1L << (EXTRACT - 64)) | (1L << (FILTER - 64)) | (1L << (FIRST - 64)) | (1L << (FORMAT - 64)) | (1L << (FUSION - 64)) | (1L << (GROUPING - 64)) | (1L << (HASH - 64)) | (1L << (INDEX - 64)) | (1L << (INSERT - 64)) | (1L << (INTERSECTION - 64)) | (1L << (ISODOW - 64)) | (1L << (ISOYEAR - 64)) | (1L << (LAST - 64)) | (1L << (LESS - 64)) | (1L << (LIST - 64)) | (1L << (LOCATION - 64)) | (1L << (MAX - 64)) | (1L << (MAXVALUE - 64)) | (1L << (MICROSECONDS - 64)) | (1L << (MILLENNIUM - 64)) | (1L << (MILLISECONDS - 64)) | (1L << (MIN - 64)) | (1L << (MINUTE - 64)) | (1L << (MONTH - 64)) | (1L << (NATIONAL - 64)) | (1L << (NULLIF - 64)) | (1L << (OVERWRITE - 64)) | (1L << (PARTITION - 64)) | (1L << (PARTITIONS - 64)) | (1L << (PRECISION - 64)) | (1L << (PURGE - 64)) | (1L << (QUARTER - 64)) | (1L << (RANGE - 64)) | (1L << (REGEXP - 64)) | (1L << (RLIKE - 64)) | (1L << (ROLLUP - 64)) | (1L << (SECOND - 64)) | (1L << (SET - 64)) | (1L << (SIMILAR - 64)) | (1L << (STDDEV_POP - 64)) | (1L << (STDDEV_SAMP - 64)) | (1L << (SUBPARTITION - 64)) | (1L << (SUM - 64)) | (1L << (TABLESPACE - 64)) | (1L << (THAN - 64)) | (1L << (TIMEZONE - 64)) | (1L << (TIMEZONE_HOUR - 64)) | (1L << (TIMEZONE_MINUTE - 64)) | (1L << (TRIM - 64)) | (1L << (TO - 64)) | (1L << (UNKNOWN - 64)) | (1L << (VALUES - 64)) | (1L << (VAR_SAMP - 64)))) != 0) || ((((_la - 128)) & ~0x3f) == 0 && ((1L << (_la - 128)) & ((1L << (VAR_POP - 128)) | (1L << (VARYING - 128)) | (1L << (WEEK - 128)) | (1L << (YEAR - 128)) | (1L << (ZONE - 128)) | (1L << (BOOLEAN - 128)) | (1L << (BOOL - 128)) | (1L << (BIT - 128)) | (1L << (VARBIT - 128)) | (1L << (INT1 - 128)) | (1L << (INT2 - 128)) | (1L << (INT4 - 128)) | (1L << (INT8 - 128)) | (1L << (TINYINT - 128)) | (1L << (SMALLINT - 128)) | (1L << (INT - 128)) | (1L << (INTEGER - 128)) | (1L << (BIGINT - 128)) | (1L << (FLOAT4 - 128)) | (1L << (FLOAT8 - 128)) | (1L << (REAL - 128)) | (1L << (FLOAT - 128)) | (1L << (DOUBLE - 128)) | (1L << (NUMERIC - 128)) | (1L << (DECIMAL - 128)) | (1L << (CHAR - 128)) | (1L << (VARCHAR - 128)) | (1L << (NCHAR - 128)) | (1L << (NVARCHAR - 128)) | (1L << (DATE - 128)) | (1L << (TIME - 128)) | (1L << (TIMETZ - 128)) | (1L << (TIMESTAMP - 128)) | (1L << (TIMESTAMPTZ - 128)) | (1L << (TEXT - 128)) | (1L << (VARBINARY - 128)) | (1L << (BLOB - 128)) | (1L << (BYTEA - 128)) | (1L << (INET4 - 128)))) != 0) || _la==Identifier) { - { - setState(1476); - as_clause(); - } - } - - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Qualified_asteriskContext extends ParserRuleContext { - public Token tb_name; - public TerminalNode MULTIPLY() { return getToken(SQLParser.MULTIPLY, 0); } - public TerminalNode DOT() { return getToken(SQLParser.DOT, 0); } - public TerminalNode Identifier() { return getToken(SQLParser.Identifier, 0); } - public Qualified_asteriskContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_qualified_asterisk; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterQualified_asterisk(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitQualified_asterisk(this); - } - } - - public final Qualified_asteriskContext qualified_asterisk() throws RecognitionException { - Qualified_asteriskContext _localctx = new Qualified_asteriskContext(_ctx, getState()); - enterRule(_localctx, 318, RULE_qualified_asterisk); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1481); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==Identifier) { - { - setState(1479); - ((Qualified_asteriskContext)_localctx).tb_name = match(Identifier); - setState(1480); - match(DOT); - } - } - - setState(1483); - match(MULTIPLY); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Set_qualifierContext extends ParserRuleContext { - public TerminalNode DISTINCT() { return getToken(SQLParser.DISTINCT, 0); } - public TerminalNode ALL() { return getToken(SQLParser.ALL, 0); } - public Set_qualifierContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_set_qualifier; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterSet_qualifier(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitSet_qualifier(this); - } - } - - public final Set_qualifierContext set_qualifier() throws RecognitionException { - Set_qualifierContext _localctx = new Set_qualifierContext(_ctx, getState()); - enterRule(_localctx, 320, RULE_set_qualifier); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1485); - _la = _input.LA(1); - if ( !(_la==ALL || _la==DISTINCT) ) { - _errHandler.recoverInline(this); - } - else { - if ( _input.LA(1)==Token.EOF ) matchedEOF = true; - _errHandler.reportMatch(this); - consume(); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Column_referenceContext extends ParserRuleContext { - public IdentifierContext tb_name; - public IdentifierContext name; - public List identifier() { - return getRuleContexts(IdentifierContext.class); - } - public IdentifierContext identifier(int i) { - return getRuleContext(IdentifierContext.class,i); - } - public TerminalNode DOT() { return getToken(SQLParser.DOT, 0); } - public Column_referenceContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_column_reference; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterColumn_reference(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitColumn_reference(this); - } - } - - public final Column_referenceContext column_reference() throws RecognitionException { - Column_referenceContext _localctx = new Column_referenceContext(_ctx, getState()); - enterRule(_localctx, 322, RULE_column_reference); - try { - enterOuterAlt(_localctx, 1); - { - setState(1490); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,157,_ctx) ) { - case 1: - { - setState(1487); - ((Column_referenceContext)_localctx).tb_name = identifier(); - setState(1488); - match(DOT); - } - break; - } - setState(1492); - ((Column_referenceContext)_localctx).name = identifier(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class As_clauseContext extends ParserRuleContext { - public IdentifierContext identifier() { - return getRuleContext(IdentifierContext.class,0); - } - public TerminalNode AS() { return getToken(SQLParser.AS, 0); } - public As_clauseContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_as_clause; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterAs_clause(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitAs_clause(this); - } - } - - public final As_clauseContext as_clause() throws RecognitionException { - As_clauseContext _localctx = new As_clauseContext(_ctx, getState()); - enterRule(_localctx, 324, RULE_as_clause); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1495); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==AS) { - { - setState(1494); - match(AS); - } - } - - setState(1497); - identifier(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Column_reference_listContext extends ParserRuleContext { - public List column_reference() { - return getRuleContexts(Column_referenceContext.class); - } - public Column_referenceContext column_reference(int i) { - return getRuleContext(Column_referenceContext.class,i); - } - public List COMMA() { return getTokens(SQLParser.COMMA); } - public TerminalNode COMMA(int i) { - return getToken(SQLParser.COMMA, i); - } - public Column_reference_listContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_column_reference_list; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterColumn_reference_list(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitColumn_reference_list(this); - } - } - - public final Column_reference_listContext column_reference_list() throws RecognitionException { - Column_reference_listContext _localctx = new Column_reference_listContext(_ctx, getState()); - enterRule(_localctx, 326, RULE_column_reference_list); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1499); - column_reference(); - setState(1504); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==COMMA) { - { - { - setState(1500); - match(COMMA); - setState(1501); - column_reference(); - } - } - setState(1506); - _errHandler.sync(this); - _la = _input.LA(1); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Scalar_subqueryContext extends ParserRuleContext { - public SubqueryContext subquery() { - return getRuleContext(SubqueryContext.class,0); - } - public Scalar_subqueryContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_scalar_subquery; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterScalar_subquery(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitScalar_subquery(this); - } - } - - public final Scalar_subqueryContext scalar_subquery() throws RecognitionException { - Scalar_subqueryContext _localctx = new Scalar_subqueryContext(_ctx, getState()); - enterRule(_localctx, 328, RULE_scalar_subquery); - try { - enterOuterAlt(_localctx, 1); - { - setState(1507); - subquery(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Row_subqueryContext extends ParserRuleContext { - public SubqueryContext subquery() { - return getRuleContext(SubqueryContext.class,0); - } - public Row_subqueryContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_row_subquery; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterRow_subquery(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitRow_subquery(this); - } - } - - public final Row_subqueryContext row_subquery() throws RecognitionException { - Row_subqueryContext _localctx = new Row_subqueryContext(_ctx, getState()); - enterRule(_localctx, 330, RULE_row_subquery); - try { - enterOuterAlt(_localctx, 1); - { - setState(1509); - subquery(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Table_subqueryContext extends ParserRuleContext { - public SubqueryContext subquery() { - return getRuleContext(SubqueryContext.class,0); - } - public Table_subqueryContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_table_subquery; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterTable_subquery(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitTable_subquery(this); - } - } - - public final Table_subqueryContext table_subquery() throws RecognitionException { - Table_subqueryContext _localctx = new Table_subqueryContext(_ctx, getState()); - enterRule(_localctx, 332, RULE_table_subquery); - try { - enterOuterAlt(_localctx, 1); - { - setState(1511); - subquery(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class SubqueryContext extends ParserRuleContext { - public TerminalNode LEFT_PAREN() { return getToken(SQLParser.LEFT_PAREN, 0); } - public Query_expressionContext query_expression() { - return getRuleContext(Query_expressionContext.class,0); - } - public TerminalNode RIGHT_PAREN() { return getToken(SQLParser.RIGHT_PAREN, 0); } - public SubqueryContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_subquery; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterSubquery(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitSubquery(this); - } - } - - public final SubqueryContext subquery() throws RecognitionException { - SubqueryContext _localctx = new SubqueryContext(_ctx, getState()); - enterRule(_localctx, 334, RULE_subquery); - try { - enterOuterAlt(_localctx, 1); - { - setState(1513); - match(LEFT_PAREN); - setState(1514); - query_expression(); - setState(1515); - match(RIGHT_PAREN); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class PredicateContext extends ParserRuleContext { - public Comparison_predicateContext comparison_predicate() { - return getRuleContext(Comparison_predicateContext.class,0); - } - public Between_predicateContext between_predicate() { - return getRuleContext(Between_predicateContext.class,0); - } - public In_predicateContext in_predicate() { - return getRuleContext(In_predicateContext.class,0); - } - public Pattern_matching_predicateContext pattern_matching_predicate() { - return getRuleContext(Pattern_matching_predicateContext.class,0); - } - public Null_predicateContext null_predicate() { - return getRuleContext(Null_predicateContext.class,0); - } - public Exists_predicateContext exists_predicate() { - return getRuleContext(Exists_predicateContext.class,0); - } - public PredicateContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_predicate; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterPredicate(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitPredicate(this); - } - } - - public final PredicateContext predicate() throws RecognitionException { - PredicateContext _localctx = new PredicateContext(_ctx, getState()); - enterRule(_localctx, 336, RULE_predicate); - try { - setState(1523); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,160,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(1517); - comparison_predicate(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(1518); - between_predicate(); - } - break; - case 3: - enterOuterAlt(_localctx, 3); - { - setState(1519); - in_predicate(); - } - break; - case 4: - enterOuterAlt(_localctx, 4); - { - setState(1520); - pattern_matching_predicate(); - } - break; - case 5: - enterOuterAlt(_localctx, 5); - { - setState(1521); - null_predicate(); - } - break; - case 6: - enterOuterAlt(_localctx, 6); - { - setState(1522); - exists_predicate(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Comparison_predicateContext extends ParserRuleContext { - public Row_value_predicandContext left; - public Comp_opContext c; - public Row_value_predicandContext right; - public List row_value_predicand() { - return getRuleContexts(Row_value_predicandContext.class); - } - public Row_value_predicandContext row_value_predicand(int i) { - return getRuleContext(Row_value_predicandContext.class,i); - } - public Comp_opContext comp_op() { - return getRuleContext(Comp_opContext.class,0); - } - public Comparison_predicateContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_comparison_predicate; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterComparison_predicate(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitComparison_predicate(this); - } - } - - public final Comparison_predicateContext comparison_predicate() throws RecognitionException { - Comparison_predicateContext _localctx = new Comparison_predicateContext(_ctx, getState()); - enterRule(_localctx, 338, RULE_comparison_predicate); - try { - enterOuterAlt(_localctx, 1); - { - setState(1525); - ((Comparison_predicateContext)_localctx).left = row_value_predicand(); - setState(1526); - ((Comparison_predicateContext)_localctx).c = comp_op(); - setState(1527); - ((Comparison_predicateContext)_localctx).right = row_value_predicand(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Comp_opContext extends ParserRuleContext { - public TerminalNode EQUAL() { return getToken(SQLParser.EQUAL, 0); } - public TerminalNode NOT_EQUAL() { return getToken(SQLParser.NOT_EQUAL, 0); } - public TerminalNode LTH() { return getToken(SQLParser.LTH, 0); } - public TerminalNode LEQ() { return getToken(SQLParser.LEQ, 0); } - public TerminalNode GTH() { return getToken(SQLParser.GTH, 0); } - public TerminalNode GEQ() { return getToken(SQLParser.GEQ, 0); } - public Comp_opContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_comp_op; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterComp_op(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitComp_op(this); - } - } - - public final Comp_opContext comp_op() throws RecognitionException { - Comp_opContext _localctx = new Comp_opContext(_ctx, getState()); - enterRule(_localctx, 340, RULE_comp_op); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1529); - _la = _input.LA(1); - if ( !(((((_la - 174)) & ~0x3f) == 0 && ((1L << (_la - 174)) & ((1L << (EQUAL - 174)) | (1L << (NOT_EQUAL - 174)) | (1L << (LTH - 174)) | (1L << (LEQ - 174)) | (1L << (GTH - 174)) | (1L << (GEQ - 174)))) != 0)) ) { - _errHandler.recoverInline(this); - } - else { - if ( _input.LA(1)==Token.EOF ) matchedEOF = true; - _errHandler.reportMatch(this); - consume(); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Between_predicateContext extends ParserRuleContext { - public Row_value_predicandContext predicand; - public Between_predicate_part_2Context between_predicate_part_2() { - return getRuleContext(Between_predicate_part_2Context.class,0); - } - public Row_value_predicandContext row_value_predicand() { - return getRuleContext(Row_value_predicandContext.class,0); - } - public Between_predicateContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_between_predicate; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterBetween_predicate(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitBetween_predicate(this); - } - } - - public final Between_predicateContext between_predicate() throws RecognitionException { - Between_predicateContext _localctx = new Between_predicateContext(_ctx, getState()); - enterRule(_localctx, 342, RULE_between_predicate); - try { - enterOuterAlt(_localctx, 1); - { - setState(1531); - ((Between_predicateContext)_localctx).predicand = row_value_predicand(); - setState(1532); - between_predicate_part_2(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Between_predicate_part_2Context extends ParserRuleContext { - public Row_value_predicandContext begin; - public Row_value_predicandContext end; - public TerminalNode BETWEEN() { return getToken(SQLParser.BETWEEN, 0); } - public TerminalNode AND() { return getToken(SQLParser.AND, 0); } - public List row_value_predicand() { - return getRuleContexts(Row_value_predicandContext.class); - } - public Row_value_predicandContext row_value_predicand(int i) { - return getRuleContext(Row_value_predicandContext.class,i); - } - public TerminalNode NOT() { return getToken(SQLParser.NOT, 0); } - public TerminalNode ASYMMETRIC() { return getToken(SQLParser.ASYMMETRIC, 0); } - public TerminalNode SYMMETRIC() { return getToken(SQLParser.SYMMETRIC, 0); } - public Between_predicate_part_2Context(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_between_predicate_part_2; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterBetween_predicate_part_2(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitBetween_predicate_part_2(this); - } - } - - public final Between_predicate_part_2Context between_predicate_part_2() throws RecognitionException { - Between_predicate_part_2Context _localctx = new Between_predicate_part_2Context(_ctx, getState()); - enterRule(_localctx, 344, RULE_between_predicate_part_2); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1535); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==NOT) { - { - setState(1534); - match(NOT); - } - } - - setState(1537); - match(BETWEEN); - setState(1539); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==ASYMMETRIC || _la==SYMMETRIC) { - { - setState(1538); - _la = _input.LA(1); - if ( !(_la==ASYMMETRIC || _la==SYMMETRIC) ) { - _errHandler.recoverInline(this); - } - else { - if ( _input.LA(1)==Token.EOF ) matchedEOF = true; - _errHandler.reportMatch(this); - consume(); - } - } - } - - setState(1541); - ((Between_predicate_part_2Context)_localctx).begin = row_value_predicand(); - setState(1542); - match(AND); - setState(1543); - ((Between_predicate_part_2Context)_localctx).end = row_value_predicand(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class In_predicateContext extends ParserRuleContext { - public Numeric_value_expressionContext predicand; - public TerminalNode IN() { return getToken(SQLParser.IN, 0); } - public In_predicate_valueContext in_predicate_value() { - return getRuleContext(In_predicate_valueContext.class,0); - } - public Numeric_value_expressionContext numeric_value_expression() { - return getRuleContext(Numeric_value_expressionContext.class,0); - } - public TerminalNode NOT() { return getToken(SQLParser.NOT, 0); } - public In_predicateContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_in_predicate; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterIn_predicate(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitIn_predicate(this); - } - } - - public final In_predicateContext in_predicate() throws RecognitionException { - In_predicateContext _localctx = new In_predicateContext(_ctx, getState()); - enterRule(_localctx, 346, RULE_in_predicate); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1545); - ((In_predicateContext)_localctx).predicand = numeric_value_expression(); - setState(1547); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==NOT) { - { - setState(1546); - match(NOT); - } - } - - setState(1549); - match(IN); - setState(1550); - in_predicate_value(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class In_predicate_valueContext extends ParserRuleContext { - public Table_subqueryContext table_subquery() { - return getRuleContext(Table_subqueryContext.class,0); - } - public TerminalNode LEFT_PAREN() { return getToken(SQLParser.LEFT_PAREN, 0); } - public In_value_listContext in_value_list() { - return getRuleContext(In_value_listContext.class,0); - } - public TerminalNode RIGHT_PAREN() { return getToken(SQLParser.RIGHT_PAREN, 0); } - public In_predicate_valueContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_in_predicate_value; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterIn_predicate_value(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitIn_predicate_value(this); - } - } - - public final In_predicate_valueContext in_predicate_value() throws RecognitionException { - In_predicate_valueContext _localctx = new In_predicate_valueContext(_ctx, getState()); - enterRule(_localctx, 348, RULE_in_predicate_value); - try { - setState(1557); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,164,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(1552); - table_subquery(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(1553); - match(LEFT_PAREN); - setState(1554); - in_value_list(); - setState(1555); - match(RIGHT_PAREN); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class In_value_listContext extends ParserRuleContext { - public List row_value_expression() { - return getRuleContexts(Row_value_expressionContext.class); - } - public Row_value_expressionContext row_value_expression(int i) { - return getRuleContext(Row_value_expressionContext.class,i); - } - public List COMMA() { return getTokens(SQLParser.COMMA); } - public TerminalNode COMMA(int i) { - return getToken(SQLParser.COMMA, i); - } - public In_value_listContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_in_value_list; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterIn_value_list(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitIn_value_list(this); - } - } - - public final In_value_listContext in_value_list() throws RecognitionException { - In_value_listContext _localctx = new In_value_listContext(_ctx, getState()); - enterRule(_localctx, 350, RULE_in_value_list); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1559); - row_value_expression(); - setState(1564); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==COMMA) { - { - { - setState(1560); - match(COMMA); - setState(1561); - row_value_expression(); - } - } - setState(1566); - _errHandler.sync(this); - _la = _input.LA(1); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Pattern_matching_predicateContext extends ParserRuleContext { - public Row_value_predicandContext f; - public Token s; - public Pattern_matcherContext pattern_matcher() { - return getRuleContext(Pattern_matcherContext.class,0); - } - public Row_value_predicandContext row_value_predicand() { - return getRuleContext(Row_value_predicandContext.class,0); - } - public TerminalNode Character_String_Literal() { return getToken(SQLParser.Character_String_Literal, 0); } - public Pattern_matching_predicateContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_pattern_matching_predicate; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterPattern_matching_predicate(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitPattern_matching_predicate(this); - } - } - - public final Pattern_matching_predicateContext pattern_matching_predicate() throws RecognitionException { - Pattern_matching_predicateContext _localctx = new Pattern_matching_predicateContext(_ctx, getState()); - enterRule(_localctx, 352, RULE_pattern_matching_predicate); - try { - enterOuterAlt(_localctx, 1); - { - setState(1567); - ((Pattern_matching_predicateContext)_localctx).f = row_value_predicand(); - setState(1568); - pattern_matcher(); - setState(1569); - ((Pattern_matching_predicateContext)_localctx).s = match(Character_String_Literal); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Pattern_matcherContext extends ParserRuleContext { - public Negativable_matcherContext negativable_matcher() { - return getRuleContext(Negativable_matcherContext.class,0); - } - public TerminalNode NOT() { return getToken(SQLParser.NOT, 0); } - public Regex_matcherContext regex_matcher() { - return getRuleContext(Regex_matcherContext.class,0); - } - public Pattern_matcherContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_pattern_matcher; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterPattern_matcher(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitPattern_matcher(this); - } - } - - public final Pattern_matcherContext pattern_matcher() throws RecognitionException { - Pattern_matcherContext _localctx = new Pattern_matcherContext(_ctx, getState()); - enterRule(_localctx, 354, RULE_pattern_matcher); - int _la; - try { - setState(1576); - _errHandler.sync(this); - switch (_input.LA(1)) { - case ILIKE: - case LIKE: - case NOT: - case REGEXP: - case RLIKE: - case SIMILAR: - enterOuterAlt(_localctx, 1); - { - setState(1572); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==NOT) { - { - setState(1571); - match(NOT); - } - } - - setState(1574); - negativable_matcher(); - } - break; - case Similar_To: - case Not_Similar_To: - case Similar_To_Case_Insensitive: - case Not_Similar_To_Case_Insensitive: - enterOuterAlt(_localctx, 2); - { - setState(1575); - regex_matcher(); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Negativable_matcherContext extends ParserRuleContext { - public TerminalNode LIKE() { return getToken(SQLParser.LIKE, 0); } - public TerminalNode ILIKE() { return getToken(SQLParser.ILIKE, 0); } - public TerminalNode SIMILAR() { return getToken(SQLParser.SIMILAR, 0); } - public TerminalNode TO() { return getToken(SQLParser.TO, 0); } - public TerminalNode REGEXP() { return getToken(SQLParser.REGEXP, 0); } - public TerminalNode RLIKE() { return getToken(SQLParser.RLIKE, 0); } - public Negativable_matcherContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_negativable_matcher; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterNegativable_matcher(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitNegativable_matcher(this); - } - } - - public final Negativable_matcherContext negativable_matcher() throws RecognitionException { - Negativable_matcherContext _localctx = new Negativable_matcherContext(_ctx, getState()); - enterRule(_localctx, 356, RULE_negativable_matcher); - try { - setState(1584); - _errHandler.sync(this); - switch (_input.LA(1)) { - case LIKE: - enterOuterAlt(_localctx, 1); - { - setState(1578); - match(LIKE); - } - break; - case ILIKE: - enterOuterAlt(_localctx, 2); - { - setState(1579); - match(ILIKE); - } - break; - case SIMILAR: - enterOuterAlt(_localctx, 3); - { - setState(1580); - match(SIMILAR); - setState(1581); - match(TO); - } - break; - case REGEXP: - enterOuterAlt(_localctx, 4); - { - setState(1582); - match(REGEXP); - } - break; - case RLIKE: - enterOuterAlt(_localctx, 5); - { - setState(1583); - match(RLIKE); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Regex_matcherContext extends ParserRuleContext { - public TerminalNode Similar_To() { return getToken(SQLParser.Similar_To, 0); } - public TerminalNode Not_Similar_To() { return getToken(SQLParser.Not_Similar_To, 0); } - public TerminalNode Similar_To_Case_Insensitive() { return getToken(SQLParser.Similar_To_Case_Insensitive, 0); } - public TerminalNode Not_Similar_To_Case_Insensitive() { return getToken(SQLParser.Not_Similar_To_Case_Insensitive, 0); } - public Regex_matcherContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_regex_matcher; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterRegex_matcher(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitRegex_matcher(this); - } - } - - public final Regex_matcherContext regex_matcher() throws RecognitionException { - Regex_matcherContext _localctx = new Regex_matcherContext(_ctx, getState()); - enterRule(_localctx, 358, RULE_regex_matcher); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1586); - _la = _input.LA(1); - if ( !(((((_la - 168)) & ~0x3f) == 0 && ((1L << (_la - 168)) & ((1L << (Similar_To - 168)) | (1L << (Not_Similar_To - 168)) | (1L << (Similar_To_Case_Insensitive - 168)) | (1L << (Not_Similar_To_Case_Insensitive - 168)))) != 0)) ) { - _errHandler.recoverInline(this); - } - else { - if ( _input.LA(1)==Token.EOF ) matchedEOF = true; - _errHandler.reportMatch(this); - consume(); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Null_predicateContext extends ParserRuleContext { - public Row_value_predicandContext predicand; - public Token n; - public TerminalNode IS() { return getToken(SQLParser.IS, 0); } - public TerminalNode NULL() { return getToken(SQLParser.NULL, 0); } - public Row_value_predicandContext row_value_predicand() { - return getRuleContext(Row_value_predicandContext.class,0); - } - public TerminalNode NOT() { return getToken(SQLParser.NOT, 0); } - public Null_predicateContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_null_predicate; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterNull_predicate(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitNull_predicate(this); - } - } - - public final Null_predicateContext null_predicate() throws RecognitionException { - Null_predicateContext _localctx = new Null_predicateContext(_ctx, getState()); - enterRule(_localctx, 360, RULE_null_predicate); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1588); - ((Null_predicateContext)_localctx).predicand = row_value_predicand(); - setState(1589); - match(IS); - setState(1591); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==NOT) { - { - setState(1590); - ((Null_predicateContext)_localctx).n = match(NOT); - } - } - - setState(1593); - match(NULL); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Quantified_comparison_predicateContext extends ParserRuleContext { - public Numeric_value_expressionContext l; - public Comp_opContext c; - public QuantifierContext q; - public Table_subqueryContext s; - public Numeric_value_expressionContext numeric_value_expression() { - return getRuleContext(Numeric_value_expressionContext.class,0); - } - public Comp_opContext comp_op() { - return getRuleContext(Comp_opContext.class,0); - } - public QuantifierContext quantifier() { - return getRuleContext(QuantifierContext.class,0); - } - public Table_subqueryContext table_subquery() { - return getRuleContext(Table_subqueryContext.class,0); - } - public Quantified_comparison_predicateContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_quantified_comparison_predicate; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterQuantified_comparison_predicate(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitQuantified_comparison_predicate(this); - } - } - - public final Quantified_comparison_predicateContext quantified_comparison_predicate() throws RecognitionException { - Quantified_comparison_predicateContext _localctx = new Quantified_comparison_predicateContext(_ctx, getState()); - enterRule(_localctx, 362, RULE_quantified_comparison_predicate); - try { - enterOuterAlt(_localctx, 1); - { - setState(1595); - ((Quantified_comparison_predicateContext)_localctx).l = numeric_value_expression(); - setState(1596); - ((Quantified_comparison_predicateContext)_localctx).c = comp_op(); - setState(1597); - ((Quantified_comparison_predicateContext)_localctx).q = quantifier(); - setState(1598); - ((Quantified_comparison_predicateContext)_localctx).s = table_subquery(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class QuantifierContext extends ParserRuleContext { - public AllContext all() { - return getRuleContext(AllContext.class,0); - } - public SomeContext some() { - return getRuleContext(SomeContext.class,0); - } - public QuantifierContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_quantifier; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterQuantifier(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitQuantifier(this); - } - } - - public final QuantifierContext quantifier() throws RecognitionException { - QuantifierContext _localctx = new QuantifierContext(_ctx, getState()); - enterRule(_localctx, 364, RULE_quantifier); - try { - setState(1602); - _errHandler.sync(this); - switch (_input.LA(1)) { - case ALL: - enterOuterAlt(_localctx, 1); - { - setState(1600); - all(); - } - break; - case ANY: - case SOME: - enterOuterAlt(_localctx, 2); - { - setState(1601); - some(); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class AllContext extends ParserRuleContext { - public TerminalNode ALL() { return getToken(SQLParser.ALL, 0); } - public AllContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_all; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterAll(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitAll(this); - } - } - - public final AllContext all() throws RecognitionException { - AllContext _localctx = new AllContext(_ctx, getState()); - enterRule(_localctx, 366, RULE_all); - try { - enterOuterAlt(_localctx, 1); - { - setState(1604); - match(ALL); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class SomeContext extends ParserRuleContext { - public TerminalNode SOME() { return getToken(SQLParser.SOME, 0); } - public TerminalNode ANY() { return getToken(SQLParser.ANY, 0); } - public SomeContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_some; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterSome(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitSome(this); - } - } - - public final SomeContext some() throws RecognitionException { - SomeContext _localctx = new SomeContext(_ctx, getState()); - enterRule(_localctx, 368, RULE_some); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1606); - _la = _input.LA(1); - if ( !(_la==ANY || _la==SOME) ) { - _errHandler.recoverInline(this); - } - else { - if ( _input.LA(1)==Token.EOF ) matchedEOF = true; - _errHandler.reportMatch(this); - consume(); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Exists_predicateContext extends ParserRuleContext { - public Table_subqueryContext s; - public TerminalNode EXISTS() { return getToken(SQLParser.EXISTS, 0); } - public Table_subqueryContext table_subquery() { - return getRuleContext(Table_subqueryContext.class,0); - } - public TerminalNode NOT() { return getToken(SQLParser.NOT, 0); } - public Exists_predicateContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_exists_predicate; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterExists_predicate(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitExists_predicate(this); - } - } - - public final Exists_predicateContext exists_predicate() throws RecognitionException { - Exists_predicateContext _localctx = new Exists_predicateContext(_ctx, getState()); - enterRule(_localctx, 370, RULE_exists_predicate); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1609); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==NOT) { - { - setState(1608); - match(NOT); - } - } - - setState(1611); - match(EXISTS); - setState(1612); - ((Exists_predicateContext)_localctx).s = table_subquery(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Unique_predicateContext extends ParserRuleContext { - public Table_subqueryContext s; - public TerminalNode UNIQUE() { return getToken(SQLParser.UNIQUE, 0); } - public Table_subqueryContext table_subquery() { - return getRuleContext(Table_subqueryContext.class,0); - } - public Unique_predicateContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_unique_predicate; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterUnique_predicate(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitUnique_predicate(this); - } - } - - public final Unique_predicateContext unique_predicate() throws RecognitionException { - Unique_predicateContext _localctx = new Unique_predicateContext(_ctx, getState()); - enterRule(_localctx, 372, RULE_unique_predicate); - try { - enterOuterAlt(_localctx, 1); - { - setState(1614); - match(UNIQUE); - setState(1615); - ((Unique_predicateContext)_localctx).s = table_subquery(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Primary_datetime_fieldContext extends ParserRuleContext { - public Non_second_primary_datetime_fieldContext non_second_primary_datetime_field() { - return getRuleContext(Non_second_primary_datetime_fieldContext.class,0); - } - public TerminalNode SECOND() { return getToken(SQLParser.SECOND, 0); } - public Primary_datetime_fieldContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_primary_datetime_field; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterPrimary_datetime_field(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitPrimary_datetime_field(this); - } - } - - public final Primary_datetime_fieldContext primary_datetime_field() throws RecognitionException { - Primary_datetime_fieldContext _localctx = new Primary_datetime_fieldContext(_ctx, getState()); - enterRule(_localctx, 374, RULE_primary_datetime_field); - try { - setState(1619); - _errHandler.sync(this); - switch (_input.LA(1)) { - case DAY: - case HOUR: - case MINUTE: - case MONTH: - case YEAR: - enterOuterAlt(_localctx, 1); - { - setState(1617); - non_second_primary_datetime_field(); - } - break; - case SECOND: - enterOuterAlt(_localctx, 2); - { - setState(1618); - match(SECOND); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Non_second_primary_datetime_fieldContext extends ParserRuleContext { - public TerminalNode YEAR() { return getToken(SQLParser.YEAR, 0); } - public TerminalNode MONTH() { return getToken(SQLParser.MONTH, 0); } - public TerminalNode DAY() { return getToken(SQLParser.DAY, 0); } - public TerminalNode HOUR() { return getToken(SQLParser.HOUR, 0); } - public TerminalNode MINUTE() { return getToken(SQLParser.MINUTE, 0); } - public Non_second_primary_datetime_fieldContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_non_second_primary_datetime_field; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterNon_second_primary_datetime_field(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitNon_second_primary_datetime_field(this); - } - } - - public final Non_second_primary_datetime_fieldContext non_second_primary_datetime_field() throws RecognitionException { - Non_second_primary_datetime_fieldContext _localctx = new Non_second_primary_datetime_fieldContext(_ctx, getState()); - enterRule(_localctx, 376, RULE_non_second_primary_datetime_field); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1621); - _la = _input.LA(1); - if ( !(((((_la - 64)) & ~0x3f) == 0 && ((1L << (_la - 64)) & ((1L << (DAY - 64)) | (1L << (HOUR - 64)) | (1L << (MINUTE - 64)) | (1L << (MONTH - 64)))) != 0) || _la==YEAR) ) { - _errHandler.recoverInline(this); - } - else { - if ( _input.LA(1)==Token.EOF ) matchedEOF = true; - _errHandler.reportMatch(this); - consume(); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Extended_datetime_fieldContext extends ParserRuleContext { - public TerminalNode CENTURY() { return getToken(SQLParser.CENTURY, 0); } - public TerminalNode DECADE() { return getToken(SQLParser.DECADE, 0); } - public TerminalNode DOW() { return getToken(SQLParser.DOW, 0); } - public TerminalNode DOY() { return getToken(SQLParser.DOY, 0); } - public TerminalNode EPOCH() { return getToken(SQLParser.EPOCH, 0); } - public TerminalNode ISODOW() { return getToken(SQLParser.ISODOW, 0); } - public TerminalNode ISOYEAR() { return getToken(SQLParser.ISOYEAR, 0); } - public TerminalNode MICROSECONDS() { return getToken(SQLParser.MICROSECONDS, 0); } - public TerminalNode MILLENNIUM() { return getToken(SQLParser.MILLENNIUM, 0); } - public TerminalNode MILLISECONDS() { return getToken(SQLParser.MILLISECONDS, 0); } - public TerminalNode QUARTER() { return getToken(SQLParser.QUARTER, 0); } - public TerminalNode WEEK() { return getToken(SQLParser.WEEK, 0); } - public Extended_datetime_fieldContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_extended_datetime_field; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterExtended_datetime_field(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitExtended_datetime_field(this); - } - } - - public final Extended_datetime_fieldContext extended_datetime_field() throws RecognitionException { - Extended_datetime_fieldContext _localctx = new Extended_datetime_fieldContext(_ctx, getState()); - enterRule(_localctx, 378, RULE_extended_datetime_field); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1623); - _la = _input.LA(1); - if ( !(((((_la - 57)) & ~0x3f) == 0 && ((1L << (_la - 57)) & ((1L << (CENTURY - 57)) | (1L << (DECADE - 57)) | (1L << (DOW - 57)) | (1L << (DOY - 57)) | (1L << (EPOCH - 57)) | (1L << (ISODOW - 57)) | (1L << (ISOYEAR - 57)) | (1L << (MICROSECONDS - 57)) | (1L << (MILLENNIUM - 57)) | (1L << (MILLISECONDS - 57)) | (1L << (QUARTER - 57)))) != 0) || _la==WEEK) ) { - _errHandler.recoverInline(this); - } - else { - if ( _input.LA(1)==Token.EOF ) matchedEOF = true; - _errHandler.reportMatch(this); - consume(); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Routine_invocationContext extends ParserRuleContext { - public Function_nameContext function_name() { - return getRuleContext(Function_nameContext.class,0); - } - public TerminalNode LEFT_PAREN() { return getToken(SQLParser.LEFT_PAREN, 0); } - public TerminalNode RIGHT_PAREN() { return getToken(SQLParser.RIGHT_PAREN, 0); } - public Sql_argument_listContext sql_argument_list() { - return getRuleContext(Sql_argument_listContext.class,0); - } - public Routine_invocationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_routine_invocation; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterRoutine_invocation(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitRoutine_invocation(this); - } - } - - public final Routine_invocationContext routine_invocation() throws RecognitionException { - Routine_invocationContext _localctx = new Routine_invocationContext(_ctx, getState()); - enterRule(_localctx, 380, RULE_routine_invocation); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1625); - function_name(); - setState(1626); - match(LEFT_PAREN); - setState(1628); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << ANY) | (1L << CASE) | (1L << CAST) | (1L << FALSE) | (1L << LEFT) | (1L << NOT) | (1L << NULL) | (1L << RIGHT) | (1L << SOME) | (1L << TRUE) | (1L << AVG) | (1L << BETWEEN) | (1L << BY) | (1L << CENTURY) | (1L << CHARACTER) | (1L << COLLECT) | (1L << COALESCE) | (1L << COLUMN) | (1L << COUNT) | (1L << CUBE))) != 0) || ((((_la - 64)) & ~0x3f) == 0 && ((1L << (_la - 64)) & ((1L << (DAY - 64)) | (1L << (DEC - 64)) | (1L << (DECADE - 64)) | (1L << (DOW - 64)) | (1L << (DOY - 64)) | (1L << (DROP - 64)) | (1L << (EPOCH - 64)) | (1L << (EVERY - 64)) | (1L << (EXISTS - 64)) | (1L << (EXTERNAL - 64)) | (1L << (EXTRACT - 64)) | (1L << (FILTER - 64)) | (1L << (FIRST - 64)) | (1L << (FORMAT - 64)) | (1L << (FUSION - 64)) | (1L << (GROUPING - 64)) | (1L << (HASH - 64)) | (1L << (INDEX - 64)) | (1L << (INSERT - 64)) | (1L << (INTERSECTION - 64)) | (1L << (ISODOW - 64)) | (1L << (ISOYEAR - 64)) | (1L << (LAST - 64)) | (1L << (LESS - 64)) | (1L << (LIST - 64)) | (1L << (LOCATION - 64)) | (1L << (MAX - 64)) | (1L << (MAXVALUE - 64)) | (1L << (MICROSECONDS - 64)) | (1L << (MILLENNIUM - 64)) | (1L << (MILLISECONDS - 64)) | (1L << (MIN - 64)) | (1L << (MINUTE - 64)) | (1L << (MONTH - 64)) | (1L << (NATIONAL - 64)) | (1L << (NULLIF - 64)) | (1L << (OVERWRITE - 64)) | (1L << (PARTITION - 64)) | (1L << (PARTITIONS - 64)) | (1L << (PRECISION - 64)) | (1L << (PURGE - 64)) | (1L << (QUARTER - 64)) | (1L << (RANGE - 64)) | (1L << (REGEXP - 64)) | (1L << (RLIKE - 64)) | (1L << (ROLLUP - 64)) | (1L << (SECOND - 64)) | (1L << (SET - 64)) | (1L << (SIMILAR - 64)) | (1L << (STDDEV_POP - 64)) | (1L << (STDDEV_SAMP - 64)) | (1L << (SUBPARTITION - 64)) | (1L << (SUM - 64)) | (1L << (TABLESPACE - 64)) | (1L << (THAN - 64)) | (1L << (TIMEZONE - 64)) | (1L << (TIMEZONE_HOUR - 64)) | (1L << (TIMEZONE_MINUTE - 64)) | (1L << (TRIM - 64)) | (1L << (TO - 64)) | (1L << (UNKNOWN - 64)) | (1L << (VALUES - 64)) | (1L << (VAR_SAMP - 64)))) != 0) || ((((_la - 128)) & ~0x3f) == 0 && ((1L << (_la - 128)) & ((1L << (VAR_POP - 128)) | (1L << (VARYING - 128)) | (1L << (WEEK - 128)) | (1L << (YEAR - 128)) | (1L << (ZONE - 128)) | (1L << (BOOLEAN - 128)) | (1L << (BOOL - 128)) | (1L << (BIT - 128)) | (1L << (VARBIT - 128)) | (1L << (INT1 - 128)) | (1L << (INT2 - 128)) | (1L << (INT4 - 128)) | (1L << (INT8 - 128)) | (1L << (TINYINT - 128)) | (1L << (SMALLINT - 128)) | (1L << (INT - 128)) | (1L << (INTEGER - 128)) | (1L << (BIGINT - 128)) | (1L << (FLOAT4 - 128)) | (1L << (FLOAT8 - 128)) | (1L << (REAL - 128)) | (1L << (FLOAT - 128)) | (1L << (DOUBLE - 128)) | (1L << (NUMERIC - 128)) | (1L << (DECIMAL - 128)) | (1L << (CHAR - 128)) | (1L << (VARCHAR - 128)) | (1L << (NCHAR - 128)) | (1L << (NVARCHAR - 128)) | (1L << (DATE - 128)) | (1L << (TIME - 128)) | (1L << (TIMETZ - 128)) | (1L << (TIMESTAMP - 128)) | (1L << (TIMESTAMPTZ - 128)) | (1L << (TEXT - 128)) | (1L << (VARBINARY - 128)) | (1L << (BLOB - 128)) | (1L << (BYTEA - 128)) | (1L << (INET4 - 128)) | (1L << (LEFT_PAREN - 128)) | (1L << (PLUS - 128)) | (1L << (MINUS - 128)))) != 0) || ((((_la - 196)) & ~0x3f) == 0 && ((1L << (_la - 196)) & ((1L << (NUMBER - 196)) | (1L << (REAL_NUMBER - 196)) | (1L << (Identifier - 196)) | (1L << (Character_String_Literal - 196)))) != 0)) { - { - setState(1627); - sql_argument_list(); - } - } - - setState(1630); - match(RIGHT_PAREN); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Function_names_for_reserved_wordsContext extends ParserRuleContext { - public TerminalNode LEFT() { return getToken(SQLParser.LEFT, 0); } - public TerminalNode RIGHT() { return getToken(SQLParser.RIGHT, 0); } - public Function_names_for_reserved_wordsContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_function_names_for_reserved_words; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterFunction_names_for_reserved_words(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitFunction_names_for_reserved_words(this); - } - } - - public final Function_names_for_reserved_wordsContext function_names_for_reserved_words() throws RecognitionException { - Function_names_for_reserved_wordsContext _localctx = new Function_names_for_reserved_wordsContext(_ctx, getState()); - enterRule(_localctx, 382, RULE_function_names_for_reserved_words); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1632); - _la = _input.LA(1); - if ( !(_la==LEFT || _la==RIGHT) ) { - _errHandler.recoverInline(this); - } - else { - if ( _input.LA(1)==Token.EOF ) matchedEOF = true; - _errHandler.reportMatch(this); - consume(); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Function_nameContext extends ParserRuleContext { - public IdentifierContext identifier() { - return getRuleContext(IdentifierContext.class,0); - } - public Function_names_for_reserved_wordsContext function_names_for_reserved_words() { - return getRuleContext(Function_names_for_reserved_wordsContext.class,0); - } - public Function_nameContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_function_name; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterFunction_name(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitFunction_name(this); - } - } - - public final Function_nameContext function_name() throws RecognitionException { - Function_nameContext _localctx = new Function_nameContext(_ctx, getState()); - enterRule(_localctx, 384, RULE_function_name); - try { - setState(1636); - _errHandler.sync(this); - switch (_input.LA(1)) { - case AVG: - case BETWEEN: - case BY: - case CENTURY: - case CHARACTER: - case COLLECT: - case COALESCE: - case COLUMN: - case COUNT: - case CUBE: - case DAY: - case DEC: - case DECADE: - case DOW: - case DOY: - case DROP: - case EPOCH: - case EVERY: - case EXISTS: - case EXTERNAL: - case EXTRACT: - case FILTER: - case FIRST: - case FORMAT: - case FUSION: - case GROUPING: - case HASH: - case INDEX: - case INSERT: - case INTERSECTION: - case ISODOW: - case ISOYEAR: - case LAST: - case LESS: - case LIST: - case LOCATION: - case MAX: - case MAXVALUE: - case MICROSECONDS: - case MILLENNIUM: - case MILLISECONDS: - case MIN: - case MINUTE: - case MONTH: - case NATIONAL: - case NULLIF: - case OVERWRITE: - case PARTITION: - case PARTITIONS: - case PRECISION: - case PURGE: - case QUARTER: - case RANGE: - case REGEXP: - case RLIKE: - case ROLLUP: - case SECOND: - case SET: - case SIMILAR: - case STDDEV_POP: - case STDDEV_SAMP: - case SUBPARTITION: - case SUM: - case TABLESPACE: - case THAN: - case TIMEZONE: - case TIMEZONE_HOUR: - case TIMEZONE_MINUTE: - case TRIM: - case TO: - case UNKNOWN: - case VALUES: - case VAR_SAMP: - case VAR_POP: - case VARYING: - case WEEK: - case YEAR: - case ZONE: - case BOOLEAN: - case BOOL: - case BIT: - case VARBIT: - case INT1: - case INT2: - case INT4: - case INT8: - case TINYINT: - case SMALLINT: - case INT: - case INTEGER: - case BIGINT: - case FLOAT4: - case FLOAT8: - case REAL: - case FLOAT: - case DOUBLE: - case NUMERIC: - case DECIMAL: - case CHAR: - case VARCHAR: - case NCHAR: - case NVARCHAR: - case DATE: - case TIME: - case TIMETZ: - case TIMESTAMP: - case TIMESTAMPTZ: - case TEXT: - case VARBINARY: - case BLOB: - case BYTEA: - case INET4: - case Identifier: - enterOuterAlt(_localctx, 1); - { - setState(1634); - identifier(); - } - break; - case LEFT: - case RIGHT: - enterOuterAlt(_localctx, 2); - { - setState(1635); - function_names_for_reserved_words(); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Sql_argument_listContext extends ParserRuleContext { - public List value_expression() { - return getRuleContexts(Value_expressionContext.class); - } - public Value_expressionContext value_expression(int i) { - return getRuleContext(Value_expressionContext.class,i); - } - public List COMMA() { return getTokens(SQLParser.COMMA); } - public TerminalNode COMMA(int i) { - return getToken(SQLParser.COMMA, i); - } - public Sql_argument_listContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_sql_argument_list; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterSql_argument_list(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitSql_argument_list(this); - } - } - - public final Sql_argument_listContext sql_argument_list() throws RecognitionException { - Sql_argument_listContext _localctx = new Sql_argument_listContext(_ctx, getState()); - enterRule(_localctx, 386, RULE_sql_argument_list); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1638); - value_expression(); - setState(1643); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==COMMA) { - { - { - setState(1639); - match(COMMA); - setState(1640); - value_expression(); - } - } - setState(1645); - _errHandler.sync(this); - _la = _input.LA(1); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Orderby_clauseContext extends ParserRuleContext { - public TerminalNode ORDER() { return getToken(SQLParser.ORDER, 0); } - public TerminalNode BY() { return getToken(SQLParser.BY, 0); } - public Sort_specifier_listContext sort_specifier_list() { - return getRuleContext(Sort_specifier_listContext.class,0); - } - public Orderby_clauseContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_orderby_clause; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterOrderby_clause(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitOrderby_clause(this); - } - } - - public final Orderby_clauseContext orderby_clause() throws RecognitionException { - Orderby_clauseContext _localctx = new Orderby_clauseContext(_ctx, getState()); - enterRule(_localctx, 388, RULE_orderby_clause); - try { - enterOuterAlt(_localctx, 1); - { - setState(1646); - match(ORDER); - setState(1647); - match(BY); - setState(1648); - sort_specifier_list(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Sort_specifier_listContext extends ParserRuleContext { - public List sort_specifier() { - return getRuleContexts(Sort_specifierContext.class); - } - public Sort_specifierContext sort_specifier(int i) { - return getRuleContext(Sort_specifierContext.class,i); - } - public List COMMA() { return getTokens(SQLParser.COMMA); } - public TerminalNode COMMA(int i) { - return getToken(SQLParser.COMMA, i); - } - public Sort_specifier_listContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_sort_specifier_list; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterSort_specifier_list(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitSort_specifier_list(this); - } - } - - public final Sort_specifier_listContext sort_specifier_list() throws RecognitionException { - Sort_specifier_listContext _localctx = new Sort_specifier_listContext(_ctx, getState()); - enterRule(_localctx, 390, RULE_sort_specifier_list); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1650); - sort_specifier(); - setState(1655); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==COMMA) { - { - { - setState(1651); - match(COMMA); - setState(1652); - sort_specifier(); - } - } - setState(1657); - _errHandler.sync(this); - _la = _input.LA(1); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Sort_specifierContext extends ParserRuleContext { - public Row_value_predicandContext key; - public Order_specificationContext order; - public Null_orderingContext null_order; - public Row_value_predicandContext row_value_predicand() { - return getRuleContext(Row_value_predicandContext.class,0); - } - public Order_specificationContext order_specification() { - return getRuleContext(Order_specificationContext.class,0); - } - public Null_orderingContext null_ordering() { - return getRuleContext(Null_orderingContext.class,0); - } - public Sort_specifierContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_sort_specifier; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterSort_specifier(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitSort_specifier(this); - } - } - - public final Sort_specifierContext sort_specifier() throws RecognitionException { - Sort_specifierContext _localctx = new Sort_specifierContext(_ctx, getState()); - enterRule(_localctx, 392, RULE_sort_specifier); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1658); - ((Sort_specifierContext)_localctx).key = row_value_predicand(); - setState(1660); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==ASC || _la==DESC) { - { - setState(1659); - ((Sort_specifierContext)_localctx).order = order_specification(); - } - } - - setState(1663); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==NULL) { - { - setState(1662); - ((Sort_specifierContext)_localctx).null_order = null_ordering(); - } - } - - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Order_specificationContext extends ParserRuleContext { - public TerminalNode ASC() { return getToken(SQLParser.ASC, 0); } - public TerminalNode DESC() { return getToken(SQLParser.DESC, 0); } - public Order_specificationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_order_specification; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterOrder_specification(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitOrder_specification(this); - } - } - - public final Order_specificationContext order_specification() throws RecognitionException { - Order_specificationContext _localctx = new Order_specificationContext(_ctx, getState()); - enterRule(_localctx, 394, RULE_order_specification); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1665); - _la = _input.LA(1); - if ( !(_la==ASC || _la==DESC) ) { - _errHandler.recoverInline(this); - } - else { - if ( _input.LA(1)==Token.EOF ) matchedEOF = true; - _errHandler.reportMatch(this); - consume(); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Limit_clauseContext extends ParserRuleContext { - public Numeric_value_expressionContext e; - public TerminalNode LIMIT() { return getToken(SQLParser.LIMIT, 0); } - public Numeric_value_expressionContext numeric_value_expression() { - return getRuleContext(Numeric_value_expressionContext.class,0); - } - public Limit_clauseContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_limit_clause; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterLimit_clause(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitLimit_clause(this); - } - } - - public final Limit_clauseContext limit_clause() throws RecognitionException { - Limit_clauseContext _localctx = new Limit_clauseContext(_ctx, getState()); - enterRule(_localctx, 396, RULE_limit_clause); - try { - enterOuterAlt(_localctx, 1); - { - setState(1667); - match(LIMIT); - setState(1668); - ((Limit_clauseContext)_localctx).e = numeric_value_expression(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Null_orderingContext extends ParserRuleContext { - public TerminalNode NULL() { return getToken(SQLParser.NULL, 0); } - public TerminalNode FIRST() { return getToken(SQLParser.FIRST, 0); } - public TerminalNode LAST() { return getToken(SQLParser.LAST, 0); } - public Null_orderingContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_null_ordering; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterNull_ordering(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitNull_ordering(this); - } - } - - public final Null_orderingContext null_ordering() throws RecognitionException { - Null_orderingContext _localctx = new Null_orderingContext(_ctx, getState()); - enterRule(_localctx, 398, RULE_null_ordering); - try { - setState(1674); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,179,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(1670); - match(NULL); - setState(1671); - match(FIRST); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(1672); - match(NULL); - setState(1673); - match(LAST); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Insert_statementContext extends ParserRuleContext { - public Token path; - public IdentifierContext file_type; - public TerminalNode INSERT() { return getToken(SQLParser.INSERT, 0); } - public TerminalNode INTO() { return getToken(SQLParser.INTO, 0); } - public Table_nameContext table_name() { - return getRuleContext(Table_nameContext.class,0); - } - public Query_expressionContext query_expression() { - return getRuleContext(Query_expressionContext.class,0); - } - public TerminalNode OVERWRITE() { return getToken(SQLParser.OVERWRITE, 0); } - public TerminalNode LEFT_PAREN() { return getToken(SQLParser.LEFT_PAREN, 0); } - public Column_name_listContext column_name_list() { - return getRuleContext(Column_name_listContext.class,0); - } - public TerminalNode RIGHT_PAREN() { return getToken(SQLParser.RIGHT_PAREN, 0); } - public TerminalNode LOCATION() { return getToken(SQLParser.LOCATION, 0); } - public TerminalNode Character_String_Literal() { return getToken(SQLParser.Character_String_Literal, 0); } - public TerminalNode USING() { return getToken(SQLParser.USING, 0); } - public IdentifierContext identifier() { - return getRuleContext(IdentifierContext.class,0); - } - public Param_clauseContext param_clause() { - return getRuleContext(Param_clauseContext.class,0); - } - public Insert_statementContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_insert_statement; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).enterInsert_statement(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof SQLParserListener ) ((SQLParserListener)listener).exitInsert_statement(this); - } - } - - public final Insert_statementContext insert_statement() throws RecognitionException { - Insert_statementContext _localctx = new Insert_statementContext(_ctx, getState()); - enterRule(_localctx, 400, RULE_insert_statement); - int _la; - try { - setState(1705); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,185,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(1676); - match(INSERT); - setState(1678); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==OVERWRITE) { - { - setState(1677); - match(OVERWRITE); - } - } - - setState(1680); - match(INTO); - setState(1681); - table_name(); - setState(1686); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,181,_ctx) ) { - case 1: - { - setState(1682); - match(LEFT_PAREN); - setState(1683); - column_name_list(); - setState(1684); - match(RIGHT_PAREN); - } - break; - } - setState(1688); - query_expression(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(1690); - match(INSERT); - setState(1692); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==OVERWRITE) { - { - setState(1691); - match(OVERWRITE); - } - } - - setState(1694); - match(INTO); - setState(1695); - match(LOCATION); - setState(1696); - ((Insert_statementContext)_localctx).path = match(Character_String_Literal); - setState(1702); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==USING) { - { - setState(1697); - match(USING); - setState(1698); - ((Insert_statementContext)_localctx).file_type = identifier(); - setState(1700); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==WITH) { - { - setState(1699); - param_clause(); - } - } - - } - } - - setState(1704); - query_expression(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static final String _serializedATN = - "\3\u0430\ud6d1\u8206\uad2d\u4417\uaef1\u8d80\uaadd\3\u00ce\u06ae\4\2\t"+ - "\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\4\t\t\t\4\n\t\n\4\13"+ - "\t\13\4\f\t\f\4\r\t\r\4\16\t\16\4\17\t\17\4\20\t\20\4\21\t\21\4\22\t\22"+ - "\4\23\t\23\4\24\t\24\4\25\t\25\4\26\t\26\4\27\t\27\4\30\t\30\4\31\t\31"+ - "\4\32\t\32\4\33\t\33\4\34\t\34\4\35\t\35\4\36\t\36\4\37\t\37\4 \t \4!"+ - "\t!\4\"\t\"\4#\t#\4$\t$\4%\t%\4&\t&\4\'\t\'\4(\t(\4)\t)\4*\t*\4+\t+\4"+ - ",\t,\4-\t-\4.\t.\4/\t/\4\60\t\60\4\61\t\61\4\62\t\62\4\63\t\63\4\64\t"+ - "\64\4\65\t\65\4\66\t\66\4\67\t\67\48\t8\49\t9\4:\t:\4;\t;\4<\t<\4=\t="+ - "\4>\t>\4?\t?\4@\t@\4A\tA\4B\tB\4C\tC\4D\tD\4E\tE\4F\tF\4G\tG\4H\tH\4I"+ - "\tI\4J\tJ\4K\tK\4L\tL\4M\tM\4N\tN\4O\tO\4P\tP\4Q\tQ\4R\tR\4S\tS\4T\tT"+ - "\4U\tU\4V\tV\4W\tW\4X\tX\4Y\tY\4Z\tZ\4[\t[\4\\\t\\\4]\t]\4^\t^\4_\t_\4"+ - "`\t`\4a\ta\4b\tb\4c\tc\4d\td\4e\te\4f\tf\4g\tg\4h\th\4i\ti\4j\tj\4k\t"+ - "k\4l\tl\4m\tm\4n\tn\4o\to\4p\tp\4q\tq\4r\tr\4s\ts\4t\tt\4u\tu\4v\tv\4"+ - "w\tw\4x\tx\4y\ty\4z\tz\4{\t{\4|\t|\4}\t}\4~\t~\4\177\t\177\4\u0080\t\u0080"+ - "\4\u0081\t\u0081\4\u0082\t\u0082\4\u0083\t\u0083\4\u0084\t\u0084\4\u0085"+ - "\t\u0085\4\u0086\t\u0086\4\u0087\t\u0087\4\u0088\t\u0088\4\u0089\t\u0089"+ - "\4\u008a\t\u008a\4\u008b\t\u008b\4\u008c\t\u008c\4\u008d\t\u008d\4\u008e"+ - "\t\u008e\4\u008f\t\u008f\4\u0090\t\u0090\4\u0091\t\u0091\4\u0092\t\u0092"+ - "\4\u0093\t\u0093\4\u0094\t\u0094\4\u0095\t\u0095\4\u0096\t\u0096\4\u0097"+ - "\t\u0097\4\u0098\t\u0098\4\u0099\t\u0099\4\u009a\t\u009a\4\u009b\t\u009b"+ - "\4\u009c\t\u009c\4\u009d\t\u009d\4\u009e\t\u009e\4\u009f\t\u009f\4\u00a0"+ - "\t\u00a0\4\u00a1\t\u00a1\4\u00a2\t\u00a2\4\u00a3\t\u00a3\4\u00a4\t\u00a4"+ - "\4\u00a5\t\u00a5\4\u00a6\t\u00a6\4\u00a7\t\u00a7\4\u00a8\t\u00a8\4\u00a9"+ - "\t\u00a9\4\u00aa\t\u00aa\4\u00ab\t\u00ab\4\u00ac\t\u00ac\4\u00ad\t\u00ad"+ - "\4\u00ae\t\u00ae\4\u00af\t\u00af\4\u00b0\t\u00b0\4\u00b1\t\u00b1\4\u00b2"+ - "\t\u00b2\4\u00b3\t\u00b3\4\u00b4\t\u00b4\4\u00b5\t\u00b5\4\u00b6\t\u00b6"+ - "\4\u00b7\t\u00b7\4\u00b8\t\u00b8\4\u00b9\t\u00b9\4\u00ba\t\u00ba\4\u00bb"+ - "\t\u00bb\4\u00bc\t\u00bc\4\u00bd\t\u00bd\4\u00be\t\u00be\4\u00bf\t\u00bf"+ - "\4\u00c0\t\u00c0\4\u00c1\t\u00c1\4\u00c2\t\u00c2\4\u00c3\t\u00c3\4\u00c4"+ - "\t\u00c4\4\u00c5\t\u00c5\4\u00c6\t\u00c6\4\u00c7\t\u00c7\4\u00c8\t\u00c8"+ - "\4\u00c9\t\u00c9\4\u00ca\t\u00ca\3\2\3\2\5\2\u0197\n\2\3\2\3\2\3\3\3\3"+ - "\3\3\3\3\5\3\u019f\n\3\3\4\3\4\3\5\3\5\3\6\3\6\5\6\u01a7\n\6\3\7\3\7\5"+ - "\7\u01ab\n\7\3\7\3\7\3\7\3\7\3\7\5\7\u01b2\n\7\3\7\3\7\3\7\3\7\5\7\u01b8"+ - "\n\7\3\b\3\b\3\b\3\b\3\b\3\b\3\b\3\b\5\b\u01c2\n\b\3\b\5\b\u01c5\n\b\3"+ - "\b\3\b\3\b\3\b\3\b\3\b\3\b\3\b\3\b\5\b\u01d0\n\b\3\b\5\b\u01d3\n\b\3\b"+ - "\5\b\u01d6\n\b\3\b\3\b\5\b\u01da\n\b\3\b\3\b\3\b\3\b\3\b\5\b\u01e1\n\b"+ - "\3\b\5\b\u01e4\n\b\3\b\5\b\u01e7\n\b\3\b\3\b\3\b\5\b\u01ec\n\b\3\t\3\t"+ - "\3\t\3\t\7\t\u01f2\n\t\f\t\16\t\u01f5\13\t\3\t\3\t\3\n\3\n\3\n\3\13\3"+ - "\13\3\f\3\f\3\f\3\f\3\f\7\f\u0203\n\f\f\f\16\f\u0206\13\f\3\f\3\f\3\r"+ - "\3\r\3\r\3\r\3\16\3\16\3\16\3\17\3\17\3\17\3\20\3\20\3\21\3\21\3\21\3"+ - "\21\5\21\u021a\n\21\3\22\3\22\3\22\3\22\3\22\3\22\3\22\3\22\3\22\3\22"+ - "\3\23\3\23\3\23\7\23\u0229\n\23\f\23\16\23\u022c\13\23\3\24\3\24\3\24"+ - "\3\24\3\24\3\24\3\24\3\24\3\24\3\24\5\24\u0238\n\24\3\24\3\24\5\24\u023c"+ - "\n\24\5\24\u023e\n\24\3\25\3\25\3\25\3\25\3\25\3\25\3\25\3\25\3\25\3\25"+ - "\3\25\5\25\u024b\n\25\3\26\3\26\3\26\7\26\u0250\n\26\f\26\16\26\u0253"+ - "\13\26\3\27\3\27\3\27\3\30\3\30\3\30\3\31\3\31\3\31\3\31\3\31\3\31\3\31"+ - "\3\31\3\31\3\31\3\32\3\32\3\32\7\32\u0268\n\32\f\32\16\32\u026b\13\32"+ - "\3\33\3\33\3\33\3\33\5\33\u0271\n\33\3\33\3\33\3\33\3\33\3\34\3\34\3\34"+ - "\3\34\3\34\3\35\3\35\3\36\3\36\3\36\3\36\5\36\u0282\n\36\3\37\3\37\5\37"+ - "\u0286\n\37\3 \3 \3!\3!\5!\u028c\n!\3\"\3\"\3\"\5\"\u0291\n\"\3#\3#\3"+ - "#\5#\u0296\n#\3$\3$\3$\3%\3%\3%\3&\3&\3&\3\'\3\'\3(\3(\3)\3)\3)\3)\3)"+ - "\3)\3)\3)\3)\5)\u02ae\n)\3*\3*\3+\3+\5+\u02b4\n+\3+\3+\5+\u02b8\n+\3+"+ - "\3+\3+\5+\u02bd\n+\3+\3+\3+\5+\u02c2\n+\3+\3+\5+\u02c6\n+\3+\5+\u02c9"+ - "\n+\3,\3,\3,\3,\3-\3-\3-\5-\u02d2\n-\3-\3-\3-\5-\u02d7\n-\3-\3-\5-\u02db"+ - "\n-\3-\3-\3-\3-\5-\u02e1\n-\3-\3-\3-\3-\5-\u02e7\n-\3-\3-\3-\5-\u02ec"+ - "\n-\3-\3-\5-\u02f0\n-\5-\u02f2\n-\3.\3.\5.\u02f6\n.\3.\3.\5.\u02fa\n."+ - "\5.\u02fc\n.\3/\3/\5/\u0300\n/\3\60\3\60\5\60\u0304\n\60\3\60\3\60\5\60"+ - "\u0308\n\60\3\60\3\60\5\60\u030c\n\60\3\60\3\60\3\60\3\60\3\60\3\60\3"+ - "\60\3\60\3\60\5\60\u0317\n\60\3\61\3\61\5\61\u031b\n\61\3\61\3\61\3\61"+ - "\3\61\3\61\3\61\5\61\u0323\n\61\3\62\3\62\3\62\3\62\3\62\3\62\3\62\3\62"+ - "\5\62\u032d\n\62\3\63\3\63\3\64\3\64\3\64\3\64\3\64\3\64\3\64\3\64\3\64"+ - "\3\64\3\64\3\64\3\64\5\64\u033e\n\64\3\65\3\65\5\65\u0342\n\65\3\65\3"+ - "\65\5\65\u0346\n\65\3\65\3\65\3\65\5\65\u034b\n\65\5\65\u034d\n\65\3\66"+ - "\3\66\5\66\u0351\n\66\3\66\3\66\3\66\5\66\u0356\n\66\3\66\3\66\5\66\u035a"+ - "\n\66\5\66\u035c\n\66\3\67\3\67\5\67\u0360\n\67\38\38\38\38\39\39\39\3"+ - "9\39\39\39\59\u036d\n9\3:\3:\3;\3;\3<\5<\u0374\n<\3<\3<\3=\3=\3>\3>\3"+ - ">\3>\3>\3>\5>\u0380\n>\5>\u0382\n>\3?\3?\3?\5?\u0387\n?\3?\3?\3?\3@\3"+ - "@\3A\3A\3A\3A\3A\3A\3B\3B\3B\3B\3B\3C\3C\3D\3D\3D\3D\3D\3D\3D\3D\3D\3"+ - "D\3D\3D\6D\u03a7\nD\rD\16D\u03a8\3D\3D\5D\u03ad\nD\3E\3E\5E\u03b1\nE\3"+ - "F\3F\3F\6F\u03b6\nF\rF\16F\u03b7\3F\5F\u03bb\nF\3F\3F\3G\3G\6G\u03c1\n"+ - "G\rG\16G\u03c2\3G\5G\u03c6\nG\3G\3G\3H\3H\3H\3H\3H\3I\3I\3I\3I\3I\3J\3"+ - "J\3J\3K\3K\5K\u03d9\nK\3L\3L\3L\3L\3L\3L\3L\3M\3M\3N\3N\3O\3O\3O\5O\u03e9"+ - "\nO\3P\3P\3P\5P\u03ee\nP\3Q\3Q\3Q\7Q\u03f3\nQ\fQ\16Q\u03f6\13Q\3R\3R\3"+ - "R\7R\u03fb\nR\fR\16R\u03fe\13R\3S\5S\u0401\nS\3S\3S\3T\3T\3T\3T\7T\u0409"+ - "\nT\fT\16T\u040c\13T\3T\3T\3U\3U\3U\7U\u0413\nU\fU\16U\u0416\13U\3U\5"+ - "U\u0419\nU\3V\3V\3W\3W\3X\3X\3X\3X\3X\3X\3X\3Y\3Y\3Y\5Y\u0429\nY\3Z\3"+ - "Z\3[\3[\5[\u042f\n[\3\\\3\\\3]\3]\3]\7]\u0436\n]\f]\16]\u0439\13]\3^\3"+ - "^\3_\3_\5_\u043f\n_\3`\3`\3a\3a\3a\3a\3a\3b\5b\u0449\nb\3b\5b\u044c\n"+ - "b\3b\5b\u044f\nb\3b\3b\3b\3b\3b\5b\u0456\nb\3c\3c\3d\3d\3e\3e\3e\7e\u045f"+ - "\ne\fe\16e\u0462\13e\3f\3f\3f\7f\u0467\nf\ff\16f\u046a\13f\3g\3g\3g\5"+ - "g\u046f\ng\3h\3h\5h\u0473\nh\3i\3i\5i\u0477\ni\3i\3i\3j\3j\3k\3k\5k\u047f"+ - "\nk\3l\3l\5l\u0483\nl\3m\3m\3m\3m\3n\3n\5n\u048b\nn\3o\3o\3p\3p\3q\3q"+ - "\5q\u0493\nq\3r\3r\5r\u0497\nr\3s\3s\5s\u049b\ns\3s\5s\u049e\ns\3s\5s"+ - "\u04a1\ns\3s\5s\u04a4\ns\3s\5s\u04a7\ns\3t\3t\3t\3u\3u\3u\7u\u04af\nu"+ - "\fu\16u\u04b2\13u\3v\3v\5v\u04b6\nv\3w\3w\6w\u04ba\nw\rw\16w\u04bb\3x"+ - "\3x\3x\3x\5x\u04c2\nx\3x\3x\3x\3x\3x\3x\5x\u04ca\nx\3x\3x\3x\3x\3x\5x"+ - "\u04d1\nx\3y\3y\3y\3y\3z\5z\u04d8\nz\3z\3z\3z\3z\3{\3{\5{\u04e0\n{\3{"+ - "\3{\3{\3|\3|\3|\3|\3}\3}\5}\u04eb\n}\3~\3~\5~\u04ef\n~\3\177\3\177\3\u0080"+ - "\3\u0080\5\u0080\u04f5\n\u0080\3\u0081\3\u0081\3\u0081\3\u0082\3\u0082"+ - "\3\u0082\3\u0082\3\u0082\3\u0083\3\u0083\5\u0083\u0501\n\u0083\3\u0083"+ - "\5\u0083\u0504\n\u0083\3\u0083\3\u0083\3\u0083\3\u0083\5\u0083\u050a\n"+ - "\u0083\3\u0083\3\u0083\5\u0083\u050e\n\u0083\3\u0083\3\u0083\3\u0083\3"+ - "\u0083\3\u0083\5\u0083\u0515\n\u0083\5\u0083\u0517\n\u0083\3\u0084\3\u0084"+ - "\3\u0084\7\u0084\u051c\n\u0084\f\u0084\16\u0084\u051f\13\u0084\3\u0085"+ - "\3\u0085\3\u0086\3\u0086\3\u0086\3\u0087\3\u0087\3\u0088\3\u0088\3\u0088"+ - "\3\u0088\3\u0089\3\u0089\3\u0089\7\u0089\u052f\n\u0089\f\u0089\16\u0089"+ - "\u0532\13\u0089\3\u008a\3\u008a\3\u008a\3\u008a\5\u008a\u0538\n\u008a"+ - "\3\u008b\3\u008b\3\u008b\3\u008b\3\u008b\5\u008b\u053f\n\u008b\3\u008c"+ - "\3\u008c\3\u008c\7\u008c\u0544\n\u008c\f\u008c\16\u008c\u0547\13\u008c"+ - "\3\u008d\3\u008d\3\u008d\3\u008d\3\u008d\3\u008e\3\u008e\3\u008e\3\u008e"+ - "\3\u008e\3\u008f\3\u008f\3\u008f\3\u0090\3\u0090\3\u0090\3\u0091\3\u0091"+ - "\3\u0091\7\u0091\u055c\n\u0091\f\u0091\16\u0091\u055f\13\u0091\3\u0092"+ - "\3\u0092\3\u0093\3\u0093\5\u0093\u0565\n\u0093\3\u0094\3\u0094\3\u0094"+ - "\3\u0094\5\u0094\u056b\n\u0094\3\u0094\3\u0094\5\u0094\u056f\n\u0094\3"+ - "\u0094\3\u0094\5\u0094\u0573\n\u0094\3\u0094\7\u0094\u0576\n\u0094\f\u0094"+ - "\16\u0094\u0579\13\u0094\3\u0095\3\u0095\5\u0095\u057d\n\u0095\3\u0096"+ - "\3\u0096\3\u0096\3\u0096\5\u0096\u0583\n\u0096\3\u0096\3\u0096\5\u0096"+ - "\u0587\n\u0096\3\u0096\3\u0096\5\u0096\u058b\n\u0096\3\u0096\7\u0096\u058e"+ - "\n\u0096\f\u0096\16\u0096\u0591\13\u0096\3\u0097\3\u0097\5\u0097\u0595"+ - "\n\u0097\3\u0098\3\u0098\3\u0098\3\u0098\3\u0098\5\u0098\u059c\n\u0098"+ - "\3\u0099\3\u0099\5\u0099\u05a0\n\u0099\3\u009a\3\u009a\3\u009a\3\u009b"+ - "\3\u009b\5\u009b\u05a7\n\u009b\3\u009c\3\u009c\3\u009c\3\u009c\3\u009c"+ - "\5\u009c\u05ae\n\u009c\5\u009c\u05b0\n\u009c\3\u009d\3\u009d\5\u009d\u05b4"+ - "\n\u009d\3\u009d\3\u009d\5\u009d\u05b8\n\u009d\3\u009e\3\u009e\3\u009e"+ - "\7\u009e\u05bd\n\u009e\f\u009e\16\u009e\u05c0\13\u009e\3\u009f\3\u009f"+ - "\5\u009f\u05c4\n\u009f\3\u00a0\3\u00a0\5\u00a0\u05c8\n\u00a0\3\u00a1\3"+ - "\u00a1\5\u00a1\u05cc\n\u00a1\3\u00a1\3\u00a1\3\u00a2\3\u00a2\3\u00a3\3"+ - "\u00a3\3\u00a3\5\u00a3\u05d5\n\u00a3\3\u00a3\3\u00a3\3\u00a4\5\u00a4\u05da"+ - "\n\u00a4\3\u00a4\3\u00a4\3\u00a5\3\u00a5\3\u00a5\7\u00a5\u05e1\n\u00a5"+ - "\f\u00a5\16\u00a5\u05e4\13\u00a5\3\u00a6\3\u00a6\3\u00a7\3\u00a7\3\u00a8"+ - "\3\u00a8\3\u00a9\3\u00a9\3\u00a9\3\u00a9\3\u00aa\3\u00aa\3\u00aa\3\u00aa"+ - "\3\u00aa\3\u00aa\5\u00aa\u05f6\n\u00aa\3\u00ab\3\u00ab\3\u00ab\3\u00ab"+ - "\3\u00ac\3\u00ac\3\u00ad\3\u00ad\3\u00ad\3\u00ae\5\u00ae\u0602\n\u00ae"+ - "\3\u00ae\3\u00ae\5\u00ae\u0606\n\u00ae\3\u00ae\3\u00ae\3\u00ae\3\u00ae"+ - "\3\u00af\3\u00af\5\u00af\u060e\n\u00af\3\u00af\3\u00af\3\u00af\3\u00b0"+ - "\3\u00b0\3\u00b0\3\u00b0\3\u00b0\5\u00b0\u0618\n\u00b0\3\u00b1\3\u00b1"+ - "\3\u00b1\7\u00b1\u061d\n\u00b1\f\u00b1\16\u00b1\u0620\13\u00b1\3\u00b2"+ - "\3\u00b2\3\u00b2\3\u00b2\3\u00b3\5\u00b3\u0627\n\u00b3\3\u00b3\3\u00b3"+ - "\5\u00b3\u062b\n\u00b3\3\u00b4\3\u00b4\3\u00b4\3\u00b4\3\u00b4\3\u00b4"+ - "\5\u00b4\u0633\n\u00b4\3\u00b5\3\u00b5\3\u00b6\3\u00b6\3\u00b6\5\u00b6"+ - "\u063a\n\u00b6\3\u00b6\3\u00b6\3\u00b7\3\u00b7\3\u00b7\3\u00b7\3\u00b7"+ - "\3\u00b8\3\u00b8\5\u00b8\u0645\n\u00b8\3\u00b9\3\u00b9\3\u00ba\3\u00ba"+ - "\3\u00bb\5\u00bb\u064c\n\u00bb\3\u00bb\3\u00bb\3\u00bb\3\u00bc\3\u00bc"+ - "\3\u00bc\3\u00bd\3\u00bd\5\u00bd\u0656\n\u00bd\3\u00be\3\u00be\3\u00bf"+ - "\3\u00bf\3\u00c0\3\u00c0\3\u00c0\5\u00c0\u065f\n\u00c0\3\u00c0\3\u00c0"+ - "\3\u00c1\3\u00c1\3\u00c2\3\u00c2\5\u00c2\u0667\n\u00c2\3\u00c3\3\u00c3"+ - "\3\u00c3\7\u00c3\u066c\n\u00c3\f\u00c3\16\u00c3\u066f\13\u00c3\3\u00c4"+ - "\3\u00c4\3\u00c4\3\u00c4\3\u00c5\3\u00c5\3\u00c5\7\u00c5\u0678\n\u00c5"+ - "\f\u00c5\16\u00c5\u067b\13\u00c5\3\u00c6\3\u00c6\5\u00c6\u067f\n\u00c6"+ - "\3\u00c6\5\u00c6\u0682\n\u00c6\3\u00c7\3\u00c7\3\u00c8\3\u00c8\3\u00c8"+ - "\3\u00c9\3\u00c9\3\u00c9\3\u00c9\5\u00c9\u068d\n\u00c9\3\u00ca\3\u00ca"+ - "\5\u00ca\u0691\n\u00ca\3\u00ca\3\u00ca\3\u00ca\3\u00ca\3\u00ca\3\u00ca"+ - "\5\u00ca\u0699\n\u00ca\3\u00ca\3\u00ca\3\u00ca\3\u00ca\5\u00ca\u069f\n"+ - "\u00ca\3\u00ca\3\u00ca\3\u00ca\3\u00ca\3\u00ca\3\u00ca\5\u00ca\u06a7\n"+ - "\u00ca\5\u00ca\u06a9\n\u00ca\3\u00ca\5\u00ca\u06ac\n\u00ca\3\u00ca\2\2"+ - "\u00cb\2\4\6\b\n\f\16\20\22\24\26\30\32\34\36 \"$&(*,.\60\62\64\668:<"+ - ">@BDFHJLNPRTVXZ\\^`bdfhjlnprtvxz|~\u0080\u0082\u0084\u0086\u0088\u008a"+ - "\u008c\u008e\u0090\u0092\u0094\u0096\u0098\u009a\u009c\u009e\u00a0\u00a2"+ - "\u00a4\u00a6\u00a8\u00aa\u00ac\u00ae\u00b0\u00b2\u00b4\u00b6\u00b8\u00ba"+ - "\u00bc\u00be\u00c0\u00c2\u00c4\u00c6\u00c8\u00ca\u00cc\u00ce\u00d0\u00d2"+ - "\u00d4\u00d6\u00d8\u00da\u00dc\u00de\u00e0\u00e2\u00e4\u00e6\u00e8\u00ea"+ - "\u00ec\u00ee\u00f0\u00f2\u00f4\u00f6\u00f8\u00fa\u00fc\u00fe\u0100\u0102"+ - "\u0104\u0106\u0108\u010a\u010c\u010e\u0110\u0112\u0114\u0116\u0118\u011a"+ - "\u011c\u011e\u0120\u0122\u0124\u0126\u0128\u012a\u012c\u012e\u0130\u0132"+ - "\u0134\u0136\u0138\u013a\u013c\u013e\u0140\u0142\u0144\u0146\u0148\u014a"+ - "\u014c\u014e\u0150\u0152\u0154\u0156\u0158\u015a\u015c\u015e\u0160\u0162"+ - "\u0164\u0166\u0168\u016a\u016c\u016e\u0170\u0172\u0174\u0176\u0178\u017a"+ - "\u017c\u017e\u0180\u0182\u0184\u0186\u0188\u018a\u018c\u018e\u0190\u0192"+ - "\2\26\5\28RT\u00a4\u00a6\u00a9\5\2\23\23\61\61\177\177\3\2\u0087\u0088"+ - "\3\2\u00c6\u00c7\17\2\6\6,,88==@@IIPPVV]]bbtuww\u0081\u0082\3\2\u00bc"+ - "\u00bd\3\2\u00be\u00c0\3\2z|\5\2\t\t\37\37\60\60\5\2\24\24 **\4\2\22"+ - "\22\62\62\4\2\4\4\17\17\4\2\u00b0\u00b0\u00b5\u00b9\4\2\7\7--\3\2\u00aa"+ - "\u00ad\4\2\6\6,,\6\2BBSScd\u0085\u0085\t\2;;DFHHWX_all\u0084\u0084\4\2"+ - " **\4\2\b\b\16\16\u06dd\2\u0194\3\2\2\2\4\u019e\3\2\2\2\6\u01a0\3\2\2"+ - "\2\b\u01a2\3\2\2\2\n\u01a6\3\2\2\2\f\u01a8\3\2\2\2\16\u01eb\3\2\2\2\20"+ - "\u01ed\3\2\2\2\22\u01f8\3\2\2\2\24\u01fb\3\2\2\2\26\u01fd\3\2\2\2\30\u0209"+ - "\3\2\2\2\32\u020d\3\2\2\2\34\u0210\3\2\2\2\36\u0213\3\2\2\2 \u0219\3\2"+ - "\2\2\"\u021b\3\2\2\2$\u0225\3\2\2\2&\u022d\3\2\2\2(\u023f\3\2\2\2*\u024c"+ - "\3\2\2\2,\u0254\3\2\2\2.\u0257\3\2\2\2\60\u025a\3\2\2\2\62\u0264\3\2\2"+ - "\2\64\u026c\3\2\2\2\66\u0276\3\2\2\28\u027b\3\2\2\2:\u027d\3\2\2\2<\u0285"+ - "\3\2\2\2>\u0287\3\2\2\2@\u028b\3\2\2\2B\u0290\3\2\2\2D\u0295\3\2\2\2F"+ - "\u0297\3\2\2\2H\u029a\3\2\2\2J\u029d\3\2\2\2L\u02a0\3\2\2\2N\u02a2\3\2"+ - "\2\2P\u02ad\3\2\2\2R\u02af\3\2\2\2T\u02c8\3\2\2\2V\u02ca\3\2\2\2X\u02f1"+ - "\3\2\2\2Z\u02fb\3\2\2\2\\\u02ff\3\2\2\2^\u0316\3\2\2\2`\u0322\3\2\2\2"+ - "b\u032c\3\2\2\2d\u032e\3\2\2\2f\u033d\3\2\2\2h\u034c\3\2\2\2j\u035b\3"+ - "\2\2\2l\u035f\3\2\2\2n\u0361\3\2\2\2p\u036c\3\2\2\2r\u036e\3\2\2\2t\u0370"+ - "\3\2\2\2v\u0373\3\2\2\2x\u0377\3\2\2\2z\u0381\3\2\2\2|\u0383\3\2\2\2~"+ - "\u038b\3\2\2\2\u0080\u038d\3\2\2\2\u0082\u0393\3\2\2\2\u0084\u0398\3\2"+ - "\2\2\u0086\u03ac\3\2\2\2\u0088\u03b0\3\2\2\2\u008a\u03b2\3\2\2\2\u008c"+ - "\u03be\3\2\2\2\u008e\u03c9\3\2\2\2\u0090\u03ce\3\2\2\2\u0092\u03d3\3\2"+ - "\2\2\u0094\u03d8\3\2\2\2\u0096\u03da\3\2\2\2\u0098\u03e1\3\2\2\2\u009a"+ - "\u03e3\3\2\2\2\u009c\u03e8\3\2\2\2\u009e\u03ed\3\2\2\2\u00a0\u03ef\3\2"+ - "\2\2\u00a2\u03f7\3\2\2\2\u00a4\u0400\3\2\2\2\u00a6\u0404\3\2\2\2\u00a8"+ - "\u0418\3\2\2\2\u00aa\u041a\3\2\2\2\u00ac\u041c\3\2\2\2\u00ae\u041e\3\2"+ - "\2\2\u00b0\u0428\3\2\2\2\u00b2\u042a\3\2\2\2\u00b4\u042e\3\2\2\2\u00b6"+ - "\u0430\3\2\2\2\u00b8\u0432\3\2\2\2\u00ba\u043a\3\2\2\2\u00bc\u043e\3\2"+ - "\2\2\u00be\u0440\3\2\2\2\u00c0\u0442\3\2\2\2\u00c2\u0455\3\2\2\2\u00c4"+ - "\u0457\3\2\2\2\u00c6\u0459\3\2\2\2\u00c8\u045b\3\2\2\2\u00ca\u0463\3\2"+ - "\2\2\u00cc\u046e\3\2\2\2\u00ce\u0470\3\2\2\2\u00d0\u0474\3\2\2\2\u00d2"+ - "\u047a\3\2\2\2\u00d4\u047e\3\2\2\2\u00d6\u0482\3\2\2\2\u00d8\u0484\3\2"+ - "\2\2\u00da\u048a\3\2\2\2\u00dc\u048c\3\2\2\2\u00de\u048e\3\2\2\2\u00e0"+ - "\u0492\3\2\2\2\u00e2\u0496\3\2\2\2\u00e4\u0498\3\2\2\2\u00e6\u04a8\3\2"+ - "\2\2\u00e8\u04ab\3\2\2\2\u00ea\u04b5\3\2\2\2\u00ec\u04b7\3\2\2\2\u00ee"+ - "\u04d0\3\2\2\2\u00f0\u04d2\3\2\2\2\u00f2\u04d7\3\2\2\2\u00f4\u04dd\3\2"+ - "\2\2\u00f6\u04e4\3\2\2\2\u00f8\u04ea\3\2\2\2\u00fa\u04ec\3\2\2\2\u00fc"+ - "\u04f0\3\2\2\2\u00fe\u04f4\3\2\2\2\u0100\u04f6\3\2\2\2\u0102\u04f9\3\2"+ - "\2\2\u0104\u0516\3\2\2\2\u0106\u0518\3\2\2\2\u0108\u0520\3\2\2\2\u010a"+ - "\u0522\3\2\2\2\u010c\u0525\3\2\2\2\u010e\u0527\3\2\2\2\u0110\u052b\3\2"+ - "\2\2\u0112\u0537\3\2\2\2\u0114\u053e\3\2\2\2\u0116\u0540\3\2\2\2\u0118"+ - "\u0548\3\2\2\2\u011a\u054d\3\2\2\2\u011c\u0552\3\2\2\2\u011e\u0555\3\2"+ - "\2\2\u0120\u0558\3\2\2\2\u0122\u0560\3\2\2\2\u0124\u0564\3\2\2\2\u0126"+ - "\u056e\3\2\2\2\u0128\u057c\3\2\2\2\u012a\u0586\3\2\2\2\u012c\u0594\3\2"+ - "\2\2\u012e\u059b\3\2\2\2\u0130\u059f\3\2\2\2\u0132\u05a1\3\2\2\2\u0134"+ - "\u05a6\3\2\2\2\u0136\u05a8\3\2\2\2\u0138\u05b1\3\2\2\2\u013a\u05b9\3\2"+ - "\2\2\u013c\u05c3\3\2\2\2\u013e\u05c5\3\2\2\2\u0140\u05cb\3\2\2\2\u0142"+ - "\u05cf\3\2\2\2\u0144\u05d4\3\2\2\2\u0146\u05d9\3\2\2\2\u0148\u05dd\3\2"+ - "\2\2\u014a\u05e5\3\2\2\2\u014c\u05e7\3\2\2\2\u014e\u05e9\3\2\2\2\u0150"+ - "\u05eb\3\2\2\2\u0152\u05f5\3\2\2\2\u0154\u05f7\3\2\2\2\u0156\u05fb\3\2"+ - "\2\2\u0158\u05fd\3\2\2\2\u015a\u0601\3\2\2\2\u015c\u060b\3\2\2\2\u015e"+ - "\u0617\3\2\2\2\u0160\u0619\3\2\2\2\u0162\u0621\3\2\2\2\u0164\u062a\3\2"+ - "\2\2\u0166\u0632\3\2\2\2\u0168\u0634\3\2\2\2\u016a\u0636\3\2\2\2\u016c"+ - "\u063d\3\2\2\2\u016e\u0644\3\2\2\2\u0170\u0646\3\2\2\2\u0172\u0648\3\2"+ - "\2\2\u0174\u064b\3\2\2\2\u0176\u0650\3\2\2\2\u0178\u0655\3\2\2\2\u017a"+ - "\u0657\3\2\2\2\u017c\u0659\3\2\2\2\u017e\u065b\3\2\2\2\u0180\u0662\3\2"+ - "\2\2\u0182\u0666\3\2\2\2\u0184\u0668\3\2\2\2\u0186\u0670\3\2\2\2\u0188"+ - "\u0674\3\2\2\2\u018a\u067c\3\2\2\2\u018c\u0683\3\2\2\2\u018e\u0685\3\2"+ - "\2\2\u0190\u068c\3\2\2\2\u0192\u06ab\3\2\2\2\u0194\u0196\5\4\3\2\u0195"+ - "\u0197\7\u00b2\2\2\u0196\u0195\3\2\2\2\u0196\u0197\3\2\2\2\u0197\u0198"+ - "\3\2\2\2\u0198\u0199\7\2\2\3\u0199\3\3\2\2\2\u019a\u019f\5\6\4\2\u019b"+ - "\u019f\5\b\5\2\u019c\u019f\5\n\6\2\u019d\u019f\5\f\7\2\u019e\u019a\3\2"+ - "\2\2\u019e\u019b\3\2\2\2\u019e\u019c\3\2\2\2\u019e\u019d\3\2\2\2\u019f"+ - "\5\3\2\2\2\u01a0\u01a1\5\u0122\u0092\2\u01a1\7\3\2\2\2\u01a2\u01a3\5\u0192"+ - "\u00ca\2\u01a3\t\3\2\2\2\u01a4\u01a7\5\16\b\2\u01a5\u01a7\5:\36\2\u01a6"+ - "\u01a4\3\2\2\2\u01a6\u01a5\3\2\2\2\u01a7\13\3\2\2\2\u01a8\u01aa\7\f\2"+ - "\2\u01a9\u01ab\7\63\2\2\u01aa\u01a9\3\2\2\2\u01aa\u01ab\3\2\2\2\u01ab"+ - "\u01ac\3\2\2\2\u01ac\u01ad\7T\2\2\u01ad\u01ae\5<\37\2\u01ae\u01af\7&\2"+ - "\2\u01af\u01b1\5\u0136\u009c\2\u01b0\u01b2\5\32\16\2\u01b1\u01b0\3\2\2"+ - "\2\u01b1\u01b2\3\2\2\2\u01b2\u01b3\3\2\2\2\u01b3\u01b4\7\u00ba\2\2\u01b4"+ - "\u01b5\5\u0188\u00c5\2\u01b5\u01b7\7\u00bb\2\2\u01b6\u01b8\5\26\f\2\u01b7"+ - "\u01b6\3\2\2\2\u01b7\u01b8\3\2\2\2\u01b8\r\3\2\2\2\u01b9\u01ba\7\f\2\2"+ - "\u01ba\u01bb\7K\2\2\u01bb\u01bc\7.\2\2\u01bc\u01bd\5\u0136\u009c\2\u01bd"+ - "\u01be\5\20\t\2\u01be\u01bf\7\64\2\2\u01bf\u01c1\5<\37\2\u01c0\u01c2\5"+ - "\26\f\2\u01c1\u01c0\3\2\2\2\u01c1\u01c2\3\2\2\2\u01c2\u01c4\3\2\2\2\u01c3"+ - "\u01c5\5 \21\2\u01c4\u01c3\3\2\2\2\u01c4\u01c5\3\2\2\2\u01c5\u01c6\3\2"+ - "\2\2\u01c6\u01c7\7\\\2\2\u01c7\u01c8\7\u00cb\2\2\u01c8\u01ec\3\2\2\2\u01c9"+ - "\u01ca\7\f\2\2\u01ca\u01cb\7.\2\2\u01cb\u01cc\5\u0136\u009c\2\u01cc\u01cf"+ - "\5\20\t\2\u01cd\u01ce\7\64\2\2\u01ce\u01d0\5<\37\2\u01cf\u01cd\3\2\2\2"+ - "\u01cf\u01d0\3\2\2\2\u01d0\u01d2\3\2\2\2\u01d1\u01d3\5\26\f\2\u01d2\u01d1"+ - "\3\2\2\2\u01d2\u01d3\3\2\2\2\u01d3\u01d5\3\2\2\2\u01d4\u01d6\5 \21\2\u01d5"+ - "\u01d4\3\2\2\2\u01d5\u01d6\3\2\2\2\u01d6\u01d9\3\2\2\2\u01d7\u01d8\7\3"+ - "\2\2\u01d8\u01da\5\u0122\u0092\2\u01d9\u01d7\3\2\2\2\u01d9\u01da\3\2\2"+ - "\2\u01da\u01ec\3\2\2\2\u01db\u01dc\7\f\2\2\u01dc\u01dd\7.\2\2\u01dd\u01e0"+ - "\5\u0136\u009c\2\u01de\u01df\7\64\2\2\u01df\u01e1\5<\37\2\u01e0\u01de"+ - "\3\2\2\2\u01e0\u01e1\3\2\2\2\u01e1\u01e3\3\2\2\2\u01e2\u01e4\5\26\f\2"+ - "\u01e3\u01e2\3\2\2\2\u01e3\u01e4\3\2\2\2\u01e4\u01e6\3\2\2\2\u01e5\u01e7"+ - "\5 \21\2\u01e6\u01e5\3\2\2\2\u01e6\u01e7\3\2\2\2\u01e7\u01e8\3\2\2\2\u01e8"+ - "\u01e9\7\3\2\2\u01e9\u01ea\5\u0122\u0092\2\u01ea\u01ec\3\2\2\2\u01eb\u01b9"+ - "\3\2\2\2\u01eb\u01c9\3\2\2\2\u01eb\u01db\3\2\2\2\u01ec\17\3\2\2\2\u01ed"+ - "\u01ee\7\u00ba\2\2\u01ee\u01f3\5\22\n\2\u01ef\u01f0\7\u00b3\2\2\u01f0"+ - "\u01f2\5\22\n\2\u01f1\u01ef\3\2\2\2\u01f2\u01f5\3\2\2\2\u01f3\u01f1\3"+ - "\2\2\2\u01f3\u01f4\3\2\2\2\u01f4\u01f6\3\2\2\2\u01f5\u01f3\3\2\2\2\u01f6"+ - "\u01f7\7\u00bb\2\2\u01f7\21\3\2\2\2\u01f8\u01f9\5<\37\2\u01f9\u01fa\5"+ - "\24\13\2\u01fa\23\3\2\2\2\u01fb\u01fc\5N(\2\u01fc\25\3\2\2\2\u01fd\u01fe"+ - "\7\67\2\2\u01fe\u01ff\7\u00ba\2\2\u01ff\u0204\5\30\r\2\u0200\u0201\7\u00b3"+ - "\2\2\u0201\u0203\5\30\r\2\u0202\u0200\3\2\2\2\u0203\u0206\3\2\2\2\u0204"+ - "\u0202\3\2\2\2\u0204\u0205\3\2\2\2\u0205\u0207\3\2\2\2\u0206\u0204\3\2"+ - "\2\2\u0207\u0208\7\u00bb\2\2\u0208\27\3\2\2\2\u0209\u020a\7\u00cb\2\2"+ - "\u020a\u020b\7\u00b0\2\2\u020b\u020c\5\u00a0Q\2\u020c\31\3\2\2\2\u020d"+ - "\u020e\7\64\2\2\u020e\u020f\5<\37\2\u020f\33\3\2\2\2\u0210\u0211\7x\2"+ - "\2\u0211\u0212\5\36\20\2\u0212\35\3\2\2\2\u0213\u0214\5<\37\2\u0214\37"+ - "\3\2\2\2\u0215\u021a\5\"\22\2\u0216\u021a\5(\25\2\u0217\u021a\5\60\31"+ - "\2\u0218\u021a\5\66\34\2\u0219\u0215\3\2\2\2\u0219\u0216\3\2\2\2\u0219"+ - "\u0217\3\2\2\2\u0219\u0218\3\2\2\2\u021a!\3\2\2\2\u021b\u021c\7h\2\2\u021c"+ - "\u021d\7:\2\2\u021d\u021e\7m\2\2\u021e\u021f\7\u00ba\2\2\u021f\u0220\5"+ - "\u0148\u00a5\2\u0220\u0221\7\u00bb\2\2\u0221\u0222\7\u00ba\2\2\u0222\u0223"+ - "\5$\23\2\u0223\u0224\7\u00bb\2\2\u0224#\3\2\2\2\u0225\u022a\5&\24\2\u0226"+ - "\u0227\7\u00b3\2\2\u0227\u0229\5&\24\2\u0228\u0226\3\2\2\2\u0229\u022c"+ - "\3\2\2\2\u022a\u0228\3\2\2\2\u022a\u022b\3\2\2\2\u022b%\3\2\2\2\u022c"+ - "\u022a\3\2\2\2\u022d\u022e\7h\2\2\u022e\u022f\58\35\2\u022f\u0230\7\u0080"+ - "\2\2\u0230\u0231\7Z\2\2\u0231\u023d\7y\2\2\u0232\u0233\7\u00ba\2\2\u0233"+ - "\u0234\5\u009cO\2\u0234\u0235\7\u00bb\2\2\u0235\u023e\3\2\2\2\u0236\u0238"+ - "\7\u00ba\2\2\u0237\u0236\3\2\2\2\u0237\u0238\3\2\2\2\u0238\u0239\3\2\2"+ - "\2\u0239\u023b\7^\2\2\u023a\u023c\7\u00bb\2\2\u023b\u023a\3\2\2\2\u023b"+ - "\u023c\3\2\2\2\u023c\u023e\3\2\2\2\u023d\u0232\3\2\2\2\u023d\u0237\3\2"+ - "\2\2\u023e\'\3\2\2\2\u023f\u0240\7h\2\2\u0240\u0241\7:\2\2\u0241\u0242"+ - "\7R\2\2\u0242\u0243\7\u00ba\2\2\u0243\u0244\5\u0148\u00a5\2\u0244\u024a"+ - "\7\u00bb\2\2\u0245\u0246\7\u00ba\2\2\u0246\u0247\5*\26\2\u0247\u0248\7"+ - "\u00bb\2\2\u0248\u024b\3\2\2\2\u0249\u024b\5.\30\2\u024a\u0245\3\2\2\2"+ - "\u024a\u0249\3\2\2\2\u024b)\3\2\2\2\u024c\u0251\5,\27\2\u024d\u024e\7"+ - "\u00b3\2\2\u024e\u0250\5,\27\2\u024f\u024d\3\2\2\2\u0250\u0253\3\2\2\2"+ - "\u0251\u024f\3\2\2\2\u0251\u0252\3\2\2\2\u0252+\3\2\2\2\u0253\u0251\3"+ - "\2\2\2\u0254\u0255\7h\2\2\u0255\u0256\58\35\2\u0256-\3\2\2\2\u0257\u0258"+ - "\7i\2\2\u0258\u0259\5\u00a0Q\2\u0259/\3\2\2\2\u025a\u025b\7h\2\2\u025b"+ - "\u025c\7:\2\2\u025c\u025d\7[\2\2\u025d\u025e\7\u00ba\2\2\u025e\u025f\5"+ - "\u0148\u00a5\2\u025f\u0260\7\u00bb\2\2\u0260\u0261\7\u00ba\2\2\u0261\u0262"+ - "\5\62\32\2\u0262\u0263\7\u00bb\2\2\u0263\61\3\2\2\2\u0264\u0269\5\64\33"+ - "\2\u0265\u0266\7\u00b3\2\2\u0266\u0268\5\64\33\2\u0267\u0265\3\2\2\2\u0268"+ - "\u026b\3\2\2\2\u0269\u0267\3\2\2\2\u0269\u026a\3\2\2\2\u026a\63\3\2\2"+ - "\2\u026b\u0269\3\2\2\2\u026c\u026d\7h\2\2\u026d\u026e\58\35\2\u026e\u0270"+ - "\7\u0080\2\2\u026f\u0271\7\31\2\2\u0270\u026f\3\2\2\2\u0270\u0271\3\2"+ - "\2\2\u0271\u0272\3\2\2\2\u0272\u0273\7\u00ba\2\2\u0273\u0274\5\u0160\u00b1"+ - "\2\u0274\u0275\7\u00bb\2\2\u0275\65\3\2\2\2\u0276\u0277\7h\2\2\u0277\u0278"+ - "\7:\2\2\u0278\u0279\7?\2\2\u0279\u027a\5\20\t\2\u027a\67\3\2\2\2\u027b"+ - "\u027c\5<\37\2\u027c9\3\2\2\2\u027d\u027e\7G\2\2\u027e\u027f\7.\2\2\u027f"+ - "\u0281\5\u0136\u009c\2\u0280\u0282\7k\2\2\u0281\u0280\3\2\2\2\u0281\u0282"+ - "\3\2\2\2\u0282;\3\2\2\2\u0283\u0286\7\u00ca\2\2\u0284\u0286\5> \2\u0285"+ - "\u0283\3\2\2\2\u0285\u0284\3\2\2\2\u0286=\3\2\2\2\u0287\u0288\t\2\2\2"+ - "\u0288?\3\2\2\2\u0289\u028c\5t;\2\u028a\u028c\5B\"\2\u028b\u0289\3\2\2"+ - "\2\u028b\u028a\3\2\2\2\u028cA\3\2\2\2\u028d\u0291\7\u00cb\2\2\u028e\u0291"+ - "\5D#\2\u028f\u0291\5L\'\2\u0290\u028d\3\2\2\2\u0290\u028e\3\2\2\2\u0290"+ - "\u028f\3\2\2\2\u0291C\3\2\2\2\u0292\u0296\5H%\2\u0293\u0296\5F$\2\u0294"+ - "\u0296\5J&\2\u0295\u0292\3\2\2\2\u0295\u0293\3\2\2\2\u0295\u0294\3\2\2"+ - "\2\u0296E\3\2\2\2\u0297\u0298\7\u00a0\2\2\u0298\u0299\7\u00cb\2\2\u0299"+ - "G\3\2\2\2\u029a\u029b\7\u00a2\2\2\u029b\u029c\7\u00cb\2\2\u029cI\3\2\2"+ - "\2\u029d\u029e\7\u009f\2\2\u029e\u029f\7\u00cb\2\2\u029fK\3\2\2\2\u02a0"+ - "\u02a1\t\3\2\2\u02a1M\3\2\2\2\u02a2\u02a3\5P)\2\u02a3O\3\2\2\2\u02a4\u02ae"+ - "\5T+\2\u02a5\u02ae\5X-\2\u02a6\u02ae\5Z.\2\u02a7\u02ae\5\\/\2\u02a8\u02ae"+ - "\5d\63\2\u02a9\u02ae\5f\64\2\u02aa\u02ae\5h\65\2\u02ab\u02ae\5j\66\2\u02ac"+ - "\u02ae\5R*\2\u02ad\u02a4\3\2\2\2\u02ad\u02a5\3\2\2\2\u02ad\u02a6\3\2\2"+ - "\2\u02ad\u02a7\3\2\2\2\u02ad\u02a8\3\2\2\2\u02ad\u02a9\3\2\2\2\u02ad\u02aa"+ - "\3\2\2\2\u02ad\u02ab\3\2\2\2\u02ad\u02ac\3\2\2\2\u02aeQ\3\2\2\2\u02af"+ - "\u02b0\7\u00a9\2\2\u02b0S\3\2\2\2\u02b1\u02b3\7<\2\2\u02b2\u02b4\5V,\2"+ - "\u02b3\u02b2\3\2\2\2\u02b3\u02b4\3\2\2\2\u02b4\u02c9\3\2\2\2\u02b5\u02b7"+ - "\7\u009b\2\2\u02b6\u02b8\5V,\2\u02b7\u02b6\3\2\2\2\u02b7\u02b8\3\2\2\2"+ - "\u02b8\u02c9\3\2\2\2\u02b9\u02ba\7<\2\2\u02ba\u02bc\7\u0083\2\2\u02bb"+ - "\u02bd\5V,\2\u02bc\u02bb\3\2\2\2\u02bc\u02bd\3\2\2\2\u02bd\u02c9\3\2\2"+ - "\2\u02be\u02bf\7\u009b\2\2\u02bf\u02c1\7\u0083\2\2\u02c0\u02c2\5V,\2\u02c1"+ - "\u02c0\3\2\2\2\u02c1\u02c2\3\2\2\2\u02c2\u02c9\3\2\2\2\u02c3\u02c5\7\u009c"+ - "\2\2\u02c4\u02c6\5V,\2\u02c5\u02c4\3\2\2\2\u02c5\u02c6\3\2\2\2\u02c6\u02c9"+ - "\3\2\2\2\u02c7\u02c9\7\u00a4\2\2\u02c8\u02b1\3\2\2\2\u02c8\u02b5\3\2\2"+ - "\2\u02c8\u02b9\3\2\2\2\u02c8\u02be\3\2\2\2\u02c8\u02c3\3\2\2\2\u02c8\u02c7"+ - "\3\2\2\2\u02c9U\3\2\2\2\u02ca\u02cb\7\u00ba\2\2\u02cb\u02cc\7\u00c6\2"+ - "\2\u02cc\u02cd\7\u00bb\2\2\u02cdW\3\2\2\2\u02ce\u02cf\7e\2\2\u02cf\u02d1"+ - "\7<\2\2\u02d0\u02d2\5V,\2\u02d1\u02d0\3\2\2\2\u02d1\u02d2\3\2\2\2\u02d2"+ - "\u02f2\3\2\2\2\u02d3\u02d4\7e\2\2\u02d4\u02d6\7\u009b\2\2\u02d5\u02d7"+ - "\5V,\2\u02d6\u02d5\3\2\2\2\u02d6\u02d7\3\2\2\2\u02d7\u02f2\3\2\2\2\u02d8"+ - "\u02da\7\u009d\2\2\u02d9\u02db\5V,\2\u02da\u02d9\3\2\2\2\u02da\u02db\3"+ - "\2\2\2\u02db\u02f2\3\2\2\2\u02dc\u02dd\7e\2\2\u02dd\u02de\7<\2\2\u02de"+ - "\u02e0\7\u0083\2\2\u02df\u02e1\5V,\2\u02e0\u02df\3\2\2\2\u02e0\u02e1\3"+ - "\2\2\2\u02e1\u02f2\3\2\2\2\u02e2\u02e3\7e\2\2\u02e3\u02e4\7\u009b\2\2"+ - "\u02e4\u02e6\7\u0083\2\2\u02e5\u02e7\5V,\2\u02e6\u02e5\3\2\2\2\u02e6\u02e7"+ - "\3\2\2\2\u02e7\u02f2\3\2\2\2\u02e8\u02e9\7\u009d\2\2\u02e9\u02eb\7\u0083"+ - "\2\2\u02ea\u02ec\5V,\2\u02eb\u02ea\3\2\2\2\u02eb\u02ec\3\2\2\2\u02ec\u02f2"+ - "\3\2\2\2\u02ed\u02ef\7\u009e\2\2\u02ee\u02f0\5V,\2\u02ef\u02ee\3\2\2\2"+ - "\u02ef\u02f0\3\2\2\2\u02f0\u02f2\3\2\2\2\u02f1\u02ce\3\2\2\2\u02f1\u02d3"+ - "\3\2\2\2\u02f1\u02d8\3\2\2\2\u02f1\u02dc\3\2\2\2\u02f1\u02e2\3\2\2\2\u02f1"+ - "\u02e8\3\2\2\2\u02f1\u02ed\3\2\2\2\u02f2Y\3\2\2\2\u02f3\u02f5\7\u00a7"+ - "\2\2\u02f4\u02f6\5V,\2\u02f5\u02f4\3\2\2\2\u02f5\u02f6\3\2\2\2\u02f6\u02fc"+ - "\3\2\2\2\u02f7\u02f9\7\u00a8\2\2\u02f8\u02fa\5V,\2\u02f9\u02f8\3\2\2\2"+ - "\u02f9\u02fa\3\2\2\2\u02fa\u02fc\3\2\2\2\u02fb\u02f3\3\2\2\2\u02fb\u02f7"+ - "\3\2\2\2\u02fc[\3\2\2\2\u02fd\u0300\5^\60\2\u02fe\u0300\5`\61\2\u02ff"+ - "\u02fd\3\2\2\2\u02ff\u02fe\3\2\2\2\u0300]\3\2\2\2\u0301\u0303\7\u0099"+ - "\2\2\u0302\u0304\5b\62\2\u0303\u0302\3\2\2\2\u0303\u0304\3\2\2\2\u0304"+ - "\u0317\3\2\2\2\u0305\u0307\7\u009a\2\2\u0306\u0308\5b\62\2\u0307\u0306"+ - "\3\2\2\2\u0307\u0308\3\2\2\2\u0308\u0317\3\2\2\2\u0309\u030b\7C\2\2\u030a"+ - "\u030c\5b\62\2\u030b\u030a\3\2\2\2\u030b\u030c\3\2\2\2\u030c\u0317\3\2"+ - "\2\2\u030d\u0317\7\u008b\2\2\u030e\u0317\7\u008f\2\2\u030f\u0317\7\u008c"+ - "\2\2\u0310\u0317\7\u0090\2\2\u0311\u0317\7\u008d\2\2\u0312\u0317\7\u0091"+ - "\2\2\u0313\u0317\7\u0092\2\2\u0314\u0317\7\u008e\2\2\u0315\u0317\7\u0093"+ - "\2\2\u0316\u0301\3\2\2\2\u0316\u0305\3\2\2\2\u0316\u0309\3\2\2\2\u0316"+ - "\u030d\3\2\2\2\u0316\u030e\3\2\2\2\u0316\u030f\3\2\2\2\u0316\u0310\3\2"+ - "\2\2\u0316\u0311\3\2\2\2\u0316\u0312\3\2\2\2\u0316\u0313\3\2\2\2\u0316"+ - "\u0314\3\2\2\2\u0316\u0315\3\2\2\2\u0317_\3\2\2\2\u0318\u031a\7\u0097"+ - "\2\2\u0319\u031b\5b\62\2\u031a\u0319\3\2\2\2\u031a\u031b\3\2\2\2\u031b"+ - "\u0323\3\2\2\2\u031c\u0323\7\u0094\2\2\u031d\u0323\7\u0096\2\2\u031e\u0323"+ - "\7\u0095\2\2\u031f\u0323\7\u0098\2\2\u0320\u0321\7\u0098\2\2\u0321\u0323"+ - "\7j\2\2\u0322\u0318\3\2\2\2\u0322\u031c\3\2\2\2\u0322\u031d\3\2\2\2\u0322"+ - "\u031e\3\2\2\2\u0322\u031f\3\2\2\2\u0322\u0320\3\2\2\2\u0323a\3\2\2\2"+ - "\u0324\u0325\7\u00ba\2\2\u0325\u0326\7\u00c6\2\2\u0326\u032d\7\u00bb\2"+ - "\2\u0327\u0328\7\u00ba\2\2\u0328\u0329\7\u00c6\2\2\u0329\u032a\7\u00b3"+ - "\2\2\u032a\u032b\7\u00c6\2\2\u032b\u032d\7\u00bb\2\2\u032c\u0324\3\2\2"+ - "\2\u032c\u0327\3\2\2\2\u032dc\3\2\2\2\u032e\u032f\t\4\2\2\u032fe\3\2\2"+ - "\2\u0330\u033e\7\u009f\2\2\u0331\u033e\7\u00a0\2\2\u0332\u0333\7\u00a0"+ - "\2\2\u0333\u0334\7\67\2\2\u0334\u0335\7\u00a0\2\2\u0335\u033e\7\u0086"+ - "\2\2\u0336\u033e\7\u00a1\2\2\u0337\u033e\7\u00a2\2\2\u0338\u0339\7\u00a2"+ - "\2\2\u0339\u033a\7\67\2\2\u033a\u033b\7\u00a0\2\2\u033b\u033e\7\u0086"+ - "\2\2\u033c\u033e\7\u00a3\2\2\u033d\u0330\3\2\2\2\u033d\u0331\3\2\2\2\u033d"+ - "\u0332\3\2\2\2\u033d\u0336\3\2\2\2\u033d\u0337\3\2\2\2\u033d\u0338\3\2"+ - "\2\2\u033d\u033c\3\2\2\2\u033eg\3\2\2\2\u033f\u0341\7\u0089\2\2\u0340"+ - "\u0342\5V,\2\u0341\u0340\3\2\2\2\u0341\u0342\3\2\2\2\u0342\u034d\3\2\2"+ - "\2\u0343\u0345\7\u008a\2\2\u0344\u0346\5V,\2\u0345\u0344\3\2\2\2\u0345"+ - "\u0346\3\2\2\2\u0346\u034d\3\2\2\2\u0347\u0348\7\u0089\2\2\u0348\u034a"+ - "\7\u0083\2\2\u0349\u034b\5V,\2\u034a\u0349\3\2\2\2\u034a\u034b\3\2\2\2"+ - "\u034b\u034d\3\2\2\2\u034c\u033f\3\2\2\2\u034c\u0343\3\2\2\2\u034c\u0347"+ - "\3\2\2\2\u034di\3\2\2\2\u034e\u0350\7\u00a5\2\2\u034f\u0351\5V,\2\u0350"+ - "\u034f\3\2\2\2\u0350\u0351\3\2\2\2\u0351\u035c\3\2\2\2\u0352\u0353\7\u00a5"+ - "\2\2\u0353\u0355\7\u0083\2\2\u0354\u0356\5V,\2\u0355\u0354\3\2\2\2\u0355"+ - "\u0356\3\2\2\2\u0356\u035c\3\2\2\2\u0357\u0359\7\u00a6\2\2\u0358\u035a"+ - "\5V,\2\u0359\u0358\3\2\2\2\u0359\u035a\3\2\2\2\u035a\u035c\3\2\2\2\u035b"+ - "\u034e\3\2\2\2\u035b\u0352\3\2\2\2\u035b\u0357\3\2\2\2\u035ck\3\2\2\2"+ - "\u035d\u0360\5n8\2\u035e\u0360\5p9\2\u035f\u035d\3\2\2\2\u035f\u035e\3"+ - "\2\2\2\u0360m\3\2\2\2\u0361\u0362\7\u00ba\2\2\u0362\u0363\5\u009cO\2\u0363"+ - "\u0364\7\u00bb\2\2\u0364o\3\2\2\2\u0365\u036d\5r:\2\u0366\u036d\5\u0144"+ - "\u00a3\2\u0367\u036d\5x=\2\u0368\u036d\5\u014a\u00a6\2\u0369\u036d\5\u0084"+ - "C\2\u036a\u036d\5\u0096L\2\u036b\u036d\5\u017e\u00c0\2\u036c\u0365\3\2"+ - "\2\2\u036c\u0366\3\2\2\2\u036c\u0367\3\2\2\2\u036c\u0368\3\2\2\2\u036c"+ - "\u0369\3\2\2\2\u036c\u036a\3\2\2\2\u036c\u036b\3\2\2\2\u036dq\3\2\2\2"+ - "\u036e\u036f\5@!\2\u036fs\3\2\2\2\u0370\u0371\t\5\2\2\u0371u\3\2\2\2\u0372"+ - "\u0374\5\u00aaV\2\u0373\u0372\3\2\2\2\u0373\u0374\3\2\2\2\u0374\u0375"+ - "\3\2\2\2\u0375\u0376\5t;\2\u0376w\3\2\2\2\u0377\u0378\5z>\2\u0378y\3\2"+ - "\2\2\u0379\u037a\7@\2\2\u037a\u037b\7\u00ba\2\2\u037b\u037c\7\u00be\2"+ - "\2\u037c\u0382\7\u00bb\2\2\u037d\u037f\5|?\2\u037e\u0380\5\u0080A\2\u037f"+ - "\u037e\3\2\2\2\u037f\u0380\3\2\2\2\u0380\u0382\3\2\2\2\u0381\u0379\3\2"+ - "\2\2\u0381\u037d\3\2\2\2\u0382{\3\2\2\2\u0383\u0384\5~@\2\u0384\u0386"+ - "\7\u00ba\2\2\u0385\u0387\5\u0142\u00a2\2\u0386\u0385\3\2\2\2\u0386\u0387"+ - "\3\2\2\2\u0387\u0388\3\2\2\2\u0388\u0389\5\u009cO\2\u0389\u038a\7\u00bb"+ - "\2\2\u038a}\3\2\2\2\u038b\u038c\t\6\2\2\u038c\177\3\2\2\2\u038d\u038e"+ - "\7M\2\2\u038e\u038f\7\u00ba\2\2\u038f\u0390\7\66\2\2\u0390\u0391\5\u010c"+ - "\u0087\2\u0391\u0392\7\u00bb\2\2\u0392\u0081\3\2\2\2\u0393\u0394\7Q\2"+ - "\2\u0394\u0395\7\u00ba\2\2\u0395\u0396\5\u0148\u00a5\2\u0396\u0397\7\u00bb"+ - "\2\2\u0397\u0083\3\2\2\2\u0398\u0399\5\u0088E\2\u0399\u0085\3\2\2\2\u039a"+ - "\u039b\7f\2\2\u039b\u039c\7\u00ba\2\2\u039c\u039d\5\u00a0Q\2\u039d\u039e"+ - "\7\u00b3\2\2\u039e\u039f\5\u00c6d\2\u039f\u03a0\7\u00bb\2\2\u03a0\u03ad"+ - "\3\2\2\2\u03a1\u03a2\7>\2\2\u03a2\u03a3\7\u00ba\2\2\u03a3\u03a6\5\u00a0"+ - "Q\2\u03a4\u03a5\7\u00b3\2\2\u03a5\u03a7\5\u00c6d\2\u03a6\u03a4\3\2\2\2"+ - "\u03a7\u03a8\3\2\2\2\u03a8\u03a6\3\2\2\2\u03a8\u03a9\3\2\2\2\u03a9\u03aa"+ - "\3\2\2\2\u03aa\u03ab\7\u00bb\2\2\u03ab\u03ad\3\2\2\2\u03ac\u039a\3\2\2"+ - "\2\u03ac\u03a1\3\2\2\2\u03ad\u0087\3\2\2\2\u03ae\u03b1\5\u008aF\2\u03af"+ - "\u03b1\5\u008cG\2\u03b0\u03ae\3\2\2\2\u03b0\u03af\3\2\2\2\u03b1\u0089"+ - "\3\2\2\2\u03b2\u03b3\7\n\2\2\u03b3\u03b5\5\u00c6d\2\u03b4\u03b6\5\u008e"+ - "H\2\u03b5\u03b4\3\2\2\2\u03b6\u03b7\3\2\2\2\u03b7\u03b5\3\2\2\2\u03b7"+ - "\u03b8\3\2\2\2\u03b8\u03ba\3\2\2\2\u03b9\u03bb\5\u0092J\2\u03ba\u03b9"+ - "\3\2\2\2\u03ba\u03bb\3\2\2\2\u03bb\u03bc\3\2\2\2\u03bc\u03bd\7\20\2\2"+ - "\u03bd\u008b\3\2\2\2\u03be\u03c0\7\n\2\2\u03bf\u03c1\5\u0090I\2\u03c0"+ - "\u03bf\3\2\2\2\u03c1\u03c2\3\2\2\2\u03c2\u03c0\3\2\2\2\u03c2\u03c3\3\2"+ - "\2\2\u03c3\u03c5\3\2\2\2\u03c4\u03c6\5\u0092J\2\u03c5\u03c4\3\2\2\2\u03c5"+ - "\u03c6\3\2\2\2\u03c6\u03c7\3\2\2\2\u03c7\u03c8\7\20\2\2\u03c8\u008d\3"+ - "\2\2\2\u03c9\u03ca\7\65\2\2\u03ca\u03cb\5\u010c\u0087\2\u03cb\u03cc\7"+ - "/\2\2\u03cc\u03cd\5\u0094K\2\u03cd\u008f\3\2\2\2\u03ce\u03cf\7\65\2\2"+ - "\u03cf\u03d0\5\u010c\u0087\2\u03d0\u03d1\7/\2\2\u03d1\u03d2\5\u0094K\2"+ - "\u03d2\u0091\3\2\2\2\u03d3\u03d4\7\21\2\2\u03d4\u03d5\5\u0094K\2\u03d5"+ - "\u0093\3\2\2\2\u03d6\u03d9\5\u009cO\2\u03d7\u03d9\7%\2\2\u03d8\u03d6\3"+ - "\2\2\2\u03d8\u03d7\3\2\2\2\u03d9\u0095\3\2\2\2\u03da\u03db\7\13\2\2\u03db"+ - "\u03dc\7\u00ba\2\2\u03dc\u03dd\5\u0098M\2\u03dd\u03de\7\3\2\2\u03de\u03df"+ - "\5\u009aN\2\u03df\u03e0\7\u00bb\2\2\u03e0\u0097\3\2\2\2\u03e1\u03e2\5"+ - "\u009cO\2\u03e2\u0099\3\2\2\2\u03e3\u03e4\5N(\2\u03e4\u009b\3\2\2\2\u03e5"+ - "\u03e9\5\u009eP\2\u03e6\u03e9\5\u00dan\2\u03e7\u03e9\5\u00c6d\2\u03e8"+ - "\u03e5\3\2\2\2\u03e8\u03e6\3\2\2\2\u03e8\u03e7\3\2\2\2\u03e9\u009d\3\2"+ - "\2\2\u03ea\u03ee\5\u00a0Q\2\u03eb\u03ee\5\u00b6\\\2\u03ec\u03ee\7%\2\2"+ - "\u03ed\u03ea\3\2\2\2\u03ed\u03eb\3\2\2\2\u03ed\u03ec\3\2\2\2\u03ee\u009f"+ - "\3\2\2\2\u03ef\u03f4\5\u00a2R\2\u03f0\u03f1\t\7\2\2\u03f1\u03f3\5\u00a2"+ - "R\2\u03f2\u03f0\3\2\2\2\u03f3\u03f6\3\2\2\2\u03f4\u03f2\3\2\2\2\u03f4"+ - "\u03f5\3\2\2\2\u03f5\u00a1\3\2\2\2\u03f6\u03f4\3\2\2\2\u03f7\u03fc\5\u00a4"+ - "S\2\u03f8\u03f9\t\b\2\2\u03f9\u03fb\5\u00a4S\2\u03fa\u03f8\3\2\2\2\u03fb"+ - "\u03fe\3\2\2\2\u03fc\u03fa\3\2\2\2\u03fc\u03fd\3\2\2\2\u03fd\u00a3\3\2"+ - "\2\2\u03fe\u03fc\3\2\2\2\u03ff\u0401\5\u00aaV\2\u0400\u03ff\3\2\2\2\u0400"+ - "\u0401\3\2\2\2\u0401\u0402\3\2\2\2\u0402\u0403\5\u00a8U\2\u0403\u00a5"+ - "\3\2\2\2\u0404\u0405\7\u00ba\2\2\u0405\u040a\5\u00a0Q\2\u0406\u0407\7"+ - "\u00b3\2\2\u0407\u0409\5\u00a0Q\2\u0408\u0406\3\2\2\2\u0409\u040c\3\2"+ - "\2\2\u040a\u0408\3\2\2\2\u040a\u040b\3\2\2\2\u040b\u040d\3\2\2\2\u040c"+ - "\u040a\3\2\2\2\u040d\u040e\7\u00bb\2\2\u040e\u00a7\3\2\2\2\u040f\u0414"+ - "\5l\67\2\u0410\u0411\7\u00ae\2\2\u0411\u0413\5\u009aN\2\u0412\u0410\3"+ - "\2\2\2\u0413\u0416\3\2\2\2\u0414\u0412\3\2\2\2\u0414\u0415\3\2\2\2\u0415"+ - "\u0419\3\2\2\2\u0416\u0414\3\2\2\2\u0417\u0419\5\u00acW\2\u0418\u040f"+ - "\3\2\2\2\u0418\u0417\3\2\2\2\u0419\u00a9\3\2\2\2\u041a\u041b\t\7\2\2\u041b"+ - "\u00ab\3\2\2\2\u041c\u041d\5\u00aeX\2\u041d\u00ad\3\2\2\2\u041e\u041f"+ - "\7L\2\2\u041f\u0420\7\u00ba\2\2\u0420\u0421\5\u00b0Y\2\u0421\u0422\7\25"+ - "\2\2\u0422\u0423\5\u00b4[\2\u0423\u0424\7\u00bb\2\2\u0424\u00af\3\2\2"+ - "\2\u0425\u0429\5\u0178\u00bd\2\u0426\u0429\5\u00b2Z\2\u0427\u0429\5\u017c"+ - "\u00bf\2\u0428\u0425\3\2\2\2\u0428\u0426\3\2\2\2\u0428\u0427\3\2\2\2\u0429"+ - "\u00b1\3\2\2\2\u042a\u042b\t\t\2\2\u042b\u00b3\3\2\2\2\u042c\u042f\5\u0144"+ - "\u00a3\2\u042d\u042f\5D#\2\u042e\u042c\3\2\2\2\u042e\u042d\3\2\2\2\u042f"+ - "\u00b5\3\2\2\2\u0430\u0431\5\u00b8]\2\u0431\u00b7\3\2\2\2\u0432\u0437"+ - "\5\u00ba^\2\u0433\u0434\7\u00b4\2\2\u0434\u0436\5\u00ba^\2\u0435\u0433"+ - "\3\2\2\2\u0436\u0439\3\2\2\2\u0437\u0435\3\2\2\2\u0437\u0438\3\2\2\2\u0438"+ - "\u00b9\3\2\2\2\u0439\u0437\3\2\2\2\u043a\u043b\5\u00bc_\2\u043b\u00bb"+ - "\3\2\2\2\u043c\u043f\5l\67\2\u043d\u043f\5\u00be`\2\u043e\u043c\3\2\2"+ - "\2\u043e\u043d\3\2\2\2\u043f\u00bd\3\2\2\2\u0440\u0441\5\u00c0a\2\u0441"+ - "\u00bf\3\2\2\2\u0442\u0443\7}\2\2\u0443\u0444\7\u00ba\2\2\u0444\u0445"+ - "\5\u00c2b\2\u0445\u0446\7\u00bb\2\2\u0446\u00c1\3\2\2\2\u0447\u0449\5"+ - "\u00c4c\2\u0448\u0447\3\2\2\2\u0448\u0449\3\2\2\2\u0449\u044b\3\2\2\2"+ - "\u044a\u044c\5\u00b8]\2\u044b\u044a\3\2\2\2\u044b\u044c\3\2\2\2\u044c"+ - "\u044d\3\2\2\2\u044d\u044f\7\25\2\2\u044e\u0448\3\2\2\2\u044e\u044f\3"+ - "\2\2\2\u044f\u0450\3\2\2\2\u0450\u0456\5\u00b8]\2\u0451\u0452\5\u00b8"+ - "]\2\u0452\u0453\7\u00b3\2\2\u0453\u0454\5\u00b8]\2\u0454\u0456\3\2\2\2"+ - "\u0455\u044e\3\2\2\2\u0455\u0451\3\2\2\2\u0456\u00c3\3\2\2\2\u0457\u0458"+ - "\t\n\2\2\u0458\u00c5\3\2\2\2\u0459\u045a\5\u00c8e\2\u045a\u00c7\3\2\2"+ - "\2\u045b\u0460\5\u00caf\2\u045c\u045d\7(\2\2\u045d\u045f\5\u00c8e\2\u045e"+ - "\u045c\3\2\2\2\u045f\u0462\3\2\2\2\u0460\u045e\3\2\2\2\u0460\u0461\3\2"+ - "\2\2\u0461\u00c9\3\2\2\2\u0462\u0460\3\2\2\2\u0463\u0468\5\u00ccg\2\u0464"+ - "\u0465\7\5\2\2\u0465\u0467\5\u00caf\2\u0466\u0464\3\2\2\2\u0467\u046a"+ - "\3\2\2\2\u0468\u0466\3\2\2\2\u0468\u0469\3\2\2\2\u0469\u00cb\3\2\2\2\u046a"+ - "\u0468\3\2\2\2\u046b\u046f\5\u00ceh\2\u046c\u046d\7$\2\2\u046d\u046f\5"+ - "\u00ceh\2\u046e\u046b\3\2\2\2\u046e\u046c\3\2\2\2\u046f\u00cd\3\2\2\2"+ - "\u0470\u0472\5\u00d4k\2\u0471\u0473\5\u00d0i\2\u0472\u0471\3\2\2\2\u0472"+ - "\u0473\3\2\2\2\u0473\u00cf\3\2\2\2\u0474\u0476\7\35\2\2\u0475\u0477\7"+ - "$\2\2\u0476\u0475\3\2\2\2\u0476\u0477\3\2\2\2\u0477\u0478\3\2\2\2\u0478"+ - "\u0479\5\u00d2j\2\u0479\u00d1\3\2\2\2\u047a\u047b\t\3\2\2\u047b\u00d3"+ - "\3\2\2\2\u047c\u047f\5\u0152\u00aa\2\u047d\u047f\5\u00d6l\2\u047e\u047c"+ - "\3\2\2\2\u047e\u047d\3\2\2\2\u047f\u00d5\3\2\2\2\u0480\u0483\5\u00d8m"+ - "\2\u0481\u0483\5p9\2\u0482\u0480\3\2\2\2\u0482\u0481\3\2\2\2\u0483\u00d7"+ - "\3\2\2\2\u0484\u0485\7\u00ba\2\2\u0485\u0486\5\u00c6d\2\u0486\u0487\7"+ - "\u00bb\2\2\u0487\u00d9\3\2\2\2\u0488\u048b\5\u00dco\2\u0489\u048b\5\u00de"+ - "p\2\u048a\u0488\3\2\2\2\u048a\u0489\3\2\2\2\u048b\u00db\3\2\2\2\u048c"+ - "\u048d\5p9\2\u048d\u00dd\3\2\2\2\u048e\u048f\7%\2\2\u048f\u00df\3\2\2"+ - "\2\u0490\u0493\5\u00dco\2\u0491\u0493\5\u00e2r\2\u0492\u0490\3\2\2\2\u0492"+ - "\u0491\3\2\2\2\u0493\u00e1\3\2\2\2\u0494\u0497\5\u009eP\2\u0495\u0497"+ - "\5\u00d6l\2\u0496\u0494\3\2\2\2\u0496\u0495\3\2\2\2\u0497\u00e3\3\2\2"+ - "\2\u0498\u049a\5\u00e6t\2\u0499\u049b\5\u010a\u0086\2\u049a\u0499\3\2"+ - "\2\2\u049a\u049b\3\2\2\2\u049b\u049d\3\2\2\2\u049c\u049e\5\u010e\u0088"+ - "\2\u049d\u049c\3\2\2\2\u049d\u049e\3\2\2\2\u049e\u04a0\3\2\2\2\u049f\u04a1"+ - "\5\u011e\u0090\2\u04a0\u049f\3\2\2\2\u04a0\u04a1\3\2\2\2\u04a1\u04a3\3"+ - "\2\2\2\u04a2\u04a4\5\u0186\u00c4\2\u04a3\u04a2\3\2\2\2\u04a3\u04a4\3\2"+ - "\2\2\u04a4\u04a6\3\2\2\2\u04a5\u04a7\5\u018e\u00c8\2\u04a6\u04a5\3\2\2"+ - "\2\u04a6\u04a7\3\2\2\2\u04a7\u00e5\3\2\2\2\u04a8\u04a9\7\25\2\2\u04a9"+ - "\u04aa\5\u00e8u\2\u04aa\u00e7\3\2\2\2\u04ab\u04b0\5\u00eav\2\u04ac\u04ad"+ - "\7\u00b3\2\2\u04ad\u04af\5\u00eav\2\u04ae\u04ac\3\2\2\2\u04af\u04b2\3"+ - "\2\2\2\u04b0\u04ae\3\2\2\2\u04b0\u04b1\3\2\2\2\u04b1\u00e9\3\2\2\2\u04b2"+ - "\u04b0\3\2\2\2\u04b3\u04b6\5\u00ecw\2\u04b4\u04b6\5\u0104\u0083\2\u04b5"+ - "\u04b3\3\2\2\2\u04b5\u04b4\3\2\2\2\u04b6\u00eb\3\2\2\2\u04b7\u04b9\5\u0104"+ - "\u0083\2\u04b8\u04ba\5\u00eex\2\u04b9\u04b8\3\2\2\2\u04ba\u04bb\3\2\2"+ - "\2\u04bb\u04b9\3\2\2\2\u04bb\u04bc\3\2\2\2\u04bc\u00ed\3\2\2\2\u04bd\u04be"+ - "\7\r\2\2\u04be\u04bf\7\36\2\2\u04bf\u04d1\5\u0104\u0083\2\u04c0\u04c2"+ - "\5\u00f8}\2\u04c1\u04c0\3\2\2\2\u04c1\u04c2\3\2\2\2\u04c2\u04c3\3\2\2"+ - "\2\u04c3\u04c4\7\36\2\2\u04c4\u04c5\5\u0104\u0083\2\u04c5\u04c6\5\u00fe"+ - "\u0080\2\u04c6\u04d1\3\2\2\2\u04c7\u04c9\7#\2\2\u04c8\u04ca\5\u00f8}\2"+ - "\u04c9\u04c8\3\2\2\2\u04c9\u04ca\3\2\2\2\u04ca\u04cb\3\2\2\2\u04cb\u04cc"+ - "\7\36\2\2\u04cc\u04d1\5\u0104\u0083\2\u04cd\u04ce\7\62\2\2\u04ce\u04cf"+ - "\7\36\2\2\u04cf\u04d1\5\u0104\u0083\2\u04d0\u04bd\3\2\2\2\u04d0\u04c1"+ - "\3\2\2\2\u04d0\u04c7\3\2\2\2\u04d0\u04cd\3\2\2\2\u04d1\u00ef\3\2\2\2\u04d2"+ - "\u04d3\7\r\2\2\u04d3\u04d4\7\36\2\2\u04d4\u04d5\5\u0104\u0083\2\u04d5"+ - "\u00f1\3\2\2\2\u04d6\u04d8\5\u00f8}\2\u04d7\u04d6\3\2\2\2\u04d7\u04d8"+ - "\3\2\2\2\u04d8\u04d9\3\2\2\2\u04d9\u04da\7\36\2\2\u04da\u04db\5\u0104"+ - "\u0083\2\u04db\u04dc\5\u00fe\u0080\2\u04dc\u00f3\3\2\2\2\u04dd\u04df\7"+ - "#\2\2\u04de\u04e0\5\u00f8}\2\u04df\u04de\3\2\2\2\u04df\u04e0\3\2\2\2\u04e0"+ - "\u04e1\3\2\2\2\u04e1\u04e2\7\36\2\2\u04e2\u04e3\5\u0104\u0083\2\u04e3"+ - "\u00f5\3\2\2\2\u04e4\u04e5\7\62\2\2\u04e5\u04e6\7\36\2\2\u04e6\u04e7\5"+ - "\u0104\u0083\2\u04e7\u00f7\3\2\2\2\u04e8\u04eb\7\32\2\2\u04e9\u04eb\5"+ - "\u00fa~\2\u04ea\u04e8\3\2\2\2\u04ea\u04e9\3\2\2\2\u04eb\u00f9\3\2\2\2"+ - "\u04ec\u04ee\5\u00fc\177\2\u04ed\u04ef\7\'\2\2\u04ee\u04ed\3\2\2\2\u04ee"+ - "\u04ef\3\2\2\2\u04ef\u00fb\3\2\2\2\u04f0\u04f1\t\13\2\2\u04f1\u00fd\3"+ - "\2\2\2\u04f2\u04f5\5\u0100\u0081\2\u04f3\u04f5\5\u0102\u0082\2\u04f4\u04f2"+ - "\3\2\2\2\u04f4\u04f3\3\2\2\2\u04f5\u00ff\3\2\2\2\u04f6\u04f7\7&\2\2\u04f7"+ - "\u04f8\5\u010c\u0087\2\u04f8\u0101\3\2\2\2\u04f9\u04fa\7\64\2\2\u04fa"+ - "\u04fb\7\u00ba\2\2\u04fb\u04fc\5\u0148\u00a5\2\u04fc\u04fd\7\u00bb\2\2"+ - "\u04fd\u0103\3\2\2\2\u04fe\u0503\5\u0134\u009b\2\u04ff\u0501\7\3\2\2\u0500"+ - "\u04ff\3\2\2\2\u0500\u0501\3\2\2\2\u0501\u0502\3\2\2\2\u0502\u0504\5<"+ - "\37\2\u0503\u0500\3\2\2\2\u0503\u0504\3\2\2\2\u0504\u0509\3\2\2\2\u0505"+ - "\u0506\7\u00ba\2\2\u0506\u0507\5\u0106\u0084\2\u0507\u0508\7\u00bb\2\2"+ - "\u0508\u050a\3\2\2\2\u0509\u0505\3\2\2\2\u0509\u050a\3\2\2\2\u050a\u0517"+ - "\3\2\2\2\u050b\u050d\5\u0108\u0085\2\u050c\u050e\7\3\2\2\u050d\u050c\3"+ - "\2\2\2\u050d\u050e\3\2\2\2\u050e\u050f\3\2\2\2\u050f\u0514\5<\37\2\u0510"+ - "\u0511\7\u00ba\2\2\u0511\u0512\5\u0106\u0084\2\u0512\u0513\7\u00bb\2\2"+ - "\u0513\u0515\3\2\2\2\u0514\u0510\3\2\2\2\u0514\u0515\3\2\2\2\u0515\u0517"+ - "\3\2\2\2\u0516\u04fe\3\2\2\2\u0516\u050b\3\2\2\2\u0517\u0105\3\2\2\2\u0518"+ - "\u051d\5<\37\2\u0519\u051a\7\u00b3\2\2\u051a\u051c\5<\37\2\u051b\u0519"+ - "\3\2\2\2\u051c\u051f\3\2\2\2\u051d\u051b\3\2\2\2\u051d\u051e\3\2\2\2\u051e"+ - "\u0107\3\2\2\2\u051f\u051d\3\2\2\2\u0520\u0521\5\u014e\u00a8\2\u0521\u0109"+ - "\3\2\2\2\u0522\u0523\7\66\2\2\u0523\u0524\5\u010c\u0087\2\u0524\u010b"+ - "\3\2\2\2\u0525\u0526\5\u009cO\2\u0526\u010d\3\2\2\2\u0527\u0528\7\26\2"+ - "\2\u0528\u0529\7:\2\2\u0529\u052a\5\u0110\u0089\2\u052a\u010f\3\2\2\2"+ - "\u052b\u0530\5\u0112\u008a\2\u052c\u052d\7\u00b3\2\2\u052d\u052f\5\u0112"+ - "\u008a\2\u052e\u052c\3\2\2\2\u052f\u0532\3\2\2\2\u0530\u052e\3\2\2\2\u0530"+ - "\u0531\3\2\2\2\u0531\u0111\3\2\2\2\u0532\u0530\3\2\2\2\u0533\u0538\5\u0118"+ - "\u008d\2\u0534\u0538\5\u011a\u008e\2\u0535\u0538\5\u011c\u008f\2\u0536"+ - "\u0538\5\u0114\u008b\2\u0537\u0533\3\2\2\2\u0537\u0534\3\2\2\2\u0537\u0535"+ - "\3\2\2\2\u0537\u0536\3\2\2\2\u0538\u0113\3\2\2\2\u0539\u053f\5\u00e0q"+ - "\2\u053a\u053b\7\u00ba\2\2\u053b\u053c\5\u0120\u0091\2\u053c\u053d\7\u00bb"+ - "\2\2\u053d\u053f\3\2\2\2\u053e\u0539\3\2\2\2\u053e\u053a\3\2\2\2\u053f"+ - "\u0115\3\2\2\2\u0540\u0545\5\u0114\u008b\2\u0541\u0542\7\u00b3\2\2\u0542"+ - "\u0544\5\u0114\u008b\2\u0543\u0541\3\2\2\2\u0544\u0547\3\2\2\2\u0545\u0543"+ - "\3\2\2\2\u0545\u0546\3\2\2\2\u0546\u0117\3\2\2\2\u0547\u0545\3\2\2\2\u0548"+ - "\u0549\7p\2\2\u0549\u054a\7\u00ba\2\2\u054a\u054b\5\u0116\u008c\2\u054b"+ - "\u054c\7\u00bb\2\2\u054c\u0119\3\2\2\2\u054d\u054e\7A\2\2\u054e\u054f"+ - "\7\u00ba\2\2\u054f\u0550\5\u0116\u008c\2\u0550\u0551\7\u00bb\2\2\u0551"+ - "\u011b\3\2\2\2\u0552\u0553\7\u00ba\2\2\u0553\u0554\7\u00bb\2\2\u0554\u011d"+ - "\3\2\2\2\u0555\u0556\7\27\2\2\u0556\u0557\5\u00c6d\2\u0557\u011f\3\2\2"+ - "\2\u0558\u055d\5\u00e0q\2\u0559\u055a\7\u00b3\2\2\u055a\u055c\5\u00e0"+ - "q\2\u055b\u0559\3\2\2\2\u055c\u055f\3\2\2\2\u055d\u055b\3\2\2\2\u055d"+ - "\u055e\3\2\2\2\u055e\u0121\3\2\2\2\u055f\u055d\3\2\2\2\u0560\u0561\5\u0124"+ - "\u0093\2\u0561\u0123\3\2\2\2\u0562\u0565\5\u0126\u0094\2\u0563\u0565\5"+ - "\u00ecw\2\u0564\u0562\3\2\2\2\u0564\u0563\3\2\2\2\u0565\u0125\3\2\2\2"+ - "\u0566\u056f\5\u012a\u0096\2\u0567\u0568\5\u00ecw\2\u0568\u056a\t\f\2"+ - "\2\u0569\u056b\t\r\2\2\u056a\u0569\3\2\2\2\u056a\u056b\3\2\2\2\u056b\u056c"+ - "\3\2\2\2\u056c\u056d\5\u0128\u0095\2\u056d\u056f\3\2\2\2\u056e\u0566\3"+ - "\2\2\2\u056e\u0567\3\2\2\2\u056f\u0577\3\2\2\2\u0570\u0572\t\f\2\2\u0571"+ - "\u0573\t\r\2\2\u0572\u0571\3\2\2\2\u0572\u0573\3\2\2\2\u0573\u0574\3\2"+ - "\2\2\u0574\u0576\5\u0128\u0095\2\u0575\u0570\3\2\2\2\u0576\u0579\3\2\2"+ - "\2\u0577\u0575\3\2\2\2\u0577\u0578\3\2\2\2\u0578\u0127\3\2\2\2\u0579\u0577"+ - "\3\2\2\2\u057a\u057d\5\u012a\u0096\2\u057b\u057d\5\u00ecw\2\u057c\u057a"+ - "\3\2\2\2\u057c\u057b\3\2\2\2\u057d\u0129\3\2\2\2\u057e\u0587\5\u012e\u0098"+ - "\2\u057f\u0580\5\u00ecw\2\u0580\u0582\7\33\2\2\u0581\u0583\t\r\2\2\u0582"+ - "\u0581\3\2\2\2\u0582\u0583\3\2\2\2\u0583\u0584\3\2\2\2\u0584\u0585\5\u012c"+ - "\u0097\2\u0585\u0587\3\2\2\2\u0586\u057e\3\2\2\2\u0586\u057f\3\2\2\2\u0587"+ - "\u058f\3\2\2\2\u0588\u058a\7\33\2\2\u0589\u058b\t\r\2\2\u058a\u0589\3"+ - "\2\2\2\u058a\u058b\3\2\2\2\u058b\u058c\3\2\2\2\u058c\u058e\5\u012c\u0097"+ - "\2\u058d\u0588\3\2\2\2\u058e\u0591\3\2\2\2\u058f\u058d\3\2\2\2\u058f\u0590"+ - "\3\2\2\2\u0590\u012b\3\2\2\2\u0591\u058f\3\2\2\2\u0592\u0595\5\u012e\u0098"+ - "\2\u0593\u0595\5\u00ecw\2\u0594\u0592\3\2\2\2\u0594\u0593\3\2\2\2\u0595"+ - "\u012d\3\2\2\2\u0596\u059c\5\u0130\u0099\2\u0597\u0598\7\u00ba\2\2\u0598"+ - "\u0599\5\u0126\u0094\2\u0599\u059a\7\u00bb\2\2\u059a\u059c\3\2\2\2\u059b"+ - "\u0596\3\2\2\2\u059b\u0597\3\2\2\2\u059c\u012f\3\2\2\2\u059d\u05a0\5\u0138"+ - "\u009d\2\u059e\u05a0\5\u0132\u009a\2\u059f\u059d\3\2\2\2\u059f\u059e\3"+ - "\2\2\2\u05a0\u0131\3\2\2\2\u05a1\u05a2\7.\2\2\u05a2\u05a3\5\u0134\u009b"+ - "\2\u05a3\u0133\3\2\2\2\u05a4\u05a7\5\u0136\u009c\2\u05a5\u05a7\5<\37\2"+ - "\u05a6\u05a4\3\2\2\2\u05a6\u05a5\3\2\2\2\u05a7\u0135\3\2\2\2\u05a8\u05af"+ - "\5<\37\2\u05a9\u05aa\7\u00c1\2\2\u05aa\u05ad\5<\37\2\u05ab\u05ac\7\u00c1"+ - "\2\2\u05ac\u05ae\5<\37\2\u05ad\u05ab\3\2\2\2\u05ad\u05ae\3\2\2\2\u05ae"+ - "\u05b0\3\2\2\2\u05af\u05a9\3\2\2\2\u05af\u05b0\3\2\2\2\u05b0\u0137\3\2"+ - "\2\2\u05b1\u05b3\7+\2\2\u05b2\u05b4\5\u0142\u00a2\2\u05b3\u05b2\3\2\2"+ - "\2\u05b3\u05b4\3\2\2\2\u05b4\u05b5\3\2\2\2\u05b5\u05b7\5\u013a\u009e\2"+ - "\u05b6\u05b8\5\u00e4s\2\u05b7\u05b6\3\2\2\2\u05b7\u05b8\3\2\2\2\u05b8"+ - "\u0139\3\2\2\2\u05b9\u05be\5\u013c\u009f\2\u05ba\u05bb\7\u00b3\2\2\u05bb"+ - "\u05bd\5\u013c\u009f\2\u05bc\u05ba\3\2\2\2\u05bd\u05c0\3\2\2\2\u05be\u05bc"+ - "\3\2\2\2\u05be\u05bf\3\2\2\2\u05bf\u013b\3\2\2\2\u05c0\u05be\3\2\2\2\u05c1"+ - "\u05c4\5\u013e\u00a0\2\u05c2\u05c4\5\u0140\u00a1\2\u05c3\u05c1\3\2\2\2"+ - "\u05c3\u05c2\3\2\2\2\u05c4\u013d\3\2\2\2\u05c5\u05c7\5\u009cO\2\u05c6"+ - "\u05c8\5\u0146\u00a4\2\u05c7\u05c6\3\2\2\2\u05c7\u05c8\3\2\2\2\u05c8\u013f"+ - "\3\2\2\2\u05c9\u05ca\7\u00ca\2\2\u05ca\u05cc\7\u00c1\2\2\u05cb\u05c9\3"+ - "\2\2\2\u05cb\u05cc\3\2\2\2\u05cc\u05cd\3\2\2\2\u05cd\u05ce\7\u00be\2\2"+ - "\u05ce\u0141\3\2\2\2\u05cf\u05d0\t\r\2\2\u05d0\u0143\3\2\2\2\u05d1\u05d2"+ - "\5<\37\2\u05d2\u05d3\7\u00c1\2\2\u05d3\u05d5\3\2\2\2\u05d4\u05d1\3\2\2"+ - "\2\u05d4\u05d5\3\2\2\2\u05d5\u05d6\3\2\2\2\u05d6\u05d7\5<\37\2\u05d7\u0145"+ - "\3\2\2\2\u05d8\u05da\7\3\2\2\u05d9\u05d8\3\2\2\2\u05d9\u05da\3\2\2\2\u05da"+ - "\u05db\3\2\2\2\u05db\u05dc\5<\37\2\u05dc\u0147\3\2\2\2\u05dd\u05e2\5\u0144"+ - "\u00a3\2\u05de\u05df\7\u00b3\2\2\u05df\u05e1\5\u0144\u00a3\2\u05e0\u05de"+ - "\3\2\2\2\u05e1\u05e4\3\2\2\2\u05e2\u05e0\3\2\2\2\u05e2\u05e3\3\2\2\2\u05e3"+ - "\u0149\3\2\2\2\u05e4\u05e2\3\2\2\2\u05e5\u05e6\5\u0150\u00a9\2\u05e6\u014b"+ - "\3\2\2\2\u05e7\u05e8\5\u0150\u00a9\2\u05e8\u014d\3\2\2\2\u05e9\u05ea\5"+ - "\u0150\u00a9\2\u05ea\u014f\3\2\2\2\u05eb\u05ec\7\u00ba\2\2\u05ec\u05ed"+ - "\5\u0122\u0092\2\u05ed\u05ee\7\u00bb\2\2\u05ee\u0151\3\2\2\2\u05ef\u05f6"+ - "\5\u0154\u00ab\2\u05f0\u05f6\5\u0158\u00ad\2\u05f1\u05f6\5\u015c\u00af"+ - "\2\u05f2\u05f6\5\u0162\u00b2\2\u05f3\u05f6\5\u016a\u00b6\2\u05f4\u05f6"+ - "\5\u0174\u00bb\2\u05f5\u05ef\3\2\2\2\u05f5\u05f0\3\2\2\2\u05f5\u05f1\3"+ - "\2\2\2\u05f5\u05f2\3\2\2\2\u05f5\u05f3\3\2\2\2\u05f5\u05f4\3\2\2\2\u05f6"+ - "\u0153\3\2\2\2\u05f7\u05f8\5\u00e0q\2\u05f8\u05f9\5\u0156\u00ac\2\u05f9"+ - "\u05fa\5\u00e0q\2\u05fa\u0155\3\2\2\2\u05fb\u05fc\t\16\2\2\u05fc\u0157"+ - "\3\2\2\2\u05fd\u05fe\5\u00e0q\2\u05fe\u05ff\5\u015a\u00ae\2\u05ff\u0159"+ - "\3\2\2\2\u0600\u0602\7$\2\2\u0601\u0600\3\2\2\2\u0601\u0602\3\2\2\2\u0602"+ - "\u0603\3\2\2\2\u0603\u0605\79\2\2\u0604\u0606\t\17\2\2\u0605\u0604\3\2"+ - "\2\2\u0605\u0606\3\2\2\2\u0606\u0607\3\2\2\2\u0607\u0608\5\u00e0q\2\u0608"+ - "\u0609\7\5\2\2\u0609\u060a\5\u00e0q\2\u060a\u015b\3\2\2\2\u060b\u060d"+ - "\5\u00a0Q\2\u060c\u060e\7$\2\2\u060d\u060c\3\2\2\2\u060d\u060e\3\2\2\2"+ - "\u060e\u060f\3\2\2\2\u060f\u0610\7\31\2\2\u0610\u0611\5\u015e\u00b0\2"+ - "\u0611\u015d\3\2\2\2\u0612\u0618\5\u014e\u00a8\2\u0613\u0614\7\u00ba\2"+ - "\2\u0614\u0615\5\u0160\u00b1\2\u0615\u0616\7\u00bb\2\2\u0616\u0618\3\2"+ - "\2\2\u0617\u0612\3\2\2\2\u0617\u0613\3\2\2\2\u0618\u015f\3\2\2\2\u0619"+ - "\u061e\5\u00dan\2\u061a\u061b\7\u00b3\2\2\u061b\u061d\5\u00dan\2\u061c"+ - "\u061a\3\2\2\2\u061d\u0620\3\2\2\2\u061e\u061c\3\2\2\2\u061e\u061f\3\2"+ - "\2\2\u061f\u0161\3\2\2\2\u0620\u061e\3\2\2\2\u0621\u0622\5\u00e0q\2\u0622"+ - "\u0623\5\u0164\u00b3\2\u0623\u0624\7\u00cb\2\2\u0624\u0163\3\2\2\2\u0625"+ - "\u0627\7$\2\2\u0626\u0625\3\2\2\2\u0626\u0627\3\2\2\2\u0627\u0628\3\2"+ - "\2\2\u0628\u062b\5\u0166\u00b4\2\u0629\u062b\5\u0168\u00b5\2\u062a\u0626"+ - "\3\2\2\2\u062a\u0629\3\2\2\2\u062b\u0165\3\2\2\2\u062c\u0633\7!\2\2\u062d"+ - "\u0633\7\30\2\2\u062e\u062f\7s\2\2\u062f\u0633\7~\2\2\u0630\u0633\7n\2"+ - "\2\u0631\u0633\7o\2\2\u0632\u062c\3\2\2\2\u0632\u062d\3\2\2\2\u0632\u062e"+ - "\3\2\2\2\u0632\u0630\3\2\2\2\u0632\u0631\3\2\2\2\u0633\u0167\3\2\2\2\u0634"+ - "\u0635\t\20\2\2\u0635\u0169\3\2\2\2\u0636\u0637\5\u00e0q\2\u0637\u0639"+ - "\7\35\2\2\u0638\u063a\7$\2\2\u0639\u0638\3\2\2\2\u0639\u063a\3\2\2\2\u063a"+ - "\u063b\3\2\2\2\u063b\u063c\7%\2\2\u063c\u016b\3\2\2\2\u063d\u063e\5\u00a0"+ - "Q\2\u063e\u063f\5\u0156\u00ac\2\u063f\u0640\5\u016e\u00b8\2\u0640\u0641"+ - "\5\u014e\u00a8\2\u0641\u016d\3\2\2\2\u0642\u0645\5\u0170\u00b9\2\u0643"+ - "\u0645\5\u0172\u00ba\2\u0644\u0642\3\2\2\2\u0644\u0643\3\2\2\2\u0645\u016f"+ - "\3\2\2\2\u0646\u0647\7\4\2\2\u0647\u0171\3\2\2\2\u0648\u0649\t\21\2\2"+ - "\u0649\u0173\3\2\2\2\u064a\u064c\7$\2\2\u064b\u064a\3\2\2\2\u064b\u064c"+ - "\3\2\2\2\u064c\u064d\3\2\2\2\u064d\u064e\7J\2\2\u064e\u064f\5\u014e\u00a8"+ - "\2\u064f\u0175\3\2\2\2\u0650\u0651\7\63\2\2\u0651\u0652\5\u014e\u00a8"+ - "\2\u0652\u0177\3\2\2\2\u0653\u0656\5\u017a\u00be\2\u0654\u0656\7q\2\2"+ - "\u0655\u0653\3\2\2\2\u0655\u0654\3\2\2\2\u0656\u0179\3\2\2\2\u0657\u0658"+ - "\t\22\2\2\u0658\u017b\3\2\2\2\u0659\u065a\t\23\2\2\u065a\u017d\3\2\2\2"+ - "\u065b\u065c\5\u0182\u00c2\2\u065c\u065e\7\u00ba\2\2\u065d\u065f\5\u0184"+ - "\u00c3\2\u065e\u065d\3\2\2\2\u065e\u065f\3\2\2\2\u065f\u0660\3\2\2\2\u0660"+ - "\u0661\7\u00bb\2\2\u0661\u017f\3\2\2\2\u0662\u0663\t\24\2\2\u0663\u0181"+ - "\3\2\2\2\u0664\u0667\5<\37\2\u0665\u0667\5\u0180\u00c1\2\u0666\u0664\3"+ - "\2\2\2\u0666\u0665\3\2\2\2\u0667\u0183\3\2\2\2\u0668\u066d\5\u009cO\2"+ - "\u0669\u066a\7\u00b3\2\2\u066a\u066c\5\u009cO\2\u066b\u0669\3\2\2\2\u066c"+ - "\u066f\3\2\2\2\u066d\u066b\3\2\2\2\u066d\u066e\3\2\2\2\u066e\u0185\3\2"+ - "\2\2\u066f\u066d\3\2\2\2\u0670\u0671\7)\2\2\u0671\u0672\7:\2\2\u0672\u0673"+ - "\5\u0188\u00c5\2\u0673\u0187\3\2\2\2\u0674\u0679\5\u018a\u00c6\2\u0675"+ - "\u0676\7\u00b3\2\2\u0676\u0678\5\u018a\u00c6\2\u0677\u0675\3\2\2\2\u0678"+ - "\u067b\3\2\2\2\u0679\u0677\3\2\2\2\u0679\u067a\3\2\2\2\u067a\u0189\3\2"+ - "\2\2\u067b\u0679\3\2\2\2\u067c\u067e\5\u00e0q\2\u067d\u067f\5\u018c\u00c7"+ - "\2\u067e\u067d\3\2\2\2\u067e\u067f\3\2\2\2\u067f\u0681\3\2\2\2\u0680\u0682"+ - "\5\u0190\u00c9\2\u0681\u0680\3\2\2\2\u0681\u0682\3\2\2\2\u0682\u018b\3"+ - "\2\2\2\u0683\u0684\t\25\2\2\u0684\u018d\3\2\2\2\u0685\u0686\7\"\2\2\u0686"+ - "\u0687\5\u00a0Q\2\u0687\u018f\3\2\2\2\u0688\u0689\7%\2\2\u0689\u068d\7"+ - "N\2\2\u068a\u068b\7%\2\2\u068b\u068d\7Y\2\2\u068c\u0688\3\2\2\2\u068c"+ - "\u068a\3\2\2\2\u068d\u0191\3\2\2\2\u068e\u0690\7U\2\2\u068f\u0691\7g\2"+ - "\2\u0690\u068f\3\2\2\2\u0690\u0691\3\2\2\2\u0691\u0692\3\2\2\2\u0692\u0693"+ - "\7\34\2\2\u0693\u0698\5\u0136\u009c\2\u0694\u0695\7\u00ba\2\2\u0695\u0696"+ - "\5\u0106\u0084\2\u0696\u0697\7\u00bb\2\2\u0697\u0699\3\2\2\2\u0698\u0694"+ - "\3\2\2\2\u0698\u0699\3\2\2\2\u0699\u069a\3\2\2\2\u069a\u069b\5\u0122\u0092"+ - "\2\u069b\u06ac\3\2\2\2\u069c\u069e\7U\2\2\u069d\u069f\7g\2\2\u069e\u069d"+ - "\3\2\2\2\u069e\u069f\3\2\2\2\u069f\u06a0\3\2\2\2\u06a0\u06a1\7\34\2\2"+ - "\u06a1\u06a2\7\\\2\2\u06a2\u06a8\7\u00cb\2\2\u06a3\u06a4\7\64\2\2\u06a4"+ - "\u06a6\5<\37\2\u06a5\u06a7\5\26\f\2\u06a6\u06a5\3\2\2\2\u06a6\u06a7\3"+ - "\2\2\2\u06a7\u06a9\3\2\2\2\u06a8\u06a3\3\2\2\2\u06a8\u06a9\3\2\2\2\u06a9"+ - "\u06aa\3\2\2\2\u06aa\u06ac\5\u0122\u0092\2\u06ab\u068e\3\2\2\2\u06ab\u069c"+ - "\3\2\2\2\u06ac\u0193\3\2\2\2\u00bc\u0196\u019e\u01a6\u01aa\u01b1\u01b7"+ - "\u01c1\u01c4\u01cf\u01d2\u01d5\u01d9\u01e0\u01e3\u01e6\u01eb\u01f3\u0204"+ - "\u0219\u022a\u0237\u023b\u023d\u024a\u0251\u0269\u0270\u0281\u0285\u028b"+ - "\u0290\u0295\u02ad\u02b3\u02b7\u02bc\u02c1\u02c5\u02c8\u02d1\u02d6\u02da"+ - "\u02e0\u02e6\u02eb\u02ef\u02f1\u02f5\u02f9\u02fb\u02ff\u0303\u0307\u030b"+ - "\u0316\u031a\u0322\u032c\u033d\u0341\u0345\u034a\u034c\u0350\u0355\u0359"+ - "\u035b\u035f\u036c\u0373\u037f\u0381\u0386\u03a8\u03ac\u03b0\u03b7\u03ba"+ - "\u03c2\u03c5\u03d8\u03e8\u03ed\u03f4\u03fc\u0400\u040a\u0414\u0418\u0428"+ - "\u042e\u0437\u043e\u0448\u044b\u044e\u0455\u0460\u0468\u046e\u0472\u0476"+ - "\u047e\u0482\u048a\u0492\u0496\u049a\u049d\u04a0\u04a3\u04a6\u04b0\u04b5"+ - "\u04bb\u04c1\u04c9\u04d0\u04d7\u04df\u04ea\u04ee\u04f4\u0500\u0503\u0509"+ - "\u050d\u0514\u0516\u051d\u0530\u0537\u053e\u0545\u055d\u0564\u056a\u056e"+ - "\u0572\u0577\u057c\u0582\u0586\u058a\u058f\u0594\u059b\u059f\u05a6\u05ad"+ - "\u05af\u05b3\u05b7\u05be\u05c3\u05c7\u05cb\u05d4\u05d9\u05e2\u05f5\u0601"+ - "\u0605\u060d\u0617\u061e\u0626\u062a\u0632\u0639\u0644\u064b\u0655\u065e"+ - "\u0666\u066d\u0679\u067e\u0681\u068c\u0690\u0698\u069e\u06a6\u06a8\u06ab"; - public static final ATN _ATN = - new ATNDeserializer().deserialize(_serializedATN.toCharArray()); - static { - _decisionToDFA = new DFA[_ATN.getNumberOfDecisions()]; - for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) { - _decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i); - } - } -} \ No newline at end of file diff --git a/core/src/arc/sql/sql/SQLParserBaseListener.java b/core/src/arc/sql/sql/SQLParserBaseListener.java deleted file mode 100644 index e7f79d4..0000000 --- a/core/src/arc/sql/sql/SQLParserBaseListener.java +++ /dev/null @@ -1,4605 +0,0 @@ -package com.srotya.sidewinder.core.sql; - -import java.util.Arrays; -import java.util.Stack; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -// Generated from SQLParser.g4 by ANTLR 4.6 - -import org.antlr.v4.runtime.ParserRuleContext; -import org.antlr.v4.runtime.tree.ErrorNode; -import org.antlr.v4.runtime.tree.TerminalNode; - -import com.srotya.sidewinder.core.sql.operators.AndOperator; -import com.srotya.sidewinder.core.sql.operators.ComplexOperator; -import com.srotya.sidewinder.core.sql.operators.Equals; -import com.srotya.sidewinder.core.sql.operators.GreaterThan; -import com.srotya.sidewinder.core.sql.operators.GreaterThanEquals; -import com.srotya.sidewinder.core.sql.operators.InOperator; -import com.srotya.sidewinder.core.sql.operators.LessThan; -import com.srotya.sidewinder.core.sql.operators.LessThanEquals; -import com.srotya.sidewinder.core.sql.operators.NotEquals; -import com.srotya.sidewinder.core.sql.operators.Operator; -import com.srotya.sidewinder.core.sql.operators.OrOperator; - -/** - * This class provides an empty implementation of {@link SQLParserListener}, - * which can be extended to create a listener which only needs to handle a - * subset of the available methods. - */ -public class SQLParserBaseListener implements SQLParserListener { - - private Pattern dateDiff = Pattern.compile("datediff\\(timestamp,now\\(\\)\\)"); - private Stack stacks; - private Operator filterTree; - private String measurementName; - - /** - * Operator / filter tree - * - * @return filterTree - */ - public Operator getFilterTree() { - return filterTree; - } - - /** - * Return measurement name (SQL Table name) - * - * @return measurement name - */ - public String getMeasurementName() { - return measurementName; - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterIn_value_list(SQLParser.In_value_listContext ctx) { - System.out.println("In operator:" + ctx.getText()); - String[] splits = ctx.getText().split(","); - Operator op = new InOperator(Arrays.asList(splits)); - if (!stacks.isEmpty()) { - ComplexOperator peek = (ComplexOperator) stacks.peek(); - peek.addOperator(op); - } - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitIn_value_list(SQLParser.In_value_listContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterComparison_predicate(SQLParser.Comparison_predicateContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitComparison_predicate(SQLParser.Comparison_predicateContext ctx) { - Operator op = null; - String lhs = ctx.left.getText(); - String rhs = ctx.right.getText(); - if (lhs.matches(".*\\(.*\\)")) { - // parse function - Matcher matcher = dateDiff.matcher(lhs); - if (matcher.matches()) { - System.out.println("Found a function expression"); - long now = System.currentTimeMillis(); - char cUnit = rhs.charAt(rhs.length() - 1); - if (cUnit > 'a' && cUnit < 'z') { - rhs = rhs.substring(0, rhs.length() - 1); - } - long timeOffset = Long.parseLong(rhs); - switch (cUnit) { - case 'h': - timeOffset = timeOffset * 1000 * 3600; - break; - case 'm': - timeOffset = timeOffset * 1000 * 60; - break; - case 's': - timeOffset = timeOffset * 1000; - break; - case 'd': - timeOffset = timeOffset * 1000 * 3600 * 24; - break; - default: - timeOffset = timeOffset * 1000 * 3600; - } - lhs = "timestamp"; - rhs = String.valueOf(now - timeOffset); - op = new GreaterThan("timestamp", false, Long.parseLong(rhs)); - } - } else { - if (ctx.comp_op().EQUAL() != null) { - op = new Equals(lhs, rhs); - } else if (ctx.comp_op().NOT_EQUAL() != null) { - op = new NotEquals(lhs, rhs); - } else if (ctx.comp_op().LEQ() != null) { - op = new LessThanEquals(lhs, true, Double.parseDouble(rhs)); - } else if (ctx.comp_op().GEQ() != null) { - op = new GreaterThanEquals(lhs, true, Double.parseDouble(rhs)); - } else if (ctx.comp_op().LTH() != null) { - op = new LessThan(lhs, true, Double.parseDouble(rhs)); - } else if (ctx.comp_op().GTH() != null) { - op = new GreaterThan(lhs, true, Double.parseDouble(rhs)); - } - } - if (!stacks.isEmpty()) { - ComplexOperator peek = (ComplexOperator) stacks.peek(); - peek.addOperator(op); - } - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterOr_predicate(SQLParser.Or_predicateContext ctx) { - stacks.push(new OrOperator(null)); - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitOr_predicate(SQLParser.Or_predicateContext ctx) { - OrOperator or = (OrOperator) stacks.pop(); - if (stacks.isEmpty()) { - stacks.push(or); - } else { - ComplexOperator peek = (ComplexOperator) stacks.peek(); - peek.addOperator(or); - } - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterAnd_predicate(SQLParser.And_predicateContext ctx) { - stacks.push(new AndOperator(null)); - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitAnd_predicate(SQLParser.And_predicateContext ctx) { - AndOperator and = (AndOperator) stacks.pop(); - if (stacks.isEmpty()) { - stacks.push(and); - } else { - ComplexOperator peek = (ComplexOperator) stacks.peek(); - peek.addOperator(and); - } - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterWhere_clause(SQLParser.Where_clauseContext ctx) { - stacks = new Stack<>(); - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitWhere_clause(SQLParser.Where_clauseContext ctx) { - filterTree = stacks.pop(); - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterFunction_name(SQLParser.Function_nameContext ctx) { -// System.out.println("Function name:" + ctx.getText()); - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitFunction_name(SQLParser.Function_nameContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterPartition_name(SQLParser.Partition_nameContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitPartition_name(SQLParser.Partition_nameContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterDrop_table_statement(SQLParser.Drop_table_statementContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitDrop_table_statement(SQLParser.Drop_table_statementContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterIdentifier(SQLParser.IdentifierContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitIdentifier(SQLParser.IdentifierContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterNonreserved_keywords(SQLParser.Nonreserved_keywordsContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitNonreserved_keywords(SQLParser.Nonreserved_keywordsContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterUnsigned_literal(SQLParser.Unsigned_literalContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitUnsigned_literal(SQLParser.Unsigned_literalContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterGeneral_literal(SQLParser.General_literalContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitGeneral_literal(SQLParser.General_literalContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterDatetime_literal(SQLParser.Datetime_literalContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitDatetime_literal(SQLParser.Datetime_literalContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterTime_literal(SQLParser.Time_literalContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitTime_literal(SQLParser.Time_literalContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterTimestamp_literal(SQLParser.Timestamp_literalContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitTimestamp_literal(SQLParser.Timestamp_literalContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterDate_literal(SQLParser.Date_literalContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitDate_literal(SQLParser.Date_literalContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterBoolean_literal(SQLParser.Boolean_literalContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitBoolean_literal(SQLParser.Boolean_literalContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterData_type(SQLParser.Data_typeContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitData_type(SQLParser.Data_typeContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterPredefined_type(SQLParser.Predefined_typeContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitPredefined_type(SQLParser.Predefined_typeContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterNetwork_type(SQLParser.Network_typeContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitNetwork_type(SQLParser.Network_typeContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterCharacter_string_type(SQLParser.Character_string_typeContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitCharacter_string_type(SQLParser.Character_string_typeContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterType_length(SQLParser.Type_lengthContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitType_length(SQLParser.Type_lengthContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterNational_character_string_type(SQLParser.National_character_string_typeContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitNational_character_string_type(SQLParser.National_character_string_typeContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterBinary_large_object_string_type(SQLParser.Binary_large_object_string_typeContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitBinary_large_object_string_type(SQLParser.Binary_large_object_string_typeContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterNumeric_type(SQLParser.Numeric_typeContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitNumeric_type(SQLParser.Numeric_typeContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterExact_numeric_type(SQLParser.Exact_numeric_typeContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitExact_numeric_type(SQLParser.Exact_numeric_typeContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterApproximate_numeric_type(SQLParser.Approximate_numeric_typeContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitApproximate_numeric_type(SQLParser.Approximate_numeric_typeContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterPrecision_param(SQLParser.Precision_paramContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitPrecision_param(SQLParser.Precision_paramContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterBoolean_type(SQLParser.Boolean_typeContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitBoolean_type(SQLParser.Boolean_typeContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterDatetime_type(SQLParser.Datetime_typeContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitDatetime_type(SQLParser.Datetime_typeContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterBit_type(SQLParser.Bit_typeContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitBit_type(SQLParser.Bit_typeContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterBinary_type(SQLParser.Binary_typeContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitBinary_type(SQLParser.Binary_typeContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterValue_expression_primary(SQLParser.Value_expression_primaryContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitValue_expression_primary(SQLParser.Value_expression_primaryContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterParenthesized_value_expression(SQLParser.Parenthesized_value_expressionContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitParenthesized_value_expression(SQLParser.Parenthesized_value_expressionContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterNonparenthesized_value_expression_primary( - SQLParser.Nonparenthesized_value_expression_primaryContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitNonparenthesized_value_expression_primary( - SQLParser.Nonparenthesized_value_expression_primaryContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterUnsigned_value_specification(SQLParser.Unsigned_value_specificationContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitUnsigned_value_specification(SQLParser.Unsigned_value_specificationContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterUnsigned_numeric_literal(SQLParser.Unsigned_numeric_literalContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitUnsigned_numeric_literal(SQLParser.Unsigned_numeric_literalContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterSigned_numerical_literal(SQLParser.Signed_numerical_literalContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitSigned_numerical_literal(SQLParser.Signed_numerical_literalContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterSet_function_specification(SQLParser.Set_function_specificationContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitSet_function_specification(SQLParser.Set_function_specificationContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterAggregate_function(SQLParser.Aggregate_functionContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitAggregate_function(SQLParser.Aggregate_functionContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterGeneral_set_function(SQLParser.General_set_functionContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitGeneral_set_function(SQLParser.General_set_functionContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterSet_function_type(SQLParser.Set_function_typeContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitSet_function_type(SQLParser.Set_function_typeContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterFilter_clause(SQLParser.Filter_clauseContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitFilter_clause(SQLParser.Filter_clauseContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterGrouping_operation(SQLParser.Grouping_operationContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitGrouping_operation(SQLParser.Grouping_operationContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterCase_expression(SQLParser.Case_expressionContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitCase_expression(SQLParser.Case_expressionContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterCase_abbreviation(SQLParser.Case_abbreviationContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitCase_abbreviation(SQLParser.Case_abbreviationContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterCase_specification(SQLParser.Case_specificationContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitCase_specification(SQLParser.Case_specificationContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterSimple_case(SQLParser.Simple_caseContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitSimple_case(SQLParser.Simple_caseContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterSearched_case(SQLParser.Searched_caseContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitSearched_case(SQLParser.Searched_caseContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterSimple_when_clause(SQLParser.Simple_when_clauseContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitSimple_when_clause(SQLParser.Simple_when_clauseContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterSearched_when_clause(SQLParser.Searched_when_clauseContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitSearched_when_clause(SQLParser.Searched_when_clauseContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterElse_clause(SQLParser.Else_clauseContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitElse_clause(SQLParser.Else_clauseContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterResult(SQLParser.ResultContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitResult(SQLParser.ResultContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterCast_specification(SQLParser.Cast_specificationContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitCast_specification(SQLParser.Cast_specificationContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterCast_operand(SQLParser.Cast_operandContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitCast_operand(SQLParser.Cast_operandContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterCast_target(SQLParser.Cast_targetContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitCast_target(SQLParser.Cast_targetContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterValue_expression(SQLParser.Value_expressionContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitValue_expression(SQLParser.Value_expressionContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterCommon_value_expression(SQLParser.Common_value_expressionContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitCommon_value_expression(SQLParser.Common_value_expressionContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterNumeric_value_expression(SQLParser.Numeric_value_expressionContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitNumeric_value_expression(SQLParser.Numeric_value_expressionContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterTerm(SQLParser.TermContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitTerm(SQLParser.TermContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterFactor(SQLParser.FactorContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitFactor(SQLParser.FactorContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterArray(SQLParser.ArrayContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitArray(SQLParser.ArrayContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterNumeric_primary(SQLParser.Numeric_primaryContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitNumeric_primary(SQLParser.Numeric_primaryContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterSign(SQLParser.SignContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitSign(SQLParser.SignContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterNumeric_value_function(SQLParser.Numeric_value_functionContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitNumeric_value_function(SQLParser.Numeric_value_functionContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterExtract_expression(SQLParser.Extract_expressionContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitExtract_expression(SQLParser.Extract_expressionContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterExtract_field(SQLParser.Extract_fieldContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitExtract_field(SQLParser.Extract_fieldContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterTime_zone_field(SQLParser.Time_zone_fieldContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitTime_zone_field(SQLParser.Time_zone_fieldContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterExtract_source(SQLParser.Extract_sourceContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitExtract_source(SQLParser.Extract_sourceContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterString_value_expression(SQLParser.String_value_expressionContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitString_value_expression(SQLParser.String_value_expressionContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterCharacter_value_expression(SQLParser.Character_value_expressionContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitCharacter_value_expression(SQLParser.Character_value_expressionContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterCharacter_factor(SQLParser.Character_factorContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitCharacter_factor(SQLParser.Character_factorContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterCharacter_primary(SQLParser.Character_primaryContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitCharacter_primary(SQLParser.Character_primaryContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterString_value_function(SQLParser.String_value_functionContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitString_value_function(SQLParser.String_value_functionContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterTrim_function(SQLParser.Trim_functionContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitTrim_function(SQLParser.Trim_functionContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterTrim_operands(SQLParser.Trim_operandsContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitTrim_operands(SQLParser.Trim_operandsContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterTrim_specification(SQLParser.Trim_specificationContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitTrim_specification(SQLParser.Trim_specificationContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterBoolean_value_expression(SQLParser.Boolean_value_expressionContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitBoolean_value_expression(SQLParser.Boolean_value_expressionContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterBoolean_factor(SQLParser.Boolean_factorContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitBoolean_factor(SQLParser.Boolean_factorContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterBoolean_test(SQLParser.Boolean_testContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitBoolean_test(SQLParser.Boolean_testContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterIs_clause(SQLParser.Is_clauseContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitIs_clause(SQLParser.Is_clauseContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterTruth_value(SQLParser.Truth_valueContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitTruth_value(SQLParser.Truth_valueContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterBoolean_primary(SQLParser.Boolean_primaryContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitBoolean_primary(SQLParser.Boolean_primaryContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterBoolean_predicand(SQLParser.Boolean_predicandContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitBoolean_predicand(SQLParser.Boolean_predicandContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterParenthesized_boolean_value_expression( - SQLParser.Parenthesized_boolean_value_expressionContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitParenthesized_boolean_value_expression( - SQLParser.Parenthesized_boolean_value_expressionContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterRow_value_expression(SQLParser.Row_value_expressionContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitRow_value_expression(SQLParser.Row_value_expressionContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterRow_value_special_case(SQLParser.Row_value_special_caseContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitRow_value_special_case(SQLParser.Row_value_special_caseContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterExplicit_row_value_constructor(SQLParser.Explicit_row_value_constructorContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitExplicit_row_value_constructor(SQLParser.Explicit_row_value_constructorContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterRow_value_predicand(SQLParser.Row_value_predicandContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitRow_value_predicand(SQLParser.Row_value_predicandContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterRow_value_constructor_predicand(SQLParser.Row_value_constructor_predicandContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitRow_value_constructor_predicand(SQLParser.Row_value_constructor_predicandContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterTable_expression(SQLParser.Table_expressionContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitTable_expression(SQLParser.Table_expressionContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterFrom_clause(SQLParser.From_clauseContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitFrom_clause(SQLParser.From_clauseContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterTable_reference_list(SQLParser.Table_reference_listContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitTable_reference_list(SQLParser.Table_reference_listContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterTable_reference(SQLParser.Table_referenceContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitTable_reference(SQLParser.Table_referenceContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterJoined_table(SQLParser.Joined_tableContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitJoined_table(SQLParser.Joined_tableContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterJoined_table_primary(SQLParser.Joined_table_primaryContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitJoined_table_primary(SQLParser.Joined_table_primaryContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterCross_join(SQLParser.Cross_joinContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitCross_join(SQLParser.Cross_joinContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterQualified_join(SQLParser.Qualified_joinContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitQualified_join(SQLParser.Qualified_joinContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterNatural_join(SQLParser.Natural_joinContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitNatural_join(SQLParser.Natural_joinContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterUnion_join(SQLParser.Union_joinContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitUnion_join(SQLParser.Union_joinContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterJoin_type(SQLParser.Join_typeContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitJoin_type(SQLParser.Join_typeContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterOuter_join_type(SQLParser.Outer_join_typeContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitOuter_join_type(SQLParser.Outer_join_typeContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterOuter_join_type_part2(SQLParser.Outer_join_type_part2Context ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitOuter_join_type_part2(SQLParser.Outer_join_type_part2Context ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterJoin_specification(SQLParser.Join_specificationContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitJoin_specification(SQLParser.Join_specificationContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterJoin_condition(SQLParser.Join_conditionContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitJoin_condition(SQLParser.Join_conditionContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterNamed_columns_join(SQLParser.Named_columns_joinContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitNamed_columns_join(SQLParser.Named_columns_joinContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterTable_primary(SQLParser.Table_primaryContext ctx) { - measurementName = ctx.getText(); - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitTable_primary(SQLParser.Table_primaryContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterColumn_name_list(SQLParser.Column_name_listContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitColumn_name_list(SQLParser.Column_name_listContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterDerived_table(SQLParser.Derived_tableContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitDerived_table(SQLParser.Derived_tableContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterSearch_condition(SQLParser.Search_conditionContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitSearch_condition(SQLParser.Search_conditionContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterGroupby_clause(SQLParser.Groupby_clauseContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitGroupby_clause(SQLParser.Groupby_clauseContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterGrouping_element_list(SQLParser.Grouping_element_listContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitGrouping_element_list(SQLParser.Grouping_element_listContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterGrouping_element(SQLParser.Grouping_elementContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitGrouping_element(SQLParser.Grouping_elementContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterOrdinary_grouping_set(SQLParser.Ordinary_grouping_setContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitOrdinary_grouping_set(SQLParser.Ordinary_grouping_setContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterOrdinary_grouping_set_list(SQLParser.Ordinary_grouping_set_listContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitOrdinary_grouping_set_list(SQLParser.Ordinary_grouping_set_listContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterRollup_list(SQLParser.Rollup_listContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitRollup_list(SQLParser.Rollup_listContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterCube_list(SQLParser.Cube_listContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitCube_list(SQLParser.Cube_listContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterEmpty_grouping_set(SQLParser.Empty_grouping_setContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitEmpty_grouping_set(SQLParser.Empty_grouping_setContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterHaving_clause(SQLParser.Having_clauseContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitHaving_clause(SQLParser.Having_clauseContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterRow_value_predicand_list(SQLParser.Row_value_predicand_listContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitRow_value_predicand_list(SQLParser.Row_value_predicand_listContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterQuery_expression(SQLParser.Query_expressionContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitQuery_expression(SQLParser.Query_expressionContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterQuery_expression_body(SQLParser.Query_expression_bodyContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitQuery_expression_body(SQLParser.Query_expression_bodyContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterNon_join_query_expression(SQLParser.Non_join_query_expressionContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitNon_join_query_expression(SQLParser.Non_join_query_expressionContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterQuery_term(SQLParser.Query_termContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitQuery_term(SQLParser.Query_termContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterNon_join_query_term(SQLParser.Non_join_query_termContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitNon_join_query_term(SQLParser.Non_join_query_termContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterQuery_primary(SQLParser.Query_primaryContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitQuery_primary(SQLParser.Query_primaryContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterNon_join_query_primary(SQLParser.Non_join_query_primaryContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitNon_join_query_primary(SQLParser.Non_join_query_primaryContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterSimple_table(SQLParser.Simple_tableContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitSimple_table(SQLParser.Simple_tableContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterExplicit_table(SQLParser.Explicit_tableContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitExplicit_table(SQLParser.Explicit_tableContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterTable_or_query_name(SQLParser.Table_or_query_nameContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitTable_or_query_name(SQLParser.Table_or_query_nameContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterTable_name(SQLParser.Table_nameContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitTable_name(SQLParser.Table_nameContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterQuery_specification(SQLParser.Query_specificationContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitQuery_specification(SQLParser.Query_specificationContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterSelect_list(SQLParser.Select_listContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitSelect_list(SQLParser.Select_listContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterSelect_sublist(SQLParser.Select_sublistContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitSelect_sublist(SQLParser.Select_sublistContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterDerived_column(SQLParser.Derived_columnContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitDerived_column(SQLParser.Derived_columnContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterQualified_asterisk(SQLParser.Qualified_asteriskContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitQualified_asterisk(SQLParser.Qualified_asteriskContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterSet_qualifier(SQLParser.Set_qualifierContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitSet_qualifier(SQLParser.Set_qualifierContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterColumn_reference(SQLParser.Column_referenceContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitColumn_reference(SQLParser.Column_referenceContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterAs_clause(SQLParser.As_clauseContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitAs_clause(SQLParser.As_clauseContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterColumn_reference_list(SQLParser.Column_reference_listContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitColumn_reference_list(SQLParser.Column_reference_listContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterScalar_subquery(SQLParser.Scalar_subqueryContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitScalar_subquery(SQLParser.Scalar_subqueryContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterRow_subquery(SQLParser.Row_subqueryContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitRow_subquery(SQLParser.Row_subqueryContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterTable_subquery(SQLParser.Table_subqueryContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitTable_subquery(SQLParser.Table_subqueryContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterSubquery(SQLParser.SubqueryContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitSubquery(SQLParser.SubqueryContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterPredicate(SQLParser.PredicateContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitPredicate(SQLParser.PredicateContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterComp_op(SQLParser.Comp_opContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitComp_op(SQLParser.Comp_opContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterBetween_predicate(SQLParser.Between_predicateContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitBetween_predicate(SQLParser.Between_predicateContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterBetween_predicate_part_2(SQLParser.Between_predicate_part_2Context ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitBetween_predicate_part_2(SQLParser.Between_predicate_part_2Context ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterPattern_matching_predicate(SQLParser.Pattern_matching_predicateContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitPattern_matching_predicate(SQLParser.Pattern_matching_predicateContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterPattern_matcher(SQLParser.Pattern_matcherContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitPattern_matcher(SQLParser.Pattern_matcherContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterNegativable_matcher(SQLParser.Negativable_matcherContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitNegativable_matcher(SQLParser.Negativable_matcherContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterRegex_matcher(SQLParser.Regex_matcherContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitRegex_matcher(SQLParser.Regex_matcherContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterNull_predicate(SQLParser.Null_predicateContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitNull_predicate(SQLParser.Null_predicateContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterQuantified_comparison_predicate(SQLParser.Quantified_comparison_predicateContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitQuantified_comparison_predicate(SQLParser.Quantified_comparison_predicateContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterQuantifier(SQLParser.QuantifierContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitQuantifier(SQLParser.QuantifierContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterAll(SQLParser.AllContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitAll(SQLParser.AllContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterSome(SQLParser.SomeContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitSome(SQLParser.SomeContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterExists_predicate(SQLParser.Exists_predicateContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitExists_predicate(SQLParser.Exists_predicateContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterUnique_predicate(SQLParser.Unique_predicateContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitUnique_predicate(SQLParser.Unique_predicateContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterPrimary_datetime_field(SQLParser.Primary_datetime_fieldContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitPrimary_datetime_field(SQLParser.Primary_datetime_fieldContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterNon_second_primary_datetime_field(SQLParser.Non_second_primary_datetime_fieldContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitNon_second_primary_datetime_field(SQLParser.Non_second_primary_datetime_fieldContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterExtended_datetime_field(SQLParser.Extended_datetime_fieldContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitExtended_datetime_field(SQLParser.Extended_datetime_fieldContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterRoutine_invocation(SQLParser.Routine_invocationContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitRoutine_invocation(SQLParser.Routine_invocationContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterFunction_names_for_reserved_words(SQLParser.Function_names_for_reserved_wordsContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitFunction_names_for_reserved_words(SQLParser.Function_names_for_reserved_wordsContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterSql_argument_list(SQLParser.Sql_argument_listContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitSql_argument_list(SQLParser.Sql_argument_listContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterOrderby_clause(SQLParser.Orderby_clauseContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitOrderby_clause(SQLParser.Orderby_clauseContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterSort_specifier_list(SQLParser.Sort_specifier_listContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitSort_specifier_list(SQLParser.Sort_specifier_listContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterSort_specifier(SQLParser.Sort_specifierContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitSort_specifier(SQLParser.Sort_specifierContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterOrder_specification(SQLParser.Order_specificationContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitOrder_specification(SQLParser.Order_specificationContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterLimit_clause(SQLParser.Limit_clauseContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitLimit_clause(SQLParser.Limit_clauseContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterNull_ordering(SQLParser.Null_orderingContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitNull_ordering(SQLParser.Null_orderingContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterInsert_statement(SQLParser.Insert_statementContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitInsert_statement(SQLParser.Insert_statementContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterEveryRule(ParserRuleContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitEveryRule(ParserRuleContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void visitTerminal(TerminalNode node) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void visitErrorNode(ErrorNode node) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterSql(SQLParser.SqlContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitSql(SQLParser.SqlContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterStatement(SQLParser.StatementContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitStatement(SQLParser.StatementContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterData_statement(SQLParser.Data_statementContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitData_statement(SQLParser.Data_statementContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterData_change_statement(SQLParser.Data_change_statementContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitData_change_statement(SQLParser.Data_change_statementContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterSchema_statement(SQLParser.Schema_statementContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitSchema_statement(SQLParser.Schema_statementContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterIndex_statement(SQLParser.Index_statementContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitIndex_statement(SQLParser.Index_statementContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterCreate_table_statement(SQLParser.Create_table_statementContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitCreate_table_statement(SQLParser.Create_table_statementContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterTable_elements(SQLParser.Table_elementsContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitTable_elements(SQLParser.Table_elementsContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterField_element(SQLParser.Field_elementContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitField_element(SQLParser.Field_elementContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterField_type(SQLParser.Field_typeContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitField_type(SQLParser.Field_typeContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterParam_clause(SQLParser.Param_clauseContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitParam_clause(SQLParser.Param_clauseContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterParam(SQLParser.ParamContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitParam(SQLParser.ParamContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterMethod_specifier(SQLParser.Method_specifierContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitMethod_specifier(SQLParser.Method_specifierContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterTable_space_specifier(SQLParser.Table_space_specifierContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitTable_space_specifier(SQLParser.Table_space_specifierContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterTable_space_name(SQLParser.Table_space_nameContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitTable_space_name(SQLParser.Table_space_nameContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterTable_partitioning_clauses(SQLParser.Table_partitioning_clausesContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitTable_partitioning_clauses(SQLParser.Table_partitioning_clausesContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterRange_partitions(SQLParser.Range_partitionsContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitRange_partitions(SQLParser.Range_partitionsContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterRange_value_clause_list(SQLParser.Range_value_clause_listContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitRange_value_clause_list(SQLParser.Range_value_clause_listContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterRange_value_clause(SQLParser.Range_value_clauseContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitRange_value_clause(SQLParser.Range_value_clauseContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterHash_partitions(SQLParser.Hash_partitionsContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitHash_partitions(SQLParser.Hash_partitionsContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterIndividual_hash_partitions(SQLParser.Individual_hash_partitionsContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitIndividual_hash_partitions(SQLParser.Individual_hash_partitionsContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterIndividual_hash_partition(SQLParser.Individual_hash_partitionContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitIndividual_hash_partition(SQLParser.Individual_hash_partitionContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterHash_partitions_by_quantity(SQLParser.Hash_partitions_by_quantityContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitHash_partitions_by_quantity(SQLParser.Hash_partitions_by_quantityContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterList_partitions(SQLParser.List_partitionsContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitList_partitions(SQLParser.List_partitionsContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterList_value_clause_list(SQLParser.List_value_clause_listContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitList_value_clause_list(SQLParser.List_value_clause_listContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterList_value_partition(SQLParser.List_value_partitionContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitList_value_partition(SQLParser.List_value_partitionContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterColumn_partitions(SQLParser.Column_partitionsContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitColumn_partitions(SQLParser.Column_partitionsContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterIn_predicate(SQLParser.In_predicateContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitIn_predicate(SQLParser.In_predicateContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void enterIn_predicate_value(SQLParser.In_predicate_valueContext ctx) { - } - - /** - * {@inheritDoc} - * - *

- * The default implementation does nothing. - *

- */ - @Override - public void exitIn_predicate_value(SQLParser.In_predicate_valueContext ctx) { - } -} \ No newline at end of file diff --git a/core/src/arc/sql/sql/SQLParserListener.java b/core/src/arc/sql/sql/SQLParserListener.java deleted file mode 100644 index 2f892a8..0000000 --- a/core/src/arc/sql/sql/SQLParserListener.java +++ /dev/null @@ -1,2023 +0,0 @@ -package com.srotya.sidewinder.core.sql; - -// Generated from SQLParser.g4 by ANTLR 4.6 - - -import org.antlr.v4.runtime.tree.ParseTreeListener; - -/** - * This interface defines a complete listener for a parse tree produced by - * {@link SQLParser}. - */ -public interface SQLParserListener extends ParseTreeListener { - /** - * Enter a parse tree produced by {@link SQLParser#sql}. - * @param ctx the parse tree - */ - void enterSql(SQLParser.SqlContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#sql}. - * @param ctx the parse tree - */ - void exitSql(SQLParser.SqlContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#statement}. - * @param ctx the parse tree - */ - void enterStatement(SQLParser.StatementContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#statement}. - * @param ctx the parse tree - */ - void exitStatement(SQLParser.StatementContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#data_statement}. - * @param ctx the parse tree - */ - void enterData_statement(SQLParser.Data_statementContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#data_statement}. - * @param ctx the parse tree - */ - void exitData_statement(SQLParser.Data_statementContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#data_change_statement}. - * @param ctx the parse tree - */ - void enterData_change_statement(SQLParser.Data_change_statementContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#data_change_statement}. - * @param ctx the parse tree - */ - void exitData_change_statement(SQLParser.Data_change_statementContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#schema_statement}. - * @param ctx the parse tree - */ - void enterSchema_statement(SQLParser.Schema_statementContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#schema_statement}. - * @param ctx the parse tree - */ - void exitSchema_statement(SQLParser.Schema_statementContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#index_statement}. - * @param ctx the parse tree - */ - void enterIndex_statement(SQLParser.Index_statementContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#index_statement}. - * @param ctx the parse tree - */ - void exitIndex_statement(SQLParser.Index_statementContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#create_table_statement}. - * @param ctx the parse tree - */ - void enterCreate_table_statement(SQLParser.Create_table_statementContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#create_table_statement}. - * @param ctx the parse tree - */ - void exitCreate_table_statement(SQLParser.Create_table_statementContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#table_elements}. - * @param ctx the parse tree - */ - void enterTable_elements(SQLParser.Table_elementsContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#table_elements}. - * @param ctx the parse tree - */ - void exitTable_elements(SQLParser.Table_elementsContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#field_element}. - * @param ctx the parse tree - */ - void enterField_element(SQLParser.Field_elementContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#field_element}. - * @param ctx the parse tree - */ - void exitField_element(SQLParser.Field_elementContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#field_type}. - * @param ctx the parse tree - */ - void enterField_type(SQLParser.Field_typeContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#field_type}. - * @param ctx the parse tree - */ - void exitField_type(SQLParser.Field_typeContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#param_clause}. - * @param ctx the parse tree - */ - void enterParam_clause(SQLParser.Param_clauseContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#param_clause}. - * @param ctx the parse tree - */ - void exitParam_clause(SQLParser.Param_clauseContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#param}. - * @param ctx the parse tree - */ - void enterParam(SQLParser.ParamContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#param}. - * @param ctx the parse tree - */ - void exitParam(SQLParser.ParamContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#method_specifier}. - * @param ctx the parse tree - */ - void enterMethod_specifier(SQLParser.Method_specifierContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#method_specifier}. - * @param ctx the parse tree - */ - void exitMethod_specifier(SQLParser.Method_specifierContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#table_space_specifier}. - * @param ctx the parse tree - */ - void enterTable_space_specifier(SQLParser.Table_space_specifierContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#table_space_specifier}. - * @param ctx the parse tree - */ - void exitTable_space_specifier(SQLParser.Table_space_specifierContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#table_space_name}. - * @param ctx the parse tree - */ - void enterTable_space_name(SQLParser.Table_space_nameContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#table_space_name}. - * @param ctx the parse tree - */ - void exitTable_space_name(SQLParser.Table_space_nameContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#table_partitioning_clauses}. - * @param ctx the parse tree - */ - void enterTable_partitioning_clauses(SQLParser.Table_partitioning_clausesContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#table_partitioning_clauses}. - * @param ctx the parse tree - */ - void exitTable_partitioning_clauses(SQLParser.Table_partitioning_clausesContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#range_partitions}. - * @param ctx the parse tree - */ - void enterRange_partitions(SQLParser.Range_partitionsContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#range_partitions}. - * @param ctx the parse tree - */ - void exitRange_partitions(SQLParser.Range_partitionsContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#range_value_clause_list}. - * @param ctx the parse tree - */ - void enterRange_value_clause_list(SQLParser.Range_value_clause_listContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#range_value_clause_list}. - * @param ctx the parse tree - */ - void exitRange_value_clause_list(SQLParser.Range_value_clause_listContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#range_value_clause}. - * @param ctx the parse tree - */ - void enterRange_value_clause(SQLParser.Range_value_clauseContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#range_value_clause}. - * @param ctx the parse tree - */ - void exitRange_value_clause(SQLParser.Range_value_clauseContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#hash_partitions}. - * @param ctx the parse tree - */ - void enterHash_partitions(SQLParser.Hash_partitionsContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#hash_partitions}. - * @param ctx the parse tree - */ - void exitHash_partitions(SQLParser.Hash_partitionsContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#individual_hash_partitions}. - * @param ctx the parse tree - */ - void enterIndividual_hash_partitions(SQLParser.Individual_hash_partitionsContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#individual_hash_partitions}. - * @param ctx the parse tree - */ - void exitIndividual_hash_partitions(SQLParser.Individual_hash_partitionsContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#individual_hash_partition}. - * @param ctx the parse tree - */ - void enterIndividual_hash_partition(SQLParser.Individual_hash_partitionContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#individual_hash_partition}. - * @param ctx the parse tree - */ - void exitIndividual_hash_partition(SQLParser.Individual_hash_partitionContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#hash_partitions_by_quantity}. - * @param ctx the parse tree - */ - void enterHash_partitions_by_quantity(SQLParser.Hash_partitions_by_quantityContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#hash_partitions_by_quantity}. - * @param ctx the parse tree - */ - void exitHash_partitions_by_quantity(SQLParser.Hash_partitions_by_quantityContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#list_partitions}. - * @param ctx the parse tree - */ - void enterList_partitions(SQLParser.List_partitionsContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#list_partitions}. - * @param ctx the parse tree - */ - void exitList_partitions(SQLParser.List_partitionsContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#list_value_clause_list}. - * @param ctx the parse tree - */ - void enterList_value_clause_list(SQLParser.List_value_clause_listContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#list_value_clause_list}. - * @param ctx the parse tree - */ - void exitList_value_clause_list(SQLParser.List_value_clause_listContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#list_value_partition}. - * @param ctx the parse tree - */ - void enterList_value_partition(SQLParser.List_value_partitionContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#list_value_partition}. - * @param ctx the parse tree - */ - void exitList_value_partition(SQLParser.List_value_partitionContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#column_partitions}. - * @param ctx the parse tree - */ - void enterColumn_partitions(SQLParser.Column_partitionsContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#column_partitions}. - * @param ctx the parse tree - */ - void exitColumn_partitions(SQLParser.Column_partitionsContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#partition_name}. - * @param ctx the parse tree - */ - void enterPartition_name(SQLParser.Partition_nameContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#partition_name}. - * @param ctx the parse tree - */ - void exitPartition_name(SQLParser.Partition_nameContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#drop_table_statement}. - * @param ctx the parse tree - */ - void enterDrop_table_statement(SQLParser.Drop_table_statementContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#drop_table_statement}. - * @param ctx the parse tree - */ - void exitDrop_table_statement(SQLParser.Drop_table_statementContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#identifier}. - * @param ctx the parse tree - */ - void enterIdentifier(SQLParser.IdentifierContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#identifier}. - * @param ctx the parse tree - */ - void exitIdentifier(SQLParser.IdentifierContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#nonreserved_keywords}. - * @param ctx the parse tree - */ - void enterNonreserved_keywords(SQLParser.Nonreserved_keywordsContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#nonreserved_keywords}. - * @param ctx the parse tree - */ - void exitNonreserved_keywords(SQLParser.Nonreserved_keywordsContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#unsigned_literal}. - * @param ctx the parse tree - */ - void enterUnsigned_literal(SQLParser.Unsigned_literalContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#unsigned_literal}. - * @param ctx the parse tree - */ - void exitUnsigned_literal(SQLParser.Unsigned_literalContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#general_literal}. - * @param ctx the parse tree - */ - void enterGeneral_literal(SQLParser.General_literalContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#general_literal}. - * @param ctx the parse tree - */ - void exitGeneral_literal(SQLParser.General_literalContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#datetime_literal}. - * @param ctx the parse tree - */ - void enterDatetime_literal(SQLParser.Datetime_literalContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#datetime_literal}. - * @param ctx the parse tree - */ - void exitDatetime_literal(SQLParser.Datetime_literalContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#time_literal}. - * @param ctx the parse tree - */ - void enterTime_literal(SQLParser.Time_literalContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#time_literal}. - * @param ctx the parse tree - */ - void exitTime_literal(SQLParser.Time_literalContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#timestamp_literal}. - * @param ctx the parse tree - */ - void enterTimestamp_literal(SQLParser.Timestamp_literalContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#timestamp_literal}. - * @param ctx the parse tree - */ - void exitTimestamp_literal(SQLParser.Timestamp_literalContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#date_literal}. - * @param ctx the parse tree - */ - void enterDate_literal(SQLParser.Date_literalContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#date_literal}. - * @param ctx the parse tree - */ - void exitDate_literal(SQLParser.Date_literalContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#boolean_literal}. - * @param ctx the parse tree - */ - void enterBoolean_literal(SQLParser.Boolean_literalContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#boolean_literal}. - * @param ctx the parse tree - */ - void exitBoolean_literal(SQLParser.Boolean_literalContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#data_type}. - * @param ctx the parse tree - */ - void enterData_type(SQLParser.Data_typeContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#data_type}. - * @param ctx the parse tree - */ - void exitData_type(SQLParser.Data_typeContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#predefined_type}. - * @param ctx the parse tree - */ - void enterPredefined_type(SQLParser.Predefined_typeContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#predefined_type}. - * @param ctx the parse tree - */ - void exitPredefined_type(SQLParser.Predefined_typeContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#network_type}. - * @param ctx the parse tree - */ - void enterNetwork_type(SQLParser.Network_typeContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#network_type}. - * @param ctx the parse tree - */ - void exitNetwork_type(SQLParser.Network_typeContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#character_string_type}. - * @param ctx the parse tree - */ - void enterCharacter_string_type(SQLParser.Character_string_typeContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#character_string_type}. - * @param ctx the parse tree - */ - void exitCharacter_string_type(SQLParser.Character_string_typeContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#type_length}. - * @param ctx the parse tree - */ - void enterType_length(SQLParser.Type_lengthContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#type_length}. - * @param ctx the parse tree - */ - void exitType_length(SQLParser.Type_lengthContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#national_character_string_type}. - * @param ctx the parse tree - */ - void enterNational_character_string_type(SQLParser.National_character_string_typeContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#national_character_string_type}. - * @param ctx the parse tree - */ - void exitNational_character_string_type(SQLParser.National_character_string_typeContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#binary_large_object_string_type}. - * @param ctx the parse tree - */ - void enterBinary_large_object_string_type(SQLParser.Binary_large_object_string_typeContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#binary_large_object_string_type}. - * @param ctx the parse tree - */ - void exitBinary_large_object_string_type(SQLParser.Binary_large_object_string_typeContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#numeric_type}. - * @param ctx the parse tree - */ - void enterNumeric_type(SQLParser.Numeric_typeContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#numeric_type}. - * @param ctx the parse tree - */ - void exitNumeric_type(SQLParser.Numeric_typeContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#exact_numeric_type}. - * @param ctx the parse tree - */ - void enterExact_numeric_type(SQLParser.Exact_numeric_typeContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#exact_numeric_type}. - * @param ctx the parse tree - */ - void exitExact_numeric_type(SQLParser.Exact_numeric_typeContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#approximate_numeric_type}. - * @param ctx the parse tree - */ - void enterApproximate_numeric_type(SQLParser.Approximate_numeric_typeContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#approximate_numeric_type}. - * @param ctx the parse tree - */ - void exitApproximate_numeric_type(SQLParser.Approximate_numeric_typeContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#precision_param}. - * @param ctx the parse tree - */ - void enterPrecision_param(SQLParser.Precision_paramContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#precision_param}. - * @param ctx the parse tree - */ - void exitPrecision_param(SQLParser.Precision_paramContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#boolean_type}. - * @param ctx the parse tree - */ - void enterBoolean_type(SQLParser.Boolean_typeContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#boolean_type}. - * @param ctx the parse tree - */ - void exitBoolean_type(SQLParser.Boolean_typeContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#datetime_type}. - * @param ctx the parse tree - */ - void enterDatetime_type(SQLParser.Datetime_typeContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#datetime_type}. - * @param ctx the parse tree - */ - void exitDatetime_type(SQLParser.Datetime_typeContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#bit_type}. - * @param ctx the parse tree - */ - void enterBit_type(SQLParser.Bit_typeContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#bit_type}. - * @param ctx the parse tree - */ - void exitBit_type(SQLParser.Bit_typeContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#binary_type}. - * @param ctx the parse tree - */ - void enterBinary_type(SQLParser.Binary_typeContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#binary_type}. - * @param ctx the parse tree - */ - void exitBinary_type(SQLParser.Binary_typeContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#value_expression_primary}. - * @param ctx the parse tree - */ - void enterValue_expression_primary(SQLParser.Value_expression_primaryContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#value_expression_primary}. - * @param ctx the parse tree - */ - void exitValue_expression_primary(SQLParser.Value_expression_primaryContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#parenthesized_value_expression}. - * @param ctx the parse tree - */ - void enterParenthesized_value_expression(SQLParser.Parenthesized_value_expressionContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#parenthesized_value_expression}. - * @param ctx the parse tree - */ - void exitParenthesized_value_expression(SQLParser.Parenthesized_value_expressionContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#nonparenthesized_value_expression_primary}. - * @param ctx the parse tree - */ - void enterNonparenthesized_value_expression_primary(SQLParser.Nonparenthesized_value_expression_primaryContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#nonparenthesized_value_expression_primary}. - * @param ctx the parse tree - */ - void exitNonparenthesized_value_expression_primary(SQLParser.Nonparenthesized_value_expression_primaryContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#unsigned_value_specification}. - * @param ctx the parse tree - */ - void enterUnsigned_value_specification(SQLParser.Unsigned_value_specificationContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#unsigned_value_specification}. - * @param ctx the parse tree - */ - void exitUnsigned_value_specification(SQLParser.Unsigned_value_specificationContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#unsigned_numeric_literal}. - * @param ctx the parse tree - */ - void enterUnsigned_numeric_literal(SQLParser.Unsigned_numeric_literalContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#unsigned_numeric_literal}. - * @param ctx the parse tree - */ - void exitUnsigned_numeric_literal(SQLParser.Unsigned_numeric_literalContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#signed_numerical_literal}. - * @param ctx the parse tree - */ - void enterSigned_numerical_literal(SQLParser.Signed_numerical_literalContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#signed_numerical_literal}. - * @param ctx the parse tree - */ - void exitSigned_numerical_literal(SQLParser.Signed_numerical_literalContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#set_function_specification}. - * @param ctx the parse tree - */ - void enterSet_function_specification(SQLParser.Set_function_specificationContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#set_function_specification}. - * @param ctx the parse tree - */ - void exitSet_function_specification(SQLParser.Set_function_specificationContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#aggregate_function}. - * @param ctx the parse tree - */ - void enterAggregate_function(SQLParser.Aggregate_functionContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#aggregate_function}. - * @param ctx the parse tree - */ - void exitAggregate_function(SQLParser.Aggregate_functionContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#general_set_function}. - * @param ctx the parse tree - */ - void enterGeneral_set_function(SQLParser.General_set_functionContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#general_set_function}. - * @param ctx the parse tree - */ - void exitGeneral_set_function(SQLParser.General_set_functionContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#set_function_type}. - * @param ctx the parse tree - */ - void enterSet_function_type(SQLParser.Set_function_typeContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#set_function_type}. - * @param ctx the parse tree - */ - void exitSet_function_type(SQLParser.Set_function_typeContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#filter_clause}. - * @param ctx the parse tree - */ - void enterFilter_clause(SQLParser.Filter_clauseContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#filter_clause}. - * @param ctx the parse tree - */ - void exitFilter_clause(SQLParser.Filter_clauseContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#grouping_operation}. - * @param ctx the parse tree - */ - void enterGrouping_operation(SQLParser.Grouping_operationContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#grouping_operation}. - * @param ctx the parse tree - */ - void exitGrouping_operation(SQLParser.Grouping_operationContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#case_expression}. - * @param ctx the parse tree - */ - void enterCase_expression(SQLParser.Case_expressionContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#case_expression}. - * @param ctx the parse tree - */ - void exitCase_expression(SQLParser.Case_expressionContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#case_abbreviation}. - * @param ctx the parse tree - */ - void enterCase_abbreviation(SQLParser.Case_abbreviationContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#case_abbreviation}. - * @param ctx the parse tree - */ - void exitCase_abbreviation(SQLParser.Case_abbreviationContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#case_specification}. - * @param ctx the parse tree - */ - void enterCase_specification(SQLParser.Case_specificationContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#case_specification}. - * @param ctx the parse tree - */ - void exitCase_specification(SQLParser.Case_specificationContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#simple_case}. - * @param ctx the parse tree - */ - void enterSimple_case(SQLParser.Simple_caseContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#simple_case}. - * @param ctx the parse tree - */ - void exitSimple_case(SQLParser.Simple_caseContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#searched_case}. - * @param ctx the parse tree - */ - void enterSearched_case(SQLParser.Searched_caseContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#searched_case}. - * @param ctx the parse tree - */ - void exitSearched_case(SQLParser.Searched_caseContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#simple_when_clause}. - * @param ctx the parse tree - */ - void enterSimple_when_clause(SQLParser.Simple_when_clauseContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#simple_when_clause}. - * @param ctx the parse tree - */ - void exitSimple_when_clause(SQLParser.Simple_when_clauseContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#searched_when_clause}. - * @param ctx the parse tree - */ - void enterSearched_when_clause(SQLParser.Searched_when_clauseContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#searched_when_clause}. - * @param ctx the parse tree - */ - void exitSearched_when_clause(SQLParser.Searched_when_clauseContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#else_clause}. - * @param ctx the parse tree - */ - void enterElse_clause(SQLParser.Else_clauseContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#else_clause}. - * @param ctx the parse tree - */ - void exitElse_clause(SQLParser.Else_clauseContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#result}. - * @param ctx the parse tree - */ - void enterResult(SQLParser.ResultContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#result}. - * @param ctx the parse tree - */ - void exitResult(SQLParser.ResultContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#cast_specification}. - * @param ctx the parse tree - */ - void enterCast_specification(SQLParser.Cast_specificationContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#cast_specification}. - * @param ctx the parse tree - */ - void exitCast_specification(SQLParser.Cast_specificationContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#cast_operand}. - * @param ctx the parse tree - */ - void enterCast_operand(SQLParser.Cast_operandContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#cast_operand}. - * @param ctx the parse tree - */ - void exitCast_operand(SQLParser.Cast_operandContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#cast_target}. - * @param ctx the parse tree - */ - void enterCast_target(SQLParser.Cast_targetContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#cast_target}. - * @param ctx the parse tree - */ - void exitCast_target(SQLParser.Cast_targetContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#value_expression}. - * @param ctx the parse tree - */ - void enterValue_expression(SQLParser.Value_expressionContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#value_expression}. - * @param ctx the parse tree - */ - void exitValue_expression(SQLParser.Value_expressionContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#common_value_expression}. - * @param ctx the parse tree - */ - void enterCommon_value_expression(SQLParser.Common_value_expressionContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#common_value_expression}. - * @param ctx the parse tree - */ - void exitCommon_value_expression(SQLParser.Common_value_expressionContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#numeric_value_expression}. - * @param ctx the parse tree - */ - void enterNumeric_value_expression(SQLParser.Numeric_value_expressionContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#numeric_value_expression}. - * @param ctx the parse tree - */ - void exitNumeric_value_expression(SQLParser.Numeric_value_expressionContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#term}. - * @param ctx the parse tree - */ - void enterTerm(SQLParser.TermContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#term}. - * @param ctx the parse tree - */ - void exitTerm(SQLParser.TermContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#factor}. - * @param ctx the parse tree - */ - void enterFactor(SQLParser.FactorContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#factor}. - * @param ctx the parse tree - */ - void exitFactor(SQLParser.FactorContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#array}. - * @param ctx the parse tree - */ - void enterArray(SQLParser.ArrayContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#array}. - * @param ctx the parse tree - */ - void exitArray(SQLParser.ArrayContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#numeric_primary}. - * @param ctx the parse tree - */ - void enterNumeric_primary(SQLParser.Numeric_primaryContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#numeric_primary}. - * @param ctx the parse tree - */ - void exitNumeric_primary(SQLParser.Numeric_primaryContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#sign}. - * @param ctx the parse tree - */ - void enterSign(SQLParser.SignContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#sign}. - * @param ctx the parse tree - */ - void exitSign(SQLParser.SignContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#numeric_value_function}. - * @param ctx the parse tree - */ - void enterNumeric_value_function(SQLParser.Numeric_value_functionContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#numeric_value_function}. - * @param ctx the parse tree - */ - void exitNumeric_value_function(SQLParser.Numeric_value_functionContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#extract_expression}. - * @param ctx the parse tree - */ - void enterExtract_expression(SQLParser.Extract_expressionContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#extract_expression}. - * @param ctx the parse tree - */ - void exitExtract_expression(SQLParser.Extract_expressionContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#extract_field}. - * @param ctx the parse tree - */ - void enterExtract_field(SQLParser.Extract_fieldContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#extract_field}. - * @param ctx the parse tree - */ - void exitExtract_field(SQLParser.Extract_fieldContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#time_zone_field}. - * @param ctx the parse tree - */ - void enterTime_zone_field(SQLParser.Time_zone_fieldContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#time_zone_field}. - * @param ctx the parse tree - */ - void exitTime_zone_field(SQLParser.Time_zone_fieldContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#extract_source}. - * @param ctx the parse tree - */ - void enterExtract_source(SQLParser.Extract_sourceContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#extract_source}. - * @param ctx the parse tree - */ - void exitExtract_source(SQLParser.Extract_sourceContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#string_value_expression}. - * @param ctx the parse tree - */ - void enterString_value_expression(SQLParser.String_value_expressionContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#string_value_expression}. - * @param ctx the parse tree - */ - void exitString_value_expression(SQLParser.String_value_expressionContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#character_value_expression}. - * @param ctx the parse tree - */ - void enterCharacter_value_expression(SQLParser.Character_value_expressionContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#character_value_expression}. - * @param ctx the parse tree - */ - void exitCharacter_value_expression(SQLParser.Character_value_expressionContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#character_factor}. - * @param ctx the parse tree - */ - void enterCharacter_factor(SQLParser.Character_factorContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#character_factor}. - * @param ctx the parse tree - */ - void exitCharacter_factor(SQLParser.Character_factorContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#character_primary}. - * @param ctx the parse tree - */ - void enterCharacter_primary(SQLParser.Character_primaryContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#character_primary}. - * @param ctx the parse tree - */ - void exitCharacter_primary(SQLParser.Character_primaryContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#string_value_function}. - * @param ctx the parse tree - */ - void enterString_value_function(SQLParser.String_value_functionContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#string_value_function}. - * @param ctx the parse tree - */ - void exitString_value_function(SQLParser.String_value_functionContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#trim_function}. - * @param ctx the parse tree - */ - void enterTrim_function(SQLParser.Trim_functionContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#trim_function}. - * @param ctx the parse tree - */ - void exitTrim_function(SQLParser.Trim_functionContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#trim_operands}. - * @param ctx the parse tree - */ - void enterTrim_operands(SQLParser.Trim_operandsContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#trim_operands}. - * @param ctx the parse tree - */ - void exitTrim_operands(SQLParser.Trim_operandsContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#trim_specification}. - * @param ctx the parse tree - */ - void enterTrim_specification(SQLParser.Trim_specificationContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#trim_specification}. - * @param ctx the parse tree - */ - void exitTrim_specification(SQLParser.Trim_specificationContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#boolean_value_expression}. - * @param ctx the parse tree - */ - void enterBoolean_value_expression(SQLParser.Boolean_value_expressionContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#boolean_value_expression}. - * @param ctx the parse tree - */ - void exitBoolean_value_expression(SQLParser.Boolean_value_expressionContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#or_predicate}. - * @param ctx the parse tree - */ - void enterOr_predicate(SQLParser.Or_predicateContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#or_predicate}. - * @param ctx the parse tree - */ - void exitOr_predicate(SQLParser.Or_predicateContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#and_predicate}. - * @param ctx the parse tree - */ - void enterAnd_predicate(SQLParser.And_predicateContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#and_predicate}. - * @param ctx the parse tree - */ - void exitAnd_predicate(SQLParser.And_predicateContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#boolean_factor}. - * @param ctx the parse tree - */ - void enterBoolean_factor(SQLParser.Boolean_factorContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#boolean_factor}. - * @param ctx the parse tree - */ - void exitBoolean_factor(SQLParser.Boolean_factorContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#boolean_test}. - * @param ctx the parse tree - */ - void enterBoolean_test(SQLParser.Boolean_testContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#boolean_test}. - * @param ctx the parse tree - */ - void exitBoolean_test(SQLParser.Boolean_testContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#is_clause}. - * @param ctx the parse tree - */ - void enterIs_clause(SQLParser.Is_clauseContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#is_clause}. - * @param ctx the parse tree - */ - void exitIs_clause(SQLParser.Is_clauseContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#truth_value}. - * @param ctx the parse tree - */ - void enterTruth_value(SQLParser.Truth_valueContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#truth_value}. - * @param ctx the parse tree - */ - void exitTruth_value(SQLParser.Truth_valueContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#boolean_primary}. - * @param ctx the parse tree - */ - void enterBoolean_primary(SQLParser.Boolean_primaryContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#boolean_primary}. - * @param ctx the parse tree - */ - void exitBoolean_primary(SQLParser.Boolean_primaryContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#boolean_predicand}. - * @param ctx the parse tree - */ - void enterBoolean_predicand(SQLParser.Boolean_predicandContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#boolean_predicand}. - * @param ctx the parse tree - */ - void exitBoolean_predicand(SQLParser.Boolean_predicandContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#parenthesized_boolean_value_expression}. - * @param ctx the parse tree - */ - void enterParenthesized_boolean_value_expression(SQLParser.Parenthesized_boolean_value_expressionContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#parenthesized_boolean_value_expression}. - * @param ctx the parse tree - */ - void exitParenthesized_boolean_value_expression(SQLParser.Parenthesized_boolean_value_expressionContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#row_value_expression}. - * @param ctx the parse tree - */ - void enterRow_value_expression(SQLParser.Row_value_expressionContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#row_value_expression}. - * @param ctx the parse tree - */ - void exitRow_value_expression(SQLParser.Row_value_expressionContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#row_value_special_case}. - * @param ctx the parse tree - */ - void enterRow_value_special_case(SQLParser.Row_value_special_caseContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#row_value_special_case}. - * @param ctx the parse tree - */ - void exitRow_value_special_case(SQLParser.Row_value_special_caseContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#explicit_row_value_constructor}. - * @param ctx the parse tree - */ - void enterExplicit_row_value_constructor(SQLParser.Explicit_row_value_constructorContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#explicit_row_value_constructor}. - * @param ctx the parse tree - */ - void exitExplicit_row_value_constructor(SQLParser.Explicit_row_value_constructorContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#row_value_predicand}. - * @param ctx the parse tree - */ - void enterRow_value_predicand(SQLParser.Row_value_predicandContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#row_value_predicand}. - * @param ctx the parse tree - */ - void exitRow_value_predicand(SQLParser.Row_value_predicandContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#row_value_constructor_predicand}. - * @param ctx the parse tree - */ - void enterRow_value_constructor_predicand(SQLParser.Row_value_constructor_predicandContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#row_value_constructor_predicand}. - * @param ctx the parse tree - */ - void exitRow_value_constructor_predicand(SQLParser.Row_value_constructor_predicandContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#table_expression}. - * @param ctx the parse tree - */ - void enterTable_expression(SQLParser.Table_expressionContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#table_expression}. - * @param ctx the parse tree - */ - void exitTable_expression(SQLParser.Table_expressionContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#from_clause}. - * @param ctx the parse tree - */ - void enterFrom_clause(SQLParser.From_clauseContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#from_clause}. - * @param ctx the parse tree - */ - void exitFrom_clause(SQLParser.From_clauseContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#table_reference_list}. - * @param ctx the parse tree - */ - void enterTable_reference_list(SQLParser.Table_reference_listContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#table_reference_list}. - * @param ctx the parse tree - */ - void exitTable_reference_list(SQLParser.Table_reference_listContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#table_reference}. - * @param ctx the parse tree - */ - void enterTable_reference(SQLParser.Table_referenceContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#table_reference}. - * @param ctx the parse tree - */ - void exitTable_reference(SQLParser.Table_referenceContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#joined_table}. - * @param ctx the parse tree - */ - void enterJoined_table(SQLParser.Joined_tableContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#joined_table}. - * @param ctx the parse tree - */ - void exitJoined_table(SQLParser.Joined_tableContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#joined_table_primary}. - * @param ctx the parse tree - */ - void enterJoined_table_primary(SQLParser.Joined_table_primaryContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#joined_table_primary}. - * @param ctx the parse tree - */ - void exitJoined_table_primary(SQLParser.Joined_table_primaryContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#cross_join}. - * @param ctx the parse tree - */ - void enterCross_join(SQLParser.Cross_joinContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#cross_join}. - * @param ctx the parse tree - */ - void exitCross_join(SQLParser.Cross_joinContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#qualified_join}. - * @param ctx the parse tree - */ - void enterQualified_join(SQLParser.Qualified_joinContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#qualified_join}. - * @param ctx the parse tree - */ - void exitQualified_join(SQLParser.Qualified_joinContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#natural_join}. - * @param ctx the parse tree - */ - void enterNatural_join(SQLParser.Natural_joinContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#natural_join}. - * @param ctx the parse tree - */ - void exitNatural_join(SQLParser.Natural_joinContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#union_join}. - * @param ctx the parse tree - */ - void enterUnion_join(SQLParser.Union_joinContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#union_join}. - * @param ctx the parse tree - */ - void exitUnion_join(SQLParser.Union_joinContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#join_type}. - * @param ctx the parse tree - */ - void enterJoin_type(SQLParser.Join_typeContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#join_type}. - * @param ctx the parse tree - */ - void exitJoin_type(SQLParser.Join_typeContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#outer_join_type}. - * @param ctx the parse tree - */ - void enterOuter_join_type(SQLParser.Outer_join_typeContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#outer_join_type}. - * @param ctx the parse tree - */ - void exitOuter_join_type(SQLParser.Outer_join_typeContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#outer_join_type_part2}. - * @param ctx the parse tree - */ - void enterOuter_join_type_part2(SQLParser.Outer_join_type_part2Context ctx); - /** - * Exit a parse tree produced by {@link SQLParser#outer_join_type_part2}. - * @param ctx the parse tree - */ - void exitOuter_join_type_part2(SQLParser.Outer_join_type_part2Context ctx); - /** - * Enter a parse tree produced by {@link SQLParser#join_specification}. - * @param ctx the parse tree - */ - void enterJoin_specification(SQLParser.Join_specificationContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#join_specification}. - * @param ctx the parse tree - */ - void exitJoin_specification(SQLParser.Join_specificationContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#join_condition}. - * @param ctx the parse tree - */ - void enterJoin_condition(SQLParser.Join_conditionContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#join_condition}. - * @param ctx the parse tree - */ - void exitJoin_condition(SQLParser.Join_conditionContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#named_columns_join}. - * @param ctx the parse tree - */ - void enterNamed_columns_join(SQLParser.Named_columns_joinContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#named_columns_join}. - * @param ctx the parse tree - */ - void exitNamed_columns_join(SQLParser.Named_columns_joinContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#table_primary}. - * @param ctx the parse tree - */ - void enterTable_primary(SQLParser.Table_primaryContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#table_primary}. - * @param ctx the parse tree - */ - void exitTable_primary(SQLParser.Table_primaryContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#column_name_list}. - * @param ctx the parse tree - */ - void enterColumn_name_list(SQLParser.Column_name_listContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#column_name_list}. - * @param ctx the parse tree - */ - void exitColumn_name_list(SQLParser.Column_name_listContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#derived_table}. - * @param ctx the parse tree - */ - void enterDerived_table(SQLParser.Derived_tableContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#derived_table}. - * @param ctx the parse tree - */ - void exitDerived_table(SQLParser.Derived_tableContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#where_clause}. - * @param ctx the parse tree - */ - void enterWhere_clause(SQLParser.Where_clauseContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#where_clause}. - * @param ctx the parse tree - */ - void exitWhere_clause(SQLParser.Where_clauseContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#search_condition}. - * @param ctx the parse tree - */ - void enterSearch_condition(SQLParser.Search_conditionContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#search_condition}. - * @param ctx the parse tree - */ - void exitSearch_condition(SQLParser.Search_conditionContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#groupby_clause}. - * @param ctx the parse tree - */ - void enterGroupby_clause(SQLParser.Groupby_clauseContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#groupby_clause}. - * @param ctx the parse tree - */ - void exitGroupby_clause(SQLParser.Groupby_clauseContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#grouping_element_list}. - * @param ctx the parse tree - */ - void enterGrouping_element_list(SQLParser.Grouping_element_listContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#grouping_element_list}. - * @param ctx the parse tree - */ - void exitGrouping_element_list(SQLParser.Grouping_element_listContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#grouping_element}. - * @param ctx the parse tree - */ - void enterGrouping_element(SQLParser.Grouping_elementContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#grouping_element}. - * @param ctx the parse tree - */ - void exitGrouping_element(SQLParser.Grouping_elementContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#ordinary_grouping_set}. - * @param ctx the parse tree - */ - void enterOrdinary_grouping_set(SQLParser.Ordinary_grouping_setContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#ordinary_grouping_set}. - * @param ctx the parse tree - */ - void exitOrdinary_grouping_set(SQLParser.Ordinary_grouping_setContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#ordinary_grouping_set_list}. - * @param ctx the parse tree - */ - void enterOrdinary_grouping_set_list(SQLParser.Ordinary_grouping_set_listContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#ordinary_grouping_set_list}. - * @param ctx the parse tree - */ - void exitOrdinary_grouping_set_list(SQLParser.Ordinary_grouping_set_listContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#rollup_list}. - * @param ctx the parse tree - */ - void enterRollup_list(SQLParser.Rollup_listContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#rollup_list}. - * @param ctx the parse tree - */ - void exitRollup_list(SQLParser.Rollup_listContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#cube_list}. - * @param ctx the parse tree - */ - void enterCube_list(SQLParser.Cube_listContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#cube_list}. - * @param ctx the parse tree - */ - void exitCube_list(SQLParser.Cube_listContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#empty_grouping_set}. - * @param ctx the parse tree - */ - void enterEmpty_grouping_set(SQLParser.Empty_grouping_setContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#empty_grouping_set}. - * @param ctx the parse tree - */ - void exitEmpty_grouping_set(SQLParser.Empty_grouping_setContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#having_clause}. - * @param ctx the parse tree - */ - void enterHaving_clause(SQLParser.Having_clauseContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#having_clause}. - * @param ctx the parse tree - */ - void exitHaving_clause(SQLParser.Having_clauseContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#row_value_predicand_list}. - * @param ctx the parse tree - */ - void enterRow_value_predicand_list(SQLParser.Row_value_predicand_listContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#row_value_predicand_list}. - * @param ctx the parse tree - */ - void exitRow_value_predicand_list(SQLParser.Row_value_predicand_listContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#query_expression}. - * @param ctx the parse tree - */ - void enterQuery_expression(SQLParser.Query_expressionContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#query_expression}. - * @param ctx the parse tree - */ - void exitQuery_expression(SQLParser.Query_expressionContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#query_expression_body}. - * @param ctx the parse tree - */ - void enterQuery_expression_body(SQLParser.Query_expression_bodyContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#query_expression_body}. - * @param ctx the parse tree - */ - void exitQuery_expression_body(SQLParser.Query_expression_bodyContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#non_join_query_expression}. - * @param ctx the parse tree - */ - void enterNon_join_query_expression(SQLParser.Non_join_query_expressionContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#non_join_query_expression}. - * @param ctx the parse tree - */ - void exitNon_join_query_expression(SQLParser.Non_join_query_expressionContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#query_term}. - * @param ctx the parse tree - */ - void enterQuery_term(SQLParser.Query_termContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#query_term}. - * @param ctx the parse tree - */ - void exitQuery_term(SQLParser.Query_termContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#non_join_query_term}. - * @param ctx the parse tree - */ - void enterNon_join_query_term(SQLParser.Non_join_query_termContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#non_join_query_term}. - * @param ctx the parse tree - */ - void exitNon_join_query_term(SQLParser.Non_join_query_termContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#query_primary}. - * @param ctx the parse tree - */ - void enterQuery_primary(SQLParser.Query_primaryContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#query_primary}. - * @param ctx the parse tree - */ - void exitQuery_primary(SQLParser.Query_primaryContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#non_join_query_primary}. - * @param ctx the parse tree - */ - void enterNon_join_query_primary(SQLParser.Non_join_query_primaryContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#non_join_query_primary}. - * @param ctx the parse tree - */ - void exitNon_join_query_primary(SQLParser.Non_join_query_primaryContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#simple_table}. - * @param ctx the parse tree - */ - void enterSimple_table(SQLParser.Simple_tableContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#simple_table}. - * @param ctx the parse tree - */ - void exitSimple_table(SQLParser.Simple_tableContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#explicit_table}. - * @param ctx the parse tree - */ - void enterExplicit_table(SQLParser.Explicit_tableContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#explicit_table}. - * @param ctx the parse tree - */ - void exitExplicit_table(SQLParser.Explicit_tableContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#table_or_query_name}. - * @param ctx the parse tree - */ - void enterTable_or_query_name(SQLParser.Table_or_query_nameContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#table_or_query_name}. - * @param ctx the parse tree - */ - void exitTable_or_query_name(SQLParser.Table_or_query_nameContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#table_name}. - * @param ctx the parse tree - */ - void enterTable_name(SQLParser.Table_nameContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#table_name}. - * @param ctx the parse tree - */ - void exitTable_name(SQLParser.Table_nameContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#query_specification}. - * @param ctx the parse tree - */ - void enterQuery_specification(SQLParser.Query_specificationContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#query_specification}. - * @param ctx the parse tree - */ - void exitQuery_specification(SQLParser.Query_specificationContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#select_list}. - * @param ctx the parse tree - */ - void enterSelect_list(SQLParser.Select_listContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#select_list}. - * @param ctx the parse tree - */ - void exitSelect_list(SQLParser.Select_listContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#select_sublist}. - * @param ctx the parse tree - */ - void enterSelect_sublist(SQLParser.Select_sublistContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#select_sublist}. - * @param ctx the parse tree - */ - void exitSelect_sublist(SQLParser.Select_sublistContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#derived_column}. - * @param ctx the parse tree - */ - void enterDerived_column(SQLParser.Derived_columnContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#derived_column}. - * @param ctx the parse tree - */ - void exitDerived_column(SQLParser.Derived_columnContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#qualified_asterisk}. - * @param ctx the parse tree - */ - void enterQualified_asterisk(SQLParser.Qualified_asteriskContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#qualified_asterisk}. - * @param ctx the parse tree - */ - void exitQualified_asterisk(SQLParser.Qualified_asteriskContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#set_qualifier}. - * @param ctx the parse tree - */ - void enterSet_qualifier(SQLParser.Set_qualifierContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#set_qualifier}. - * @param ctx the parse tree - */ - void exitSet_qualifier(SQLParser.Set_qualifierContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#column_reference}. - * @param ctx the parse tree - */ - void enterColumn_reference(SQLParser.Column_referenceContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#column_reference}. - * @param ctx the parse tree - */ - void exitColumn_reference(SQLParser.Column_referenceContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#as_clause}. - * @param ctx the parse tree - */ - void enterAs_clause(SQLParser.As_clauseContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#as_clause}. - * @param ctx the parse tree - */ - void exitAs_clause(SQLParser.As_clauseContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#column_reference_list}. - * @param ctx the parse tree - */ - void enterColumn_reference_list(SQLParser.Column_reference_listContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#column_reference_list}. - * @param ctx the parse tree - */ - void exitColumn_reference_list(SQLParser.Column_reference_listContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#scalar_subquery}. - * @param ctx the parse tree - */ - void enterScalar_subquery(SQLParser.Scalar_subqueryContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#scalar_subquery}. - * @param ctx the parse tree - */ - void exitScalar_subquery(SQLParser.Scalar_subqueryContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#row_subquery}. - * @param ctx the parse tree - */ - void enterRow_subquery(SQLParser.Row_subqueryContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#row_subquery}. - * @param ctx the parse tree - */ - void exitRow_subquery(SQLParser.Row_subqueryContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#table_subquery}. - * @param ctx the parse tree - */ - void enterTable_subquery(SQLParser.Table_subqueryContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#table_subquery}. - * @param ctx the parse tree - */ - void exitTable_subquery(SQLParser.Table_subqueryContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#subquery}. - * @param ctx the parse tree - */ - void enterSubquery(SQLParser.SubqueryContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#subquery}. - * @param ctx the parse tree - */ - void exitSubquery(SQLParser.SubqueryContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#predicate}. - * @param ctx the parse tree - */ - void enterPredicate(SQLParser.PredicateContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#predicate}. - * @param ctx the parse tree - */ - void exitPredicate(SQLParser.PredicateContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#comparison_predicate}. - * @param ctx the parse tree - */ - void enterComparison_predicate(SQLParser.Comparison_predicateContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#comparison_predicate}. - * @param ctx the parse tree - */ - void exitComparison_predicate(SQLParser.Comparison_predicateContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#comp_op}. - * @param ctx the parse tree - */ - void enterComp_op(SQLParser.Comp_opContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#comp_op}. - * @param ctx the parse tree - */ - void exitComp_op(SQLParser.Comp_opContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#between_predicate}. - * @param ctx the parse tree - */ - void enterBetween_predicate(SQLParser.Between_predicateContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#between_predicate}. - * @param ctx the parse tree - */ - void exitBetween_predicate(SQLParser.Between_predicateContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#between_predicate_part_2}. - * @param ctx the parse tree - */ - void enterBetween_predicate_part_2(SQLParser.Between_predicate_part_2Context ctx); - /** - * Exit a parse tree produced by {@link SQLParser#between_predicate_part_2}. - * @param ctx the parse tree - */ - void exitBetween_predicate_part_2(SQLParser.Between_predicate_part_2Context ctx); - /** - * Enter a parse tree produced by {@link SQLParser#in_predicate}. - * @param ctx the parse tree - */ - void enterIn_predicate(SQLParser.In_predicateContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#in_predicate}. - * @param ctx the parse tree - */ - void exitIn_predicate(SQLParser.In_predicateContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#in_predicate_value}. - * @param ctx the parse tree - */ - void enterIn_predicate_value(SQLParser.In_predicate_valueContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#in_predicate_value}. - * @param ctx the parse tree - */ - void exitIn_predicate_value(SQLParser.In_predicate_valueContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#in_value_list}. - * @param ctx the parse tree - */ - void enterIn_value_list(SQLParser.In_value_listContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#in_value_list}. - * @param ctx the parse tree - */ - void exitIn_value_list(SQLParser.In_value_listContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#pattern_matching_predicate}. - * @param ctx the parse tree - */ - void enterPattern_matching_predicate(SQLParser.Pattern_matching_predicateContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#pattern_matching_predicate}. - * @param ctx the parse tree - */ - void exitPattern_matching_predicate(SQLParser.Pattern_matching_predicateContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#pattern_matcher}. - * @param ctx the parse tree - */ - void enterPattern_matcher(SQLParser.Pattern_matcherContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#pattern_matcher}. - * @param ctx the parse tree - */ - void exitPattern_matcher(SQLParser.Pattern_matcherContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#negativable_matcher}. - * @param ctx the parse tree - */ - void enterNegativable_matcher(SQLParser.Negativable_matcherContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#negativable_matcher}. - * @param ctx the parse tree - */ - void exitNegativable_matcher(SQLParser.Negativable_matcherContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#regex_matcher}. - * @param ctx the parse tree - */ - void enterRegex_matcher(SQLParser.Regex_matcherContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#regex_matcher}. - * @param ctx the parse tree - */ - void exitRegex_matcher(SQLParser.Regex_matcherContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#null_predicate}. - * @param ctx the parse tree - */ - void enterNull_predicate(SQLParser.Null_predicateContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#null_predicate}. - * @param ctx the parse tree - */ - void exitNull_predicate(SQLParser.Null_predicateContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#quantified_comparison_predicate}. - * @param ctx the parse tree - */ - void enterQuantified_comparison_predicate(SQLParser.Quantified_comparison_predicateContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#quantified_comparison_predicate}. - * @param ctx the parse tree - */ - void exitQuantified_comparison_predicate(SQLParser.Quantified_comparison_predicateContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#quantifier}. - * @param ctx the parse tree - */ - void enterQuantifier(SQLParser.QuantifierContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#quantifier}. - * @param ctx the parse tree - */ - void exitQuantifier(SQLParser.QuantifierContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#all}. - * @param ctx the parse tree - */ - void enterAll(SQLParser.AllContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#all}. - * @param ctx the parse tree - */ - void exitAll(SQLParser.AllContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#some}. - * @param ctx the parse tree - */ - void enterSome(SQLParser.SomeContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#some}. - * @param ctx the parse tree - */ - void exitSome(SQLParser.SomeContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#exists_predicate}. - * @param ctx the parse tree - */ - void enterExists_predicate(SQLParser.Exists_predicateContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#exists_predicate}. - * @param ctx the parse tree - */ - void exitExists_predicate(SQLParser.Exists_predicateContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#unique_predicate}. - * @param ctx the parse tree - */ - void enterUnique_predicate(SQLParser.Unique_predicateContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#unique_predicate}. - * @param ctx the parse tree - */ - void exitUnique_predicate(SQLParser.Unique_predicateContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#primary_datetime_field}. - * @param ctx the parse tree - */ - void enterPrimary_datetime_field(SQLParser.Primary_datetime_fieldContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#primary_datetime_field}. - * @param ctx the parse tree - */ - void exitPrimary_datetime_field(SQLParser.Primary_datetime_fieldContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#non_second_primary_datetime_field}. - * @param ctx the parse tree - */ - void enterNon_second_primary_datetime_field(SQLParser.Non_second_primary_datetime_fieldContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#non_second_primary_datetime_field}. - * @param ctx the parse tree - */ - void exitNon_second_primary_datetime_field(SQLParser.Non_second_primary_datetime_fieldContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#extended_datetime_field}. - * @param ctx the parse tree - */ - void enterExtended_datetime_field(SQLParser.Extended_datetime_fieldContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#extended_datetime_field}. - * @param ctx the parse tree - */ - void exitExtended_datetime_field(SQLParser.Extended_datetime_fieldContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#routine_invocation}. - * @param ctx the parse tree - */ - void enterRoutine_invocation(SQLParser.Routine_invocationContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#routine_invocation}. - * @param ctx the parse tree - */ - void exitRoutine_invocation(SQLParser.Routine_invocationContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#function_names_for_reserved_words}. - * @param ctx the parse tree - */ - void enterFunction_names_for_reserved_words(SQLParser.Function_names_for_reserved_wordsContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#function_names_for_reserved_words}. - * @param ctx the parse tree - */ - void exitFunction_names_for_reserved_words(SQLParser.Function_names_for_reserved_wordsContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#function_name}. - * @param ctx the parse tree - */ - void enterFunction_name(SQLParser.Function_nameContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#function_name}. - * @param ctx the parse tree - */ - void exitFunction_name(SQLParser.Function_nameContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#sql_argument_list}. - * @param ctx the parse tree - */ - void enterSql_argument_list(SQLParser.Sql_argument_listContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#sql_argument_list}. - * @param ctx the parse tree - */ - void exitSql_argument_list(SQLParser.Sql_argument_listContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#orderby_clause}. - * @param ctx the parse tree - */ - void enterOrderby_clause(SQLParser.Orderby_clauseContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#orderby_clause}. - * @param ctx the parse tree - */ - void exitOrderby_clause(SQLParser.Orderby_clauseContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#sort_specifier_list}. - * @param ctx the parse tree - */ - void enterSort_specifier_list(SQLParser.Sort_specifier_listContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#sort_specifier_list}. - * @param ctx the parse tree - */ - void exitSort_specifier_list(SQLParser.Sort_specifier_listContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#sort_specifier}. - * @param ctx the parse tree - */ - void enterSort_specifier(SQLParser.Sort_specifierContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#sort_specifier}. - * @param ctx the parse tree - */ - void exitSort_specifier(SQLParser.Sort_specifierContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#order_specification}. - * @param ctx the parse tree - */ - void enterOrder_specification(SQLParser.Order_specificationContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#order_specification}. - * @param ctx the parse tree - */ - void exitOrder_specification(SQLParser.Order_specificationContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#limit_clause}. - * @param ctx the parse tree - */ - void enterLimit_clause(SQLParser.Limit_clauseContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#limit_clause}. - * @param ctx the parse tree - */ - void exitLimit_clause(SQLParser.Limit_clauseContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#null_ordering}. - * @param ctx the parse tree - */ - void enterNull_ordering(SQLParser.Null_orderingContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#null_ordering}. - * @param ctx the parse tree - */ - void exitNull_ordering(SQLParser.Null_orderingContext ctx); - /** - * Enter a parse tree produced by {@link SQLParser#insert_statement}. - * @param ctx the parse tree - */ - void enterInsert_statement(SQLParser.Insert_statementContext ctx); - /** - * Exit a parse tree produced by {@link SQLParser#insert_statement}. - * @param ctx the parse tree - */ - void exitInsert_statement(SQLParser.Insert_statementContext ctx); -} \ No newline at end of file diff --git a/core/src/arc/sql/sql/calcite/DateDiffFunction.java b/core/src/arc/sql/sql/calcite/DateDiffFunction.java deleted file mode 100644 index f456083..0000000 --- a/core/src/arc/sql/sql/calcite/DateDiffFunction.java +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Copyright 2017 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.sql.calcite; - -import java.sql.Timestamp; - -import org.apache.calcite.linq4j.function.Function2; - -public class DateDiffFunction implements Function2 { - - @Override - public Long apply(Timestamp v0, Timestamp v1) { - return Math.abs(v0.getTime() - v1.getTime()); - } - -} diff --git a/core/src/arc/sql/sql/calcite/SidewinderSchemaFactory.java b/core/src/arc/sql/sql/calcite/SidewinderSchemaFactory.java deleted file mode 100644 index 1944275..0000000 --- a/core/src/arc/sql/sql/calcite/SidewinderSchemaFactory.java +++ /dev/null @@ -1,351 +0,0 @@ -/** - * Copyright 2017 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.sql.calcite; - -import java.io.IOException; -import java.util.AbstractMap; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -import org.apache.calcite.DataContext; -import org.apache.calcite.linq4j.AbstractEnumerable; -import org.apache.calcite.linq4j.Enumerable; -import org.apache.calcite.linq4j.Enumerator; -import org.apache.calcite.plan.RelTrait; -import org.apache.calcite.rel.RelNode; -import org.apache.calcite.rel.convert.ConverterRule; -import org.apache.calcite.rel.type.RelDataType; -import org.apache.calcite.rel.type.RelDataTypeFactory; -import org.apache.calcite.rex.RexCall; -import org.apache.calcite.rex.RexInputRef; -import org.apache.calcite.rex.RexLiteral; -import org.apache.calcite.rex.RexNode; -import org.apache.calcite.schema.FilterableTable; -import org.apache.calcite.schema.Schema; -import org.apache.calcite.schema.Schema.TableType; -import org.apache.calcite.schema.SchemaFactory; -import org.apache.calcite.schema.SchemaPlus; -import org.apache.calcite.schema.Table; -import org.apache.calcite.schema.impl.AbstractSchema; -import org.apache.calcite.schema.impl.AbstractTable; -import org.apache.calcite.sql.SqlKind; -import org.apache.calcite.sql.type.SqlTypeName; - -import com.srotya.sidewinder.core.storage.DataPoint; -import com.srotya.sidewinder.core.storage.gorilla.MemStorageEngine; -import com.srotya.sidewinder.core.storage.gorilla.Reader; - -/** - * @author ambud - */ -public class SidewinderSchemaFactory implements SchemaFactory { - - private MemStorageEngine engine; - - public SidewinderSchemaFactory() { - this.engine = new MemStorageEngine(); - try { - this.engine.configure(new HashMap<>()); - this.engine.connect(); - for (int i = 1; i < 10; i++) { - engine.writeDataPoint("test", new DataPoint("test", "cpu", "value", Arrays.asList("host"), - System.currentTimeMillis() - 1000 + i * 10, 2.2 * i)); - } - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - @Override - public Schema create(SchemaPlus parentSchema, String name, Map operand) { - System.out.println(operand); - String dbName = (String) operand.get("db"); - return new SidewinderDatabaseSchema(engine, dbName); - } - - public static class SidewinderConverter extends ConverterRule { - - public SidewinderConverter(Class clazz, RelTrait in, RelTrait out, String description) { - super(clazz, in, out, description); - } - - @Override - public RelNode convert(RelNode rel) { - System.out.println("Capture converter:" + rel); - return rel; - } - - } - - public static class MeasurementTable extends AbstractTable implements FilterableTable { - - private MemStorageEngine engine; - private String fieldName; - private boolean isFp; - private String measurementName; - private String dbName; - private List types; - private List names; - - public MeasurementTable(MemStorageEngine engine, String dbName, String measurementName, String fieldName, - boolean isFp) { - this.engine = engine; - this.dbName = dbName; - this.measurementName = measurementName; - this.fieldName = fieldName; - this.isFp = isFp; - } - - @Override - public RelDataType getRowType(RelDataTypeFactory typeFactory) { - types = new ArrayList<>(); - names = new ArrayList<>(); - - // value field - if (isFp) { - names.add(measurementName + "_" + fieldName); - types.add(typeFactory.createSqlType(SqlTypeName.DOUBLE, 10)); - } else { - names.add(measurementName + "_" + fieldName); - types.add(typeFactory.createSqlType(SqlTypeName.INTEGER, 10)); - } - - names.add("time_stamp"); - types.add(typeFactory.createSqlType(SqlTypeName.TIMESTAMP)); - - names.add("tags"); - types.add(typeFactory.createSqlType(SqlTypeName.CHAR)); - - return typeFactory.createStructType(types, names); - } - - @Override - public TableType getJdbcTableType() { - return TableType.TABLE; - } - - @Override - public Enumerable scan(DataContext root, List filters) { - // final String[] filterValues = new String[types.size()]; - System.err.println("Filters:" + filters); - Entry findTimeRange = null; - for (RexNode filter : filters) { - Entry temp = findTimeRange(filter); - if (temp != null) { - findTimeRange = temp; - if (findTimeRange.getKey() > findTimeRange.getValue()) { - // swap - findTimeRange = new AbstractMap.SimpleEntry(findTimeRange.getValue(), - findTimeRange.getKey()); - } - } - System.err.println("Time range filter:" + findTimeRange); - } - - if (findTimeRange == null) { - // by default get last 1hr's data if no time range filter is - // specified - findTimeRange = new AbstractMap.SimpleEntry(System.currentTimeMillis() - (3600 * 1000), - System.currentTimeMillis()); - } else if (findTimeRange.getKey().equals(findTimeRange.getValue())) { - findTimeRange = new AbstractMap.SimpleEntry(findTimeRange.getKey(), - System.currentTimeMillis()); - } - - final Entry range = findTimeRange; - - return new AbstractEnumerable() { - public Enumerator enumerator() { - return new Enumerator() { - - private List readers; - private int i; - private DataPoint dataPoint; - - @Override - public void reset() { - } - - @Override - public boolean moveNext() { - if (readers == null) { - try { - readers = new ArrayList<>(); - readers.addAll(engine.queryReaders(dbName, measurementName, fieldName, - range.getKey(), range.getValue())); - System.err.println("Received readers:" + readers); - } catch (Exception e) { - e.printStackTrace(); - return false; - } - } - if (i < readers.size()) { - try { - dataPoint = readers.get(i).readPair(); - } catch (IOException e) { - i++; - if (i < readers.size()) { - return true; - } else { - return false; - } - } - return true; - } else { - return false; - } - } - - @Override - public Object[] current() { - return new Object[] { dataPoint.getValue(), dataPoint.getTimestamp(), dataPoint.getTags().toString() }; - } - - @Override - public void close() { - readers = null; - } - }; - } - }; - } - - private Entry findTimeRange(RexNode filter) { - List> vals = new ArrayList(); - if (filter.isA(SqlKind.AND) || filter.isA(SqlKind.OR)) { - RexCall call = (RexCall) filter; - for (RexNode rexNode : call.getOperands()) { - Entry val = findTimeRange(rexNode); - if (val != null) { - vals.add(val); - } - } - if (vals.size() > 0) { - long min = Long.MAX_VALUE, max = 1; - for (Entry val : vals) { - if (min > val.getKey()) { - System.err.println("Swapping min value:" + min + "\t" + val.getValue()); - min = val.getKey(); - } - if (max < val.getValue()) { - System.err.println("Swapping max value:" + max + "\t" + val.getValue()); - max = val.getValue(); - } - } - return new AbstractMap.SimpleEntry(min, max); - } else { - return null; - } - } else { - RexCall call = ((RexCall) filter); - RexNode left = call.getOperands().get(0); - RexNode right = call.getOperands().get(call.getOperands().size() - 1); - if (left.isA(SqlKind.CAST)) { - left = ((RexCall) left).operands.get(0); - } else if (left.isA(SqlKind.FUNCTION)) { - left = ((RexCall) left).operands.get(0); - if (names.get(((RexInputRef) left).getIndex()).equals("time_stamp")) { - // resolve the function - } - } - - if (!names.get(((RexInputRef) left).getIndex()).equals("time_stamp")) { - return null; - } - - long val = 10; - if (right.isA(SqlKind.CAST)) { - right = ((RexCall) right).operands.get(0); - } else if (right.isA(SqlKind.FUNCTION)) { - if (((RexCall) right).operands.size() > 0) { - right = ((RexCall) right).operands.get(0); - val = (long) ((RexLiteral) right).getValue2(); - } else { - System.err.println("Funtion:" + ((RexCall) right).op.getName() + "\t" + filter.getKind()); - if (((RexCall) right).op.getName().equals("now")) { - val = System.currentTimeMillis(); - } - } - } - if (filter.isA(Arrays.asList(SqlKind.GREATER_THAN, SqlKind.GREATER_THAN_OR_EQUAL))) { - return new AbstractMap.SimpleEntry(val, val); - } else if (filter.isA(Arrays.asList(SqlKind.LESS_THAN, SqlKind.LESS_THAN_OR_EQUAL))) { - return new AbstractMap.SimpleEntry(Long.MAX_VALUE, val); - } else { - return new AbstractMap.SimpleEntry(Long.MAX_VALUE, 0L); - } - } - } - - private static boolean addFilter(RexNode filter, Object[] filterValues) { - if (filter.isA(SqlKind.EQUALS)) { - final RexCall call = (RexCall) filter; - RexNode left = call.getOperands().get(0); - if (left.isA(SqlKind.CAST)) { - left = ((RexCall) left).operands.get(0); - } - final RexNode right = call.getOperands().get(1); - if (left instanceof RexInputRef && right instanceof RexLiteral) { - final int index = ((RexInputRef) left).getIndex(); - if (filterValues[index] == null) { - filterValues[index] = ((RexLiteral) right).getValue2().toString(); - return true; - } - } - } - return false; - } - - } - - public static class SidewinderDatabaseSchema extends AbstractSchema { - - private String dbName; - private MemStorageEngine engine; - - public SidewinderDatabaseSchema(MemStorageEngine engine, String dbName) { - this.engine = engine; - this.dbName = dbName; - } - - @Override - protected Map getTableMap() { - Map tableMap = new HashMap<>(); - - try { - for (String measurementName : engine.getAllMeasurementsForDb(dbName)) { - for (String fieldName : engine.getFieldsForMeasurement(dbName, measurementName)) { - boolean isFp = engine.isMeasurementFieldFP(dbName, measurementName, fieldName); - tableMap.put(measurementName + "_" + fieldName, - new MeasurementTable(engine, dbName, measurementName, fieldName, isFp)); - } - } - } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - System.out.println(tableMap); - return tableMap; - } - - } - -} diff --git a/core/src/arc/sql/sql/calcite/TestSidewinderSql.java b/core/src/arc/sql/sql/calcite/TestSidewinderSql.java deleted file mode 100644 index 0d90a96..0000000 --- a/core/src/arc/sql/sql/calcite/TestSidewinderSql.java +++ /dev/null @@ -1,64 +0,0 @@ -/** - * Copyright 2017 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.sql.calcite; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.ResultSetMetaData; -import java.sql.Statement; -import java.util.Properties; - -/** - * @author ambud - */ -public class TestSidewinderSql { - - public static void main(String[] args) throws ClassNotFoundException { - Class.forName("org.apache.calcite.jdbc.Driver"); - Properties info = new Properties(); - info.setProperty("lex", "JAVA"); - // info.setProperty("operand.db", "test"); - try (Connection connection = DriverManager.getConnection("jdbc:calcite:model=src/main/resources/model.json", - info)) { - Statement st = connection.createStatement(); - ResultSet results = st.executeQuery( - "select cpu_value,time_stamp from test.cpu_value where cpu_value>11.0 and tags like '%host%' and time_stamp>totimestamp(1484646984784)" - // "select time_stamp,cpu_value from test.cpu_value where - // cpu_value>11.0 and datediff(time_stamp, now()) < tomilli(10, - // 'HOURS')" - );// - // "select cpu_value,time_stamp from test.cpu_value where - // cpu_value>11.0 and time_stamp11.0 and datediff(time_stamp, now()) < tomilli(10, - // 'HOURS')" - ResultSetMetaData rsmd = results.getMetaData(); - System.out.println("\n\n:"); - for (int i = 1; i <= rsmd.getColumnCount(); i++) { - System.out.print("Column:" + rsmd.getColumnName(i) + ","); - } - System.out.println("\n\n"); - while (results.next()) { - System.out.println("Measurements:" + results.getLong(2) + "\t" + results.getDouble(1)); - } - st.close(); - } catch (Exception e) { - e.printStackTrace(); - } - } - -} diff --git a/core/src/arc/sql/sql/calcite/ToMilliseconds.java b/core/src/arc/sql/sql/calcite/ToMilliseconds.java deleted file mode 100644 index fbeeb55..0000000 --- a/core/src/arc/sql/sql/calcite/ToMilliseconds.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Copyright 2017 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.sql.calcite; - -import java.util.concurrent.TimeUnit; - -import org.apache.calcite.linq4j.function.Function2; - -import com.srotya.sidewinder.core.utils.TimeUtils; - -/** - * @author ambud - */ -public class ToMilliseconds implements Function2 { - - @Override - public Long apply(Integer v0, String v1) { - return (long) TimeUtils.timeToSeconds(TimeUnit.valueOf(v1), v0) * 1000; - } - -} diff --git a/core/src/arc/sql/sql/calcite/ToTimestamp.java b/core/src/arc/sql/sql/calcite/ToTimestamp.java deleted file mode 100644 index c1e7b12..0000000 --- a/core/src/arc/sql/sql/calcite/ToTimestamp.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright 2017 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.sql.calcite; - -import java.sql.Timestamp; -import java.time.Instant; - -import org.apache.calcite.linq4j.function.Function1; - -public class ToTimestamp implements Function1 { - - @Override - public Timestamp apply(Long a0) { - return Timestamp.from(Instant.ofEpochMilli(a0)); - } - -} diff --git a/core/src/arc/sql/sql/operators/AndOperator.java b/core/src/arc/sql/sql/operators/AndOperator.java deleted file mode 100644 index 2a30550..0000000 --- a/core/src/arc/sql/sql/operators/AndOperator.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * Copyright 2016 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.sql.operators; - -import java.util.List; - -import com.srotya.sidewinder.core.storage.DataPoint; - -/** - * @author ambud - */ -public class AndOperator extends ComplexOperator { - - public AndOperator(List operators) { - super(operators); - } - - @Override - public boolean shortCircuit(boolean prev, boolean current) { - return !(prev && current); - } - - @Override - public boolean operator(boolean prev, Operator next, DataPoint value) { - return prev && next.operate(value); - } - - @Override - public String toString() { - return "AndOperator " + getOperators() + ""; - } - -} diff --git a/core/src/arc/sql/sql/operators/BetweenOperator.java b/core/src/arc/sql/sql/operators/BetweenOperator.java deleted file mode 100644 index 8f81097..0000000 --- a/core/src/arc/sql/sql/operators/BetweenOperator.java +++ /dev/null @@ -1,127 +0,0 @@ -/** - * Copyright 2016 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.sql.operators; - -import com.srotya.sidewinder.core.storage.DataPoint; - -/** - * @author ambud - */ -public class BetweenOperator implements Operator { - - private Number upperBound; - private Number lowerBound; - private boolean isFloat; - private boolean isInclusive; - private String column; - - public BetweenOperator(String column, boolean isFloat, boolean isInclusive, Number lowerBound, Number upperBound) { - this.column = column; - this.isFloat = isFloat; - this.isInclusive = isInclusive; - this.lowerBound = lowerBound; - this.upperBound = upperBound; - } - - @Override - public boolean operate(DataPoint val) { - Number value = null; - if (column.equals("timestamp")) { - value = (Number) val.getTimestamp(); - } else { - if (isFloat) { - value = (Number) val.getValue(); - } else { - value = (Number) val.getLongValue(); - } - } - if (isInclusive) { - if (isFloat) { - return lowerBound.doubleValue() <= value.doubleValue() - && upperBound.doubleValue() >= value.doubleValue(); - } else { - return lowerBound.longValue() <= value.longValue() && upperBound.longValue() >= value.longValue(); - } - } else { - if (isFloat) { - return lowerBound.doubleValue() < value.doubleValue() && upperBound.doubleValue() > value.doubleValue(); - } else { - return lowerBound.longValue() <= value.longValue() && upperBound.longValue() >= value.longValue(); - } - } - } - - /** - * @return the upperBound - */ - public Number getUpperBound() { - return upperBound; - } - - /** - * @param upperBound - * the upperBound to set - */ - public void setUpperBound(Number upperBound) { - this.upperBound = upperBound; - } - - /** - * @return the lowerBound - */ - public Number getLowerBound() { - return lowerBound; - } - - /** - * @param lowerBound - * the lowerBound to set - */ - public void setLowerBound(Number lowerBound) { - this.lowerBound = lowerBound; - } - - /** - * @return the isFloat - */ - public boolean isFloat() { - return isFloat; - } - - /** - * @param isFloat - * the isFloat to set - */ - public void setFloat(boolean isFloat) { - this.isFloat = isFloat; - } - - /** - * @return the isInclusive - */ - public boolean isInclusive() { - return isInclusive; - } - - /** - * @param isInclusive - * the isInclusive to set - */ - public void setInclusive(boolean isInclusive) { - this.isInclusive = isInclusive; - } - -} diff --git a/core/src/arc/sql/sql/operators/ComplexOperator.java b/core/src/arc/sql/sql/operators/ComplexOperator.java deleted file mode 100644 index e1749b5..0000000 --- a/core/src/arc/sql/sql/operators/ComplexOperator.java +++ /dev/null @@ -1,67 +0,0 @@ -/** - * Copyright 2016 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.sql.operators; - -import java.util.ArrayList; -import java.util.List; - -import com.srotya.sidewinder.core.storage.DataPoint; - -/** - * @author ambud - */ -public abstract class ComplexOperator implements Operator { - - private List operators; - - public ComplexOperator(List operators) { - if (operators == null) { - this.operators = new ArrayList<>(); - } else { - this.operators = operators; - } - } - - @Override - public boolean operate(DataPoint value) { - boolean result = operators.get(0).operate(value); - for (int i = 1; i < operators.size(); i++) { - boolean temp = result; - result = operator(result, operators.get(i), value); - if (shortCircuit(temp, result)) { - break; - } - } - return result; - } - - public abstract boolean shortCircuit(boolean prev, boolean current); - - public abstract boolean operator(boolean prev, Operator next, DataPoint value); - - public void addOperator(Operator operator) { - operators.add(operator); - } - - public void addOperators(List operators) { - operators.addAll(operators); - } - - public List getOperators() { - return operators; - } - -} diff --git a/core/src/arc/sql/sql/operators/Equals.java b/core/src/arc/sql/sql/operators/Equals.java deleted file mode 100644 index 8b16e61..0000000 --- a/core/src/arc/sql/sql/operators/Equals.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Copyright 2016 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.sql.operators; - -import com.srotya.sidewinder.core.storage.DataPoint; - -/** - * @author ambud - */ -public class Equals extends SimpleOperator { - - public Equals(String column, Object literal) { - super(column, literal); - } - - @Override - public boolean operate(DataPoint value) { - return getLiteral().equals(value); - } - -} diff --git a/core/src/arc/sql/sql/operators/GreaterThan.java b/core/src/arc/sql/sql/operators/GreaterThan.java deleted file mode 100644 index c2bf82b..0000000 --- a/core/src/arc/sql/sql/operators/GreaterThan.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Copyright 2016 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.sql.operators; - -/** - * @author ambud - */ -public class GreaterThan extends NumericOperator { - - public GreaterThan(String column, boolean isFloat, Number literal) { - super(column, isFloat, literal); - } - - @Override - public boolean compareTrue(Number literal, Number value) { - if (isFloat()) { - return value.doubleValue() > literal.doubleValue(); - } else { - return value.longValue() > literal.longValue(); - } - } - -} diff --git a/core/src/arc/sql/sql/operators/GreaterThanEquals.java b/core/src/arc/sql/sql/operators/GreaterThanEquals.java deleted file mode 100644 index d36342f..0000000 --- a/core/src/arc/sql/sql/operators/GreaterThanEquals.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Copyright 2016 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.sql.operators; - -/** - * @author ambud - */ -public class GreaterThanEquals extends NumericOperator { - - public GreaterThanEquals(String column, boolean isFloat, Number literal) { - super(column, isFloat, literal); - } - - @Override - public boolean compareTrue(Number literal, Number value) { - if (isFloat()) { - return value.doubleValue() >= literal.doubleValue(); - } else { - return value.longValue() >= literal.longValue(); - } - } - -} diff --git a/core/src/arc/sql/sql/operators/InOperator.java b/core/src/arc/sql/sql/operators/InOperator.java deleted file mode 100644 index 823e6e5..0000000 --- a/core/src/arc/sql/sql/operators/InOperator.java +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Copyright 2017 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.sql.operators; - -import java.util.List; - -import com.srotya.sidewinder.core.storage.DataPoint; - -/** - * @author ambud - */ -public class InOperator extends SimpleOperator { - - public InOperator(List literal) { - super("tags", literal); - } - - @SuppressWarnings("unchecked") - @Override - public boolean operate(DataPoint value) { - for(String v:((List)getLiteral())) { - if(value.getTags().contains(v)) { - return true; - } - } - return false; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "InOperator ["+getLiteral()+"]"; - } - -} diff --git a/core/src/arc/sql/sql/operators/LessThan.java b/core/src/arc/sql/sql/operators/LessThan.java deleted file mode 100644 index 9843aca..0000000 --- a/core/src/arc/sql/sql/operators/LessThan.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Copyright 2016 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.sql.operators; - -/** - * @author ambud - */ -public class LessThan extends NumericOperator { - - public LessThan(String column, boolean isFloat, Number literal) { - super(column, isFloat, literal); - } - - @Override - public boolean compareTrue(Number literal, Number value) { - if (isFloat()) { - return value.doubleValue() < literal.doubleValue(); - } else { - return value.longValue() < literal.longValue(); - } - } - -} diff --git a/core/src/arc/sql/sql/operators/LessThanEquals.java b/core/src/arc/sql/sql/operators/LessThanEquals.java deleted file mode 100644 index c444296..0000000 --- a/core/src/arc/sql/sql/operators/LessThanEquals.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Copyright 2016 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.sql.operators; - -/** - * @author ambud - */ -public class LessThanEquals extends NumericOperator { - - public LessThanEquals(String column, boolean isFloat, Number literal) { - super(column, isFloat, literal); - } - - @Override - public boolean compareTrue(Number literal, Number value) { - if (isFloat()) { - return value.doubleValue() <= literal.doubleValue(); - } else { - return value.longValue() <= literal.longValue(); - } - } - -} diff --git a/core/src/arc/sql/sql/operators/NotEquals.java b/core/src/arc/sql/sql/operators/NotEquals.java deleted file mode 100644 index e00512f..0000000 --- a/core/src/arc/sql/sql/operators/NotEquals.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Copyright 2016 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.sql.operators; - -import com.srotya.sidewinder.core.storage.DataPoint; - -/** - * @author ambud - */ -public class NotEquals extends SimpleOperator { - - public NotEquals(String column, Object literal) { - super(column, literal); - } - - @Override - public boolean operate(DataPoint value) { - return getLiteral().equals(value); - } - -} diff --git a/core/src/arc/sql/sql/operators/NotOperator.java b/core/src/arc/sql/sql/operators/NotOperator.java deleted file mode 100644 index 408f53f..0000000 --- a/core/src/arc/sql/sql/operators/NotOperator.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Copyright 2016 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.sql.operators; - -import com.srotya.sidewinder.core.storage.DataPoint; - -/** - * @author ambud - */ -public class NotOperator implements Operator{ - - private Operator inputOperator; - - public NotOperator(Operator inputOperator) { - this.inputOperator = inputOperator; - } - - @Override - public boolean operate(DataPoint value) { - return !inputOperator.operate(value); - } - -} diff --git a/core/src/arc/sql/sql/operators/NumericEquals.java b/core/src/arc/sql/sql/operators/NumericEquals.java deleted file mode 100644 index b968b22..0000000 --- a/core/src/arc/sql/sql/operators/NumericEquals.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Copyright 2016 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.sql.operators; - -/** - * @author ambud - */ -public class NumericEquals extends NumericOperator { - - public NumericEquals(String column, boolean isFloat, Number literal) { - super(column, isFloat, literal); - } - - @Override - public boolean compareTrue(Number literal, Number value) { - if (isFloat()) { - return value.doubleValue() == literal.doubleValue(); - } else { - return value.longValue() == literal.longValue(); - } - } - -} diff --git a/core/src/arc/sql/sql/operators/NumericOperator.java b/core/src/arc/sql/sql/operators/NumericOperator.java deleted file mode 100644 index 09f8a69..0000000 --- a/core/src/arc/sql/sql/operators/NumericOperator.java +++ /dev/null @@ -1,57 +0,0 @@ -/** - * Copyright 2016 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.sql.operators; - -import com.srotya.sidewinder.core.storage.DataPoint; - -/** - * @author ambud - */ -public abstract class NumericOperator extends SimpleOperator { - - private boolean isFloat; - - public NumericOperator(String column, boolean isFloat, Number literal) { - super(column, literal); - this.isFloat = isFloat; - } - - @Override - public boolean operate(DataPoint value) { - if(getLiteral().equals("timestamp")) { - return compareTrue((Number) getLiteral(), (Number) value.getTimestamp()); - }else { - return compareTrue((Number) getLiteral(), (Number) value.getLongValue()); - } - } - - public abstract boolean compareTrue(Number literal, Number value); - - public boolean isFloat() { - return isFloat; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "NumericOperator [column=" + getColumn() + "\tliteral=" + getLiteral() + "]"; - } - -} diff --git a/core/src/arc/sql/sql/operators/OrOperator.java b/core/src/arc/sql/sql/operators/OrOperator.java deleted file mode 100644 index cdc3fec..0000000 --- a/core/src/arc/sql/sql/operators/OrOperator.java +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Copyright 2016 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.sql.operators; - -import java.util.List; - -import com.srotya.sidewinder.core.storage.DataPoint; - -/** - * @author ambud - */ -public class OrOperator extends ComplexOperator { - - public OrOperator(List operators) { - super(operators); - } - - @Override - public boolean shortCircuit(boolean prev, boolean current) { - return prev || current; - } - - @Override - public boolean operator(boolean prev, Operator next, DataPoint value) { - return prev || next.operate(value); - } - - @Override - public String toString() { - return "OrOperator " + getOperators() + ""; - } -} diff --git a/core/src/arc/sql/sql/operators/SimpleOperator.java b/core/src/arc/sql/sql/operators/SimpleOperator.java deleted file mode 100644 index b8fcd14..0000000 --- a/core/src/arc/sql/sql/operators/SimpleOperator.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Copyright 2016 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.sql.operators; - -/** - * @author ambud - */ -public abstract class SimpleOperator implements Operator { - - private Object literal; - private String column; - - public SimpleOperator(String column, Object literal) { - this.column = column; - this.literal = literal; - } - - public String getColumn() { - return column; - } - - public Object getLiteral() { - return literal; - } -} diff --git a/core/src/arc/storage/TestAbstractStorageEngine.java b/core/src/arc/storage/TestAbstractStorageEngine.java deleted file mode 100644 index bb88dd1..0000000 --- a/core/src/arc/storage/TestAbstractStorageEngine.java +++ /dev/null @@ -1,166 +0,0 @@ -/** - * Copyright 2016 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.storage; - -import static org.junit.Assert.assertEquals; - -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.TreeMap; -import java.util.concurrent.TimeUnit; - -import org.junit.Test; - -import com.srotya.sidewinder.core.predicates.Predicate; - -/** - * @author ambudsharma - */ -public class TestAbstractStorageEngine { - - @Test - public void testBasicBuildRowKey() throws IOException { - AbstractStorageEngine engine = new TestStorageEngine(); - long timestamp = System.currentTimeMillis(); - byte[] rowKey = engine.buildRowKey("testSeries1", Arrays.asList("one", "five", "ten"), - TimeUnit.MILLISECONDS, timestamp); - byte[] timeStamp = new byte[4]; - System.arraycopy(rowKey, rowKey.length - 4, timeStamp, 0, 4); -// assertEquals((timestamp / 1000 / AbstractStorageEngine.BUCKET_SIZE) * AbstractStorageEngine.BUCKET_SIZE, -// ByteUtils.bytesToIntMSB(timeStamp)); - assertEquals((byte) 't', rowKey[0]); - assertEquals((byte) 'f', rowKey[3]); - assertEquals((byte) 'o', rowKey[6]); - assertEquals((byte) 't', rowKey[9]); - } - - @Test - public void testPerfBuildRowKey() throws IOException { - AbstractStorageEngine engine = new TestStorageEngine(); - long timestamp = System.currentTimeMillis(); - for (int i = 0; i < 10000000; i++) { - engine.buildRowKey("testSeries1", Arrays.asList("one", "five", "ten", "sixty", "eighty", "hundred"), TimeUnit.MILLISECONDS, timestamp); - } - } - - private class TestStorageEngine extends AbstractStorageEngine { - - @Override - public void configure(Map conf) throws IOException { - } - - @Override - public byte[] indexIdentifier(String identifier) throws IOException { - return new byte[] { (byte) identifier.charAt(0), (byte) identifier.charAt(1), (byte) identifier.charAt(2) }; - } - - @Override - public void writeSeriesPoint(WriteTask point) throws IOException { - // do nothing - } - - @Override - public void connect() throws IOException { - } - - @Override - public void disconnect() throws IOException { - } - - @Override - public TreeMap getTreeFromDS(byte[] rowKey) throws Exception { - return null; - } - - @Override - public void print() throws Exception { - // TODO Auto-generated method stub - - } - - @Override - public void flush() throws IOException { - // TODO Auto-generated method stub - - } - - @Override - public Set getDatabases() throws Exception { - // TODO Auto-generated method stub - return null; - } - - @Override - public Set getAllMeasurementsForDb(String dbName) throws Exception { - // TODO Auto-generated method stub - return null; - } - - @Override - public void deleteAllData() throws Exception { - // TODO Auto-generated method stub - - } - - @Override - public boolean checkIfExists(String dbName) throws Exception { - // TODO Auto-generated method stub - return false; - } - - @Override - public void dropDatabase(String dbName) throws Exception { - // TODO Auto-generated method stub - - } - - @Override - public void writeDataPoint(String dbName, DataPoint dp) throws IOException { - // TODO Auto-generated method stub - - } - - @Override - public Set getMeasurementsLike(String dbName, String seriesNames) throws IOException { - // TODO Auto-generated method stub - return null; - } - - @Override - public List queryDataPoints(String dbName, String measurementName, long startTime, long endTime, - List tags, Predicate valuePredicate) { - // TODO Auto-generated method stub - return null; - } - - @Override - public void dropMeasurement(String dbName, String measurementName) throws Exception { - // TODO Auto-generated method stub - - } - - @Override - public boolean checkIfExists(String dbName, String measurement) throws Exception { - // TODO Auto-generated method stub - return false; - } - - } - -} diff --git a/core/src/arc/storage/gorilla/TestGorillaCompression.java b/core/src/arc/storage/gorilla/TestGorillaCompression.java deleted file mode 100644 index 3ffbe2f..0000000 --- a/core/src/arc/storage/gorilla/TestGorillaCompression.java +++ /dev/null @@ -1,266 +0,0 @@ -/** - * Copyright 2016 Michael Burman - * - * Licensed 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 com.srotya.sidewinder.core.storage.gorilla; - -import static org.junit.Assert.*; - -import java.nio.ByteBuffer; -import java.time.LocalDateTime; -import java.time.Month; -import java.time.ZoneOffset; -import java.time.temporal.ChronoUnit; -import java.util.Arrays; -import java.util.concurrent.ThreadLocalRandom; - -import org.junit.Test; - -import com.srotya.sidewinder.core.storage.DataPoint; -import com.srotya.sidewinder.core.storage.RejectException; -import com.srotya.sidewinder.core.storage.gorilla.ByteBufferBitInput; -import com.srotya.sidewinder.core.storage.gorilla.ByteBufferBitOutput; -import com.srotya.sidewinder.core.storage.gorilla.Reader; -import com.srotya.sidewinder.core.storage.gorilla.Writer; - -/** - * These are generic tests to test that input matches the output after - * compression + decompression cycle, using both the timestamp and value - * compression. - * - * @author Michael Burman - * - * Modified by @author Ambud to switch to JUnit4 - */ -public class TestGorillaCompression { - - @Test - public void simpleEncodeAndDecodeTest() throws Exception { - long now = LocalDateTime.now().truncatedTo(ChronoUnit.HOURS).toInstant(ZoneOffset.UTC).toEpochMilli(); - - ByteBufferBitOutput output = new ByteBufferBitOutput(); - - Writer c = new Writer(now, output); - - DataPoint[] pairs = { new DataPoint(now + 10, Double.doubleToRawLongBits(1.0)), - new DataPoint(now + 20, Double.doubleToRawLongBits(-2.0)), - new DataPoint(now + 28, Double.doubleToRawLongBits(-2.5)), - new DataPoint(now + 84, Double.doubleToRawLongBits(65537)), - new DataPoint(now + 400, Double.doubleToRawLongBits(2147483650.0)), - new DataPoint(now + 2300, Double.doubleToRawLongBits(-16384)), - new DataPoint(now + 16384, Double.doubleToRawLongBits(2.8)), - new DataPoint(now + 16500, Double.doubleToRawLongBits(-38.0)) }; - - Arrays.stream(pairs).forEach(p -> c.addValue(p.getTimestamp(), p.getValue())); - c.flush(); - - ByteBuffer byteBuffer = output.getByteBuffer(); - byteBuffer.flip(); - - ByteBufferBitInput input = new ByteBufferBitInput(byteBuffer); - Reader d = new Reader(input, pairs.length, null, null); - - // Replace with stream once decompressor supports it - for (int i = 0; i < pairs.length; i++) { - DataPoint pair = d.readPair(); - assertEquals("Timestamp did not match", pairs[i].getTimestamp(), pair.getTimestamp()); - assertEquals("Value did not match", pairs[i].getValue(), pair.getValue(), 0); - } - - try { - assertNull(d.readPair()); - fail("End of stream, shouldn't be able to read any more"); - } catch (RejectException e) { - } - } - - /** - * Tests encoding of similar floats, see - * https://github.com/dgryski/go-tsz/issues/4 for more information. - */ - @Test - public void testEncodeSimilarFloats() throws Exception { - long now = LocalDateTime.of(2015, Month.MARCH, 02, 00, 00).toInstant(ZoneOffset.UTC).toEpochMilli(); - - ByteBufferBitOutput output = new ByteBufferBitOutput(); - Writer c = new Writer(now, output); - - ByteBuffer bb = ByteBuffer.allocate(5 * 2 * Long.BYTES); - - bb.putLong(now + 1); - bb.putDouble(6.00065e+06); - bb.putLong(now + 2); - bb.putDouble(6.000656e+06); - bb.putLong(now + 3); - bb.putDouble(6.000657e+06); - bb.putLong(now + 4); - bb.putDouble(6.000659e+06); - bb.putLong(now + 5); - bb.putDouble(6.000661e+06); - - bb.flip(); - - for (int j = 0; j < 5; j++) { - c.addValue(bb.getLong(), bb.getDouble()); - } - - c.flush(); - - bb.flip(); - - ByteBuffer byteBuffer = output.getByteBuffer(); - byteBuffer.flip(); - - ByteBufferBitInput input = new ByteBufferBitInput(byteBuffer); - Reader d = new Reader(input, 5, null, null); - - // Replace with stream once decompressor supports it - for (int i = 0; i < 5; i++) { - DataPoint pair = d.readPair(); - assertEquals("Timestamp did not match", bb.getLong(), pair.getTimestamp()); - assertEquals("Value did not match", bb.getDouble(), pair.getValue(), 0); - } - try { - assertNull(d.readPair()); - fail("End of stream, shouldn't be able to read any more"); - } catch (RejectException e) { - } - } - - /** - * Tests writing enough large amount of datapoints that causes the included - * ByteBufferBitOutput to do internal byte array expansion. - */ - @Test - public void testEncodeLargeAmountOfData() throws Exception { - // This test should trigger ByteBuffer reallocation - int amountOfPoints = 100000; - long blockStart = LocalDateTime.now().truncatedTo(ChronoUnit.HOURS).toInstant(ZoneOffset.UTC).toEpochMilli(); - ByteBufferBitOutput output = new ByteBufferBitOutput(); - - long now = blockStart + 60; - ByteBuffer bb = ByteBuffer.allocateDirect(amountOfPoints * 2 * Long.BYTES); - - for (int i = 0; i < amountOfPoints; i++) { - bb.putLong(now + i * 60); - bb.putDouble(i * Math.random()); - } - - Writer c = new Writer(blockStart, output); - - bb.flip(); - - for (int j = 0; j < amountOfPoints; j++) { - c.addValue(bb.getLong(), bb.getDouble()); - } - - c.flush(); - - bb.flip(); - - ByteBuffer byteBuffer = output.getByteBuffer(); - byteBuffer.flip(); - - ByteBufferBitInput input = new ByteBufferBitInput(byteBuffer); - Reader d = new Reader(input, amountOfPoints, null, null); - - for (int i = 0; i < amountOfPoints; i++) { - long tStamp = bb.getLong(); - double val = bb.getDouble(); - DataPoint pair = d.readPair(); - assertEquals("Expected timestamp did not match at point " + i, tStamp, pair.getTimestamp()); - assertEquals(val, pair.getValue(), 0); - } - try { - assertNull(d.readPair()); - fail("End of stream, shouldn't be able to read any more"); - } catch (RejectException e) { - } - } - - /** - * Although not intended usage, an empty block should not cause errors - */ - @Test - public void testEmptyBlock() throws Exception { - long now = LocalDateTime.now().truncatedTo(ChronoUnit.HOURS).toInstant(ZoneOffset.UTC).toEpochMilli(); - - ByteBufferBitOutput output = new ByteBufferBitOutput(); - - Writer c = new Writer(now, output); - c.flush(); - - ByteBuffer byteBuffer = output.getByteBuffer(); - byteBuffer.flip(); - - ByteBufferBitInput input = new ByteBufferBitInput(byteBuffer); - Reader d = new Reader(input, 0, null, null); - - try { - assertNull(d.readPair()); - fail("End of stream, shouldn't be able to read any more"); - } catch (RejectException e) { - } - } - - /** - * Long values should be compressable and decompressable in the stream - */ - @Test - public void testLongEncoding() throws Exception { - // This test should trigger ByteBuffer reallocation - int amountOfPoints = 10000; - long blockStart = LocalDateTime.now().truncatedTo(ChronoUnit.HOURS).toInstant(ZoneOffset.UTC).toEpochMilli(); - ByteBufferBitOutput output = new ByteBufferBitOutput(); - - long now = blockStart + 60; - ByteBuffer bb = ByteBuffer.allocateDirect(amountOfPoints * 2 * Long.BYTES); - - for (int i = 0; i < amountOfPoints; i++) { - bb.putLong(now + i * 60); - bb.putLong(ThreadLocalRandom.current().nextLong(Integer.MAX_VALUE)); - } - - Writer c = new Writer(blockStart, output); - - bb.flip(); - - for (int j = 0; j < amountOfPoints; j++) { - c.addValue(bb.getLong(), bb.getLong()); - } - - c.flush(); - - bb.flip(); - - ByteBuffer byteBuffer = output.getByteBuffer(); - byteBuffer.flip(); - - ByteBufferBitInput input = new ByteBufferBitInput(byteBuffer); - Reader d = new Reader(input, amountOfPoints, null, null); - - for (int i = 0; i < amountOfPoints; i++) { - long tStamp = bb.getLong(); - long val = bb.getLong(); - DataPoint pair = d.readPair(); - assertEquals("Expected timestamp did not match at point " + i, tStamp, pair.getTimestamp()); - assertEquals(val, pair.getLongValue()); - } - try { - assertNull(d.readPair()); - fail("End of stream, shouldn't be able to read any more"); - } catch (RejectException e) { - } - } -} diff --git a/core/src/arc/storage/gorilla/TestMemStorageEngine.java b/core/src/arc/storage/gorilla/TestMemStorageEngine.java deleted file mode 100644 index 9121288..0000000 --- a/core/src/arc/storage/gorilla/TestMemStorageEngine.java +++ /dev/null @@ -1,223 +0,0 @@ -/** - * Copyright 2016 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.storage.gorilla; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.TimeUnit; - -import org.junit.Test; - -import com.srotya.sidewinder.core.predicates.BetweenPredicate; -import com.srotya.sidewinder.core.predicates.Predicate; -import com.srotya.sidewinder.core.storage.DataPoint; -import com.srotya.sidewinder.core.storage.ItemNotFoundException; -import com.srotya.sidewinder.core.storage.RejectException; -import com.srotya.sidewinder.core.storage.StorageEngine; -import com.srotya.sidewinder.core.utils.TimeUtils; - -/** - * Unit tests for {@link MemStorageEngine} - * - * @author ambud - */ -public class TestMemStorageEngine { - - private Map conf = new HashMap<>(); - - @Test - public void testTagEncodeDecode() throws IOException { - MemStorageEngine engine = new MemStorageEngine(); - engine.configure(new HashMap<>()); - String encodedStr = engine.encodeTagsToString(Arrays.asList("host", "value", "test")); - - List decodedStr = engine.decodeStringToTags(encodedStr); - - System.out.println(decodedStr); - } - - @Test - public void testConfigure() { - StorageEngine engine = new MemStorageEngine(); - try { - engine.writeDataPoint("test", - new DataPoint("test", "ss", "value", Arrays.asList("te"), System.currentTimeMillis(), 2.2)); - fail("Engine not initialized, shouldn't be able to write a datapoint"); - } catch (Exception e) { - } - - try { - engine.configure(new HashMap<>()); - } catch (IOException e) { - fail("No IOException should be thrown"); - } - try { - engine.writeDataPoint("test", - new DataPoint("test", "ss", "value", Arrays.asList("te"), System.currentTimeMillis(), 2.2)); - } catch (Exception e) { - e.printStackTrace(); - fail("Engine is initialized, no IO Exception should be thrown:" + e.getMessage()); - } - } - - @Test - public void testQueryDataPoints() throws IOException, ItemNotFoundException { - StorageEngine engine = new MemStorageEngine(); - engine.configure(conf); - long ts = System.currentTimeMillis(); - engine.writeSeries("test", "cpu", Arrays.asList("test"), TimeUnit.MILLISECONDS, ts, 1, null); - engine.writeSeries("test", "cpu", Arrays.asList("test"), TimeUnit.MILLISECONDS, ts + (400 * 60000), 4, null); - List queryDataPoints = engine.queryDataPoints("test", "cpu", ts, ts + (400 * 60000), null, null); - assertEquals(2, queryDataPoints.size()); - assertEquals(ts, queryDataPoints.get(0).getTimestamp()); - assertEquals(ts + (400 * 60000), queryDataPoints.get(1).getTimestamp()); - } - - @Test - public void testGetMeasurementsLike() throws IOException { - StorageEngine engine = new MemStorageEngine(); - engine.configure(conf); - engine.writeSeries("test", "cpu", Arrays.asList("test"), TimeUnit.MILLISECONDS, System.currentTimeMillis(), 2L, - null); - engine.writeSeries("test", "mem", Arrays.asList("test"), TimeUnit.MILLISECONDS, System.currentTimeMillis() + 10, - 3L, null); - engine.writeSeries("test", "netm", Arrays.asList("test"), TimeUnit.MILLISECONDS, - System.currentTimeMillis() + 20, 5L, null); - Set result = engine.getMeasurementsLike("test", " "); - assertEquals(3, result.size()); - - result = engine.getMeasurementsLike("test", "c"); - assertEquals(1, result.size()); - - result = engine.getMeasurementsLike("test", "m"); - assertEquals(2, result.size()); - } - - @Test - public void testSeriesToDataPointConversion() throws RejectException { - List points = new ArrayList<>(); - long headerTimestamp = System.currentTimeMillis(); - TimeSeriesBucket timeSeries = new TimeSeriesBucket(headerTimestamp); - timeSeries.addDataPoint(headerTimestamp, 1L); - TimeSeries.seriesToDataPoints(Arrays.asList("test"), points, timeSeries, null, null, false); - assertEquals(1, points.size()); - points.clear(); - - Predicate timepredicate = new BetweenPredicate(Long.MAX_VALUE, Long.MAX_VALUE); - TimeSeries.seriesToDataPoints(Arrays.asList("test"), points, timeSeries, timepredicate, null, false); - assertEquals(0, points.size()); - } - - @Test - public void testSeriesBucketLookups() throws IOException, ItemNotFoundException { - MemStorageEngine engine = new MemStorageEngine(); - engine.configure(new HashMap<>()); - engine.connect(); - String dbName = "test1"; - String measurementName = "cpu"; - List tags = Arrays.asList("test"); - - long ts = 1483923600000L; - System.out.println("Base timestamp=" + new Date(ts)); - - for (int i = 0; i < 100; i++) { - engine.writeSeries(dbName, measurementName, tags, TimeUnit.MILLISECONDS, ts + (i * 60000), 2.2, null); - } - System.out.println("Buckets:" + engine.getSeriesMap(dbName, measurementName).size()); - long endTs = ts + 99 * 60000; - - // validate all points are returned with a full range query - List points = engine.queryDataPoints(dbName, measurementName, ts, endTs, tags, null); - assertEquals(ts, points.get(0).getTimestamp()); - assertEquals(endTs, points.get(points.size() - 1).getTimestamp()); - - // validate ts-1 yields the same result - points = engine.queryDataPoints(dbName, measurementName, ts - 1, endTs, tags, null); - assertEquals(ts, points.get(0).getTimestamp()); - assertEquals(endTs, points.get(points.size() - 1).getTimestamp()); - - // validate ts+1 yields correct result - points = engine.queryDataPoints(dbName, measurementName, ts + 1, endTs, tags, null); - assertEquals(ts + 60000, points.get(0).getTimestamp()); - assertEquals(endTs, points.get(points.size() - 1).getTimestamp()); - - // validate that points have been written to 2 different buckets - assertTrue(TimeUtils.getTimeBucket(TimeUnit.MILLISECONDS, ts, 4096) != TimeUtils - .getTimeBucket(TimeUnit.MILLISECONDS, endTs, 4096)); - // calculate base timestamp for the second bucket - long baseTs2 = ((long) TimeUtils.getTimeBucket(TimeUnit.MILLISECONDS, endTs, 4096)) * 1000; - System.out.println("Bucket2 base timestamp=" + new Date(baseTs2)); - - // validate random seek with deliberate time offset - points = engine.queryDataPoints(dbName, measurementName, ts, baseTs2, tags, null); - assertEquals("Invalid first entry:" + new Date(points.get(0).getTimestamp()), ts, points.get(0).getTimestamp()); - assertEquals("Invalid first entry:" + (baseTs2 - ts), (baseTs2 / 60000) * 60000, - points.get(points.size() - 1).getTimestamp()); - - points = engine.queryDataPoints(dbName, measurementName, baseTs2, endTs, tags, null); - assertEquals("Invalid first entry:" + new Date(points.get(0).getTimestamp()), (baseTs2 - ts), - (baseTs2 / 60000) * 60000, points.get(0).getTimestamp()); - assertEquals("Invalid first entry:" + endTs, endTs, points.get(points.size() - 1).getTimestamp()); - - // validate correct results when time range is incorrectly swapped i.e. - // end time is smaller than start time - points = engine.queryDataPoints(dbName, measurementName, endTs - 1, baseTs2, tags, null); - assertEquals("Invalid first entry:" + new Date(points.get(0).getTimestamp()), (baseTs2 - ts), - (baseTs2 / 60000) * 60000, points.get(0).getTimestamp()); - assertEquals("Invalid first entry:" + endTs, endTs - 60000, points.get(points.size() - 1).getTimestamp()); - } - - @Test - public void testBaseTimeSeriesWrites() throws Exception { - MemStorageEngine engine = new MemStorageEngine(); - engine.configure(new HashMap<>()); - engine.connect(); - - final long ts1 = System.currentTimeMillis(); - ExecutorService es = Executors.newCachedThreadPool(); - for (int k = 0; k < 500; k++) { - final int p = k; - es.submit(() -> { - long ts = System.currentTimeMillis(); - for (int i = 0; i < 1000; i++) { - try { - engine.writeSeries("test", "helo" + p, Arrays.asList(""), TimeUnit.MILLISECONDS, ts + i * 60, - ts + i, null); - } catch (IOException e) { - e.printStackTrace(); - } - } - }); - } - es.shutdown(); - es.awaitTermination(10, TimeUnit.SECONDS); - - System.out.println("Write time:" + (System.currentTimeMillis() - ts1) + "\tms"); - } - -} diff --git a/core/src/arc/storage/gorilla/TestTimeSeriesBucket.java b/core/src/arc/storage/gorilla/TestTimeSeriesBucket.java deleted file mode 100644 index 06bd3f2..0000000 --- a/core/src/arc/storage/gorilla/TestTimeSeriesBucket.java +++ /dev/null @@ -1,170 +0,0 @@ -/** - * Copyright 2017 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.storage.gorilla; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; - -import java.io.IOException; -import java.util.Random; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.atomic.AtomicBoolean; - -import org.junit.Test; - -import com.srotya.sidewinder.core.storage.DataPoint; -import com.srotya.sidewinder.core.storage.RejectException; - -/** - * Unit tests for {@link TimeSeriesBucket} - * - * @author ambud - */ -public class TestTimeSeriesBucket { - - @Test - public void testReadWriteLongs() throws RejectException { - long ts = System.currentTimeMillis(); - int count = 10000; - TimeSeriesBucket series = new TimeSeriesBucket(ts); - for (int i = 0; i < count; i++) { - series.addDataPoint(ts + (i * 1000), i); - } - Reader reader = series.getReader(null, null); - assertEquals(count, series.getCount()); - // longs have an issue with serialization and flushing on last value for - // a given series - series.flush(); - for (int i = 0; i < count; i++) { - try { - DataPoint pair = reader.readPair(); - assertEquals(ts + (i * 1000), pair.getTimestamp()); - assertEquals(i, pair.getLongValue()); - } catch (Exception e) { - fail("Must not through EOS exception since the loop should stop at the last element"); - } - } - } - - @Test - public void testReadWriteDoubles() throws RejectException { - long ts = System.currentTimeMillis(); - int count = 1000; - TimeSeriesBucket series = new TimeSeriesBucket(ts); - for (int i = 0; i < 1000; i++) { - series.addDataPoint(ts + (i * 1000), i * 1.2); - } - Reader reader = series.getReader(null, null); - assertEquals(count, series.getCount()); - for (int i = 0; i < count; i++) { - try { - DataPoint pair = reader.readPair(); - assertEquals(ts + (i * 1000), pair.getTimestamp()); - assertEquals(i * 1.2, pair.getValue(), 0.01); - } catch (Exception e) { - fail("Must not through EOS exception since the loop should stop at the last element"); - } - } - } - - @Test - public void testCompressionRatios() throws RejectException { - long ts = System.currentTimeMillis(); - TimeSeriesBucket series = new TimeSeriesBucket(ts); - for (int i = 0; i < 10000; i++) { - series.addDataPoint(ts + (i * 1000), i); - } - System.out.println("Test compression ratio (10K longs 1s frequency):" + series.getCompressionRatio()); - - series = new TimeSeriesBucket(ts); - for (int i = 0; i < 10000; i++) { - series.addDataPoint(ts + i, i); - } - System.out.println("Test compression ratio (10K longs 1ms frequency):" + series.getCompressionRatio()); - - series = new TimeSeriesBucket(ts); - for (int i = 0; i < 10000; i++) { - series.addDataPoint(ts + (i * 1000), i * 1.2); - } - System.out.println("Test compression ratio (10K double 1s frequency):" + series.getCompressionRatio()); - - series = new TimeSeriesBucket(ts); - Random rand = new Random(); - for (int i = 0; i < 10000; i++) { - series.addDataPoint(ts + (i * 1000), rand.nextLong()); - } - System.out.println("Test compression ratio (10K random 1s frequency):" + series.getCompressionRatio()); - } - - @Test - public void testConcurrentReadWrites() throws RejectException { - final long ts = System.currentTimeMillis(); - final TimeSeriesBucket series = new TimeSeriesBucket(ts); - final AtomicBoolean startFlag = new AtomicBoolean(false); - ExecutorService es = Executors.newCachedThreadPool(); - for (int i = 0; i < 2; i++) { - es.submit(() -> { - while (!startFlag.get()) { - try { - Thread.sleep(1); - } catch (InterruptedException e) { - return; - } - } - for (int k = 0; k < 10; k++) { - Reader reader = series.getReader(null, null); - try { - int c = 0; - while (true) { - reader.readPair(); - c = c + 1; - } - } catch (IOException e) { - } - try { - Thread.sleep(10); - } catch (InterruptedException e) { - return; - } - } - }); - } - - startFlag.set(true); - for (int i = 0; i < 20; i++) { - series.addDataPoint(ts + i, i * 1.2); - try { - Thread.sleep(50); - } catch (InterruptedException e) { - break; - } - } - - es.shutdownNow(); - - Reader reader = series.getReader(null, null); - try { - for (int i = 0; i < 20; i++) { - DataPoint pair = reader.readPair(); - assertEquals(ts + i, pair.getTimestamp()); - assertEquals(i * 1.2, pair.getValue(), 0.01); - } - } catch (IOException e) { - } - } - -} diff --git a/core/src/main/java/com/srotya/sidewinder/core/SidewinderServer.java b/core/src/main/java/com/srotya/sidewinder/core/SidewinderServer.java index f4f4220..5e7f5d5 100644 --- a/core/src/main/java/com/srotya/sidewinder/core/SidewinderServer.java +++ b/core/src/main/java/com/srotya/sidewinder/core/SidewinderServer.java @@ -31,6 +31,7 @@ import com.srotya.sidewinder.core.api.DatabaseOpsApi; import com.srotya.sidewinder.core.api.InfluxApi; import com.srotya.sidewinder.core.api.MeasurementOpsApi; +import com.srotya.sidewinder.core.api.SqlApi; import com.srotya.sidewinder.core.api.grafana.GrafanaQueryApi; import com.srotya.sidewinder.core.health.RestAPIHealthCheck; import com.srotya.sidewinder.core.ingress.binary.NettyBinaryIngestionServer; @@ -89,6 +90,7 @@ public void run(SidewinderConfig config, Environment env) throws Exception { env.jersey().register(new MeasurementOpsApi(storageEngine, registry)); env.jersey().register(new DatabaseOpsApi(storageEngine, registry)); env.jersey().register(new InfluxApi(storageEngine, registry)); + env.jersey().register(new SqlApi(storageEngine)); env.healthChecks().register("restapi", new RestAPIHealthCheck()); if (Boolean.parseBoolean(conf.getOrDefault(ConfigConstants.AUTH_BASIC_ENABLED, ConfigConstants.FALSE))) { diff --git a/core/src/arc/SqlApi.java b/core/src/main/java/com/srotya/sidewinder/core/api/SqlApi.java similarity index 97% rename from core/src/arc/SqlApi.java rename to core/src/main/java/com/srotya/sidewinder/core/api/SqlApi.java index 9552fb2..5433cec 100644 --- a/core/src/arc/SqlApi.java +++ b/core/src/main/java/com/srotya/sidewinder/core/api/SqlApi.java @@ -25,7 +25,6 @@ import java.util.Arrays; import javax.ws.rs.BadRequestException; -import javax.ws.rs.Consumes; import javax.ws.rs.NotFoundException; import javax.ws.rs.POST; import javax.ws.rs.Path; @@ -84,7 +83,7 @@ public boolean checkAndAddSchema(String dbName) throws Exception { CalciteConnection calciteConnection = connection.unwrap(CalciteConnection.class); String tdbName = dbName.toUpperCase(); if (calciteConnection.getRootSchema().getSubSchema(tdbName) == null) { - System.err.println("Adding DB to connection:" + dbName); + System.err.println("Adding DB to connection:" + dbName + "\t" + tdbName); calciteConnection.getRootSchema().add(tdbName, new SidewinderDatabaseSchema(engine, dbName)); } return true; @@ -93,7 +92,6 @@ public boolean checkAndAddSchema(String dbName) throws Exception { @Path("/database/{" + DatabaseOpsApi.DB_NAME + "}") @Produces({ MediaType.APPLICATION_JSON }) - @Consumes({ MediaType.TEXT_PLAIN }) @POST public String queryResults(@PathParam(DatabaseOpsApi.DB_NAME) String dbName, String sql) { try { diff --git a/core/src/main/java/com/srotya/sidewinder/core/ingress/binary/SeriesDataPointWriter.java b/core/src/main/java/com/srotya/sidewinder/core/ingress/binary/SeriesDataPointWriter.java index 2d59916..5b35d31 100644 --- a/core/src/main/java/com/srotya/sidewinder/core/ingress/binary/SeriesDataPointWriter.java +++ b/core/src/main/java/com/srotya/sidewinder/core/ingress/binary/SeriesDataPointWriter.java @@ -17,6 +17,8 @@ import java.io.IOException; import java.util.concurrent.atomic.AtomicLong; +import java.util.logging.Level; +import java.util.logging.Logger; import com.srotya.sidewinder.core.storage.DataPoint; import com.srotya.sidewinder.core.storage.StorageEngine; @@ -32,6 +34,7 @@ */ public class SeriesDataPointWriter extends ChannelInboundHandlerAdapter { + private static final Logger logger = Logger.getLogger(SeriesDataPointWriter.class.getName()); private static AtomicLong counter = new AtomicLong(); private StorageEngine engine; @@ -51,8 +54,7 @@ public void channelRead(ChannelHandlerContext ctx, Object msg) { System.out.println(counter.get()); } } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + logger.log(Level.SEVERE, "Error writing data point", e); } ReferenceCountUtil.release(msg); } diff --git a/core/src/main/java/com/srotya/sidewinder/core/rpc/WriterServiceImpl.java b/core/src/main/java/com/srotya/sidewinder/core/rpc/WriterServiceImpl.java index 5a0355b..2ccba7c 100644 --- a/core/src/main/java/com/srotya/sidewinder/core/rpc/WriterServiceImpl.java +++ b/core/src/main/java/com/srotya/sidewinder/core/rpc/WriterServiceImpl.java @@ -23,9 +23,9 @@ import com.srotya.sidewinder.core.rpc.WriterServiceGrpc.WriterServiceImplBase; import com.srotya.sidewinder.core.storage.DataPoint; import com.srotya.sidewinder.core.storage.StorageEngine; +import com.srotya.sidewinder.core.storage.TimeSeries; import com.srotya.sidewinder.core.storage.TimeSeriesBucket; -import com.srotya.sidewinder.core.storage.Writer; -import com.srotya.sidewinder.core.storage.mem.TimeSeries; +import com.srotya.sidewinder.core.storage.compression.Writer; import com.srotya.sidewinder.core.utils.MiscUtils; import io.grpc.stub.StreamObserver; @@ -83,7 +83,7 @@ public void writeSeriesPoint(RawTimeSeriesBucket request, StreamObserver re TimeSeriesBucket tsb = series.getOrCreateSeriesBucket(TimeUnit.MILLISECONDS, bucket.getHeaderTimestamp()); Writer writer = tsb.getWriter(); - writer.configure(conf); + writer.configure(conf, null, false); writer.setCounter(bucket.getCount()); writer.bootstrap(bucket.getData().asReadOnlyByteBuffer()); } diff --git a/core/src/main/java/com/srotya/sidewinder/core/security/User.java b/core/src/main/java/com/srotya/sidewinder/core/security/User.java index 26a4acf..6c9cc48 100644 --- a/core/src/main/java/com/srotya/sidewinder/core/security/User.java +++ b/core/src/main/java/com/srotya/sidewinder/core/security/User.java @@ -1,7 +1,25 @@ +/** + * Copyright 2017 Ambud Sharma + * + * Licensed 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 com.srotya.sidewinder.core.security; import java.security.Principal; +/** + * @author ambud + */ public class User implements Principal { private String name; diff --git a/core/src/arc/calcite/MeasurementTable.java b/core/src/main/java/com/srotya/sidewinder/core/sql/calcite/MeasurementTable.java similarity index 86% rename from core/src/arc/calcite/MeasurementTable.java rename to core/src/main/java/com/srotya/sidewinder/core/sql/calcite/MeasurementTable.java index dffbe87..c4e3e07 100644 --- a/core/src/arc/calcite/MeasurementTable.java +++ b/core/src/main/java/com/srotya/sidewinder/core/sql/calcite/MeasurementTable.java @@ -41,8 +41,8 @@ import org.apache.calcite.sql.type.SqlTypeName; import com.srotya.sidewinder.core.storage.DataPoint; -import com.srotya.sidewinder.core.storage.Reader; import com.srotya.sidewinder.core.storage.StorageEngine; +import com.srotya.sidewinder.core.storage.compression.Reader; /** * @author ambud @@ -71,21 +71,20 @@ public RelDataType getRowType(RelDataTypeFactory typeFactory) { types = new ArrayList<>(); names = new ArrayList<>(); +// names.add("TAGS"); +// types.add(typeFactory.createSqlType(SqlTypeName.ANY)); + + names.add(fieldName.toUpperCase()); // value field if (isFp) { - names.add(measurementName + "_" + fieldName); types.add(typeFactory.createSqlType(SqlTypeName.DOUBLE, 10)); } else { - names.add(measurementName + "_" + fieldName); types.add(typeFactory.createSqlType(SqlTypeName.BIGINT, 10)); } - names.add("time_stamp"); + names.add("TIME_STAMP".toUpperCase()); types.add(typeFactory.createSqlType(SqlTypeName.TIMESTAMP)); - names.add("tags"); - types.add(typeFactory.createSqlType(SqlTypeName.CHAR)); - return typeFactory.createStructType(types, names); } @@ -113,7 +112,7 @@ public Enumerable scan(DataContext root, List filters) { if (findTimeRange == null) { // by default get last 1hr's data if no time range filter is // specified - findTimeRange = new AbstractMap.SimpleEntry(System.currentTimeMillis() - (3600 * 1000), + findTimeRange = new AbstractMap.SimpleEntry(System.currentTimeMillis() - (3600_000), System.currentTimeMillis()); } else if (findTimeRange.getKey().equals(findTimeRange.getValue())) { findTimeRange = new AbstractMap.SimpleEntry(findTimeRange.getKey(), System.currentTimeMillis()); @@ -156,7 +155,7 @@ public boolean moveNext() { } catch (IOException e) { if (iterator.hasNext()) { next = iterator.next(); - }else { + } else { next = null; } if (next != null) { @@ -174,11 +173,11 @@ public boolean moveNext() { @Override public Object[] current() { if (next.getValue()) { - return new Object[] { (Double) dataPoint.getValue(), dataPoint.getTimestamp(), - dataPoint.getTags().toString() }; + // (dataPoint.getTags() != null) ? dataPoint.getTags().toString() : null, + return new Object[] { + (Double) dataPoint.getValue(), dataPoint.getTimestamp() }; } else { - return new Object[] { (Long) dataPoint.getLongValue(), dataPoint.getTimestamp(), - dataPoint.getTags().toString() }; + return new Object[] { (Long) dataPoint.getLongValue(), dataPoint.getTimestamp() }; } } @@ -258,24 +257,24 @@ private Entry findTimeRange(RexNode filter) { } } - @SuppressWarnings("unused") - private static boolean addFilter(RexNode filter, Object[] filterValues) { - if (filter.isA(SqlKind.EQUALS)) { - final RexCall call = (RexCall) filter; - RexNode left = call.getOperands().get(0); - if (left.isA(SqlKind.CAST)) { - left = ((RexCall) left).operands.get(0); - } - final RexNode right = call.getOperands().get(1); - if (left instanceof RexInputRef && right instanceof RexLiteral) { - final int index = ((RexInputRef) left).getIndex(); - if (filterValues[index] == null) { - filterValues[index] = ((RexLiteral) right).getValue2().toString(); - return true; - } - } - } - return false; - } + // @SuppressWarnings("unused") + // private static boolean addFilter(RexNode filter, Object[] filterValues) { + // if (filter.isA(SqlKind.EQUALS)) { + // final RexCall call = (RexCall) filter; + // RexNode left = call.getOperands().get(0); + // if (left.isA(SqlKind.CAST)) { + // left = ((RexCall) left).operands.get(0); + // } + // final RexNode right = call.getOperands().get(1); + // if (left instanceof RexInputRef && right instanceof RexLiteral) { + // final int index = ((RexInputRef) left).getIndex(); + // if (filterValues[index] == null) { + // filterValues[index] = ((RexLiteral) right).getValue2().toString(); + // return true; + // } + // } + // } + // return false; + // } } \ No newline at end of file diff --git a/core/src/arc/calcite/SidewinderDatabaseSchema.java b/core/src/main/java/com/srotya/sidewinder/core/sql/calcite/SidewinderDatabaseSchema.java similarity index 87% rename from core/src/arc/calcite/SidewinderDatabaseSchema.java rename to core/src/main/java/com/srotya/sidewinder/core/sql/calcite/SidewinderDatabaseSchema.java index 5eca51d..03c4c92 100644 --- a/core/src/arc/calcite/SidewinderDatabaseSchema.java +++ b/core/src/main/java/com/srotya/sidewinder/core/sql/calcite/SidewinderDatabaseSchema.java @@ -17,6 +17,8 @@ import java.util.HashMap; import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; import org.apache.calcite.schema.Table; import org.apache.calcite.schema.impl.AbstractSchema; @@ -28,6 +30,7 @@ */ public class SidewinderDatabaseSchema extends AbstractSchema { + private static final Logger logger = Logger.getLogger(SidewinderDatabaseSchema.class.getName()); private String dbName; private StorageEngine engine; @@ -35,7 +38,7 @@ public SidewinderDatabaseSchema(StorageEngine engine, String dbName) { this.engine = engine; this.dbName = dbName; } - + @Override protected Map getTableMap() { Map tableMap = new HashMap<>(); @@ -48,11 +51,9 @@ protected Map getTableMap() { } } } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); + logger.log(Level.SEVERE, "Failed to get table map for query", e); } - System.err.println(tableMap); return tableMap; } - + } \ No newline at end of file diff --git a/core/src/arc/calcite/SidewinderSchemaFactory.java b/core/src/main/java/com/srotya/sidewinder/core/sql/calcite/SidewinderSchemaFactory.java similarity index 78% rename from core/src/arc/calcite/SidewinderSchemaFactory.java rename to core/src/main/java/com/srotya/sidewinder/core/sql/calcite/SidewinderSchemaFactory.java index 5fd0ec3..afb07be 100644 --- a/core/src/arc/calcite/SidewinderSchemaFactory.java +++ b/core/src/main/java/com/srotya/sidewinder/core/sql/calcite/SidewinderSchemaFactory.java @@ -16,7 +16,6 @@ package com.srotya.sidewinder.core.sql.calcite; import java.io.IOException; -import java.util.HashMap; import java.util.Map; import java.util.concurrent.ScheduledExecutorService; @@ -24,19 +23,17 @@ import org.apache.calcite.schema.SchemaFactory; import org.apache.calcite.schema.SchemaPlus; -import com.srotya.sidewinder.core.storage.mem.MemStorageEngine; +import com.srotya.sidewinder.core.storage.StorageEngine; /** * @author ambud */ public class SidewinderSchemaFactory implements SchemaFactory { - private MemStorageEngine engine; + private StorageEngine engine; - public SidewinderSchemaFactory(ScheduledExecutorService bgTasks) throws IOException { - this.engine = new MemStorageEngine(); - this.engine.configure(new HashMap<>(), bgTasks); - this.engine.connect(); + public SidewinderSchemaFactory(StorageEngine engine, ScheduledExecutorService bgTasks) throws IOException { + this.engine = engine; } @Override diff --git a/core/src/arc/calcite/functions/DateDiffFunction.java b/core/src/main/java/com/srotya/sidewinder/core/sql/calcite/functions/DateDiffFunction.java similarity index 100% rename from core/src/arc/calcite/functions/DateDiffFunction.java rename to core/src/main/java/com/srotya/sidewinder/core/sql/calcite/functions/DateDiffFunction.java diff --git a/core/src/arc/calcite/functions/NowFunction.java b/core/src/main/java/com/srotya/sidewinder/core/sql/calcite/functions/NowFunction.java similarity index 100% rename from core/src/arc/calcite/functions/NowFunction.java rename to core/src/main/java/com/srotya/sidewinder/core/sql/calcite/functions/NowFunction.java diff --git a/core/src/arc/calcite/functions/ToMilliseconds.java b/core/src/main/java/com/srotya/sidewinder/core/sql/calcite/functions/ToMilliseconds.java similarity index 100% rename from core/src/arc/calcite/functions/ToMilliseconds.java rename to core/src/main/java/com/srotya/sidewinder/core/sql/calcite/functions/ToMilliseconds.java diff --git a/core/src/arc/calcite/functions/ToTimestamp.java b/core/src/main/java/com/srotya/sidewinder/core/sql/calcite/functions/ToTimestamp.java similarity index 100% rename from core/src/arc/calcite/functions/ToTimestamp.java rename to core/src/main/java/com/srotya/sidewinder/core/sql/calcite/functions/ToTimestamp.java diff --git a/core/src/main/java/com/srotya/sidewinder/core/storage/Measurement.java b/core/src/main/java/com/srotya/sidewinder/core/storage/Measurement.java new file mode 100644 index 0000000..b936c3c --- /dev/null +++ b/core/src/main/java/com/srotya/sidewinder/core/storage/Measurement.java @@ -0,0 +1,275 @@ +/** + * Copyright 2017 Ambud Sharma + * + * Licensed 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 com.srotya.sidewinder.core.storage; + +import java.io.IOException; +import java.nio.ByteBuffer; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Map.Entry; +import java.util.concurrent.ScheduledExecutorService; +import java.util.logging.Level; +import java.util.logging.Logger; + +import com.srotya.sidewinder.core.aggregators.AggregationFunction; +import com.srotya.sidewinder.core.filters.Filter; +import com.srotya.sidewinder.core.predicates.Predicate; +import com.srotya.sidewinder.core.storage.compression.Reader; + +/** + * @author ambud + */ +public interface Measurement { + + public static final String FIELD_TAG_SEPARATOR = "#"; + public static final String TAG_SEPARATOR = "_"; + + public void configure(Map conf, String measurementName, String baseIndexDirectory, + String dataDirectory, DBMetadata metadata, ScheduledExecutorService bgTaskPool) throws IOException; + + public Collection getTimeSeries(); + + public Map getTimeSeriesMap(); + + public TagIndex getTagIndex(); + + public void loadTimeseriesFromMeasurements() throws IOException; + + public void close() throws IOException; + + public ByteBuffer createNewBuffer(String seriesId) throws IOException; + + public TimeSeries getOrCreateTimeSeries(String valueFieldName, List tags, int timeBucketSize, boolean fp, + Map conf) throws IOException; + + public static void indexRowKey(TagIndex tagIndex, String rowKey, List tags) throws IOException { + for (String tag : tags) { + tagIndex.index(tag, rowKey); + } + } + + public default String encodeTagsToString(TagIndex tagIndex, List tags) throws IOException { + StringBuilder builder = new StringBuilder(tags.size() * 5); + builder.append(tagIndex.createEntry(tags.get(0))); + for (int i = 1; i < tags.size(); i++) { + String tag = tags.get(i); + builder.append(TAG_SEPARATOR); + builder.append(tagIndex.createEntry(tag)); + } + return builder.toString(); + } + + public default String constructSeriesId(String valueFieldName, List tags, TagIndex index) + throws IOException { + String encodeTagsToString = encodeTagsToString(index, tags); + StringBuilder rowKeyBuilder = new StringBuilder(valueFieldName.length() + 1 + encodeTagsToString.length()); + rowKeyBuilder.append(valueFieldName); + rowKeyBuilder.append(FIELD_TAG_SEPARATOR); + rowKeyBuilder.append(encodeTagsToString); + return rowKeyBuilder.toString(); + } + + public default List decodeStringToTags(TagIndex tagLookupTable, String tagString) { + List tagList = new ArrayList<>(); + if (tagString == null || tagString.isEmpty()) { + return tagList; + } + for (String tag : tagString.split(TAG_SEPARATOR)) { + tagList.add(tagLookupTable.getEntry(tag)); + } + return tagList; + } + + public String getMeasurementName(); + + public default List> getTagsForMeasurement(String valueFieldName) throws Exception { + Set keySet = new HashSet<>(); + for (Entry entry : getTimeSeriesMap().entrySet()) { + if (entry.getKey().startsWith(valueFieldName)) { + keySet.add(entry.getKey()); + } + } + List> tagList = new ArrayList<>(); + for (String entry : keySet) { + String[] keys = entry.split(FIELD_TAG_SEPARATOR); + if (!keys[0].equals(valueFieldName)) { + continue; + } + List tags = decodeStringToTags(getTagIndex(), keys[1]); + tagList.add(tags); + } + return tagList; + } + + public default Set getTagFilteredRowKeys(String valueFieldName, Filter> tagFilterTree, + List rawTags) throws IOException { + Set filteredSeries = getSeriesIdsWhereTags(rawTags); + for (Iterator iterator = filteredSeries.iterator(); iterator.hasNext();) { + String rowKey = iterator.next(); + if (!rowKey.startsWith(valueFieldName)) { + continue; + } + String[] keys = rowKey.split(FIELD_TAG_SEPARATOR); + if (keys.length != 2) { + // field encoding + getLogger().severe("Invalid series tag encode, series ingested without tag field encoding"); + iterator.remove(); + continue; + } + if (!keys[0].equals(valueFieldName)) { + iterator.remove(); + continue; + } + List seriesTags = null; + if (keys.length > 1) { + seriesTags = decodeStringToTags(getTagIndex(), keys[1]); + } else { + seriesTags = new ArrayList<>(); + } + if (!tagFilterTree.isRetain(seriesTags)) { + iterator.remove(); + } + } + return filteredSeries; + } + + public default void garbageCollector() throws IOException { + for (Entry entry : getTimeSeriesMap().entrySet()) { + try { + List garbage = entry.getValue().collectGarbage(); + for (TimeSeriesBucket timeSeriesBucket : garbage) { + timeSeriesBucket.delete(); + getLogger().info("Collecting garbage for bucket:" + entry.getKey()); + } + getLogger().fine("Collecting garbage for time series:" + entry.getKey()); + } catch (IOException e) { + getLogger().log(Level.SEVERE, "Error collecing garbage", e); + } + } + } + + public default TimeSeries getTimeSeries(String valueFieldName, List tags) throws IOException { + Collections.sort(tags); + String rowKey = constructSeriesId(valueFieldName, tags, getTagIndex()); + // check and create timeseries + TimeSeries timeSeries = getTimeSeriesMap().get(rowKey); + return timeSeries; + } + + public default Set getFieldsForMeasurement() { + Set results = new HashSet<>(); + Set keySet = getTimeSeriesMap().keySet(); + for (String key : keySet) { + String[] splits = key.split(FIELD_TAG_SEPARATOR); + if (splits.length == 2) { + results.add(splits[0]); + } + } + return results; + } + + public default Set getSeriesIdsWhereTags(List tags) throws IOException { + Set series = new HashSet<>(); + for (String tag : tags) { + Set keys = getTagIndex().searchRowKeysForTag(tag); + if (keys != null) { + series.addAll(keys); + } + } + return series; + } + + public default void queryDataPoints(String valueFieldName, long startTime, long endTime, List tagList, + Filter> tagFilter, Predicate valuePredicate, AggregationFunction aggregationFunction, + Set resultMap) throws IOException { + Set rowKeys = null; + if (tagList == null || tagList.size() == 0) { + rowKeys = getTimeSeriesMap().keySet(); + } else { + rowKeys = getTagFilteredRowKeys(valueFieldName, tagFilter, tagList); + } + for (String entry : rowKeys) { + String[] keys = entry.split(FIELD_TAG_SEPARATOR); + if (!keys[0].equals(valueFieldName)) { + continue; + } + List points = null; + List seriesTags = null; + if (keys.length > 1) { + seriesTags = decodeStringToTags(getTagIndex(), keys[1]); + } else { + seriesTags = new ArrayList<>(); + } + TimeSeries value = getTimeSeriesMap().get(entry); + if (value == null) { + getLogger().severe( + "Invalid time series value " + entry + "\t" + rowKeys + "\t" + "\n\n"); +// continue; + } + points = value.queryDataPoints(keys[0], seriesTags, startTime, endTime, valuePredicate); + if (aggregationFunction != null) { + points = aggregationFunction.aggregate(points); + } + if (points == null) { + points = new ArrayList<>(); + } + if (points.size() > 0) { + SeriesQueryOutput seriesQueryOutput = new SeriesQueryOutput(getMeasurementName(), keys[0], seriesTags); + seriesQueryOutput.setDataPoints(points); + resultMap.add(seriesQueryOutput); + } + } + } + + public default void queryReaders(String valueFieldName, long startTime, long endTime, + LinkedHashMap readers) throws IOException { + for (String entry : getTimeSeriesMap().keySet()) { + TimeSeries series = getTimeSeriesMap().get(entry); + String[] keys = entry.split(FIELD_TAG_SEPARATOR); + if (keys.length != 2) { + getLogger().log(Level.SEVERE, "Invalid situation, series ingested without tag"); + // field encoding + continue; + } + if (!keys[0].equals(valueFieldName)) { + continue; + } + List seriesTags = null; + if (keys.length > 1) { + seriesTags = decodeStringToTags(getTagIndex(), keys[1]); + } else { + seriesTags = new ArrayList<>(); + } + for (Reader reader : series.queryReader(valueFieldName, seriesTags, startTime, endTime, null)) { + readers.put(reader, series.isFp()); + } + } + } + + public default Set getTags() { + return getTagIndex().getTags(); + } + + public Logger getLogger(); + +} diff --git a/core/src/main/java/com/srotya/sidewinder/core/storage/StorageEngine.java b/core/src/main/java/com/srotya/sidewinder/core/storage/StorageEngine.java index a17a8a8..d1e598e 100644 --- a/core/src/main/java/com/srotya/sidewinder/core/storage/StorageEngine.java +++ b/core/src/main/java/com/srotya/sidewinder/core/storage/StorageEngine.java @@ -16,7 +16,6 @@ package com.srotya.sidewinder.core.storage; import java.io.IOException; -import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Set; @@ -26,7 +25,7 @@ import com.srotya.sidewinder.core.filters.AnyFilter; import com.srotya.sidewinder.core.filters.Filter; import com.srotya.sidewinder.core.predicates.Predicate; -import com.srotya.sidewinder.core.storage.mem.TimeSeries; +import com.srotya.sidewinder.core.storage.compression.Reader; /** * Interface for Timeseries Storage Engine @@ -46,8 +45,6 @@ public interface StorageEngine { public static final String RETENTION_HOURS = "default.series.retention.hours"; public static final int DEFAULT_RETENTION_HOURS = (int) Math .ceil((((double) DEFAULT_TIME_BUCKET_CONSTANT) * 24 / 60) / 60); - public static final String FIELD_TAG_SEPARATOR = "#"; - public static final String TAG_SEPARATOR = "_"; public static final String PERSISTENCE_DISK = "persistence.disk"; public static final String ARCHIVER_CLASS = "archiver.class"; public static final String GC_DELAY = "gc.delay"; @@ -247,8 +244,9 @@ public void updateTimeSeriesRetentionPolicy(String dbName, String measurementNam * @param dbName * @param measurementName * @param retentionHours + * @throws ItemNotFoundException */ - public void updateTimeSeriesRetentionPolicy(String dbName, String measurementName, int retentionHours); + public void updateTimeSeriesRetentionPolicy(String dbName, String measurementName, int retentionHours) throws ItemNotFoundException; /** * Update default retention policy for a database @@ -284,7 +282,7 @@ public default void updateDefaultTimeSeriesRetentionPolicy(String dbName, int re * @return databaseMap * @throws IOException */ - public Map> getOrCreateDatabase(String dbName) throws IOException; + public Map getOrCreateDatabase(String dbName) throws IOException; /** * Gets the database, creates it with supplied rention policy if it doesn't @@ -295,7 +293,7 @@ public default void updateDefaultTimeSeriesRetentionPolicy(String dbName, int re * @return measurementMap * @throws IOException */ - public Map> getOrCreateDatabase(String dbName, int retentionPolicy) + public Map getOrCreateDatabase(String dbName, int retentionPolicy) throws IOException; /** @@ -306,7 +304,7 @@ public Map> getOrCreateDatabase(String dbName, i * @return timeseriesMap * @throws IOException */ - public Map getOrCreateMeasurement(String dbName, String measurementName) throws IOException; + public Measurement getOrCreateMeasurement(String dbName, String measurementName) throws IOException; /** * Gets the Timeseries, creates it if it doesn't already exist @@ -383,47 +381,11 @@ public TimeSeries getTimeSeries(String dbName, String measurementName, String va */ public Map getDbMetadataMap(); - public TagIndex getOrCreateTagIndex(String dbName, String measurementName) throws IOException; - - public default void indexRowKey(TagIndex memTagLookupTable, String rowKey, List tags) throws IOException { - for (String tag : tags) { - memTagLookupTable.index(tag, rowKey); - } - } - - public default String encodeTagsToString(TagIndex tagLookupTable, List tags) throws IOException { - StringBuilder builder = new StringBuilder(tags.size() * 5); - builder.append(tagLookupTable.createEntry(tags.get(0))); - for (int i = 1; i < tags.size(); i++) { - String tag = tags.get(i); - builder.append(TAG_SEPARATOR); - builder.append(tagLookupTable.createEntry(tag)); - } - return builder.toString(); - } - - public default List decodeStringToTags(TagIndex tagLookupTable, String tagString) { - List tagList = new ArrayList<>(); - if (tagString == null || tagString.isEmpty()) { - return tagList; - } - for (String tag : tagString.split(TAG_SEPARATOR)) { - tagList.add(tagLookupTable.getEntry(tag)); - } - return tagList; - } - - public default String constructRowKey(String dbName, String measurementName, String valueFieldName, List tags) - throws IOException { - TagIndex memTagLookupTable = getOrCreateTagIndex(dbName, measurementName); - String encodeTagsToString = encodeTagsToString(memTagLookupTable, tags); - StringBuilder rowKeyBuilder = new StringBuilder(valueFieldName.length() + 1 + encodeTagsToString.length()); - rowKeyBuilder.append(valueFieldName); - rowKeyBuilder.append(FIELD_TAG_SEPARATOR); - rowKeyBuilder.append(encodeTagsToString); - String rowKey = rowKeyBuilder.toString(); - indexRowKey(memTagLookupTable, rowKey, tags); - return rowKey; - } + public Map> getMeasurementMap(); + + Set getSeriesIdsWhereTags(String dbName, String measurementName, List rawTags) throws ItemNotFoundException, Exception; + + Set getTagFilteredRowKeys(String dbName, String measurementName, String valueFieldName, + Filter> tagFilterTree, List tags) throws ItemNotFoundException, Exception; } diff --git a/core/src/main/java/com/srotya/sidewinder/core/storage/disk/PersistentTimeSeries.java b/core/src/main/java/com/srotya/sidewinder/core/storage/TimeSeries.java similarity index 60% rename from core/src/main/java/com/srotya/sidewinder/core/storage/disk/PersistentTimeSeries.java rename to core/src/main/java/com/srotya/sidewinder/core/storage/TimeSeries.java index 2d04298..d524057 100644 --- a/core/src/main/java/com/srotya/sidewinder/core/storage/disk/PersistentTimeSeries.java +++ b/core/src/main/java/com/srotya/sidewinder/core/storage/TimeSeries.java @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.srotya.sidewinder.core.storage.disk; +package com.srotya.sidewinder.core.storage; -import java.io.File; import java.io.IOException; +import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -25,7 +25,6 @@ import java.util.SortedMap; import java.util.TreeMap; import java.util.concurrent.ConcurrentSkipListMap; -import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; import java.util.logging.Level; @@ -33,13 +32,8 @@ import com.srotya.sidewinder.core.predicates.BetweenPredicate; import com.srotya.sidewinder.core.predicates.Predicate; -import com.srotya.sidewinder.core.storage.DBMetadata; -import com.srotya.sidewinder.core.storage.DataPoint; -import com.srotya.sidewinder.core.storage.Reader; -import com.srotya.sidewinder.core.storage.RejectException; -import com.srotya.sidewinder.core.storage.TimeSeriesBucket; -import com.srotya.sidewinder.core.storage.mem.TimeSeries; -import com.srotya.sidewinder.core.utils.MiscUtils; +import com.srotya.sidewinder.core.storage.compression.Reader; +import com.srotya.sidewinder.core.storage.compression.RollOverException; import com.srotya.sidewinder.core.utils.TimeUtils; /** @@ -53,32 +47,31 @@ * * @author ambud */ -public class PersistentTimeSeries extends TimeSeries { +public class TimeSeries { - private SortedMap bucketMap; + private static final Logger logger = Logger.getLogger(TimeSeries.class.getName()); + private SortedMap> bucketMap; private boolean fp; private AtomicInteger retentionBuckets; - private static final Logger logger = Logger.getLogger(PersistentTimeSeries.class.getName()); private String seriesId; - private int timeBucketSize; private String compressionFQCN; private Map conf; - private String bucketMapPath; + private Measurement measurement; + private int timeBucketSize; + private int bucketCount; /** * @param seriesId * used for logger name * @param metadata * duration of data that will be stored in this time series - * @param timeBucketSize - * size of each time bucket (partition) * @param fp * @param bgTaskPool * @throws IOException */ - public PersistentTimeSeries(String measurementPath, String compressionFQCN, String seriesId, DBMetadata metadata, - int timeBucketSize, boolean fp, Map conf, ScheduledExecutorService bgTaskPool) - throws IOException { + public TimeSeries(Measurement measurement, String compressionFQCN, String seriesId, int timeBucketSize, + DBMetadata metadata, boolean fp, Map conf) throws IOException { + this.measurement = measurement; this.compressionFQCN = compressionFQCN; this.seriesId = seriesId; this.timeBucketSize = timeBucketSize; @@ -86,38 +79,97 @@ public PersistentTimeSeries(String measurementPath, String compressionFQCN, Stri retentionBuckets = new AtomicInteger(0); setRetentionHours(metadata.getRetentionHours()); this.fp = fp; -// bucketMap = new ConcurrentLRUSortedMap(2); bucketMap = new ConcurrentSkipListMap<>(); - bucketMapPath = measurementPath + "/" + seriesId; - this.conf.put("data.dir", bucketMapPath); - new File(bucketMapPath).mkdirs(); - bucketMapPath += "/.bucket"; - loadBucketMap(bucketMapPath); + } + + public TimeSeriesBucket getOrCreateSeriesBucket(TimeUnit unit, long timestamp) throws IOException { + int bucket = TimeUtils.getTimeBucket(unit, timestamp, timeBucketSize); + String tsBucket = Integer.toHexString(bucket); + List list = bucketMap.get(tsBucket); + if (list == null) { + synchronized (bucketMap) { + if ((list = bucketMap.get(tsBucket)) == null) { + list = new ArrayList<>(); + createNewTimeSeriesBucket(timestamp, tsBucket, list); + bucketMap.put(tsBucket, list); + } + } + } + + TimeSeriesBucket ans = list.get(list.size() - 1); + if (ans.isFull()) { + synchronized (bucketMap) { + if ((ans = list.get(list.size() - 1)).isFull()) { + logger.fine("Requesting new time series:" + seriesId + ",measurement:" + + measurement.getMeasurementName() + "\t" + bucketCount); + ans = createNewTimeSeriesBucket(timestamp, tsBucket, list); + } + } + } + try { + return ans; + } catch (Exception e) { + logger.log(Level.SEVERE, "Create new:" + "\tList:" + list + "\tbucket:" + tsBucket + "\t" + bucketMap, e); + e.printStackTrace(); + throw e; + } + } + + private TimeSeriesBucket createNewTimeSeriesBucket(long timestamp, String tsBucket, List list) + throws IOException { + ByteBuffer buf = measurement.createNewBuffer(seriesId); + // writeStringToBuffer(seriesId, buf); + writeStringToBuffer(tsBucket, buf); + buf.putLong(timestamp); + buf = buf.slice(); + TimeSeriesBucket bucketEntry = new TimeSeriesBucket(compressionFQCN, timestamp, conf, buf, true); + list.add(bucketEntry); + bucketCount++; + return bucketEntry; } /** * Function to check and recover existing bucket map, if one exists. * - * @param bucketMapPath + * @param list2 * @throws IOException */ - protected void loadBucketMap(String bucketMapPath) throws IOException { - File file = new File(bucketMapPath); - if (!file.exists()) { - return; - } - List bucketEntries = MiscUtils.readAllLines(file); - for (String bucketEntry : bucketEntries) { - String[] split = bucketEntry.split("\t"); - logger.fine("Loading bucketmap:" + seriesId + "\t" + split[1]); - bucketMap.put(split[0], new BucketEntry(split[0], new TimeSeriesBucket(combinedSeriesId(split[0]), - compressionFQCN, Long.parseLong(split[1]), true, conf))); + public void loadBucketMap(List bufList) throws IOException { + logger.info("Scanning buffer for:" + seriesId); + for (ByteBuffer entry : bufList) { + ByteBuffer duplicate = entry.duplicate(); + duplicate.rewind(); + // String series = getStringFromBuffer(duplicate); + // if (!series.equalsIgnoreCase(seriesId)) { + // continue; + // } + String tsBucket = getStringFromBuffer(duplicate); + List list = bucketMap.get(tsBucket); + if (list == null) { + list = new ArrayList<>(); + bucketMap.put(tsBucket, list); + } + long bucketTimestamp = duplicate.getLong(); + ByteBuffer slice = duplicate.slice(); + list.add(new TimeSeriesBucket(compressionFQCN, bucketTimestamp, conf, slice, false)); + logger.fine("Loading bucketmap:" + seriesId + "\t" + tsBucket); } } + public static String getStringFromBuffer(ByteBuffer buf) { + short length = buf.getShort(); + byte[] dst = new byte[length]; + buf.get(dst); + return new String(dst); + } + + public static void writeStringToBuffer(String str, ByteBuffer buf) { + buf.putShort((short) str.length()); + buf.put(str.getBytes()); + } + /** - * Extract {@link DataPoint}s for the supplied time range and value - * predicate. + * Extract {@link DataPoint}s for the supplied time range and value predicate. * * Each {@link DataPoint} has the appendFieldValue and appendTags set in it. * @@ -136,29 +188,30 @@ protected void loadBucketMap(String bucketMapPath) throws IOException { */ public List queryDataPoints(String appendFieldValueName, List appendTags, long startTime, long endTime, Predicate valuePredicate) throws IOException { - List readers = queryReader(appendFieldValueName, appendTags, startTime, endTime, valuePredicate); + if (startTime > endTime) { + // swap start and end times if they are off + startTime = startTime ^ endTime; + endTime = endTime ^ startTime; + startTime = startTime ^ endTime; + } + List readers = new ArrayList<>(); + BetweenPredicate timeRangePredicate = new BetweenPredicate(startTime, endTime); + int tsStartBucket = TimeUtils.getTimeBucket(TimeUnit.MILLISECONDS, startTime, timeBucketSize) - timeBucketSize; + String startTsBucket = Integer.toHexString(tsStartBucket); + int tsEndBucket = TimeUtils.getTimeBucket(TimeUnit.MILLISECONDS, endTime, timeBucketSize); + String endTsBucket = Integer.toHexString(tsEndBucket); + SortedMap> series = bucketMap.subMap(startTsBucket, + endTsBucket + Character.MAX_VALUE); + for (List timeSeries : series.values()) { + for (TimeSeriesBucket bucketEntry : timeSeries) { + readers.add(bucketEntry.getReader(timeRangePredicate, valuePredicate, fp, appendFieldValueName, + appendTags)); + } + } List points = new ArrayList<>(); for (Reader reader : readers) { readerToDataPoints(points, reader); } - /* - * if (startTime > endTime) { // swap start and end times if they are - * off startTime = startTime ^ endTime; endTime = endTime ^ startTime; - * startTime = startTime ^ endTime; } - * - * BetweenPredicate timeRangePredicate = new BetweenPredicate(startTime, - * endTime); int tsStartBucket = - * TimeUtils.getTimeBucket(TimeUnit.MILLISECONDS, startTime, - * timeBucketSize) - timeBucketSize; String startTsBucket = - * Integer.toHexString(tsStartBucket); int tsEndBucket = - * TimeUtils.getTimeBucket(TimeUnit.MILLISECONDS, endTime, - * timeBucketSize); String endTsBucket = - * Integer.toHexString(tsEndBucket); SortedMap - * series = bucketMap.subMap(startTsBucket, endTsBucket + - * Character.MAX_VALUE); for (BucketEntry timeSeries : series.values()) - * { seriesToDataPoints(appendFieldValueName, appendTags, points, - * timeSeries.getValue(), timeRangePredicate, valuePredicate, fp); } - */ return points; } @@ -194,16 +247,19 @@ public List queryReader(String appendFieldValueName, List append String startTsBucket = Integer.toHexString(tsStartBucket); int tsEndBucket = TimeUtils.getTimeBucket(TimeUnit.MILLISECONDS, endTime, timeBucketSize); String endTsBucket = Integer.toHexString(tsEndBucket); - SortedMap series = bucketMap.subMap(startTsBucket, endTsBucket + Character.MAX_VALUE); - for (BucketEntry timeSeries : series.values()) { - readers.add(timeSeries.getValue().getReader(timeRangePredicate, valuePredicate, fp, appendFieldValueName, - appendTags)); + SortedMap> series = bucketMap.subMap(startTsBucket, + endTsBucket + Character.MAX_VALUE); + for (List timeSeries : series.values()) { + for (TimeSeriesBucket bucketEntry : timeSeries) { + readers.add(bucketEntry.getReader(timeRangePredicate, valuePredicate, fp, appendFieldValueName, + appendTags)); + } } return readers; } /** - * Add data point with non floating point value + * Add data point with floating point value * * @param unit * of time for the supplied timestamp @@ -211,47 +267,22 @@ public List queryReader(String appendFieldValueName, List append * of this data point * @param value * of this data point - * @throws RejectException + * @throws IOException */ - public void addDataPoint(TimeUnit unit, long timestamp, long value) throws IOException { + public void addDataPoint(TimeUnit unit, long timestamp, double value) throws IOException { TimeSeriesBucket timeseriesBucket = getOrCreateSeriesBucket(unit, timestamp); - timeseriesBucket.addDataPoint(timestamp, value); - } - - public TimeSeriesBucket getOrCreateSeriesBucket(TimeUnit unit, long timestamp) throws IOException { - int bucket = TimeUtils.getTimeBucket(unit, timestamp, timeBucketSize); - String tsBucket = Integer.toHexString(bucket); - BucketEntry timeseriesBucket = bucketMap.get(tsBucket); - if (timeseriesBucket == null) { - synchronized (bucketMap) { - if ((timeseriesBucket = bucketMap.get(tsBucket)) == null) { - timeseriesBucket = new BucketEntry(tsBucket, - new TimeSeriesBucket(combinedSeriesId(tsBucket), compressionFQCN, timestamp, true, conf)); - appendBucketToSeriesFile(tsBucket, timestamp); - bucketMap.put(tsBucket, timeseriesBucket); - } - } + try { + timeseriesBucket.addDataPoint(timestamp, value); + } catch (RollOverException e) { + timeseriesBucket.setFull(true); + addDataPoint(unit, timestamp, value); + } catch (NullPointerException e) { + logger.log(Level.SEVERE, "\n\nNPE occurred for add datapoint operation\n\n", e); } - return timeseriesBucket.getValue(); - } - - private String combinedSeriesId(String tsBucket) { - return tsBucket; } /** - * Method to update the series bucket mapping file. - * - * @param tsBucket - * @param timestamp - * @throws IOException - */ - protected void appendBucketToSeriesFile(String tsBucket, long timestamp) throws IOException { - DiskStorageEngine.appendLineToFile(tsBucket + "\t" + timestamp, bucketMapPath); - } - - /** - * Add data point with floating point value + * Add data point with non floating point value * * @param unit * of time for the supplied timestamp @@ -259,18 +290,25 @@ protected void appendBucketToSeriesFile(String tsBucket, long timestamp) throws * of this data point * @param value * of this data point - * @throws RejectException + * @throws IOException */ - public void addDataPoint(TimeUnit unit, long timestamp, double value) throws IOException { + public void addDataPoint(TimeUnit unit, long timestamp, long value) throws IOException { TimeSeriesBucket timeseriesBucket = getOrCreateSeriesBucket(unit, timestamp); - timeseriesBucket.addDataPoint(timestamp, value); + try { + timeseriesBucket.addDataPoint(timestamp, value); + } catch (RollOverException e) { + timeseriesBucket.setFull(true); + addDataPoint(unit, timestamp, value); + } catch (NullPointerException e) { + logger.log(Level.SEVERE, "\n\nNPE occurred for add datapoint operation\n\n", e); + } } /** * Converts timeseries to a list of datapoints appended to the supplied list - * object. Datapoints are filtered by the supplied predicates before they - * are returned. These predicates are pushed down to the reader for - * efficiency and performance as it prevents unnecessary object creation. + * object. Datapoints are filtered by the supplied predicates before they are + * returned. These predicates are pushed down to the reader for efficiency and + * performance as it prevents unnecessary object creation. * * @param appendFieldValueName * @param appendTags @@ -334,20 +372,24 @@ public static List readerToDataPoints(List points, Reader } return points; } - + /** * Cleans stale series + * + * @throws IOException */ - public List collectGarbage() { + public List collectGarbage() throws IOException { List gcedBuckets = new ArrayList<>(); while (bucketMap.size() > retentionBuckets.get()) { int oldSize = bucketMap.size(); String key = bucketMap.firstKey(); - BucketEntry bucket = bucketMap.remove(key); - bucket.close(); - gcedBuckets.add(bucket.getValue()); - logger.log(Level.INFO, "GC, removing bucket:" + key + ": as it passed retention period of:" - + retentionBuckets.get() + ":old size:" + oldSize + ":newsize:" + bucketMap.size() + ":"); + List buckets = bucketMap.remove(key); + for (TimeSeriesBucket bucket : buckets) { + bucket.close(); + gcedBuckets.add(bucket); + logger.log(Level.INFO, "GC, removing bucket:" + key + ": as it passed retention period of:" + + retentionBuckets.get() + ":old size:" + oldSize + ":newsize:" + bucketMap.size() + ":"); + } } return gcedBuckets; } @@ -364,13 +406,6 @@ public void setRetentionHours(int retentionHours) { this.retentionBuckets.set((int) ((long) retentionHours * 3600) / timeBucketSize); } - /** - * @return the timeBucketSize - */ - public int getTimeBucketSize() { - return timeBucketSize; - } - /** * @return number of {@link TimeSeriesBucket}s to retain for this * {@link TimeSeries} @@ -384,8 +419,12 @@ public int getRetentionBuckets() { */ public SortedMap getBucketMap() { SortedMap map = new TreeMap<>(); - for (Entry entry : bucketMap.entrySet()) { - map.put(entry.getKey(), entry.getValue().getValue()); + for (Entry> entry : bucketMap.entrySet()) { + List value = entry.getValue(); + for (int i = 0; i < value.size(); i++) { + TimeSeriesBucket bucketEntry = value.get(i); + map.put(entry.getKey() + i, bucketEntry); + } } return map; } @@ -423,4 +462,21 @@ public String toString() { + ", logger=" + logger + ", seriesId=" + seriesId + ", timeBucketSize=" + timeBucketSize + "]"; } + public void close() throws IOException { + // TODO close series + } + + public int getTimeBucketSize() { + return timeBucketSize; + } + + /** + * FOR UNIT TESTING ONLY + * + * @return + */ + public int getBucketCount() { + return bucketCount; + } + } diff --git a/core/src/main/java/com/srotya/sidewinder/core/storage/TimeSeriesBucket.java b/core/src/main/java/com/srotya/sidewinder/core/storage/TimeSeriesBucket.java index 1d5937d..7573fbd 100644 --- a/core/src/main/java/com/srotya/sidewinder/core/storage/TimeSeriesBucket.java +++ b/core/src/main/java/com/srotya/sidewinder/core/storage/TimeSeriesBucket.java @@ -17,10 +17,14 @@ import java.io.IOException; import java.io.Serializable; +import java.nio.ByteBuffer; import java.util.List; import java.util.Map; import com.srotya.sidewinder.core.predicates.Predicate; +import com.srotya.sidewinder.core.storage.compression.Reader; +import com.srotya.sidewinder.core.storage.compression.RollOverException; +import com.srotya.sidewinder.core.storage.compression.Writer; /** * In-memory representation of a time series based on Facebook's Gorilla @@ -36,15 +40,16 @@ public class TimeSeriesBucket implements Serializable { // private static final RejectException OLD_DATA_POINT = new // RejectException("Rejected older datapoint"); private Writer writer; + private TimeSeriesBucket prev, next; private long headerTimestamp; + private volatile boolean full; - public TimeSeriesBucket(String seriesId, String compressionFQCN, long headerTimestamp, boolean disk, - Map conf) { + public TimeSeriesBucket(String compressionFQCN, long headerTimestamp, Map conf, ByteBuffer buf, + boolean isNew) { this.headerTimestamp = headerTimestamp; try { writer = (Writer) Class.forName(compressionFQCN).newInstance(); - writer.setSeriesId(seriesId); - writer.configure(conf); + writer.configure(conf, buf, isNew); } catch (InstantiationException | IllegalAccessException | ClassNotFoundException | IOException e) { e.printStackTrace(); throw new RuntimeException(e); @@ -55,34 +60,36 @@ public TimeSeriesBucket(String seriesId, String compressionFQCN, long headerTime /** * Add data point with a double value and timestamp.
*
- * Throws {@link RejectException} if the caller tries to add data older than - * the current timestamp. + * Throws {@link RejectException} if the caller tries to add data older than the + * current timestamp. * * @param timestamp * @param value - * @throws RejectException + * @throws RollOverException + * @throws IOException */ - public void addDataPoint(long timestamp, double value) throws IOException { + public void addDataPoint(long timestamp, double value) throws IOException, RollOverException { writer.addValue(timestamp, value); } /** * Add data point with a long value and timestamp.
*
- * Throws {@link RejectException} if the caller tries to add data older than - * the current timestamp. + * Throws {@link RejectException} if the caller tries to add data older than the + * current timestamp. * * @param timestamp * @param value - * @throws RejectException + * @throws RollOverException + * @throws IOException */ - public void addDataPoint(long timestamp, long value) throws IOException { + public void addDataPoint(long timestamp, long value) throws IOException, RollOverException { writer.addValue(timestamp, value); } /** - * Get {@link Reader} with time and value filter predicates pushed-down to - * it. Along with {@link DataPoint} enrichments pushed to it. + * Get {@link Reader} with time and value filter predicates pushed-down to it. + * Along with {@link DataPoint} enrichments pushed to it. * * @param timePredicate * @param valuePredicate @@ -90,7 +97,7 @@ public void addDataPoint(long timestamp, long value) throws IOException { * @param appendFieldValueName * @param appendTags * @return point in time instance of reader - * @throws IOException + * @throws IOException */ public Reader getReader(Predicate timePredicate, Predicate valuePredicate, boolean isFp, String appendFieldValueName, List appendTags) throws IOException { @@ -104,13 +111,12 @@ public Reader getReader(Predicate timePredicate, Predicate valuePredicate, boole } /** - * Get {@link Reader} with time and value filter predicates pushed-down to - * it. + * Get {@link Reader} with time and value filter predicates pushed-down to it. * * @param timePredicate * @param valuePredicate * @return point in time instance of reader - * @throws IOException + * @throws IOException */ public Reader getReader(Predicate timePredicate, Predicate valuePredicate) throws IOException { Reader reader = writer.getReader(); @@ -119,18 +125,11 @@ public Reader getReader(Predicate timePredicate, Predicate valuePredicate) throw return reader; } - /** - * @return the headerTimestamp - */ - public long getHeaderTimestamp() { - return headerTimestamp; - } - /** * Get count of data points currently hosted in this bucket * * @return - * @throws IOException + * @throws IOException */ public int getCount() throws IOException { return getReader(null, null).getPairCount(); @@ -145,16 +144,59 @@ public int getCount() throws IOException { public double getCompressionRatio() { return writer.getCompressionRatio(); } - + public Writer getWriter() { return writer; } public void close() throws IOException { - writer.close(); } - + public void delete() throws IOException { - writer.delete(); + } + + /** + * @return the prev + */ + public TimeSeriesBucket getPrev() { + return prev; + } + + /** + * @return the next + */ + public TimeSeriesBucket getNext() { + return next; + } + + /** + * @return the headerTimestamp + */ + public long getHeaderTimestamp() { + return headerTimestamp; + } + + /** + * @return the full + */ + public boolean isFull() { + return full; + } + + /** + * @param full the full to set + */ + public void setFull(boolean full) { + this.full = full; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "TimeSeriesBucket [headerTimestamp=" + headerTimestamp + "]"; } } \ No newline at end of file diff --git a/core/src/arc/sql/sql/operators/Operator.java b/core/src/main/java/com/srotya/sidewinder/core/storage/compression/CompressionCaller.java similarity index 71% rename from core/src/arc/sql/sql/operators/Operator.java rename to core/src/main/java/com/srotya/sidewinder/core/storage/compression/CompressionCaller.java index 2a39533..805650e 100644 --- a/core/src/arc/sql/sql/operators/Operator.java +++ b/core/src/main/java/com/srotya/sidewinder/core/storage/compression/CompressionCaller.java @@ -1,27 +1,28 @@ -/** - * Copyright 2016 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.sql.operators; - -import com.srotya.sidewinder.core.storage.DataPoint; - -/** - * @author ambud - */ -public interface Operator { - - boolean operate(DataPoint value); - -} +/** + * Copyright 2017 Ambud Sharma + * + * Licensed 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 com.srotya.sidewinder.core.storage.compression; + +import java.io.IOException; +import java.nio.ByteBuffer; + +/** + * @author ambud + */ +public interface CompressionCaller { + + public ByteBuffer expandBuffer() throws IOException; + +} \ No newline at end of file diff --git a/core/src/main/java/com/srotya/sidewinder/core/storage/Reader.java b/core/src/main/java/com/srotya/sidewinder/core/storage/compression/Reader.java similarity index 87% rename from core/src/main/java/com/srotya/sidewinder/core/storage/Reader.java rename to core/src/main/java/com/srotya/sidewinder/core/storage/compression/Reader.java index afdda5b..a36ada1 100644 --- a/core/src/main/java/com/srotya/sidewinder/core/storage/Reader.java +++ b/core/src/main/java/com/srotya/sidewinder/core/storage/compression/Reader.java @@ -13,12 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.srotya.sidewinder.core.storage; +package com.srotya.sidewinder.core.storage.compression; import java.io.IOException; import java.util.List; import com.srotya.sidewinder.core.predicates.Predicate; +import com.srotya.sidewinder.core.storage.DataPoint; /** * @author ambud @@ -31,14 +32,14 @@ public interface Reader { public int getPairCount(); - public void setTimePredicate(Predicate timePredicate); - - public void setValuePredicate(Predicate valuePredicate); - public void setIsFP(boolean fp); public void setFieldName(String fieldName); public void setTags(List tags); + + public void setTimePredicate(Predicate timePredicate); + + public void setValuePredicate(Predicate valuePredicate); } diff --git a/core/src/arc/sql/sql/calcite/NowFunction.java b/core/src/main/java/com/srotya/sidewinder/core/storage/compression/RollOverException.java similarity index 69% rename from core/src/arc/sql/sql/calcite/NowFunction.java rename to core/src/main/java/com/srotya/sidewinder/core/storage/compression/RollOverException.java index 155a7ae..658e2cf 100644 --- a/core/src/arc/sql/sql/calcite/NowFunction.java +++ b/core/src/main/java/com/srotya/sidewinder/core/storage/compression/RollOverException.java @@ -13,21 +13,20 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.srotya.sidewinder.core.sql.calcite; +package com.srotya.sidewinder.core.storage.compression; -import java.sql.Timestamp; -import java.time.Instant; - -import org.apache.calcite.linq4j.function.Function0; +import java.io.IOException; /** * @author ambud */ -public class NowFunction implements Function0 { +public class RollOverException extends IOException { + + private static final long serialVersionUID = 1L; @Override - public Timestamp apply() { - return Timestamp.from(Instant.now()); + public synchronized Throwable fillInStackTrace() { + return this; } } diff --git a/core/src/main/java/com/srotya/sidewinder/core/storage/Writer.java b/core/src/main/java/com/srotya/sidewinder/core/storage/compression/Writer.java similarity index 63% rename from core/src/main/java/com/srotya/sidewinder/core/storage/Writer.java rename to core/src/main/java/com/srotya/sidewinder/core/storage/compression/Writer.java index c412303..750fd5f 100644 --- a/core/src/main/java/com/srotya/sidewinder/core/storage/Writer.java +++ b/core/src/main/java/com/srotya/sidewinder/core/storage/compression/Writer.java @@ -13,41 +13,46 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.srotya.sidewinder.core.storage; +package com.srotya.sidewinder.core.storage.compression; import java.io.IOException; import java.nio.ByteBuffer; +import java.util.List; import java.util.Map; +import com.srotya.sidewinder.core.storage.DataPoint; +import com.srotya.sidewinder.core.storage.RejectException; + /** * @author ambud */ public interface Writer { + + public static final RollOverException BUF_ROLLOVER_EXCEPTION = new RollOverException(); + public static final RejectException WRITE_REJECT_EXCEPTION = new RejectException(); public void addValue(long timestamp, long value) throws IOException; public void addValue(long timestamp, double value) throws IOException; + public void write(DataPoint dp) throws IOException; + + public void write(List dp) throws IOException; + public Reader getReader() throws IOException; public double getCompressionRatio(); public void setHeaderTimestamp(long timestamp); - public void configure(Map conf) throws IOException; + public void configure(Map conf, ByteBuffer buf, boolean isNew) throws IOException; public void bootstrap(ByteBuffer buf) throws IOException; - public void setSeriesId(String seriesId); - public ByteBuffer getRawBytes(); public void setCounter(int counter); - - public void close() throws IOException; - - public void setConf(Map conf); - - public void delete() throws IOException; + public void makeReadOnly(); + } \ No newline at end of file diff --git a/core/src/main/java/com/srotya/sidewinder/core/storage/compression/byzantine/ByzantineReader.java b/core/src/main/java/com/srotya/sidewinder/core/storage/compression/byzantine/ByzantineReader.java index f668f7b..ea2360d 100644 --- a/core/src/main/java/com/srotya/sidewinder/core/storage/compression/byzantine/ByzantineReader.java +++ b/core/src/main/java/com/srotya/sidewinder/core/storage/compression/byzantine/ByzantineReader.java @@ -21,8 +21,8 @@ import com.srotya.sidewinder.core.predicates.Predicate; import com.srotya.sidewinder.core.storage.DataPoint; -import com.srotya.sidewinder.core.storage.Reader; import com.srotya.sidewinder.core.storage.RejectException; +import com.srotya.sidewinder.core.storage.compression.Reader; /** * @author ambud diff --git a/core/src/main/java/com/srotya/sidewinder/core/storage/compression/byzantine/ByzantineWriter.java b/core/src/main/java/com/srotya/sidewinder/core/storage/compression/byzantine/ByzantineWriter.java index 051a3c9..fd6b01c 100644 --- a/core/src/main/java/com/srotya/sidewinder/core/storage/compression/byzantine/ByzantineWriter.java +++ b/core/src/main/java/com/srotya/sidewinder/core/storage/compression/byzantine/ByzantineWriter.java @@ -15,23 +15,16 @@ */ package com.srotya.sidewinder.core.storage.compression.byzantine; -import java.io.File; import java.io.IOException; -import java.io.RandomAccessFile; import java.nio.ByteBuffer; -import java.nio.MappedByteBuffer; -import java.nio.channels.FileChannel.MapMode; import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantReadWriteLock; -import java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock; -import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock; -import java.util.logging.Logger; import com.srotya.sidewinder.core.storage.DataPoint; -import com.srotya.sidewinder.core.storage.StorageEngine; -import com.srotya.sidewinder.core.storage.Writer; +import com.srotya.sidewinder.core.storage.compression.Writer; /** * A simple delta-of-delta timeseries compression with XOR value compression @@ -40,61 +33,51 @@ */ public class ByzantineWriter implements Writer { - private static final Logger logger = Logger.getLogger(ByzantineWriter.class.getName()); - public static final int DEFAULT_BUFFER_INIT_SIZE = 4096; private static final int BYTES_PER_DATAPOINT = 16; - private ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); - private ReadLock read = lock.readLock(); - private WriteLock write = lock.writeLock(); + private Lock read; + private Lock write; private long prevTs; private long delta; private int count; private long lastTs; private ByteBuffer buf; private long prevValue; - private String seriesId; - private boolean onDisk; - private String outputFile; - private boolean closed; - private Map conf; + private boolean readOnly; public ByzantineWriter() { } - public ByzantineWriter(long headerTimestamp, byte[] buf) { + /** + * For unit testing only + * + * @param headerTimestamp + * @param buf + */ + protected ByzantineWriter(long headerTimestamp, byte[] buf) { + this(); this.buf = ByteBuffer.allocateDirect(buf.length); setHeaderTimestamp(headerTimestamp); + ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); + read = lock.readLock(); + write = lock.writeLock(); } @Override - public void configure(Map conf) throws IOException { - this.conf = conf; - onDisk = Boolean.parseBoolean(conf.getOrDefault(StorageEngine.PERSISTENCE_DISK, "false")); - if (onDisk) { - RandomAccessFile file; - String outputDirectory = conf.getOrDefault("data.dir", "/tmp/sidewinder/data"); - outputFile = outputDirectory + "/" + seriesId; - logger.fine("\n\n" + outputFile + "\t" + outputFile + "\n\n"); - File fileTmp = new File(outputFile); - if (fileTmp.exists()) { - file = new RandomAccessFile(outputFile, "rwd"); - logger.fine("Re-loading data file:" + outputFile); - MappedByteBuffer map = file.getChannel().map(MapMode.READ_WRITE, 0, file.length()); - map.load(); - buf = map; - forwardCursorToEnd(); - } else { - fileTmp.createNewFile(); - file = new RandomAccessFile(outputFile, "rwd"); - buf = file.getChannel().map(MapMode.READ_WRITE, 0, DEFAULT_BUFFER_INIT_SIZE); - buf.putInt(0); - } - file.close(); + public void configure(Map conf, ByteBuffer buf, boolean isNew) throws IOException { + if (Boolean.parseBoolean(conf.getOrDefault("lock.enabled", "true"))) { + ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); + read = lock.readLock(); + write = lock.writeLock(); + } else { + read = new NoLock(); + write = new NoLock(); + } + this.buf = buf; + if (isNew) { + this.buf.putInt(0); } else { - buf = ByteBuffer.allocateDirect(DEFAULT_BUFFER_INIT_SIZE); - buf.putInt(0); + forwardCursorToEnd(); } - closed = false; } private void forwardCursorToEnd() throws IOException { @@ -108,19 +91,30 @@ private void forwardCursorToEnd() throws IOException { prevValue = reader.getPrevValue(); } + @Override public void write(DataPoint dp) throws IOException { - write.lock(); - writeDataPoint(dp.getTimestamp(), dp.getLongValue()); - write.unlock(); + if (readOnly) { + throw WRITE_REJECT_EXCEPTION; + } + try { + write.lock(); + writeDataPoint(dp.getTimestamp(), dp.getLongValue()); + } finally { + write.unlock(); + } } + @Override public void write(List dps) throws IOException { write.lock(); - for (Iterator itr = dps.iterator(); itr.hasNext();) { - DataPoint dp = itr.next(); - writeDataPoint(dp.getTimestamp(), dp.getLongValue()); + try { + for (Iterator itr = dps.iterator(); itr.hasNext();) { + DataPoint dp = itr.next(); + writeDataPoint(dp.getTimestamp(), dp.getLongValue()); + } + } finally { + write.unlock(); } - write.unlock(); } /** @@ -129,17 +123,12 @@ public void write(List dps) throws IOException { * @throws IOException */ private void writeDataPoint(long timestamp, long value) throws IOException { - if (closed && onDisk) { - configure(conf); - } lastTs = timestamp; checkAndExpandBuffer(); compressAndWriteTimestamp(buf, timestamp); compressAndWriteValue(buf, value); count++; - // if (onDisk) { updateCount(); - // } } private void compressAndWriteValue(ByteBuffer tBuf, long value) { @@ -163,32 +152,11 @@ private void compressAndWriteValue(ByteBuffer tBuf, long value) { } private void checkAndExpandBuffer() throws IOException { - if (buf.remaining() < 20) { - int cap = 0; - if (!onDisk) { - cap = (int) (buf.capacity() * 1.2); - if (cap < 0) { - throw new IOException("Buffer too large >2GB"); - } - } - expandBufferTo(cap); + if (buf.remaining() < 20 || buf.isReadOnly()) { + throw BUF_ROLLOVER_EXCEPTION; } } - private void expandBufferTo(int newBufferSize) throws IOException { - ByteBuffer temp = null; - if (onDisk) { - RandomAccessFile file = new RandomAccessFile(outputFile, "rwd"); - temp = file.getChannel().map(MapMode.READ_WRITE, 0, (int) (file.length() * 1.2)); - file.close(); - } else { - temp = ByteBuffer.allocateDirect(newBufferSize); - } - buf.flip(); - temp.put(buf); - buf = temp; - } - private void compressAndWriteTimestamp(ByteBuffer tBuf, long timestamp) { long ts = timestamp; long newDelta = (ts - prevTs); @@ -198,7 +166,7 @@ private void compressAndWriteTimestamp(ByteBuffer tBuf, long timestamp) { } else if (deltaOfDelta >= Byte.MIN_VALUE && deltaOfDelta <= Byte.MAX_VALUE) { tBuf.put((byte) 1); tBuf.put((byte) deltaOfDelta); - } else if (deltaOfDelta >= -32767 && deltaOfDelta <= 32768) { + } else if (deltaOfDelta >= Short.MIN_VALUE && deltaOfDelta <= Short.MAX_VALUE) { tBuf.put((byte) 10); tBuf.putShort((short) deltaOfDelta); } else { @@ -221,21 +189,21 @@ private void updateCount() { public ByzantineReader getReader() throws IOException { ByzantineReader reader = null; read.lock(); - if (closed && onDisk) { - configure(conf); - } ByteBuffer rbuf = buf.duplicate(); rbuf.rewind(); - read.unlock(); reader = new ByzantineReader(rbuf); + read.unlock(); return reader; } @Override public void addValue(long timestamp, long value) throws IOException { - write.lock(); - writeDataPoint(timestamp, value); - write.unlock(); + try { + write.lock(); + writeDataPoint(timestamp, value); + } finally { + write.unlock(); + } } @Override @@ -255,24 +223,17 @@ public void setHeaderTimestamp(long timestamp) { } } - /** - * @return the lock - */ - protected ReentrantReadWriteLock getLock() { - return lock; - } - /** * @return the read */ - protected ReadLock getRead() { + protected Lock getReadLock() { return read; } /** * @return the write */ - protected WriteLock getWrite() { + protected Lock getWriteLock() { return write; } @@ -318,11 +279,6 @@ protected long getPrevValue() { return prevValue; } - @Override - public void setSeriesId(String seriesId) { - this.seriesId = seriesId; - } - @Override public ByteBuffer getRawBytes() { read.lock(); @@ -337,9 +293,8 @@ public void bootstrap(ByteBuffer buf) throws IOException { write.lock(); this.buf.rewind(); buf.rewind(); - if (this.buf.capacity() < buf.limit()) { - // expand buffer - expandBufferTo(buf.limit()); + if (this.buf.limit() < buf.limit()) { + throw BUF_ROLLOVER_EXCEPTION; } this.buf.put(buf); this.buf.rewind(); @@ -353,31 +308,9 @@ public void setCounter(int count) { } @Override - public void close() throws IOException { + public void makeReadOnly() { write.lock(); - if (onDisk && !closed) { - logger.info("Data file being freed to contain file IO for:" + seriesId + "\t" + outputFile); - ((MappedByteBuffer) buf).force(); - buf = null; - closed = true; - } + readOnly = true; write.unlock(); } - - @Override - public void setConf(Map conf) { - this.conf = conf; - } - - @Override - public void delete() throws IOException { - if (!closed) { - close(); - } - if (onDisk) { - logger.info("Data file being deleted:" + seriesId + "\t" + outputFile); - new File(outputFile).delete(); - } - } - } diff --git a/core/src/main/java/com/srotya/sidewinder/core/storage/compression/byzantine/NoLock.java b/core/src/main/java/com/srotya/sidewinder/core/storage/compression/byzantine/NoLock.java new file mode 100644 index 0000000..57661b7 --- /dev/null +++ b/core/src/main/java/com/srotya/sidewinder/core/storage/compression/byzantine/NoLock.java @@ -0,0 +1,60 @@ +/** + * Copyright 2017 Ambud Sharma + * + * Licensed 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 com.srotya.sidewinder.core.storage.compression.byzantine; + +import java.util.concurrent.TimeUnit; +import java.util.concurrent.locks.Condition; +import java.util.concurrent.locks.Lock; + +/** + * @author ambud + */ +public class NoLock implements Lock { + + @Override + public void lock() { + // do nothing + } + + @Override + public void lockInterruptibly() throws InterruptedException { + // do nothing + } + + @Override + public boolean tryLock() { + // do nothing + return true; + } + + @Override + public boolean tryLock(long time, TimeUnit unit) throws InterruptedException { + // do nothing + return true; + } + + @Override + public void unlock() { + // do nothing + } + + @Override + public Condition newCondition() { + // do nothing + return null; + } + +} \ No newline at end of file diff --git a/core/src/main/java/com/srotya/sidewinder/core/storage/compression/dod/BitWriter.java b/core/src/main/java/com/srotya/sidewinder/core/storage/compression/dod/BitWriter.java index 85adc70..54c2c74 100644 --- a/core/src/main/java/com/srotya/sidewinder/core/storage/compression/dod/BitWriter.java +++ b/core/src/main/java/com/srotya/sidewinder/core/storage/compression/dod/BitWriter.java @@ -33,6 +33,10 @@ public BitWriter() { this(DEFAULT_BUFFER_SIZE); } + public BitWriter(ByteBuffer buf) { + buffer = buf; + } + public BitWriter(byte[] buf) { this(buf.length); buffer.put(buf); diff --git a/core/src/main/java/com/srotya/sidewinder/core/storage/compression/dod/DoD.java b/core/src/main/java/com/srotya/sidewinder/core/storage/compression/dod/DoD.java index ac16fcb..91bab08 100644 --- a/core/src/main/java/com/srotya/sidewinder/core/storage/compression/dod/DoD.java +++ b/core/src/main/java/com/srotya/sidewinder/core/storage/compression/dod/DoD.java @@ -20,6 +20,7 @@ import java.util.concurrent.Executors; import com.srotya.sidewinder.core.storage.DataPoint; +import com.srotya.sidewinder.core.storage.RejectException; /** */ @@ -38,7 +39,12 @@ public static void main(String[] args) throws InterruptedException { DataPoint dp = new DataPoint(); dp.setTimestamp(ts + k); dp.setLongValue(i); - gorilla.write(dp); + try { + gorilla.write(dp); + } catch (RejectException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } if (i % 1000 == 0) { try { Thread.sleep(1); diff --git a/core/src/main/java/com/srotya/sidewinder/core/storage/compression/dod/DoDReader.java b/core/src/main/java/com/srotya/sidewinder/core/storage/compression/dod/DoDReader.java index 5ef66c6..7a0fcf8 100644 --- a/core/src/main/java/com/srotya/sidewinder/core/storage/compression/dod/DoDReader.java +++ b/core/src/main/java/com/srotya/sidewinder/core/storage/compression/dod/DoDReader.java @@ -21,8 +21,8 @@ import com.srotya.sidewinder.core.predicates.Predicate; import com.srotya.sidewinder.core.storage.DataPoint; -import com.srotya.sidewinder.core.storage.Reader; import com.srotya.sidewinder.core.storage.RejectException; +import com.srotya.sidewinder.core.storage.compression.Reader; /** * @author ambud diff --git a/core/src/main/java/com/srotya/sidewinder/core/storage/compression/dod/DodWriter.java b/core/src/main/java/com/srotya/sidewinder/core/storage/compression/dod/DodWriter.java index bf37724..04e04e6 100644 --- a/core/src/main/java/com/srotya/sidewinder/core/storage/compression/dod/DodWriter.java +++ b/core/src/main/java/com/srotya/sidewinder/core/storage/compression/dod/DodWriter.java @@ -25,7 +25,8 @@ import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock; import com.srotya.sidewinder.core.storage.DataPoint; -import com.srotya.sidewinder.core.storage.Writer; +import com.srotya.sidewinder.core.storage.RejectException; +import com.srotya.sidewinder.core.storage.compression.Writer; /** * A simple delta-of-delta timeseries compression with no value compression @@ -42,42 +43,51 @@ public class DodWriter implements Writer { private long delta; private int count; private long lastTs; + private boolean readOnly; public DodWriter() { - writer = new BitWriter(4096); } public DodWriter(long headTs, byte[] buf) { prevTs = headTs; writer = new BitWriter(buf); } - + @Override - public void configure(Map conf) { + public void configure(Map conf, ByteBuffer buf, boolean isNew) throws IOException { + writer = new BitWriter(buf); } - public void write(DataPoint dp) { - write.lock(); - writeDataPoint(dp.getTimestamp(), dp.getLongValue()); - write.unlock(); + public void write(DataPoint dp) throws RejectException { + if (readOnly) { + throw WRITE_REJECT_EXCEPTION; + } + try { + write.lock(); + writeDataPoint(dp.getTimestamp(), dp.getLongValue()); + } finally { + write.unlock(); + } } public void write(List dps) { - write.lock(); - for (Iterator itr = dps.iterator(); itr.hasNext();) { - DataPoint dp = itr.next(); - writeDataPoint(dp.getTimestamp(), dp.getLongValue()); + try { + for (Iterator itr = dps.iterator(); itr.hasNext();) { + DataPoint dp = itr.next(); + writeDataPoint(dp.getTimestamp(), dp.getLongValue()); + } + } finally { + write.unlock(); } - write.unlock(); } /** - * (a) Calculate the delta of delta: D = (tn - tn1) - (tn1 - tn2) (b) If D - * is zero, then store a single `0' bit (c) If D is between [-63, 64], store - * `10' followed by the value (7 bits) (d) If D is between [-255, 256], - * store `110' followed by the value (9 bits) (e) if D is between [-2047, - * 2048], store `1110' followed by the value (12 bits) (f) Otherwise store - * `1111' followed by D using 32 bits + * (a) Calculate the delta of delta: D = (tn - tn1) - (tn1 - tn2) (b) If D is + * zero, then store a single `0' bit (c) If D is between [-63, 64], store `10' + * followed by the value (7 bits) (d) If D is between [-255, 256], store `110' + * followed by the value (9 bits) (e) if D is between [-2047, 2048], store + * `1110' followed by the value (12 bits) (f) Otherwise store `1111' followed by + * D using 32 bits * * @param dp */ @@ -94,7 +104,7 @@ private void writeDataPoint(long timestamp, long value) { prevTs = ts; delta = newDelta; } - + @Override public void addValue(long timestamp, double value) { addValue(timestamp, Double.doubleToLongBits(value)); @@ -111,9 +121,12 @@ public DoDReader getReader() { @Override public void addValue(long timestamp, long value) { - write.lock(); - writeDataPoint(timestamp, value); - write.unlock(); + try { + write.lock(); + writeDataPoint(timestamp, value); + } finally { + write.unlock(); + } } @Override @@ -127,10 +140,6 @@ public void setHeaderTimestamp(long timestamp) { writer.writeBits(timestamp, 64); } - @Override - public void setSeriesId(String seriesId) { - } - public BitWriter getWriter() { return writer; } @@ -155,14 +164,10 @@ public void setCounter(int counter) { } @Override - public void close() throws IOException { - } - - @Override - public void setConf(Map conf) { + public void makeReadOnly() { + write.lock(); + readOnly = true; + write.unlock(); } - @Override - public void delete() throws IOException { - } } diff --git a/core/src/main/java/com/srotya/sidewinder/core/storage/disk/BucketEntry.java b/core/src/main/java/com/srotya/sidewinder/core/storage/disk/BucketEntry.java deleted file mode 100644 index 8483003..0000000 --- a/core/src/main/java/com/srotya/sidewinder/core/storage/disk/BucketEntry.java +++ /dev/null @@ -1,132 +0,0 @@ -/** - * Copyright 2017 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.storage.disk; - -import java.io.IOException; - -import com.srotya.sidewinder.core.storage.TimeSeriesBucket; -import com.srotya.sidewinder.core.storage.disk.BucketEntry; - -/** - * @author ambud - */ -public class BucketEntry { - - private BucketEntry next, prev; - private String key; - private TimeSeriesBucket value; - - public BucketEntry(String key, TimeSeriesBucket value) { - this.key = key; - this.value = value; - } - - /** - * @return the next - */ - public BucketEntry getNext() { - return next; - } - - /** - * @param next - * the next to set - */ - public void setNext(BucketEntry next) { - this.next = next; - } - - /** - * @return the prev - */ - public BucketEntry getPrev() { - return prev; - } - - /** - * @param prev - * the prev to set - */ - public void setPrev(BucketEntry prev) { - this.prev = prev; - } - - /** - * @return the value - */ - public TimeSeriesBucket getValue() { - return value; - } - - /** - * @param value - * the value to set - */ - public void setValue(TimeSeriesBucket value) { - this.value = value; - } - - /** - * @return the key - */ - public String getKey() { - return key; - } - - /** - * @param key - * the key to set - */ - public void setKey(String key) { - this.key = key; - } - - @Override - protected void finalize() throws Throwable { - value.close(); - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "BucketEntry [next=" + next + ", prev=" + prev + ", key=" + key + ", value=" + value + "]"; - } - - public void close() { - if (value != null) { - try { - value.close(); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - } - - public void delete() { - if (value != null) { - try { - value.delete(); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - } - -} \ No newline at end of file diff --git a/core/src/main/java/com/srotya/sidewinder/core/storage/disk/ConcurrentLRUSortedMap.java b/core/src/main/java/com/srotya/sidewinder/core/storage/disk/ConcurrentLRUSortedMap.java deleted file mode 100644 index 983d7ba..0000000 --- a/core/src/main/java/com/srotya/sidewinder/core/storage/disk/ConcurrentLRUSortedMap.java +++ /dev/null @@ -1,220 +0,0 @@ -/** - * Copyright 2017 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.storage.disk; - -import java.util.Collection; -import java.util.Comparator; -import java.util.Map; -import java.util.Set; -import java.util.SortedMap; -import java.util.concurrent.ConcurrentSkipListMap; -import java.util.concurrent.locks.ReentrantLock; - -/** - * A sorted map that evicts least recently used items and has a fixed capacity - * - * @author ambud - */ -public class ConcurrentLRUSortedMap implements SortedMap { - - private ReentrantLock lock = new ReentrantLock(); - private SortedMap mapCore; - private BucketEntry head; - private BucketEntry tail; - private volatile int maxSize; - - public ConcurrentLRUSortedMap(int maxSize) { - if (maxSize <= 0) { - throw new IllegalArgumentException("Invalid max size for LRU"); - } - this.maxSize = maxSize; - this.mapCore = new ConcurrentSkipListMap(); - } - - @Override - public int size() { - return mapCore.size(); - } - - @Override - public boolean isEmpty() { - return mapCore.isEmpty(); - } - - @Override - public boolean containsKey(Object key) { - return mapCore.containsKey(key); - } - - @Override - public boolean containsValue(Object value) { - return mapCore.containsValue(value); - } - - @Override - public void clear() { - lock.lock(); - mapCore.clear(); - head = null; - tail = null; - lock.unlock(); - } - - @Override - public Comparator comparator() { - return mapCore.comparator(); - } - - @Override - public String firstKey() { - lock.lock(); - String firstKey = mapCore.firstKey(); - lock.unlock(); - return firstKey; - } - - @Override - public String lastKey() { - lock.lock(); - String lastKey = mapCore.lastKey(); - lock.unlock(); - return lastKey; - } - - @Override - public Set keySet() { - lock.lock(); - Set keySet = mapCore.keySet(); - lock.unlock(); - return keySet; - } - - @Override - public BucketEntry get(Object key) { - lock.lock(); - BucketEntry entry = mapCore.get(key); - if (entry == null) { - return null; - } - BucketEntry prev = entry.getPrev(); - BucketEntry next = entry.getNext(); - if (prev != null) { - prev.setNext(next); - } - if (next != null) { - next.setPrev(prev); - } - head.setPrev(entry); - entry.setNext(head); - head = entry; - prune(); - lock.unlock(); - return entry; - } - - @Override - public BucketEntry put(String key, BucketEntry value) { - lock.lock(); - prune(); - mapCore.put(key, value); - if (head != null) { - value.setNext(head); - head.setPrev(value); - } - head = value; - if (tail == null) { - tail = value; - } - lock.unlock(); - return null; - } - - private void prune() { - if (mapCore.size() >= maxSize) { - BucketEntry prev = tail.getPrev(); - if (prev == null) { - System.err.println("Tail previous is null:" + head); - throw new NullPointerException(); - } - prev.setNext(null); - tail.close(); - tail = prev; - } - } - - @Override - public BucketEntry remove(Object key) { - lock.lock(); - BucketEntry bucketEntry = mapCore.remove(key); - if (bucketEntry != null) { - BucketEntry next = bucketEntry.getNext(); - BucketEntry prev = bucketEntry.getPrev(); - if (prev != null) { - prev.setNext(next); - } - if (next != null) { - next.setPrev(prev); - } - } - lock.unlock(); - return bucketEntry; - } - - @Override - public void putAll(Map m) { - for (Entry entry : m.entrySet()) { - put(entry.getKey(), entry.getValue()); - } - } - - @Override - public SortedMap subMap(String fromKey, String toKey) { - SortedMap subMap = mapCore.subMap(fromKey, toKey); - for (java.util.Map.Entry entry : subMap.entrySet()) { - get(entry.getKey()); - } - return subMap; - } - - @Override - public SortedMap headMap(String toKey) { - return mapCore.headMap(toKey); - } - - @Override - public SortedMap tailMap(String fromKey) { - return mapCore.tailMap(fromKey); - } - - @Override - public Collection values() { - return mapCore.values(); - } - - @Override - public Set> entrySet() { - lock.lock(); - Set> entrySet = mapCore.entrySet(); - lock.unlock(); - return entrySet; - } - - @Override - public String toString() { - return mapCore.toString(); - } - -} diff --git a/core/src/main/java/com/srotya/sidewinder/core/storage/disk/DiskStorageEngine.java b/core/src/main/java/com/srotya/sidewinder/core/storage/disk/DiskStorageEngine.java index 604c7ae..a2be366 100644 --- a/core/src/main/java/com/srotya/sidewinder/core/storage/disk/DiskStorageEngine.java +++ b/core/src/main/java/com/srotya/sidewinder/core/storage/disk/DiskStorageEngine.java @@ -19,18 +19,13 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.PrintWriter; -import java.util.ArrayList; -import java.util.Collections; import java.util.HashSet; -import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.Future; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; @@ -45,13 +40,12 @@ import com.srotya.sidewinder.core.storage.DBMetadata; import com.srotya.sidewinder.core.storage.DataPoint; import com.srotya.sidewinder.core.storage.ItemNotFoundException; -import com.srotya.sidewinder.core.storage.Reader; +import com.srotya.sidewinder.core.storage.Measurement; import com.srotya.sidewinder.core.storage.RejectException; import com.srotya.sidewinder.core.storage.SeriesQueryOutput; import com.srotya.sidewinder.core.storage.StorageEngine; -import com.srotya.sidewinder.core.storage.TagIndex; -import com.srotya.sidewinder.core.storage.TimeSeriesBucket; -import com.srotya.sidewinder.core.storage.mem.TimeSeries; +import com.srotya.sidewinder.core.storage.TimeSeries; +import com.srotya.sidewinder.core.storage.compression.Reader; import com.srotya.sidewinder.core.storage.mem.archival.NoneArchiver; import com.srotya.sidewinder.core.utils.MiscUtils; @@ -62,17 +56,17 @@ */ public class DiskStorageEngine implements StorageEngine { + private static final String TMP_SIDEWINDER_INDEX = "/tmp/sidewinder/index"; + private static final String TMP_SIDEWINDER_METADATA = "/tmp/sidewinder/data"; private static final String INDEX_DIR = "index.dir"; private static final String DATA_DIRS = "data.dir"; private static final Logger logger = Logger.getLogger(DiskStorageEngine.class.getName()); - private Map>> databaseMap; + private Map> databaseMap; private AtomicInteger counter = new AtomicInteger(0); - private Map> tagLookupTable; private Map dbMetadataMap; private int defaultRetentionHours; private int defaultTimebucketSize; private Archiver archiver; - private String compressionFQCN; private Map conf; private String[] dataDirs; private String baseIndexDirectory; @@ -86,14 +80,12 @@ public void configure(Map conf, ScheduledExecutorService bgTaskP .parseInt(conf.getOrDefault(RETENTION_HOURS, String.valueOf(DEFAULT_RETENTION_HOURS))); logger.info("Setting default timeseries retention hours policy to:" + defaultRetentionHours); - this.conf.put(StorageEngine.PERSISTENCE_DISK, "true"); - dataDirs = MiscUtils.splitAndNormalizeString(conf.getOrDefault(DATA_DIRS, "/tmp/sidewinder/metadata")); - baseIndexDirectory = conf.getOrDefault(INDEX_DIR, "/tmp/sidewinder/index"); + dataDirs = MiscUtils.splitAndNormalizeString(conf.getOrDefault(DATA_DIRS, TMP_SIDEWINDER_METADATA)); + baseIndexDirectory = conf.getOrDefault(INDEX_DIR, TMP_SIDEWINDER_INDEX); for (String dataDir : dataDirs) { new File(dataDir).mkdirs(); } new File(baseIndexDirectory).mkdirs(); - tagLookupTable = new ConcurrentHashMap<>(); databaseMap = new ConcurrentHashMap<>(); dbMetadataMap = new ConcurrentHashMap<>(); @@ -104,33 +96,22 @@ public void configure(Map conf, ScheduledExecutorService bgTaskP } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { logger.log(Level.SEVERE, "Failed to instantiate archiver", e); } - compressionFQCN = conf.getOrDefault(COMPRESSION_CLASS, DEFAULT_COMPRESSION_CLASS); - this.defaultTimebucketSize = Integer .parseInt(conf.getOrDefault(DEFAULT_BUCKET_SIZE, String.valueOf(DEFAULT_TIME_BUCKET_CONSTANT))); bgTaskPool.scheduleAtFixedRate(() -> { - for (Entry>> measurementMap : databaseMap.entrySet()) { - // String db = measurementMap.getKey(); - for (Entry> measurementEntry : measurementMap.getValue().entrySet()) { - // String measurement = measurementEntry.getKey(); - for (Entry entry : measurementEntry.getValue().entrySet()) { - try { - List garbage = entry.getValue().collectGarbage(); - for (TimeSeriesBucket timeSeriesBucket : garbage) { - timeSeriesBucket.delete(); - logger.info("Collecting garbage for bucket:" + entry.getKey()); - } - // logger.info("Collecting garbage for time series:" - // + entry.getKey()); - } catch (IOException e) { - logger.log(Level.SEVERE, "Error collecing garbage", e); - } + for (Entry> measurementMap : databaseMap.entrySet()) { + for (Entry measurementEntry : measurementMap.getValue().entrySet()) { + Measurement value = measurementEntry.getValue(); + try { + value.garbageCollector(); + } catch (IOException e) { + logger.log(Level.SEVERE, "Failed collect garbage for measurement:" + value.getMeasurementName(), + e); } } } }, Integer.parseInt(conf.getOrDefault(GC_FREQUENCY, DEFAULT_GC_FREQUENCY)), Integer.parseInt(conf.getOrDefault(GC_DELAY, DEFAULT_GC_DELAY)), TimeUnit.MILLISECONDS); - loadDatabases(); } @@ -144,12 +125,14 @@ public void updateTimeSeriesRetentionPolicy(String dbName, String measurementNam @Override public void updateTimeSeriesRetentionPolicy(String dbName, String measurementName, int retentionHours) { - Map> measurementMap = databaseMap.get(dbName); - if (measurementMap != null) { - Map seriesMap = measurementMap.get(measurementName); - if (seriesMap != null) { - for (TimeSeries series : seriesMap.values()) { - series.setRetentionHours(retentionHours); + Map measurementMap = databaseMap.get(dbName); + synchronized (dbMetadataMap) { + if (measurementMap != null) { + Measurement seriesMap = measurementMap.get(measurementName); + if (seriesMap != null) { + for (TimeSeries series : seriesMap.getTimeSeries()) { + series.setRetentionHours(retentionHours); + } } } } @@ -161,10 +144,10 @@ public void updateTimeSeriesRetentionPolicy(String dbName, int retentionHours) t synchronized (dbMetadataMap) { metadata.setRetentionHours(retentionHours); saveDBMetadata(dbName, metadata); - Map> measurementMap = databaseMap.get(dbName); + Map measurementMap = databaseMap.get(dbName); if (measurementMap != null) { - for (Map sortedMap : measurementMap.values()) { - for (TimeSeries timeSeries : sortedMap.values()) { + for (Measurement sortedMap : measurementMap.values()) { + for (TimeSeries timeSeries : sortedMap.getTimeSeries()) { timeSeries.setRetentionHours(retentionHours); } } @@ -184,39 +167,11 @@ public void updateTimeSeriesRetentionPolicy(String dbName, int retentionHours) t @Override public LinkedHashMap queryReaders(String dbName, String measurementName, String valueFieldName, long startTime, long endTime) throws Exception { - LinkedHashMap readers = new LinkedHashMap<>(); - Map> measurementMap = databaseMap.get(dbName); - if (measurementMap != null) { - Map seriesMap = measurementMap.get(measurementName); - if (seriesMap != null) { - TagIndex memTagIndex = getOrCreateTagIndex(dbName, measurementName); - for (String entry : seriesMap.keySet()) { - TimeSeries series = seriesMap.get(entry); - String[] keys = entry.split(FIELD_TAG_SEPARATOR); - if (keys.length != 2) { - // TODO report major error, series ingested without tag - // field encoding - continue; - } - if (!keys[0].equals(valueFieldName)) { - continue; - } - List seriesTags = null; - if (keys.length > 1) { - seriesTags = decodeStringToTags(memTagIndex, keys[1]); - } else { - seriesTags = new ArrayList<>(); - } - for (Reader reader : series.queryReader(valueFieldName, seriesTags, startTime, endTime, null)) { - readers.put(reader, series.isFp()); - } - } - } else { - throw new ItemNotFoundException("Measurement " + measurementName + " not found"); - } - } else { - throw new ItemNotFoundException("Database " + dbName + " not found"); + if (!checkIfExists(dbName, measurementName)) { + throw NOT_FOUND_EXCEPTION; } + LinkedHashMap readers = new LinkedHashMap<>(); + databaseMap.get(dbName).get(measurementName).queryReaders(valueFieldName, startTime, endTime, readers); return readers; } @@ -224,51 +179,12 @@ public LinkedHashMap queryReaders(String dbName, String measure public Set queryDataPoints(String dbName, String measurementName, String valueFieldName, long startTime, long endTime, List tagList, Filter> tagFilter, Predicate valuePredicate, AggregationFunction aggregationFunction) throws IOException { - Set resultMap = new HashSet<>(); - Map> measurementMap = databaseMap.get(dbName); - if (measurementMap != null) { - Map seriesMap = measurementMap.get(measurementName); - if (seriesMap != null) { - TagIndex memTagIndex = getOrCreateTagIndex(dbName, measurementName); - Set rowKeys = null; - if (tagList == null || tagList.size() == 0) { - rowKeys = seriesMap.keySet(); - } else { - rowKeys = getTagFilteredRowKeys(dbName, measurementName, valueFieldName, tagFilter, tagList); - } - for (String entry : rowKeys) { - TimeSeries value = seriesMap.get(entry); - String[] keys = entry.split(FIELD_TAG_SEPARATOR); - if (!keys[0].equals(valueFieldName)) { - continue; - } - List points = null; - List seriesTags = null; - if (keys.length > 1) { - seriesTags = decodeStringToTags(memTagIndex, keys[1]); - } else { - seriesTags = new ArrayList<>(); - } - points = value.queryDataPoints(keys[0], seriesTags, startTime, endTime, valuePredicate); - if (aggregationFunction != null) { - points = aggregationFunction.aggregate(points); - } - if (points == null) { - points = new ArrayList<>(); - } - if (points.size() > 0) { - SeriesQueryOutput seriesQueryOutput = new SeriesQueryOutput(measurementName, keys[0], - seriesTags); - seriesQueryOutput.setDataPoints(points); - resultMap.add(seriesQueryOutput); - } - } - } else { - throw new ItemNotFoundException("Measurement " + measurementName + " not found"); - } - } else { - throw new ItemNotFoundException("Database " + dbName + " not found"); + if (!checkIfExists(dbName, measurementName)) { + throw NOT_FOUND_EXCEPTION; } + Set resultMap = new HashSet<>(); + databaseMap.get(dbName).get(measurementName).queryDataPoints(valueFieldName, startTime, endTime, tagList, + tagFilter, valuePredicate, aggregationFunction, resultMap); return resultMap; } @@ -277,7 +193,7 @@ public Set getMeasurementsLike(String dbName, String partialMeasurementN if (!checkIfExists(dbName)) { throw NOT_FOUND_EXCEPTION; } - Map> measurementMap = databaseMap.get(dbName); + Map measurementMap = databaseMap.get(dbName); partialMeasurementName = partialMeasurementName.trim(); if (partialMeasurementName.isEmpty()) { return measurementMap.keySet(); @@ -318,8 +234,8 @@ public void writeDataPoint(DataPoint dp) throws IOException { } @Override - public Map> getOrCreateDatabase(String dbName) throws IOException { - Map> measurementMap = databaseMap.get(dbName); + public Map getOrCreateDatabase(String dbName) throws IOException { + Map measurementMap = databaseMap.get(dbName); if (measurementMap == null) { synchronized (databaseMap) { if ((measurementMap = databaseMap.get(dbName)) == null) { @@ -339,13 +255,13 @@ public Map> getOrCreateDatabase(String dbName) t } private void saveDBMetadata(String dbName, DBMetadata metadata) throws IOException { - String dbDirectory = dbMetadataDirectoryPath(dbName); + String dbDirectory = dbDirectoryPath(dbName); String line = new Gson().toJson(metadata); - writeLineToFile(line, dbDirectory + ".md"); + writeLineToFile(line, dbDirectory + "/.md"); } protected void createDatabaseDirectory(String dbName) { - String dbDirectory = dbMetadataDirectoryPath(dbName); + String dbDirectory = dbDirectoryPath(dbName); File file = new File(dbDirectory); file.mkdirs(); } @@ -361,19 +277,19 @@ protected void loadDatabases() throws IOException { if (!db.isDirectory()) { continue; } - Map> measurementMap = new ConcurrentHashMap<>(); + Map measurementMap = new ConcurrentHashMap<>(); String dbName = db.getName(); databaseMap.put(dbName, measurementMap); DBMetadata metadata = readMetadata(dbName); dbMetadataMap.put(dbName, metadata); logger.info("Loading database:" + dbName); - loadMeasurements(dbName, measurementMap); + loadMeasurements(dbName, measurementMap, metadata); } } } protected DBMetadata readMetadata(String dbName) throws IOException { - String path = dbMetadataDirectoryPath(dbName) + ".md"; + String path = dbDirectoryPath(dbName) + "/.md"; File file = new File(path); if (!file.exists()) { return new DBMetadata(defaultRetentionHours); @@ -383,161 +299,103 @@ protected DBMetadata readMetadata(String dbName) throws IOException { for (String line : lines) { builder.append(line); } + logger.info("JSON for metadata:" + builder.toString()); DBMetadata metadata = new Gson().fromJson(builder.toString(), DBMetadata.class); + if (metadata == null) { + throw new IOException("Invalid metadata for:" + dbName); + } return metadata; } @Override - public Map> getOrCreateDatabase(String dbName, int retentionPolicy) - throws IOException { - Map> map = getOrCreateDatabase(dbName); + public Map getOrCreateDatabase(String dbName, int retentionPolicy) throws IOException { + Map map = getOrCreateDatabase(dbName); updateTimeSeriesRetentionPolicy(dbName, retentionPolicy); return map; } @Override - public Map getOrCreateMeasurement(String dbName, String measurementName) throws IOException { - Map> measurementMap = getOrCreateDatabase(dbName); + public Measurement getOrCreateMeasurement(String dbName, String measurementName) throws IOException { + Map measurementMap = getOrCreateDatabase(dbName); return getOrCreateMeasurement(measurementMap, measurementName, dbName); } - protected Map getOrCreateMeasurement(Map> measurementMap, - String measurementName, String dbName) throws IOException { - Map seriesMap = measurementMap.get(measurementName); - if (seriesMap == null) { - synchronized (measurementMap) { - if ((seriesMap = measurementMap.get(measurementName)) == null) { - seriesMap = new ConcurrentHashMap<>(); - createMeasurementDirectory(dbName, measurementName); - measurementMap.put(measurementName, seriesMap); + protected Measurement getOrCreateMeasurement(Map measurementMap, String measurementName, + String dbName) throws IOException { + Measurement measurement = measurementMap.get(measurementName); + if (measurement == null) { + synchronized (databaseMap) { + if ((measurement = measurementMap.get(measurementName)) == null) { + measurement = new PersistentMeasurement(); + measurement.configure(conf, measurementName, dbIndexPath(dbName), dbDirectoryPath(dbName), + dbMetadataMap.get(dbName), bgTaskPool); + measurementMap.put(measurementName, measurement); logger.info("Created new measurement:" + measurementName); } } } - return seriesMap; - } - - protected void createMeasurementDirectory(String dbName, String measurementName) throws IOException { - String measurementDirectory = measurementDataDirectoryPath(dbName, measurementName); - new File(measurementDirectory).mkdirs(); + return measurement; } public String getDataDir(String dbName) { return dataDirs[dbName.hashCode() % dataDirs.length]; } - public String dbMetadataDirectoryPath(String dbName) { + public String dbDirectoryPath(String dbName) { return getDataDir(dbName) + "/" + dbName; } - protected void loadMeasurements(String dbName, Map> measurementMap) + public String dbIndexPath(String dbName) { + return getIndexDir(dbName) + "/" + dbName; + } + + public String getIndexDir(String dbName) { + return baseIndexDirectory; + } + + protected void loadMeasurements(String dbName, Map measurementMap, DBMetadata metadata) throws IOException { - File file = new File(dbMetadataDirectoryPath(dbName)); + File file = new File(dbDirectoryPath(dbName)); if (!file.exists() || file.listFiles() == null) { return; } for (File measurementMdFile : file.listFiles()) { - Map seriesMap = new ConcurrentHashMap<>(); + if (!measurementMdFile.isDirectory()) { + continue; + } String measurementName = measurementMdFile.getName(); - measurementMap.put(measurementName, seriesMap); + Measurement measurement = new PersistentMeasurement(); + measurement.configure(conf, measurementName, dbIndexPath(dbName), dbDirectoryPath(dbName), metadata, + bgTaskPool); + measurementMap.put(measurementName, measurement); logger.info("Loading measurements:" + measurementName); - loadTimeseriesFromMeasurementMetadata(measurementMetadataFilePath(dbName, measurementName), dbName, - measurementName, seriesMap); + measurement.loadTimeseriesFromMeasurements(); } } @Override public TimeSeries getTimeSeries(String dbName, String measurementName, String valueFieldName, List tags) throws IOException { - Collections.sort(tags); - - String rowKey = constructRowKey(dbName, measurementName, valueFieldName, tags); - - // check and create database map - Map> dbMap = getOrCreateDatabase(dbName); - - // check and create measurement map - Map measurementMap = getOrCreateMeasurement(dbMap, measurementName, dbName); - - // check and create timeseries - TimeSeries timeSeries = measurementMap.get(rowKey); + if (!checkIfExists(dbName, measurementName)) { + throw NOT_FOUND_EXCEPTION; + } + // get timeseries + Measurement measurement = databaseMap.get(dbName).get(measurementName); + TimeSeries timeSeries = measurement.getTimeSeries(valueFieldName, tags); return timeSeries; } @Override public TimeSeries getOrCreateTimeSeries(String dbName, String measurementName, String valueFieldName, List tags, int timeBucketSize, boolean fp) throws IOException { - Collections.sort(tags); - - String rowKey = constructRowKey(dbName, measurementName, valueFieldName, tags); - // check and create database map - Map> dbMap = getOrCreateDatabase(dbName); + Map dbMap = getOrCreateDatabase(dbName); // check and create measurement map - Map measurementMap = getOrCreateMeasurement(dbMap, measurementName, dbName); + Measurement measurement = getOrCreateMeasurement(dbMap, measurementName, dbName); // check and create timeseries - TimeSeries timeSeries = measurementMap.get(rowKey); - if (timeSeries == null) { - synchronized (measurementMap) { - if ((timeSeries = measurementMap.get(rowKey)) == null) { - timeSeries = new PersistentTimeSeries(measurementDataDirectoryPath(dbName, measurementName), - compressionFQCN, seriesId(measurementName, rowKey), dbMetadataMap.get(dbName), - timeBucketSize, fp, conf, bgTaskPool); - measurementMap.put(rowKey, timeSeries); - appendTimeseriesToMeasurementMetadata(measurementMetadataFilePath(dbName, measurementName), rowKey, - fp, timeBucketSize); - logger.fine("Created new timeseries:" + timeSeries + " for measurement:" + measurementName + "\t" - + rowKey + "\t" + dbMetadataMap.get(dbName)); - } - } - } - return timeSeries; - } - - private String measurementDataDirectoryPath(String dbName, String measurementName) { - return getDataDir(dbName) + "/" + dbName + "/" + measurementName; - } - - private String measurementMetadataFilePath(String dbName, String measurementName) { - return getDataDir(dbName) + "/" + dbName + "/" + measurementName + "/.md"; - } - - public static String seriesId(String measurementName, String rowKey) { - return measurementName + "_" + rowKey; - } - - protected void loadTimeseriesFromMeasurementMetadata(String measurementFilePath, String dbName, - String measurementName, Map measurementMap) throws IOException { - File file = new File(measurementFilePath); - if (!file.exists()) { - return; - } - List seriesEntries = MiscUtils.readAllLines(file); - List> futures = new ArrayList<>(); - for (String entry : seriesEntries) { - String[] split = entry.split("\t"); - futures.add(bgTaskPool.submit(() -> { - logger.fine("Loading Timeseries:" + seriesId(measurementName, split[0])); - try { - measurementMap.put(split[0], - new PersistentTimeSeries(measurementDataDirectoryPath(dbName, measurementName), - compressionFQCN, seriesId(measurementName, split[0]), dbMetadataMap.get(dbName), - Integer.parseInt(split[2]), Boolean.parseBoolean(split[1]), conf, bgTaskPool)); - logger.fine("Loaded Timeseries:" + seriesId(measurementName, split[0])); - } catch (NumberFormatException | IOException e) { - logger.log(Level.SEVERE, "Failed to load series:" + entry, e); - } - })); - } - for (Future future : futures) { - try { - future.get(); - } catch (InterruptedException | ExecutionException e) { - logger.log(Level.SEVERE, "Failed to load series", e); - } - } + return measurement.getOrCreateTimeSeries(valueFieldName, tags, timeBucketSize, fp, conf); } public static void writeLineToFile(String line, String filePath) throws IOException { @@ -547,26 +405,21 @@ public static void writeLineToFile(String line, String filePath) throws IOExcept pr.close(); } - public static void appendLineToFile(String line, String filePath) throws IOException { - File pth = new File(filePath); - PrintWriter pr = new PrintWriter(new FileOutputStream(pth, true)); + public static void appendLineToFile(String line, PrintWriter pr) throws IOException { pr.println(line); - pr.close(); - } - - protected void appendTimeseriesToMeasurementMetadata(String measurementFilePath, String rowKey, boolean fp, - int timeBucketSize) throws IOException { - appendLineToFile(rowKey + "\t" + fp + "\t" + timeBucketSize, measurementFilePath); - + pr.flush(); } @Override public boolean isMeasurementFieldFP(String dbName, String measurementName, String valueFieldName) throws IOException { - Map> dbMap = getOrCreateDatabase(dbName); + if (!checkIfExists(dbName, measurementName)) { + throw NOT_FOUND_EXCEPTION; + } + Map dbMap = getOrCreateDatabase(dbName); // check and create measurement map - Map measurementMap = getOrCreateMeasurement(dbMap, measurementName, dbName); - for (Entry entry : measurementMap.entrySet()) { + Measurement measurementMap = getOrCreateMeasurement(dbMap, measurementName, dbName); + for (Entry entry : measurementMap.getTimeSeriesMap().entrySet()) { if (entry.getKey().startsWith(valueFieldName)) { return entry.getValue().isFp(); } @@ -574,97 +427,16 @@ public boolean isMeasurementFieldFP(String dbName, String measurementName, Strin throw NOT_FOUND_EXCEPTION; } - public Set getSeriesIdsWhereTags(String dbName, String measurementName, List tags) - throws IOException { - Set series = new HashSet<>(); - DiskTagIndex memTagLookupTable = (DiskTagIndex) getOrCreateTagIndex(dbName, measurementName); - for (String tag : tags) { - Set keys = memTagLookupTable.searchRowKeysForTag(tag); - if (keys != null) { - series.addAll(keys); - } - } - return series; - } - - public Set getTagFilteredRowKeys(String dbName, String measurementName, String valueFieldName, - Filter> tagFilterTree, List rawTags) throws IOException { - Set filteredSeries = getSeriesIdsWhereTags(dbName, measurementName, rawTags); - for (Iterator iterator = filteredSeries.iterator(); iterator.hasNext();) { - String rowKey = iterator.next(); - if (!rowKey.startsWith(valueFieldName)) { - continue; - } - String[] keys = rowKey.split(FIELD_TAG_SEPARATOR); - if (keys.length != 2) { - // TODO report major error, series ingested without tag - // field encoding - logger.severe("Invalid series tag encode, series ingested without tag field encoding"); - iterator.remove(); - continue; - } - if (!keys[0].equals(valueFieldName)) { - iterator.remove(); - continue; - } - List seriesTags = null; - if (keys.length > 1) { - seriesTags = decodeStringToTags(getOrCreateTagIndex(dbName, measurementName), keys[1]); - } else { - seriesTags = new ArrayList<>(); - } - if (!tagFilterTree.isRetain(seriesTags)) { - iterator.remove(); - } - } - return filteredSeries; - } - - @Override - public TagIndex getOrCreateTagIndex(String dbName, String measurementName) throws IOException { - Map lookupMap = tagLookupTable.get(dbName); - if (lookupMap == null) { - synchronized (tagLookupTable) { - if ((lookupMap = tagLookupTable.get(dbName)) == null) { - lookupMap = new ConcurrentHashMap<>(); - tagLookupTable.put(dbName, lookupMap); - } - } - } - - DiskTagIndex memTagLookupTable = lookupMap.get(measurementName); - if (memTagLookupTable == null) { - synchronized (lookupMap) { - if ((memTagLookupTable = lookupMap.get(measurementName)) == null) { - memTagLookupTable = new DiskTagIndex(baseIndexDirectory, dbName, measurementName); - lookupMap.put(measurementName, memTagLookupTable); - } - } - } - return memTagLookupTable; - } - @Override public boolean checkTimeSeriesExists(String dbName, String measurementName, String valueFieldName, List tags) throws Exception { - Collections.sort(tags); - - if (!checkIfExists(dbName)) { - return false; - } - // check and create database map - Map> dbMap = getOrCreateDatabase(dbName); - if (!checkIfExists(dbName, measurementName)) { return false; } - // check and create measurement map - Map measurementMap = getOrCreateMeasurement(dbMap, dbName, measurementName); - - String rowKey = constructRowKey(dbName, measurementName, valueFieldName, tags); - // check and create timeseries - TimeSeries timeSeries = measurementMap.get(rowKey); + Measurement measurement = databaseMap.get(dbName).get(measurementName); + // check timeseries + TimeSeries timeSeries = measurement.getTimeSeries(valueFieldName, tags); return timeSeries == null; } @@ -689,55 +461,38 @@ public void deleteAllData() throws Exception { } @Override - public boolean checkIfExists(String dbName) throws Exception { + public boolean checkIfExists(String dbName) throws IOException { return databaseMap.containsKey(dbName); } @Override public void dropDatabase(String dbName) throws Exception { synchronized (databaseMap) { - databaseMap.remove(dbName); - MiscUtils.delete(new File(dbMetadataDirectoryPath(dbName))); + Map remove = databaseMap.remove(dbName); + for (Measurement measurement : remove.values()) { + measurement.close(); + } + MiscUtils.delete(new File(dbDirectoryPath(dbName))); + MiscUtils.delete(new File(dbIndexPath(dbName))); } } @Override public void dropMeasurement(String dbName, String measurementName) throws Exception { - Map> map = databaseMap.get(dbName); - synchronized (map) { + Map map = databaseMap.get(dbName); + synchronized (databaseMap) { map.remove(measurementName); - MiscUtils.delete(new File(measurementDataDirectoryPath(dbName, measurementName))); } } @Override public List> getTagsForMeasurement(String dbName, String measurementName, String valueFieldName) throws Exception { - Map measurementMap = tagLookupTable.get(dbName); - if (measurementMap == null) { + if (!checkIfExists(dbName, measurementName)) { throw new ItemNotFoundException("Database " + dbName + " not found"); } - DiskTagIndex tagLookupTable = measurementMap.get(measurementName); - if (tagLookupTable == null) { - throw new ItemNotFoundException("Measurement " + measurementName + " not found"); - } - Map map = databaseMap.get(dbName).get(measurementMap); - Set keySet = new HashSet<>(); - for (Entry entry : map.entrySet()) { - if(entry.getKey().startsWith(valueFieldName)) { - keySet.add(entry.getKey()); - } - } - List> tagList = new ArrayList<>(); - for (String entry : keySet) { - String[] keys = entry.split(FIELD_TAG_SEPARATOR); - if (!keys[0].equals(valueFieldName)) { - continue; - } - List tags = decodeStringToTags(tagLookupTable, keys[1]); - tagList.add(tags); - } - return tagList; + Measurement measurement = databaseMap.get(dbName).get(measurementName); + return measurement.getTagsForMeasurement(valueFieldName); } /** @@ -748,7 +503,7 @@ public List> getTagsForMeasurement(String dbName, String measuremen * @return */ protected Map getSeriesMap(String dbName, String measurementName) { - return databaseMap.get(dbName).get(measurementName); + return databaseMap.get(dbName).get(measurementName).getTimeSeriesMap(); } @Override @@ -757,9 +512,9 @@ public void connect() throws IOException { @Override public void disconnect() throws IOException { - for (Entry>> measurementMap : databaseMap.entrySet()) { - for (Entry> seriesMap : measurementMap.getValue().entrySet()) { - for (Entry series : seriesMap.getValue().entrySet()) { + for (Entry> measurementMap : databaseMap.entrySet()) { + for (Entry seriesMap : measurementMap.getValue().entrySet()) { + for (Entry series : seriesMap.getValue().getTimeSeriesMap().entrySet()) { series.getValue().close(); } } @@ -768,25 +523,21 @@ public void disconnect() throws IOException { } @Override - public boolean checkIfExists(String dbName, String measurement) throws Exception { + public boolean checkIfExists(String dbName, String measurement) throws IOException { if (checkIfExists(dbName)) { return databaseMap.get(dbName).containsKey(measurement); } else { + logger.info("Database not found"); return false; } } @Override public Set getTagsForMeasurement(String dbName, String measurementName) throws Exception { - Map measurementMap = tagLookupTable.get(dbName); - if (measurementMap == null) { - throw new ItemNotFoundException("Database " + dbName + " not found"); - } - DiskTagIndex memTagLookupTable = measurementMap.get(measurementName); - if (memTagLookupTable == null) { - throw new ItemNotFoundException("Measurement " + measurementName + " not found"); + if (!checkIfExists(dbName, measurementName)) { + throw new ItemNotFoundException("Database " + dbName + " & " + measurementName + " not found"); } - return memTagLookupTable.getTags(); + return databaseMap.get(dbName).get(measurementName).getTags(); } @Override @@ -794,23 +545,9 @@ public Set getFieldsForMeasurement(String dbName, String measurementName if (!checkIfExists(dbName, measurementName)) { throw NOT_FOUND_EXCEPTION; } - Map> measurementMap = databaseMap.get(dbName); - if (measurementMap == null) { - throw new ItemNotFoundException("Database " + dbName + " not found"); - } - Map seriesMap = measurementMap.get(measurementName); - if (seriesMap == null) { - throw new ItemNotFoundException("Measurement " + measurementName + " not found"); - } - Set results = new HashSet<>(); - Set keySet = seriesMap.keySet(); - for (String key : keySet) { - String[] splits = key.split(FIELD_TAG_SEPARATOR); - if (splits.length == 2) { - results.add(splits[0]); - } - } - return results; + Map measurementMap = databaseMap.get(dbName); + Measurement measurement = measurementMap.get(measurementName); + return measurement.getFieldsForMeasurement(); } @Override @@ -818,7 +555,28 @@ public Map getDbMetadataMap() { return dbMetadataMap; } - protected Map> getTagLookupTable() { - return tagLookupTable; + @Override + public Map> getMeasurementMap() { + return databaseMap; } + + @Override + public Set getTagFilteredRowKeys(String dbName, String measurementName, String valueFieldName, + Filter> tagFilterTree, List rawTags) throws ItemNotFoundException, Exception { + if (!checkIfExists(dbName, measurementName)) { + throw NOT_FOUND_EXCEPTION; + } + return databaseMap.get(dbName).get(measurementName).getTagFilteredRowKeys(valueFieldName, tagFilterTree, + rawTags); + } + + @Override + public Set getSeriesIdsWhereTags(String dbName, String measurementName, List tags) + throws ItemNotFoundException, Exception { + if (!checkIfExists(dbName, measurementName)) { + throw NOT_FOUND_EXCEPTION; + } + return databaseMap.get(dbName).get(measurementName).getSeriesIdsWhereTags(tags); + } + } diff --git a/core/src/main/java/com/srotya/sidewinder/core/storage/disk/DiskTagIndex.java b/core/src/main/java/com/srotya/sidewinder/core/storage/disk/DiskTagIndex.java index 81d9eb4..925c438 100644 --- a/core/src/main/java/com/srotya/sidewinder/core/storage/disk/DiskTagIndex.java +++ b/core/src/main/java/com/srotya/sidewinder/core/storage/disk/DiskTagIndex.java @@ -16,7 +16,9 @@ package com.srotya.sidewinder.core.storage.disk; import java.io.File; +import java.io.FileOutputStream; import java.io.IOException; +import java.io.PrintWriter; import java.util.Collections; import java.util.HashSet; import java.util.List; @@ -26,7 +28,9 @@ import com.srotya.sidewinder.core.storage.TagIndex; import com.srotya.sidewinder.core.utils.MiscUtils; -import com.srotya.sidewinder.core.utils.MurmurHash; + +import net.jpountz.xxhash.XXHash32; +import net.jpountz.xxhash.XXHashFactory; /** * Tag hash lookup table + Tag inverted index @@ -37,19 +41,28 @@ public class DiskTagIndex implements TagIndex { private Map tagMap; private Map> rowKeyIndex; + private XXHashFactory factory = XXHashFactory.fastestInstance(); + private PrintWriter prFwd; + private PrintWriter prRv; private String indexPath; + private XXHash32 hash; + private String fwdIndex; + private String revIndex; - public DiskTagIndex(String baseIndexDirectory, String dbName, String measurementName) throws IOException { - this.indexPath = baseIndexDirectory + "/" + dbName; - new File(indexPath).mkdirs(); - this.indexPath += "/" + measurementName; - tagMap = new ConcurrentHashMap<>(); - rowKeyIndex = new ConcurrentHashMap<>(); + public DiskTagIndex(String indexDir, String measurementName) throws IOException { + this.indexPath = indexDir + "/" + measurementName; + tagMap = new ConcurrentHashMap<>(1000); + rowKeyIndex = new ConcurrentHashMap<>(1000); + fwdIndex = indexPath + ".fwd"; + revIndex = indexPath + ".rev"; + prFwd = new PrintWriter( new FileOutputStream(new File(fwdIndex), true)); + prRv = new PrintWriter(new FileOutputStream(new File(revIndex), true)); + hash = factory.hash32(); loadTagIndex(); } protected void loadTagIndex() throws IOException { - File fwd = new File(indexPath + ".fwd"); + File fwd = new File(fwdIndex); if (!fwd.exists()) { return; } @@ -62,7 +75,7 @@ protected void loadTagIndex() throws IOException { tagMap.put(Integer.parseInt(hash32), tag); } // load reverse lookup - File rev = new File(indexPath + ".rev"); + File rev = new File(revIndex); if (!rev.exists()) { return; } @@ -82,13 +95,13 @@ protected void loadTagIndex() throws IOException { @Override public String createEntry(String tag) throws IOException { - int hash32 = MurmurHash.hash32(tag); + int hash32 = hash.hash(tag.getBytes(), 0, tag.length(), 57); String val = tagMap.get(hash32); if (val == null) { synchronized (tagMap) { String out = tagMap.put(hash32, tag); if (out == null) { - DiskStorageEngine.appendLineToFile(hash32 + "\t" + tag, indexPath + ".fwd"); + DiskStorageEngine.appendLineToFile(hash32 + "\t" + tag, prFwd); } } } @@ -111,15 +124,18 @@ public void index(String tag, String rowKey) throws IOException { if (rowKeySet == null) { synchronized (rowKeyIndex) { if ((rowKeySet = rowKeyIndex.get(tag)) == null) { - rowKeySet = Collections.newSetFromMap(new ConcurrentHashMap());; + rowKeySet = Collections.newSetFromMap(new ConcurrentHashMap()); + ; rowKeyIndex.put(tag, rowKeySet); } } } - boolean add = rowKeySet.add(rowKey); - if (add) { - synchronized (tagMap) { - DiskStorageEngine.appendLineToFile(tag + "\t" + rowKey, indexPath + ".rev"); + if (!rowKeySet.contains(rowKey)) { + boolean add = rowKeySet.add(rowKey); + if (add) { + synchronized (tagMap) { + DiskStorageEngine.appendLineToFile(tag + "\t" + rowKey, prRv); + } } } } @@ -129,4 +145,9 @@ public Set searchRowKeysForTag(String tag) { return rowKeyIndex.get(tag); } + public void close() throws IOException { + prFwd.close(); + prRv.close(); + } + } \ No newline at end of file diff --git a/core/src/main/java/com/srotya/sidewinder/core/storage/disk/PersistentMeasurement.java b/core/src/main/java/com/srotya/sidewinder/core/storage/disk/PersistentMeasurement.java new file mode 100644 index 0000000..be9a5a2 --- /dev/null +++ b/core/src/main/java/com/srotya/sidewinder/core/storage/disk/PersistentMeasurement.java @@ -0,0 +1,342 @@ +/** + * Copyright 2017 Ambud Sharma + * + * Licensed 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 com.srotya.sidewinder.core.storage.disk; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.FilenameFilter; +import java.io.IOException; +import java.io.PrintWriter; +import java.io.RandomAccessFile; +import java.nio.ByteBuffer; +import java.nio.MappedByteBuffer; +import java.nio.channels.FileChannel.MapMode; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; +import java.util.logging.Level; +import java.util.logging.Logger; + +import com.srotya.sidewinder.core.storage.DBMetadata; +import com.srotya.sidewinder.core.storage.Measurement; +import com.srotya.sidewinder.core.storage.StorageEngine; +import com.srotya.sidewinder.core.storage.TagIndex; +import com.srotya.sidewinder.core.storage.TimeSeries; +import com.srotya.sidewinder.core.utils.MiscUtils; + +/** + * @author ambud + */ +public class PersistentMeasurement implements Measurement { + + private static final int DEFAULT_BUF_INCREMENT = 1048576; + private static final int DEFAULT_MAX_FILE_SIZE = Integer.MAX_VALUE; + private static final String CONF_MEASUREMENT_FILE_MAX = "measurement.file.max"; + private static final String CONF_MEASUREMENT_FILE_INCREMENT = "measurement.file.increment"; + private static final Logger logger = Logger.getLogger(PersistentMeasurement.class.getName()); + private Map seriesMap; + private DiskTagIndex tagIndex; + private String compressionClass; + private String dataDirectory; + private DBMetadata metadata; + private Map conf; + private ScheduledExecutorService bgTaskPool; + private RandomAccessFile activeFile; + private List bufTracker; + private int itr; + private int fileMapIncrement; + private int increment = 4096; + private int curr; + private int base; + private int fcnt; + private MappedByteBuffer memoryMappedBuffer; + private String measurementName; + private long maxFileSize; + private String filename; + private PrintWriter prBufPointers; + private PrintWriter prMetadata; + private String indexDirectory; + + @Override + public void configure(Map conf, String measurementName, String indexDirectory, String dataDirectory, + DBMetadata metadata, ScheduledExecutorService bgTaskPool) throws IOException { + this.conf = conf; + this.dataDirectory = dataDirectory + "/" + measurementName; + this.indexDirectory = indexDirectory + "/" + measurementName; + createMeasurementDirectory(); + if (metadata == null) { + throw new IOException("Metadata can't be null"); + } + this.metadata = metadata; + this.bgTaskPool = bgTaskPool; + this.seriesMap = new ConcurrentHashMap<>(10000); + this.tagIndex = new DiskTagIndex(this.indexDirectory, measurementName); + this.compressionClass = conf.getOrDefault(StorageEngine.COMPRESSION_CLASS, + StorageEngine.DEFAULT_COMPRESSION_CLASS); + this.measurementName = measurementName; + this.bufTracker = new ArrayList<>(); + this.prBufPointers = new PrintWriter(new FileOutputStream(new File(getPtrPath()), true)); + this.prMetadata = new PrintWriter(new FileOutputStream(new File(getMetadataPath()), true)); + this.fileMapIncrement = Integer + .parseInt(conf.getOrDefault(CONF_MEASUREMENT_FILE_INCREMENT, String.valueOf(DEFAULT_BUF_INCREMENT))); + this.maxFileSize = Integer + .parseInt(conf.getOrDefault(CONF_MEASUREMENT_FILE_MAX, String.valueOf(DEFAULT_MAX_FILE_SIZE))); + if (fileMapIncrement >= maxFileSize) { + throw new IllegalArgumentException("File increment can't be greater than or equal to file size"); + } + this.bgTaskPool.scheduleAtFixedRate(() -> { + }, 0, 60, TimeUnit.SECONDS); + } + + private String getPtrPath() { + return dataDirectory + "/.ptr"; + } + + private String getMetadataPath() { + return dataDirectory + "/.md"; + } + + @Override + public TimeSeries getOrCreateTimeSeries(String valueFieldName, List tags, int timeBucketSize, boolean fp, + Map conf) throws IOException { + Collections.sort(tags); + String seriesId = constructSeriesId(valueFieldName, tags, tagIndex); + TimeSeries timeSeries = getTimeSeries(seriesId); + if (timeSeries == null) { + synchronized (seriesMap) { + if ((timeSeries = getTimeSeries(seriesId)) == null) { + Measurement.indexRowKey(tagIndex, seriesId, tags); + timeSeries = new TimeSeries(this, compressionClass, seriesId, timeBucketSize, metadata, fp, conf); + seriesMap.put(seriesId, timeSeries); + appendTimeseriesToMeasurementMetadata(seriesId, fp, timeBucketSize); + logger.fine("Created new timeseries:" + timeSeries + " for measurement:" + measurementName + "\t" + + seriesId + "\t" + metadata.getRetentionHours() + "\t" + seriesMap.size()); + } + } + } + return timeSeries; + } + + @Override + public void loadTimeseriesFromMeasurements() throws IOException { + logger.info("Loading measurement:" + measurementName); + String mdFilePath = getMetadataPath(); + File file = new File(mdFilePath); + if (!file.exists()) { + logger.warning("Metadata file missing for measurement:" + measurementName); + return; + } + + List seriesEntries = MiscUtils.readAllLines(file); + loadSeriesEntries(seriesEntries); + + Map bufferMap = new HashMap<>(); + Map> seriesBuffers = seriesBufferMap(bufferMap); + for (String series : seriesMap.keySet()) { + TimeSeries ts = seriesMap.get(series); + List list = seriesBuffers.get(series); + if (list != null) { + ts.loadBucketMap(list); + } + } + } + + private Map> seriesBufferMap(Map bufferMap) + throws FileNotFoundException, IOException { + File[] listFiles = new File(dataDirectory).listFiles(new FilenameFilter() { + + @Override + public boolean accept(File dir, String name) { + return name.endsWith(".dat"); + } + }); + + for (File dataFile : listFiles) { + RandomAccessFile raf = new RandomAccessFile(dataFile, "r"); + MappedByteBuffer map = raf.getChannel().map(MapMode.READ_ONLY, 0, dataFile.length()); + bufferMap.put(dataDirectory + "/" + dataFile.getName(), map); + logger.info("Recovering data file:" + dataDirectory + "/" + dataFile.getName()); + raf.close(); + } + fcnt = listFiles.length; + + Map> seriesBuffers = new HashMap<>(); + List lines = MiscUtils.readAllLines(new File(getPtrPath())); + Collections.sort(lines); + for (String line : lines) { + String[] splits = line.split("\\s+"); + String seriesId = splits[0]; + String fileName = splits[1]; + int pointer = Integer.parseInt(splits[2]); + ByteBuffer buf = bufferMap.get(fileName); + buf.position(pointer); + ByteBuffer slice = buf.slice(); + slice.limit(increment); + List list = seriesBuffers.get(seriesId); + if (list == null) { + list = new ArrayList<>(); + seriesBuffers.put(seriesId, list); + } + list.add(slice); + } + return seriesBuffers; + } + + private void loadSeriesEntries(List seriesEntries) { + for (String entry : seriesEntries) { + String[] split = entry.split("\t"); + String seriesId = split[0]; + logger.info("Loading Timeseries:" + seriesId); + try { + String timeBucketSize = split[2]; + String isFp = split[1]; + seriesMap.put(seriesId, new TimeSeries(this, compressionClass, seriesId, + Integer.parseInt(timeBucketSize), metadata, Boolean.parseBoolean(isFp), conf)); + logger.info("Intialized Timeseries:" + seriesId); + } catch (NumberFormatException | IOException e) { + logger.log(Level.SEVERE, "Failed to load series:" + entry, e); + } + } + } + + @Override + public Collection getTimeSeries() { + return seriesMap.values(); + } + + @Override + public Map getTimeSeriesMap() { + return seriesMap; + } + + @Override + public TagIndex getTagIndex() { + return tagIndex; + } + + protected TimeSeries getTimeSeries(String entry) { + return seriesMap.get(entry); + } + + protected void createMeasurementDirectory() throws IOException { + new File(dataDirectory).mkdirs(); + new File(indexDirectory).mkdirs(); + } + + protected void appendTimeseriesToMeasurementMetadata(String seriesId, boolean fp, int timeBucketSize) + throws IOException { + DiskStorageEngine.appendLineToFile(seriesId + "\t" + fp + "\t" + timeBucketSize, prMetadata); + } + + @Override + public ByteBuffer createNewBuffer(String seriesId) throws IOException { + if (activeFile == null) { + synchronized (this) { + if (activeFile == null) { + filename = dataDirectory + "/data-" + String.format("%03d", fcnt) + ".dat"; + activeFile = new RandomAccessFile(filename, "rwd"); + logger.info("Creating new datafile for measurement:" + filename); + memoryMappedBuffer = activeFile.getChannel().map(MapMode.READ_WRITE, 0, fileMapIncrement); + bufTracker.add(memoryMappedBuffer); + fcnt++; + } + } + } + synchronized (activeFile) { + if (curr + increment < 0 || curr + increment > memoryMappedBuffer.remaining()) { + base = 0; + long position = (((long) (fileMapIncrement)) * itr) + 1; + // close the current data file, increment the filename by 1 so + // that + // a new data file will be created next time a buffer is + // requested + if (position >= maxFileSize) { + itr = 0; + logger.info("Rotating datafile for measurement:" + measurementName + " closing active file" + + activeFile); + activeFile.close(); + activeFile = null; + return createNewBuffer(seriesId); + } + memoryMappedBuffer = activeFile.getChannel().map(MapMode.READ_WRITE, position, fileMapIncrement); + logger.fine("Buffer expansion:" + position + "\t" + curr); + // bufTracker.add(memoryMappedBuffer); + itr++; + } + curr = base * increment; + memoryMappedBuffer.position(curr); + appendBufferPointersToDisk(seriesId, filename, curr); + base++; + ByteBuffer buf = memoryMappedBuffer.slice(); + buf.limit(increment); + // System.out.println("Position:" + buf.position() + "\t" + buf.limit() + "\t" + + // buf.capacity()); + return buf; + } + } + + protected void appendBufferPointersToDisk(String seriesId, String filename, int curr) throws IOException { + DiskStorageEngine.appendLineToFile(seriesId + "\t" + filename + "\t" + curr, prBufPointers); + } + + @Override + public String getMeasurementName() { + return measurementName; + } + + @Override + public Set getTags() { + return tagIndex.getTags(); + } + + @Override + public Logger getLogger() { + return logger; + } + + @Override + public void close() throws IOException { + if (activeFile != null) { + activeFile.close(); + } + if (memoryMappedBuffer != null) { + memoryMappedBuffer.force(); + } + tagIndex.close(); + prBufPointers.close(); + prMetadata.close(); + logger.info("Closing measurement:" + measurementName); + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "PersistentMeasurement [seriesMap=" + seriesMap + ", measurementName=" + measurementName + "]"; + } + +} diff --git a/core/src/main/java/com/srotya/sidewinder/core/storage/mem/MemStorageEngine.java b/core/src/main/java/com/srotya/sidewinder/core/storage/mem/MemStorageEngine.java index 872159d..431a050 100644 --- a/core/src/main/java/com/srotya/sidewinder/core/storage/mem/MemStorageEngine.java +++ b/core/src/main/java/com/srotya/sidewinder/core/storage/mem/MemStorageEngine.java @@ -16,10 +16,7 @@ package com.srotya.sidewinder.core.storage.mem; import java.io.IOException; -import java.util.ArrayList; -import java.util.Collections; import java.util.HashSet; -import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -35,19 +32,18 @@ import com.srotya.sidewinder.core.aggregators.AggregationFunction; import com.srotya.sidewinder.core.filters.Filter; import com.srotya.sidewinder.core.predicates.Predicate; -import com.srotya.sidewinder.core.storage.ArchiveException; import com.srotya.sidewinder.core.storage.Archiver; import com.srotya.sidewinder.core.storage.DBMetadata; import com.srotya.sidewinder.core.storage.DataPoint; import com.srotya.sidewinder.core.storage.ItemNotFoundException; -import com.srotya.sidewinder.core.storage.Reader; +import com.srotya.sidewinder.core.storage.Measurement; import com.srotya.sidewinder.core.storage.RejectException; import com.srotya.sidewinder.core.storage.SeriesQueryOutput; import com.srotya.sidewinder.core.storage.StorageEngine; -import com.srotya.sidewinder.core.storage.TagIndex; +import com.srotya.sidewinder.core.storage.TimeSeries; import com.srotya.sidewinder.core.storage.TimeSeriesBucket; +import com.srotya.sidewinder.core.storage.compression.Reader; import com.srotya.sidewinder.core.storage.mem.archival.NoneArchiver; -import com.srotya.sidewinder.core.storage.mem.archival.TimeSeriesArchivalObject; /** * In-memory Timeseries {@link StorageEngine} implementation that uses the @@ -78,65 +74,66 @@ public class MemStorageEngine implements StorageEngine { private static RejectException FP_MISMATCH_EXCEPTION = new RejectException("Floating point mismatch"); private static RejectException INVALID_DATAPOINT_EXCEPTION = new RejectException( "Datapoint is missing required values"); - private Map>> databaseMap; + private Map> databaseMap; private AtomicInteger counter = new AtomicInteger(0); - private Map> tagLookupTable; private Map dbMetadataMap; private int defaultRetentionHours; private int defaultTimebucketSize; private Archiver archiver; - private String compressionFQCN; private Map conf; + private ScheduledExecutorService bgTaskPool; @Override public void configure(Map conf, ScheduledExecutorService bgTaskPool) throws IOException { this.conf = conf; + this.bgTaskPool = bgTaskPool; this.defaultRetentionHours = Integer .parseInt(conf.getOrDefault(RETENTION_HOURS, String.valueOf(DEFAULT_RETENTION_HOURS))); logger.info("Setting default timeseries retention hours policy to:" + defaultRetentionHours); - tagLookupTable = new ConcurrentHashMap<>(); databaseMap = new ConcurrentHashMap<>(); dbMetadataMap = new ConcurrentHashMap<>(); try { archiver = (Archiver) Class.forName(conf.getOrDefault("archiver.class", NoneArchiver.class.getName())) .newInstance(); archiver.init(conf); - } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); + } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { + logger.log(Level.SEVERE, "Failed to instantiate archiver", e); } this.defaultTimebucketSize = Integer .parseInt(conf.getOrDefault(DEFAULT_BUCKET_SIZE, String.valueOf(DEFAULT_TIME_BUCKET_CONSTANT))); conf.put(PERSISTENCE_DISK, "false"); - compressionFQCN = conf.getOrDefault(COMPRESSION_CLASS, DEFAULT_COMPRESSION_CLASS); if (bgTaskPool != null) { bgTaskPool.scheduleAtFixedRate(() -> { - for (Entry>> measurementMap : databaseMap.entrySet()) { - String db = measurementMap.getKey(); - for (Entry> measurementEntry : measurementMap.getValue() - .entrySet()) { - String measurement = measurementEntry.getKey(); - for (Entry entry : measurementEntry.getValue().entrySet()) { - List buckets; - try { - buckets = entry.getValue().collectGarbage(); - } catch (IOException e1) { - continue; - } - if (archiver != null) { - for (TimeSeriesBucket bucket : buckets) { - try { - archiver.archive( - new TimeSeriesArchivalObject(db, measurement, entry.getKey(), bucket)); - } catch (ArchiveException e) { - logger.log(Level.WARNING, - "Failed to archive time series bucket:" + entry.getKey(), e); - } - } - } - } - } - } + // for (Entry>> + // measurementMap : databaseMap.entrySet()) { + // String db = measurementMap.getKey(); + // for (Entry> measurementEntry + // : measurementMap.getValue() + // .entrySet()) { + // String measurement = measurementEntry.getKey(); + // for (Entry entry : + // measurementEntry.getValue().entrySet()) { + // List buckets; + // try { + // buckets = entry.getValue().collectGarbage(); + // } catch (IOException e1) { + // continue; + // } + // if (archiver != null) { + // for (TimeSeriesBucket bucket : buckets) { + // try { + // archiver.archive( + // new TimeSeriesArchivalObject(db, measurement, entry.getKey(), + // bucket)); + // } catch (ArchiveException e) { + // logger.log(Level.WARNING, + // "Failed to archive time series bucket:" + entry.getKey(), e); + // } + // } + // } + // } + // } + // } }, Integer.parseInt(conf.getOrDefault(GC_FREQUENCY, DEFAULT_GC_FREQUENCY)), Integer.parseInt(conf.getOrDefault(GC_DELAY, DEFAULT_GC_DELAY)), TimeUnit.MILLISECONDS); } @@ -151,15 +148,14 @@ public void updateTimeSeriesRetentionPolicy(String dbName, String measurementNam } @Override - public void updateTimeSeriesRetentionPolicy(String dbName, String measurementName, int retentionHours) { - Map> measurementMap = databaseMap.get(dbName); - if (measurementMap != null) { - Map seriesMap = measurementMap.get(measurementName); - if (seriesMap != null) { - for (TimeSeries series : seriesMap.values()) { - series.setRetentionHours(retentionHours); - } - } + public void updateTimeSeriesRetentionPolicy(String dbName, String measurementName, int retentionHours) + throws ItemNotFoundException { + if (!checkIfExists(dbName, measurementName)) { + throw NOT_FOUND_EXCEPTION; + } + Measurement measurement = databaseMap.get(dbName).get(measurementName); + for (TimeSeries series : measurement.getTimeSeriesMap().values()) { + series.setRetentionHours(retentionHours); } } @@ -168,10 +164,10 @@ public void updateTimeSeriesRetentionPolicy(String dbName, int retentionHours) { DBMetadata metadata = dbMetadataMap.get(dbName); synchronized (metadata) { metadata.setRetentionHours(retentionHours); - Map> measurementMap = databaseMap.get(dbName); + Map measurementMap = databaseMap.get(dbName); if (measurementMap != null) { - for (Map sortedMap : measurementMap.values()) { - for (TimeSeries timeSeries : sortedMap.values()) { + for (Measurement sortedMap : measurementMap.values()) { + for (TimeSeries timeSeries : sortedMap.getTimeSeries()) { timeSeries.setRetentionHours(retentionHours); } } @@ -192,38 +188,10 @@ public void updateTimeSeriesRetentionPolicy(String dbName, int retentionHours) { public LinkedHashMap queryReaders(String dbName, String measurementName, String valueFieldName, long startTime, long endTime) throws Exception { LinkedHashMap readers = new LinkedHashMap<>(); - Map> measurementMap = databaseMap.get(dbName); - if (measurementMap != null) { - Map seriesMap = measurementMap.get(measurementName); - if (seriesMap != null) { - TagIndex memTagIndex = getOrCreateTagIndex(dbName, measurementName); - for (String entry : seriesMap.keySet()) { - TimeSeries series = seriesMap.get(entry); - String[] keys = entry.split(FIELD_TAG_SEPARATOR); - if (keys.length != 2) { - // TODO report major error, series ingested without tag - // field encoding - continue; - } - if (!keys[0].equals(valueFieldName)) { - continue; - } - List seriesTags = null; - if (keys.length > 1) { - seriesTags = decodeStringToTags(memTagIndex, keys[1]); - } else { - seriesTags = new ArrayList<>(); - } - for (Reader reader : series.queryReader(valueFieldName, seriesTags, startTime, endTime, null)) { - readers.put(reader, series.isFp()); - } - } - } else { - throw new ItemNotFoundException("Measurement " + measurementName + " not found"); - } - } else { - throw new ItemNotFoundException("Database " + dbName + " not found"); + if (!checkIfExists(dbName, measurementName)) { + throw NOT_FOUND_EXCEPTION; } + databaseMap.get(dbName).get(measurementName).queryReaders(valueFieldName, startTime, endTime, readers); return readers; } @@ -232,44 +200,15 @@ public Set queryDataPoints(String dbName, String measurementN long startTime, long endTime, List tagList, Filter> tagFilter, Predicate valuePredicate, AggregationFunction aggregationFunction) throws ItemNotFoundException { Set resultMap = new HashSet<>(); - Map> measurementMap = databaseMap.get(dbName); + Map measurementMap = databaseMap.get(dbName); if (measurementMap != null) { - Map seriesMap = measurementMap.get(measurementName); - if (seriesMap != null) { - TagIndex memTagIndex = getOrCreateTagIndex(dbName, measurementName); - Set rowKeys = null; - if (tagList == null || tagList.size() == 0) { - rowKeys = seriesMap.keySet(); - } else { - rowKeys = getTagFilteredRowKeys(dbName, measurementName, valueFieldName, tagFilter, tagList); - } - for (String entry : rowKeys) { - TimeSeries value = seriesMap.get(entry); - String[] keys = entry.split(FIELD_TAG_SEPARATOR); - if (!keys[0].equals(valueFieldName)) { - continue; - } - List points = null; - List seriesTags = null; - if (keys.length > 1) { - seriesTags = decodeStringToTags(memTagIndex, keys[1]); - } else { - seriesTags = new ArrayList<>(); - } - try { - points = value.queryDataPoints(keys[0], seriesTags, startTime, endTime, valuePredicate); - } catch (IOException e) { - logger.log(Level.SEVERE, "Error querying datapoints", e); - } - if (aggregationFunction != null) { - points = aggregationFunction.aggregate(points); - } - if (points == null) { - points = new ArrayList<>(); - } - if (points.size() > 0) { - resultMap.add(new SeriesQueryOutput(measurementName, keys[0], seriesTags, points)); - } + Measurement measurement = measurementMap.get(measurementName); + if (measurement != null) { + try { + measurement.queryDataPoints(valueFieldName, startTime, endTime, tagList, tagFilter, valuePredicate, + aggregationFunction, resultMap); + } catch (IOException e) { + logger.log(Level.SEVERE, "Error running query on measurement", e); } } else { throw new ItemNotFoundException("Measurement " + measurementName + " not found"); @@ -285,7 +224,7 @@ public Set getMeasurementsLike(String dbName, String partialMeasurementN if (!checkIfExists(dbName)) { throw NOT_FOUND_EXCEPTION; } - Map> measurementMap = databaseMap.get(dbName); + Map measurementMap = databaseMap.get(dbName); partialMeasurementName = partialMeasurementName.trim(); if (partialMeasurementName.isEmpty()) { return measurementMap.keySet(); @@ -326,8 +265,8 @@ public void writeDataPoint(DataPoint dp) throws IOException { } @Override - public Map> getOrCreateDatabase(String dbName) { - Map> measurementMap = databaseMap.get(dbName); + public Map getOrCreateDatabase(String dbName) { + Map measurementMap = databaseMap.get(dbName); if (measurementMap == null) { synchronized (databaseMap) { if ((measurementMap = databaseMap.get(dbName)) == null) { @@ -345,111 +284,80 @@ public Map> getOrCreateDatabase(String dbName) { } @Override - public Map> getOrCreateDatabase(String dbName, int retentionPolicy) { - Map> map = getOrCreateDatabase(dbName); + public Map getOrCreateDatabase(String dbName, int retentionPolicy) { + Map map = getOrCreateDatabase(dbName); updateTimeSeriesRetentionPolicy(dbName, retentionPolicy); return map; } @Override - public Map getOrCreateMeasurement(String dbName, String measurementName) { - Map> measurementMap = getOrCreateDatabase(dbName); - return getOrCreateMeasurement(measurementMap, measurementName); + public Measurement getOrCreateMeasurement(String dbName, String measurementName) throws IOException { + Map measurementMap = getOrCreateDatabase(dbName); + return getOrCreateMeasurement(measurementMap, dbName, measurementName); } - protected Map getOrCreateMeasurement(Map> measurementMap, - String measurementName) { - Map seriesMap = measurementMap.get(measurementName); - if (seriesMap == null) { + protected Measurement getOrCreateMeasurement(Map measurementMap, String dbName, + String measurementName) throws IOException { + Measurement measurement = measurementMap.get(measurementName); + if (measurement == null) { synchronized (measurementMap) { - if ((seriesMap = measurementMap.get(measurementName)) == null) { - seriesMap = new ConcurrentHashMap<>(); - measurementMap.put(measurementName, seriesMap); + if ((measurement = measurementMap.get(measurementName)) == null) { + // TODO create measurement + measurement = new MemoryMeasurement(); + measurement.configure(conf, measurementName, "", "", dbMetadataMap.get(dbName), bgTaskPool); + measurementMap.put(measurementName, measurement); logger.info("Created new measurement:" + measurementName); } } } - return seriesMap; + return measurement; } @Override public boolean checkTimeSeriesExists(String dbName, String measurementName, String valueFieldName, List tags) throws Exception { - Collections.sort(tags); - - if (!checkIfExists(dbName)) { - return false; - } - // check and create database map - Map> dbMap = getOrCreateDatabase(dbName); - if (!checkIfExists(dbName, measurementName)) { return false; } - // check and create measurement map - Map measurementMap = getOrCreateMeasurement(dbMap, measurementName); - - String rowKey = constructRowKey(dbName, measurementName, valueFieldName, tags); // check and create timeseries - TimeSeries timeSeries = measurementMap.get(rowKey); - + TimeSeries timeSeries = databaseMap.get(dbName).get(measurementName).getTimeSeries(valueFieldName, tags); return timeSeries != null; } @Override public TimeSeries getOrCreateTimeSeries(String dbName, String measurementName, String valueFieldName, List tags, int timeBucketSize, boolean fp) throws IOException { - Collections.sort(tags); - - String rowKey = constructRowKey(dbName, measurementName, valueFieldName, tags); - // check and create database map - Map> dbMap = getOrCreateDatabase(dbName); + Map dbMap = getOrCreateDatabase(dbName); // check and create measurement map - Map measurementMap = getOrCreateMeasurement(dbMap, measurementName); + Measurement measurement = getOrCreateMeasurement(dbMap, dbName, measurementName); // check and create timeseries - TimeSeries timeSeries = measurementMap.get(rowKey); - if (timeSeries == null) { - synchronized (measurementMap) { - if ((timeSeries = measurementMap.get(rowKey)) == null) { - timeSeries = new TimeSeries(compressionFQCN, measurementName + "_" + rowKey, - dbMetadataMap.get(dbName), timeBucketSize, fp, conf); - measurementMap.put(rowKey, timeSeries); - logger.fine("Created new timeseries:" + timeSeries + " for measurement:" + measurementName + "\t" - + rowKey + "\t" + dbMetadataMap.get(dbName)); - } - } - } - return timeSeries; + return measurement.getOrCreateTimeSeries(valueFieldName, tags, timeBucketSize, fp, conf); } @Override public TimeSeries getTimeSeries(String dbName, String measurementName, String valueFieldName, List tags) throws IOException { - Collections.sort(tags); - - String rowKey = constructRowKey(dbName, measurementName, valueFieldName, tags); - // check and create database map - Map> dbMap = getOrCreateDatabase(dbName); + Map dbMap = getOrCreateDatabase(dbName); // check and create measurement map - Map measurementMap = getOrCreateMeasurement(dbMap, measurementName); + Measurement measurementMap = getOrCreateMeasurement(dbMap, dbName, measurementName); // check and create timeseries - return measurementMap.get(rowKey); + return measurementMap.getTimeSeries(valueFieldName, tags); } @Override public boolean isMeasurementFieldFP(String dbName, String measurementName, String valueFieldName) - throws RejectException { - Map> dbMap = getOrCreateDatabase(dbName); + throws IOException { + Map dbMap = getOrCreateDatabase(dbName); // check and create measurement map - Map measurementMap = getOrCreateMeasurement(dbMap, measurementName); - for (Entry entry : measurementMap.entrySet()) { + Measurement measurement = getOrCreateMeasurement(dbMap, dbName, measurementName); + for (Entry entry : measurement.getTimeSeriesMap().entrySet()) { if (entry.getKey().startsWith(valueFieldName)) { return entry.getValue().isFp(); } @@ -457,72 +365,23 @@ public boolean isMeasurementFieldFP(String dbName, String measurementName, Strin throw NOT_FOUND_EXCEPTION; } - public Set getSeriesIdsWhereTags(String dbName, String measurementName, List tags) { - Set series = new HashSet<>(); - TagIndex memTagLookupTable = getOrCreateTagIndex(dbName, measurementName); - for (String tag : tags) { - Set keys = memTagLookupTable.searchRowKeysForTag(tag); - if (keys != null) { - series.addAll(keys); - } + @Override + public Set getSeriesIdsWhereTags(String dbName, String measurementName, List tags) + throws IOException { + if (!checkIfExists(dbName, measurementName)) { + throw NOT_FOUND_EXCEPTION; } - return series; + return databaseMap.get(dbName).get(measurementName).getSeriesIdsWhereTags(tags); } + @Override public Set getTagFilteredRowKeys(String dbName, String measurementName, String valueFieldName, - Filter> tagFilterTree, List rawTags) { - Set filteredSeries = getSeriesIdsWhereTags(dbName, measurementName, rawTags); - for (Iterator iterator = filteredSeries.iterator(); iterator.hasNext();) { - String rowKey = iterator.next(); - if (!rowKey.startsWith(valueFieldName)) { - continue; - } - String[] keys = rowKey.split(FIELD_TAG_SEPARATOR); - if (keys.length != 2) { - // TODO report major error, series ingested without tag - // field encoding - logger.severe("Invalid series tag encode, series ingested without tag field encoding"); - iterator.remove(); - continue; - } - if (!keys[0].equals(valueFieldName)) { - iterator.remove(); - continue; - } - List seriesTags = null; - if (keys.length > 1) { - seriesTags = decodeStringToTags(getOrCreateTagIndex(dbName, measurementName), keys[1]); - } else { - seriesTags = new ArrayList<>(); - } - if (tagFilterTree != null && !tagFilterTree.isRetain(seriesTags)) { - iterator.remove(); - } - } - return filteredSeries; - } - - public TagIndex getOrCreateTagIndex(String dbName, String measurementName) { - Map lookupMap = tagLookupTable.get(dbName); - if (lookupMap == null) { - synchronized (tagLookupTable) { - if ((lookupMap = tagLookupTable.get(dbName)) == null) { - lookupMap = new ConcurrentHashMap<>(); - tagLookupTable.put(dbName, lookupMap); - } - } - } - - MemTagIndex memTagLookupTable = lookupMap.get(measurementName); - if (memTagLookupTable == null) { - synchronized (lookupMap) { - if ((memTagLookupTable = lookupMap.get(measurementName)) == null) { - memTagLookupTable = new MemTagIndex(); - lookupMap.put(measurementName, memTagLookupTable); - } - } + Filter> tagFilterTree, List rawTags) throws IOException { + if (!checkIfExists(dbName, measurementName)) { + throw NOT_FOUND_EXCEPTION; } - return memTagLookupTable; + return databaseMap.get(dbName).get(measurementName).getTagFilteredRowKeys(valueFieldName, tagFilterTree, + rawTags); } @Override @@ -546,7 +405,7 @@ public void deleteAllData() throws Exception { } @Override - public boolean checkIfExists(String dbName) throws Exception { + public boolean checkIfExists(String dbName) { return databaseMap.containsKey(dbName); } @@ -567,7 +426,7 @@ public void dropMeasurement(String dbName, String measurementName) throws Except * @param measurementName * @return */ - protected Map getSeriesMap(String dbName, String measurementName) { + protected Measurement getMeasurement(String dbName, String measurementName) { return databaseMap.get(dbName).get(measurementName); } @@ -580,7 +439,7 @@ public void disconnect() throws IOException { } @Override - public boolean checkIfExists(String dbName, String measurement) throws Exception { + public boolean checkIfExists(String dbName, String measurement) { if (checkIfExists(dbName)) { return databaseMap.get(dbName).containsKey(measurement); } else { @@ -590,45 +449,19 @@ public boolean checkIfExists(String dbName, String measurement) throws Exception @Override public Set getTagsForMeasurement(String dbName, String measurementName) throws Exception { - Map measurementMap = tagLookupTable.get(dbName); - if (measurementMap == null) { - throw new ItemNotFoundException("Database " + dbName + " not found"); - } - MemTagIndex memTagLookupTable = measurementMap.get(measurementName); - if (memTagLookupTable == null) { - throw new ItemNotFoundException("Measurement " + measurementName + " not found"); + if (!checkIfExists(dbName, measurementName)) { + throw NOT_FOUND_EXCEPTION; } - return memTagLookupTable.getTags(); + return databaseMap.get(dbName).get(measurementName).getTags(); } @Override public List> getTagsForMeasurement(String dbName, String measurementName, String valueFieldName) throws Exception { - Map measurementMap = tagLookupTable.get(dbName); - if (measurementMap == null) { - throw new ItemNotFoundException("Database " + dbName + " not found"); - } - MemTagIndex memTagLookupTable = measurementMap.get(measurementName); - if (memTagLookupTable == null) { - throw new ItemNotFoundException("Measurement " + measurementName + " not found"); - } - Map map = databaseMap.get(dbName).get(measurementMap); - Set keySet = new HashSet<>(); - for (Entry entry : map.entrySet()) { - if (entry.getKey().startsWith(valueFieldName)) { - keySet.add(entry.getKey()); - } - } - List> tagList = new ArrayList<>(); - for (String entry : keySet) { - String[] keys = entry.split(FIELD_TAG_SEPARATOR); - if (!keys[0].equals(valueFieldName)) { - continue; - } - List tags = decodeStringToTags(memTagLookupTable, keys[1]); - tagList.add(tags); + if (!checkIfExists(dbName, measurementName)) { + throw NOT_FOUND_EXCEPTION; } - return tagList; + return databaseMap.get(dbName).get(measurementName).getTagsForMeasurement(valueFieldName); } @Override @@ -636,26 +469,15 @@ public Set getFieldsForMeasurement(String dbName, String measurementName if (!checkIfExists(dbName, measurementName)) { throw NOT_FOUND_EXCEPTION; } - Map> measurementMap = databaseMap.get(dbName); - if (measurementMap == null) { - throw new ItemNotFoundException("Database " + dbName + " not found"); - } - Map seriesMap = measurementMap.get(measurementName); - if (seriesMap == null) { - throw new ItemNotFoundException("Measurement " + measurementName + " not found"); - } - Set results = new HashSet<>(); - Set keySet = seriesMap.keySet(); - for (String key : keySet) { - String[] splits = key.split(FIELD_TAG_SEPARATOR); - if (splits.length == 2) { - results.add(splits[0]); - } - } - return results; + return databaseMap.get(dbName).get(measurementName).getFieldsForMeasurement(); } public Map getDbMetadataMap() { return dbMetadataMap; } + + @Override + public Map> getMeasurementMap() { + return databaseMap; + } } diff --git a/core/src/main/java/com/srotya/sidewinder/core/storage/mem/MemTagIndex.java b/core/src/main/java/com/srotya/sidewinder/core/storage/mem/MemTagIndex.java index 337b8fa..1317976 100644 --- a/core/src/main/java/com/srotya/sidewinder/core/storage/mem/MemTagIndex.java +++ b/core/src/main/java/com/srotya/sidewinder/core/storage/mem/MemTagIndex.java @@ -22,7 +22,9 @@ import java.util.concurrent.ConcurrentHashMap; import com.srotya.sidewinder.core.storage.TagIndex; -import com.srotya.sidewinder.core.utils.MurmurHash; + +import net.jpountz.xxhash.XXHash32; +import net.jpountz.xxhash.XXHashFactory; /** * Tag hash lookup table + Tag inverted index @@ -33,19 +35,23 @@ public class MemTagIndex implements TagIndex { private Map tagMap; private Map> rowKeyIndex; + private XXHashFactory factory = XXHashFactory.fastestInstance(); + private XXHash32 hash; public MemTagIndex() { tagMap = new ConcurrentHashMap<>(); rowKeyIndex = new ConcurrentHashMap<>(); + hash = factory.hash32(); } /** * Hashes the tag to UI + * * @param tag * @return uid */ public String createEntry(String tag) { - int hash32 = MurmurHash.hash32(tag); + int hash32 = hash.hash(tag.getBytes(), 0, tag.length(), 57); String val = tagMap.get(hash32); if (val == null) { tagMap.put(hash32, tag); @@ -63,6 +69,7 @@ public Set getTags() { /** * Indexes tag in the row key, creating an adjacency list + * * @param tag * @param rowKey */ @@ -76,7 +83,9 @@ public void index(String tag, String rowKey) { } } } - rowKeySet.add(rowKey); + if (!rowKeySet.contains(rowKey)) { + rowKeySet.add(rowKey); + } } public Set searchRowKeysForTag(String tag) { diff --git a/core/src/main/java/com/srotya/sidewinder/core/storage/mem/MemoryMeasurement.java b/core/src/main/java/com/srotya/sidewinder/core/storage/mem/MemoryMeasurement.java new file mode 100644 index 0000000..2a2fe94 --- /dev/null +++ b/core/src/main/java/com/srotya/sidewinder/core/storage/mem/MemoryMeasurement.java @@ -0,0 +1,130 @@ +/** + * Copyright 2017 Ambud Sharma + * + * Licensed 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 com.srotya.sidewinder.core.storage.mem; + +import java.io.IOException; +import java.nio.ByteBuffer; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ScheduledExecutorService; +import java.util.logging.Logger; + +import com.srotya.sidewinder.core.storage.DBMetadata; +import com.srotya.sidewinder.core.storage.Measurement; +import com.srotya.sidewinder.core.storage.StorageEngine; +import com.srotya.sidewinder.core.storage.TagIndex; +import com.srotya.sidewinder.core.storage.TimeSeries; + +/** + * @author ambud + */ +public class MemoryMeasurement implements Measurement { + + private static Logger logger = Logger.getLogger(MemoryMeasurement.class.getName()); + private String measurementName; + private DBMetadata metadata; + private Map seriesMap; + private MemTagIndex tagIndex; + private List bufTracker; + private String compressionClass; + + @Override + public void configure(Map conf, String measurementName, String baseIndexDirectory, + String dataDirectory, DBMetadata metadata, ScheduledExecutorService bgTaskPool) throws IOException { + this.measurementName = measurementName; + this.metadata = metadata; + this.tagIndex = new MemTagIndex(); + this.seriesMap = new ConcurrentHashMap<>(); + this.bufTracker = new ArrayList<>(); + this.compressionClass = conf.getOrDefault(StorageEngine.COMPRESSION_CLASS, + StorageEngine.DEFAULT_COMPRESSION_CLASS); + } + + @Override + public Collection getTimeSeries() { + return seriesMap.values(); + } + + @Override + public Map getTimeSeriesMap() { + return seriesMap; + } + + @Override + public TagIndex getTagIndex() { + return tagIndex; + } + + @Override + public void loadTimeseriesFromMeasurements() throws IOException { + } + + @Override + public void close() throws IOException { + } + + @Override + public ByteBuffer createNewBuffer(String seriesId) throws IOException { + ByteBuffer allocateDirect = ByteBuffer.allocateDirect(1024); + synchronized (bufTracker) { + bufTracker.add(allocateDirect); + } + return allocateDirect; + } + + public List getBufTracker() { + return bufTracker; + } + + @Override + public TimeSeries getOrCreateTimeSeries(String valueFieldName, List tags, int timeBucketSize, boolean fp, + Map conf) throws IOException { + Collections.sort(tags); + String rowKey = constructSeriesId(valueFieldName, tags, tagIndex); + TimeSeries timeSeries = getTimeSeries(rowKey); + if (timeSeries == null) { + synchronized (this) { + if ((timeSeries = getTimeSeries(rowKey)) == null) { + Measurement.indexRowKey(tagIndex, rowKey, tags); + timeSeries = new TimeSeries(this, compressionClass, rowKey, timeBucketSize, metadata, fp, conf); + seriesMap.put(rowKey, timeSeries); + logger.fine("Created new timeseries:" + timeSeries + " for measurement:" + measurementName + "\t" + + rowKey + "\t" + metadata); + } + } + } + return timeSeries; + } + + private TimeSeries getTimeSeries(String rowKey) { + return getTimeSeriesMap().get(rowKey); + } + + @Override + public String getMeasurementName() { + return measurementName; + } + + @Override + public Logger getLogger() { + return logger; + } + +} diff --git a/core/src/main/java/com/srotya/sidewinder/core/storage/mem/TimeSeries.java b/core/src/main/java/com/srotya/sidewinder/core/storage/mem/TimeSeries.java deleted file mode 100644 index 26e91b6..0000000 --- a/core/src/main/java/com/srotya/sidewinder/core/storage/mem/TimeSeries.java +++ /dev/null @@ -1,376 +0,0 @@ -/** - * Copyright 2017 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.storage.mem; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.SortedMap; -import java.util.concurrent.ConcurrentSkipListMap; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.logging.Level; -import java.util.logging.Logger; - -import com.srotya.sidewinder.core.predicates.BetweenPredicate; -import com.srotya.sidewinder.core.predicates.Predicate; -import com.srotya.sidewinder.core.storage.DBMetadata; -import com.srotya.sidewinder.core.storage.DataPoint; -import com.srotya.sidewinder.core.storage.Reader; -import com.srotya.sidewinder.core.storage.RejectException; -import com.srotya.sidewinder.core.storage.TimeSeriesBucket; -import com.srotya.sidewinder.core.utils.TimeUtils; - -/** - * A timeseries is defined as a subset of a measurement for a specific set of - * tags. Measurement is defined as a category and is an abstract to group - * metrics about a given topic under a the same label. E.g of a measurement is - * CPU, Memory whereas a {@link TimeSeries} would be cpu measurement on a - * specific host.
- *
- * Internally a {@link TimeSeries} contains a {@link SortedMap} of buckets that - * bundle datapoints under temporally sorted partitions that makes storage, - * retrieval and evictions efficient. This class provides the abstractions - * around that, therefore partitioning / bucketing interval can be controlled on - * a per {@link TimeSeries} basis rather than keep it a constant.
- *
- * - * @author ambud - */ -public class TimeSeries { - - private SortedMap bucketMap; - private boolean fp; - private AtomicInteger retentionBuckets; - private static final Logger logger = Logger.getLogger(TimeSeries.class.getName()); - private String seriesId; - private int timeBucketSize; - private String compressionFQCN; - private Map conf; - - protected TimeSeries() { - } - - /** - * @param seriesId - * used for logger name - * @param metadata - * duration of data that will be stored in this time series - * @param timeBucketSize - * size of each time bucket (partition) - * @param fp - */ - public TimeSeries(String compressionFQCN, String seriesId, DBMetadata metadata, int timeBucketSize, boolean fp, - Map conf) { - this.compressionFQCN = compressionFQCN; - this.seriesId = seriesId; - this.timeBucketSize = timeBucketSize; - this.conf = conf; - retentionBuckets = new AtomicInteger(0); - setRetentionHours(metadata.getRetentionHours()); - this.fp = fp; - bucketMap = new ConcurrentSkipListMap<>(); - } - - /** - * Extract {@link DataPoint}s for the supplied time range and value - * predicate. - * - * Each {@link DataPoint} has the appendFieldValue and appendTags set in it. - * - * @param appendFieldValueName - * fieldname to append to each datapoint - * @param appendTags - * tags to append to each datapoint - * @param startTime - * time range beginning - * @param endTime - * time range end - * @param valuePredicate - * pushed down filter for values - * @return list of datapoints - * @throws IOException - */ - public List queryDataPoints(String appendFieldValueName, List appendTags, long startTime, - long endTime, Predicate valuePredicate) throws IOException { - if (startTime > endTime) { - // swap start and end times if they are off - startTime = startTime ^ endTime; - endTime = endTime ^ startTime; - startTime = startTime ^ endTime; - } - List points = new ArrayList<>(); - BetweenPredicate timeRangePredicate = new BetweenPredicate(startTime, endTime); - int tsStartBucket = TimeUtils.getTimeBucket(TimeUnit.MILLISECONDS, startTime, timeBucketSize) - timeBucketSize; - String startTsBucket = Integer.toHexString(tsStartBucket); - int tsEndBucket = TimeUtils.getTimeBucket(TimeUnit.MILLISECONDS, endTime, timeBucketSize); - String endTsBucket = Integer.toHexString(tsEndBucket); - SortedMap series = bucketMap.subMap(startTsBucket, endTsBucket + Character.MAX_VALUE); - for (TimeSeriesBucket timeSeries : series.values()) { - seriesToDataPoints(appendFieldValueName, appendTags, points, timeSeries, timeRangePredicate, valuePredicate, - fp); - } - return points; - } - - /** - * Extract list of readers for the supplied time range and value predicate. - * - * Each {@link DataPoint} has the appendFieldValue and appendTags set in it. - * - * @param appendFieldValueName - * fieldname to append to each datapoint - * @param appendTags - * tags to append to each datapoint - * @param startTime - * time range beginning - * @param endTime - * time range end - * @param valuePredicate - * pushed down filter for values - * @return list of readers - * @throws IOException - */ - public List queryReader(String appendFieldValueName, List appendTags, long startTime, long endTime, - Predicate valuePredicate) throws IOException { - List readers = new ArrayList<>(); - BetweenPredicate timeRangePredicate = new BetweenPredicate(startTime, endTime); - int tsStartBucket = TimeUtils.getTimeBucket(TimeUnit.MILLISECONDS, startTime, timeBucketSize) - timeBucketSize; - String startTsBucket = Integer.toHexString(tsStartBucket); - int tsEndBucket = TimeUtils.getTimeBucket(TimeUnit.MILLISECONDS, endTime, timeBucketSize); - String endTsBucket = Integer.toHexString(tsEndBucket); - SortedMap series = bucketMap.subMap(startTsBucket, endTsBucket + Character.MAX_VALUE); - for (TimeSeriesBucket timeSeries : series.values()) { - readers.add(timeSeries.getReader(timeRangePredicate, valuePredicate, fp, appendFieldValueName, appendTags)); - } - return readers; - } - - /** - * Add data point with non floating point value - * - * @param unit - * of time for the supplied timestamp - * @param timestamp - * of this data point - * @param value - * of this data point - * @throws RejectException - */ - public void addDataPoint(TimeUnit unit, long timestamp, long value) throws IOException { - TimeSeriesBucket timeseriesBucket = getOrCreateSeriesBucket(unit, timestamp); - timeseriesBucket.addDataPoint(timestamp, value); - } - - /** - * @param unit - * @param timestamp - * @return - * @throws IOException - */ - public TimeSeriesBucket getOrCreateSeriesBucket(TimeUnit unit, long timestamp) throws IOException { - int bucket = TimeUtils.getTimeBucket(unit, timestamp, timeBucketSize); - String tsBucket = Integer.toHexString(bucket); - TimeSeriesBucket timeseriesBucket = bucketMap.get(tsBucket); - if (timeseriesBucket == null) { - synchronized (bucketMap) { - if ((timeseriesBucket = bucketMap.get(tsBucket)) == null) { - timeseriesBucket = new TimeSeriesBucket(seriesId + tsBucket, compressionFQCN, timestamp, false, - conf); - bucketMap.put(tsBucket, timeseriesBucket); - } - } - } - return timeseriesBucket; - } - - /** - * @param unit - * @param timestamp - * @return - * @throws IOException - */ - public TimeSeriesBucket getSeriesBucket(TimeUnit unit, long timestamp) throws IOException { - int bucket = TimeUtils.getTimeBucket(unit, timestamp, timeBucketSize); - String tsBucket = Integer.toHexString(bucket); - return getBucketMap().get(tsBucket); - } - - public SortedMap getSeriesBuckets(TimeUnit unit, long timestamp) throws IOException { - int bucket = TimeUtils.getTimeBucket(unit, timestamp, getTimeBucketSize()); - String tsBucket = Integer.toHexString(bucket); - return getBucketMap().tailMap(tsBucket); - } - - /** - * Add data point with floating point value - * - * @param unit - * of time for the supplied timestamp - * @param timestamp - * of this data point - * @param value - * of this data point - * @throws RejectException - */ - public void addDataPoint(TimeUnit unit, long timestamp, double value) throws IOException { - TimeSeriesBucket timeseriesBucket = getOrCreateSeriesBucket(unit, timestamp); - timeseriesBucket.addDataPoint(timestamp, value); - } - - /** - * Converts timeseries to a list of datapoints appended to the supplied list - * object. Datapoints are filtered by the supplied predicates before they - * are returned. These predicates are pushed down to the reader for - * efficiency and performance as it prevents unnecessary object creation. - * - * @param appendFieldValueName - * @param appendTags - * - * @param points - * list data points are appended to - * @param timeSeries - * to extract the data points from - * @param timePredicate - * time range filter - * @param valuePredicate - * value filter - * @return the points argument - * @throws IOException - */ - public static List seriesToDataPoints(String appendFieldValueName, List appendTags, - List points, TimeSeriesBucket timeSeries, Predicate timePredicate, Predicate valuePredicate, - boolean isFp) throws IOException { - Reader reader = timeSeries.getReader(timePredicate, valuePredicate, isFp, appendFieldValueName, appendTags); - DataPoint point = null; - while (true) { - try { - point = reader.readPair(); - if (point != null) { - points.add(point); - } - } catch (IOException e) { - if (e instanceof RejectException) { - } else { - e.printStackTrace(); - } - break; - } - } - if (reader.getCounter() != reader.getPairCount() || points.size() < reader.getCounter()) { - // System.err.println("SDP:" + points.size() + "/" + - // reader.getCounter() + "/" + reader.getPairCount()); - } - return points; - } - - /** - * Cleans stale series - * @throws IOException - */ - public List collectGarbage() throws IOException { - List gcedBuckets = new ArrayList<>(); - while (bucketMap.size() > retentionBuckets.get()) { - int oldSize = bucketMap.size(); - String key = bucketMap.firstKey(); - TimeSeriesBucket bucket = bucketMap.remove(key); - bucket.close(); - gcedBuckets.add(bucket); - logger.log(Level.INFO, "GC, removing bucket:" + key + ": as it passed retention period of:" - + retentionBuckets.get() + ":old size:" + oldSize + ":newsize:" + bucketMap.size() + ":"); - } - return gcedBuckets; - } - - /** - * Update retention hours for this TimeSeries - * - * @param retentionHours - */ - public void setRetentionHours(int retentionHours) { - if (retentionHours < 1) { - retentionHours = 2; - } - this.retentionBuckets.set((int) ((long) retentionHours * 3600) / timeBucketSize); - } - - /** - * @return the timeBucketSize - */ - public int getTimeBucketSize() { - return timeBucketSize; - } - - /** - * @return number of {@link TimeSeriesBucket}s to retain for this - * {@link TimeSeries} - */ - public int getRetentionBuckets() { - return retentionBuckets.get(); - } - - /** - * @return the bucketMap - */ - public SortedMap getBucketMap() { - return bucketMap; - } - - /** - * @return the seriesId - */ - public String getSeriesId() { - return seriesId; - } - - /** - * @param seriesId - * the seriesId to set - */ - public void setSeriesId(String seriesId) { - this.seriesId = seriesId; - } - - /** - * @return the fp - */ - public boolean isFp() { - return fp; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "TimeSeries [bucketMap=" + bucketMap + ", fp=" + fp + ", retentionBuckets=" + retentionBuckets - + ", logger=" + logger + ", seriesId=" + seriesId + ", timeBucketSize=" + timeBucketSize + "]"; - } - - public void close() throws IOException { - if (bucketMap == null) { - return; - } - for (Entry entry : bucketMap.entrySet()) { - entry.getValue().close(); - } - } - -} diff --git a/core/src/main/java/com/srotya/sidewinder/core/storage/mem/archival/NoneArchiver.java b/core/src/main/java/com/srotya/sidewinder/core/storage/mem/archival/NoneArchiver.java index 3e6c15e..36cb66e 100644 --- a/core/src/main/java/com/srotya/sidewinder/core/storage/mem/archival/NoneArchiver.java +++ b/core/src/main/java/com/srotya/sidewinder/core/storage/mem/archival/NoneArchiver.java @@ -38,7 +38,6 @@ public void archive(TimeSeriesArchivalObject object) throws ArchiveException { @Override public List unarchive() throws ArchiveException { - // TODO Auto-generated method stub return null; } diff --git a/core/src/main/java/com/srotya/sidewinder/core/utils/MiscUtils.java b/core/src/main/java/com/srotya/sidewinder/core/utils/MiscUtils.java index a7c6784..9d35356 100644 --- a/core/src/main/java/com/srotya/sidewinder/core/utils/MiscUtils.java +++ b/core/src/main/java/com/srotya/sidewinder/core/utils/MiscUtils.java @@ -108,6 +108,16 @@ public static DataPoint buildDataPoint(long timestamp, double value) { return dp; } + public static void ls(File file) throws IOException { + if (file.isDirectory()) { + for (File file2 : file.listFiles()) { + System.out.println(file2.getAbsolutePath()); + } + } else { + System.out.println(file.getAbsolutePath()); + } + } + public static void delete(File file) throws IOException { if (file.isDirectory()) { // directory is empty, then delete it diff --git a/core/src/main/java/com/srotya/sidewinder/core/utils/MurmurHash.java b/core/src/main/java/com/srotya/sidewinder/core/utils/MurmurHash.java deleted file mode 100644 index 72db579..0000000 --- a/core/src/main/java/com/srotya/sidewinder/core/utils/MurmurHash.java +++ /dev/null @@ -1,180 +0,0 @@ -package com.srotya.sidewinder.core.utils; - -/** - * Murmur hash 2.0. - * - * The murmur hash is a relative fast hash function from - * http://murmurhash.googlepages.com/ for platforms with efficient - * multiplication. - * - * This is a re-implementation of the original C code plus some - * additional features. - * - * Public domain. - * - * @author Viliam Holub - * @version 1.0.2 - * - */ -public final class MurmurHash { - - /** Generates 32 bit hash from byte array of the given length and - * seed. - * - * @param data byte array to hash - * @param length length of the array to hash - * @param seed initial seed value - * @return 32 bit hash of the given array - */ - public static int hash32( final byte[] data, int length, int seed) { - // 'm' and 'r' are mixing constants generated offline. - // They're not really 'magic', they just happen to work well. - final int m = 0x5bd1e995; - final int r = 24; - // Initialize the hash to a random value - int h = seed^length; - int length4 = length/4; - - for (int i=0; i>> r; - k *= m; - h *= m; - h ^= k; - } - - // Handle the last few bytes of the input array - switch (length%4) { - case 3: h ^= (data[(length&~3) +2]&0xff) << 16; - case 2: h ^= (data[(length&~3) +1]&0xff) << 8; - case 1: h ^= (data[length&~3]&0xff); - h *= m; - } - - h ^= h >>> 13; - h *= m; - h ^= h >>> 15; - - return h; - } - - - /** Generates 32 bit hash from byte array with default seed value. - * - * @param data byte array to hash - * @param length length of the array to hash - * @return 32 bit hash of the given array - */ - public static int hash32( final byte[] data, int length) { - return hash32( data, length, 0x9747b28c); - } - - - /** Generates 32 bit hash from a string. - * - * @param text string to hash - * @return 32 bit hash of the given string - */ - public static int hash32( final String text) { - final byte[] bytes = text.getBytes(); - return hash32( bytes, bytes.length); - } - - - /** Generates 32 bit hash from a substring. - * - * @param text string to hash - * @param from starting index - * @param length length of the substring to hash - * @return 32 bit hash of the given string - */ - public static int hash32( final String text, int from, int length) { - return hash32( text.substring( from, from+length)); - } - - - /** Generates 64 bit hash from byte array of the given length and seed. - * - * @param data byte array to hash - * @param length length of the array to hash - * @param seed initial seed value - * @return 64 bit hash of the given array - */ - public static long hash64( final byte[] data, int length, int seed) { - final long m = 0xc6a4a7935bd1e995L; - final int r = 47; - - long h = (seed&0xffffffffl)^(length*m); - - int length8 = length/8; - - for (int i=0; i>> r; - k *= m; - - h ^= k; - h *= m; - } - - switch (length%8) { - case 7: h ^= (long)(data[(length&~7)+6]&0xff) << 48; - case 6: h ^= (long)(data[(length&~7)+5]&0xff) << 40; - case 5: h ^= (long)(data[(length&~7)+4]&0xff) << 32; - case 4: h ^= (long)(data[(length&~7)+3]&0xff) << 24; - case 3: h ^= (long)(data[(length&~7)+2]&0xff) << 16; - case 2: h ^= (long)(data[(length&~7)+1]&0xff) << 8; - case 1: h ^= (long)(data[length&~7]&0xff); - h *= m; - }; - - h ^= h >>> r; - h *= m; - h ^= h >>> r; - - return h; - } - - - /** Generates 64 bit hash from byte array with default seed value. - * - * @param data byte array to hash - * @param length length of the array to hash - * @return 64 bit hash of the given string - */ - public static long hash64( final byte[] data, int length) { - return hash64( data, length, 0xe17a1465); - } - - - /** Generates 64 bit hash from a string. - * - * @param text string to hash - * @return 64 bit hash of the given string - */ - public static long hash64( final String text) { - final byte[] bytes = text.getBytes(); - return hash64( bytes, bytes.length); - } - - - /** Generates 64 bit hash from a substring. - * - * @param text string to hash - * @param from starting index - * @param length length of the substring to hash - * @return 64 bit hash of the given array - */ - public static long hash64( final String text, int from, int length) { - return hash64( text.substring( from, from+length)); - } -} \ No newline at end of file diff --git a/core/src/main/resources/model.json b/core/src/main/resources/model.json index 3e86d39..e208f98 100644 --- a/core/src/main/resources/model.json +++ b/core/src/main/resources/model.json @@ -2,11 +2,9 @@ "version": "1.0", "defaultSchema": "test", "schemas": [{ - "name": "test", "type": "custom", "factory": "com.srotya.sidewinder.core.sql.calcite.SidewinderSchemaFactory", "operand": { - "db": "test" }, "functions": [ { diff --git a/core/src/arc/functions/TestSqlFunctions.java b/core/src/test/java/com/srotya/sidewinder/core/sql/calcite/functions/TestSqlFunctions.java similarity index 100% rename from core/src/arc/functions/TestSqlFunctions.java rename to core/src/test/java/com/srotya/sidewinder/core/sql/calcite/functions/TestSqlFunctions.java diff --git a/core/src/test/java/com/srotya/sidewinder/core/storage/MockMeasurement.java b/core/src/test/java/com/srotya/sidewinder/core/storage/MockMeasurement.java new file mode 100644 index 0000000..e791d42 --- /dev/null +++ b/core/src/test/java/com/srotya/sidewinder/core/storage/MockMeasurement.java @@ -0,0 +1,107 @@ +/** + * Copyright 2017 Ambud Sharma + * + * Licensed 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 com.srotya.sidewinder.core.storage; + +import java.io.IOException; +import java.nio.ByteBuffer; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ScheduledExecutorService; +import java.util.logging.Logger; + +/** + * @author ambud + */ +public class MockMeasurement implements Measurement { + + private int bufferRenewCounter = 0; + private List list; + private int bufSize; + + public MockMeasurement(int bufSize) { + this.bufSize = bufSize; + list = new ArrayList<>(); + } + + @Override + public Collection getTimeSeries() { + return null; + } + + @Override + public Map getTimeSeriesMap() { + return null; + } + + @Override + public TagIndex getTagIndex() { + return null; + } + + @Override + public void close() throws IOException { + } + + @Override + public void garbageCollector() throws IOException { + } + + @Override + public ByteBuffer createNewBuffer(String seriesId) throws IOException { + bufferRenewCounter++; + ByteBuffer allocate = ByteBuffer.allocate(bufSize); + list.add(allocate); + return allocate; + } + + public int getBufferRenewCounter() { + return bufferRenewCounter; + } + + public List getBufTracker() { + return list; + } + + @Override + public void loadTimeseriesFromMeasurements() throws IOException { + } + + @Override + public TimeSeries getOrCreateTimeSeries(String valueFieldName, List tags, int timeBucketSize, + boolean fp, Map conf) throws IOException { + return null; + } + + @Override + public void configure(Map conf, String measurementName, String baseIndexDirectory, + String dataDirectory, DBMetadata metadata, ScheduledExecutorService bgTaskPool) throws IOException { + } + + @Override + public String getMeasurementName() { + return null; + } + + @Override + public Logger getLogger() { + return null; + } + + + +} \ No newline at end of file diff --git a/core/src/test/java/com/srotya/sidewinder/core/storage/TestTimeSeries.java b/core/src/test/java/com/srotya/sidewinder/core/storage/TestTimeSeries.java new file mode 100644 index 0000000..090d665 --- /dev/null +++ b/core/src/test/java/com/srotya/sidewinder/core/storage/TestTimeSeries.java @@ -0,0 +1,231 @@ +/** + * Copyright 2017 Ambud Sharma + * + * Licensed 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 com.srotya.sidewinder.core.storage; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +import org.junit.Test; + +import com.srotya.sidewinder.core.storage.compression.Reader; +import com.srotya.sidewinder.core.storage.compression.byzantine.ByzantineWriter; + +/** + * @author ambud + */ +public class TestTimeSeries { + + private static final String compression = ByzantineWriter.class.getName(); + private Map conf = new HashMap<>(); + + @Test + public void testTimeSeries() throws IOException { + Measurement measurement = new MockMeasurement(100); + DBMetadata metadata = new DBMetadata(24); + TimeSeries series = new TimeSeries(measurement, compression, "2214abfa", 4096, metadata, true, conf); + assertEquals("2214abfa", series.getSeriesId()); + assertEquals(4096, series.getTimeBucketSize()); + assertEquals((24 * 3600) / 4096, series.getRetentionBuckets()); + } + + @Test + public void testAddAndReadDataPoints() throws IOException { + Measurement measurement = new MockMeasurement(100); + DBMetadata metadata = new DBMetadata(24); + TimeSeries series = new TimeSeries(measurement, compression, "43232", 4096, metadata, true, conf); + long curr = System.currentTimeMillis(); + for (int i = 1; i <= 3; i++) { + series.addDataPoint(TimeUnit.MILLISECONDS, curr + i, 2.2 * i); + } + assertEquals(1, series.getBucketMap().size()); + TimeSeriesBucket bucket = series.getBucketMap().values().iterator().next(); + assertEquals(3, bucket.getCount()); + + Reader reader = bucket.getReader(null, null, true, "value", Arrays.asList("test")); + for (int i = 0; i < 3; i++) { + reader.readPair(); + } + try { + reader.readPair(); + fail("The read shouldn't succeed"); + } catch (IOException e) { + } + + List values = series.queryDataPoints("value", Arrays.asList("test"), curr, curr + 3, null); + assertEquals(3, values.size()); + for (int i = 1; i <= 3; i++) { + DataPoint dp = values.get(i - 1); + assertEquals("Value mismatch:" + dp.getValue() + "\t" + (2.2 * i) + "\t" + i, dp.getValue(), 2.2 * i, 0.01); + assertEquals("value", dp.getValueFieldName()); + assertEquals(Arrays.asList("test"), dp.getTags()); + } + + List queryReaders = series.queryReader("value", Arrays.asList("test"), curr, curr + 3, null); + assertEquals(1, queryReaders.size()); + reader = queryReaders.get(0); + for (int i = 1; i <= 3; i++) { + DataPoint dp = reader.readPair(); + assertEquals("Value mismatch:" + dp.getValue() + "\t" + (2.2 * i) + "\t" + i, dp.getValue(), 2.2 * i, 0.01); + assertEquals("value", dp.getValueFieldName()); + assertEquals(Arrays.asList("test"), dp.getTags()); + } + + values = series.queryDataPoints("value", Arrays.asList("test"), curr - 1, curr - 1, null); + assertEquals(0, values.size()); + } + + @Test + public void testGarbageCollector() throws IOException { + Measurement measurement = new MockMeasurement(100); + DBMetadata metadata = new DBMetadata(24); + TimeSeries series = new TimeSeries(measurement, compression, "43232", 4096, metadata, true, conf); + long curr = 1484788896586L; + for (int i = 0; i <= 24; i++) { + series.addDataPoint(TimeUnit.MILLISECONDS, curr + (4096_000 * i), 2.2 * i); + } + List readers = series.queryReader("test", Arrays.asList("test"), curr, curr + (4096_000) * 23, null); + // should return 3 partitions + assertEquals(24, readers.size()); + series.collectGarbage(); + readers = series.queryReader("test", Arrays.asList("test"), curr, curr + (4096_000) * 26, null); + assertEquals(21, readers.size()); + + series = new TimeSeries(measurement, compression, "43232", 4096, metadata, true, conf); + curr = 1484788896586L; + for (int i = 0; i <= 24; i++) { + series.addDataPoint(TimeUnit.MILLISECONDS, curr + (4096_000 * i), 2.2 * i); + } + readers = series.queryReader("test", Arrays.asList("test"), curr, curr + (4096_000) * 28, null); + // should return 25 partitions + assertEquals(25, readers.size()); + List collectGarbage = series.collectGarbage(); + assertEquals(4, collectGarbage.size()); + readers = series.queryReader("test", Arrays.asList("test"), curr, curr + (4096_000) * 28, null); + assertEquals(21, readers.size()); + } + + @Test + public void testTimeSeriesBucketRecoverDouble() throws IOException { + Map conf = new HashMap<>(); + MockMeasurement measurement = new MockMeasurement(100); + DBMetadata metadata = new DBMetadata(28); + + TimeSeries ts = new TimeSeries(measurement, ByzantineWriter.class.getName(), "test12312", 4096 * 10, metadata, + false, conf); + long t = 1497720442566L; + for (int i = 0; i < 1000; i++) { + ts.addDataPoint(TimeUnit.MILLISECONDS, t + i, i * 0.1); + } + + assertEquals("test12312", ts.getSeriesId()); + int size = ts.getBucketMap().values().size(); + assertTrue(!ts.isFp()); + + ts = new TimeSeries(measurement, ByzantineWriter.class.getName(), "test12312", 4096 * 10, metadata, false, conf); + ts.loadBucketMap(measurement.getBufTracker()); + assertEquals(size, measurement.getBufferRenewCounter()); + List dps = ts.queryDataPoints("test", Arrays.asList("test32"), t, t + 1001, null); + assertEquals(1000, dps.size()); + for (int j = 0; j < dps.size(); j++) { + DataPoint dataPoint = dps.get(j); + assertEquals(t + j, dataPoint.getTimestamp()); + assertEquals(j * 0.1, dataPoint.getValue(), 0); + } + assertEquals(2, ts.getRetentionBuckets()); + } + + @Test + public void testTimeSeriesBucketRecover() throws IOException { + Map conf = new HashMap<>(); + MockMeasurement measurement = new MockMeasurement(1024); + DBMetadata metadata = new DBMetadata(28); + + TimeSeries ts = new TimeSeries(measurement, ByzantineWriter.class.getName(), "test12312", 4096 * 10, metadata, + false, conf); + long t = 1497720442566L; + for (int i = 0; i < 1000; i++) { + ts.addDataPoint(TimeUnit.MILLISECONDS, t + i, i); + } + + assertEquals("test12312", ts.getSeriesId()); + assertEquals(4, ts.getBucketMap().values().size()); + assertTrue(!ts.isFp()); + + ts = new TimeSeries(measurement, ByzantineWriter.class.getName(), "test12312", 4096 * 10, metadata, false, conf); + ts.loadBucketMap(measurement.getBufTracker()); + assertEquals(4, measurement.getBufferRenewCounter()); + List dps = ts.queryDataPoints("test", Arrays.asList("test32"), t, t + 1001, null); + assertEquals(1000, dps.size()); + for (int j = 0; j < dps.size(); j++) { + DataPoint dataPoint = dps.get(j); + assertEquals(t + j, dataPoint.getTimestamp()); + assertEquals(j, dataPoint.getLongValue()); + } + } + + @Test + public void testReadWriteSingle() throws IOException { + Map conf = new HashMap<>(); + MockMeasurement measurement = new MockMeasurement(100); + DBMetadata metadata = new DBMetadata(28); + + TimeSeries ts = new TimeSeries(measurement, ByzantineWriter.class.getName(), "test12312", 4096 * 10, metadata, + false, conf); + long t = 1497720442566L; + for (int i = 0; i < 10; i++) { + ts.addDataPoint(TimeUnit.MILLISECONDS, t + i, i); + } + assertEquals(1, measurement.getBufferRenewCounter()); + List dps = ts.queryDataPoints("test", Arrays.asList("test32"), t, t + 1001, null); + assertEquals(10, dps.size()); + for (int j = 0; j < dps.size(); j++) { + DataPoint dataPoint = dps.get(j); + assertEquals(t + j, dataPoint.getTimestamp()); + assertEquals(j, dataPoint.getLongValue()); + } + } + + @Test + public void testReadWriteExpand() throws IOException { + Map conf = new HashMap<>(); + MockMeasurement measurement = new MockMeasurement(1024); + DBMetadata metadata = new DBMetadata(28); + + TimeSeries ts = new TimeSeries(measurement, ByzantineWriter.class.getName(), "test12312", 4096 * 10, metadata, + false, conf); + long t = 1497720442566L; + for (int i = 0; i < 1000; i++) { + ts.addDataPoint(TimeUnit.MILLISECONDS, t + i, i); + } + assertEquals(4, measurement.getBufferRenewCounter()); + List dps = ts.queryDataPoints("test", Arrays.asList("test32"), t, t + 1001, null); + assertEquals(1000, dps.size()); + for (int j = 0; j < dps.size(); j++) { + DataPoint dataPoint = dps.get(j); + assertEquals(t + j, dataPoint.getTimestamp()); + assertEquals(j, dataPoint.getLongValue()); + } + } + +} diff --git a/core/src/test/java/com/srotya/sidewinder/core/storage/TestTimeSeriesBucket.java b/core/src/test/java/com/srotya/sidewinder/core/storage/TestTimeSeriesBucket.java index c0ae16a..a63e45d 100644 --- a/core/src/test/java/com/srotya/sidewinder/core/storage/TestTimeSeriesBucket.java +++ b/core/src/test/java/com/srotya/sidewinder/core/storage/TestTimeSeriesBucket.java @@ -20,6 +20,7 @@ import static org.junit.Assert.fail; import java.io.IOException; +import java.nio.ByteBuffer; import java.util.HashMap; import java.util.Random; import java.util.concurrent.ExecutorService; @@ -28,6 +29,7 @@ import org.junit.Test; +import com.srotya.sidewinder.core.storage.compression.Reader; import com.srotya.sidewinder.core.storage.compression.byzantine.ByzantineWriter; /** @@ -41,22 +43,26 @@ public class TestTimeSeriesBucket { @Test public void testDataPointWrite() throws IOException { - TimeSeriesBucket bucket = new TimeSeriesBucket("seriesId", className, System.currentTimeMillis(), false, - new HashMap<>()); + ByteBuffer buf = ByteBuffer.allocate(4096); + TimeSeriesBucket bucket = new TimeSeriesBucket(className, System.currentTimeMillis(), new HashMap<>(), buf, + false); bucket.addDataPoint(System.currentTimeMillis(), 2.2); bucket.addDataPoint(System.currentTimeMillis() + 1, 2.3); assertEquals(2, bucket.getCount()); - bucket = new TimeSeriesBucket("seriesId", className, System.currentTimeMillis(), false, new HashMap<>()); + bucket = new TimeSeriesBucket(className, System.currentTimeMillis(), new HashMap<>(), buf, false); bucket.addDataPoint(System.currentTimeMillis(), 2); bucket.addDataPoint(System.currentTimeMillis() + 1, 3); assertEquals(2, bucket.getCount()); + bucket.close(); + // does nothing } @Test public void testCompressionRatio() throws IOException { - TimeSeriesBucket bucket = new TimeSeriesBucket("seriesId", className, System.currentTimeMillis(), false, - new HashMap<>()); + ByteBuffer buf = ByteBuffer.allocate(4096); + TimeSeriesBucket bucket = new TimeSeriesBucket(className, System.currentTimeMillis(), new HashMap<>(), buf, + false); bucket.addDataPoint(System.currentTimeMillis(), 2.2); bucket.addDataPoint(System.currentTimeMillis() + 1, 2.3); assertEquals(2, bucket.getCount()); @@ -67,7 +73,8 @@ public void testCompressionRatio() throws IOException { public void testReadWriteLongs() throws IOException { long ts = System.currentTimeMillis(); int count = 10000; - TimeSeriesBucket series = new TimeSeriesBucket("seriesId", className, ts, false, new HashMap<>()); + ByteBuffer buf = ByteBuffer.allocate(4096*10); + TimeSeriesBucket series = new TimeSeriesBucket(className, ts, new HashMap<>(), buf, true); for (int i = 0; i < count; i++) { series.addDataPoint(ts + (i * 1000), i); } @@ -90,7 +97,8 @@ public void testReadWriteLongs() throws IOException { public void testReadWriteDoubles() throws IOException { long ts = System.currentTimeMillis(); int count = 1000; - TimeSeriesBucket series = new TimeSeriesBucket("seriesId", className, ts, false, new HashMap<>()); + ByteBuffer buf = ByteBuffer.allocate(4096 * 10); + TimeSeriesBucket series = new TimeSeriesBucket(className, ts, new HashMap<>(), buf, true); for (int i = 0; i < 1000; i++) { series.addDataPoint(ts + (i * 1000), i * 1.2); } @@ -110,27 +118,29 @@ public void testReadWriteDoubles() throws IOException { @Test public void testCompressionRatios() throws IOException { long ts = System.currentTimeMillis(); - TimeSeriesBucket series = new TimeSeriesBucket("seriesId", className, ts, false, new HashMap<>()); - for (int i = 0; i < 10000; i++) { + int capacity = 4096 * 10; + ByteBuffer buf = ByteBuffer.allocate(capacity); + TimeSeriesBucket series = new TimeSeriesBucket(className, ts, new HashMap<>(), buf, true); + for (int i = 0; i < 1000; i++) { series.addDataPoint(ts + (i * 1000), i); } System.out.println("Test compression ratio (10K longs 1s frequency):" + series.getCompressionRatio()); - series = new TimeSeriesBucket("seriesId", className, ts, false, new HashMap<>()); - for (int i = 0; i < 10000; i++) { + series = new TimeSeriesBucket(className, ts, new HashMap<>(), buf, true); + for (int i = 0; i < 1000; i++) { series.addDataPoint(ts + i, i); } System.out.println("Test compression ratio (10K longs 1ms frequency):" + series.getCompressionRatio()); - series = new TimeSeriesBucket("seriesId", className, ts, false, new HashMap<>()); - for (int i = 0; i < 10000; i++) { + series = new TimeSeriesBucket(className, ts, new HashMap<>(), buf, true); + for (int i = 0; i < 1000; i++) { series.addDataPoint(ts + (i * 1000), i * 1.2); } System.out.println("Test compression ratio (10K double 1s frequency):" + series.getCompressionRatio()); - series = new TimeSeriesBucket("seriesId", className, ts, false, new HashMap<>()); + series = new TimeSeriesBucket(className, ts, new HashMap<>(), buf, true); Random rand = new Random(); - for (int i = 0; i < 10000; i++) { + for (int i = 0; i < 1000; i++) { series.addDataPoint(ts + (i * 1000), rand.nextLong()); } System.out.println("Test compression ratio (10K random 1s frequency):" + series.getCompressionRatio()); @@ -139,7 +149,8 @@ public void testCompressionRatios() throws IOException { // @Test public void testConcurrentReadWrites() throws IOException { final long ts = System.currentTimeMillis(); - final TimeSeriesBucket series = new TimeSeriesBucket("seriesId", className, ts, false, new HashMap<>()); + ByteBuffer buf = ByteBuffer.allocate(4096); + final TimeSeriesBucket series = new TimeSeriesBucket(className, ts, new HashMap<>(), buf, false); final AtomicBoolean startFlag = new AtomicBoolean(false); ExecutorService es = Executors.newCachedThreadPool(); for (int i = 0; i < 2; i++) { diff --git a/core/src/test/java/com/srotya/sidewinder/core/storage/compression/byzantine/TestByzantineReadWrite.java b/core/src/test/java/com/srotya/sidewinder/core/storage/compression/byzantine/TestByzantineReadWrite.java index 3fd1f61..3592c65 100644 --- a/core/src/test/java/com/srotya/sidewinder/core/storage/compression/byzantine/TestByzantineReadWrite.java +++ b/core/src/test/java/com/srotya/sidewinder/core/storage/compression/byzantine/TestByzantineReadWrite.java @@ -18,17 +18,22 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; -import java.io.File; import java.io.IOException; import java.nio.ByteBuffer; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; import org.junit.Test; import com.srotya.sidewinder.core.storage.DataPoint; -import com.srotya.sidewinder.core.storage.Reader; -import com.srotya.sidewinder.core.storage.StorageEngine; -import com.srotya.sidewinder.core.storage.Writer; +import com.srotya.sidewinder.core.storage.compression.Reader; +import com.srotya.sidewinder.core.storage.compression.Writer; import com.srotya.sidewinder.core.storage.compression.dod.DodWriter; import com.srotya.sidewinder.core.utils.MiscUtils; @@ -42,14 +47,14 @@ public class TestByzantineReadWrite { @Test public void testByzantineReaderInit() throws IOException { + ByteBuffer buf = ByteBuffer.allocateDirect(1024); ByzantineWriter writer = new ByzantineWriter(); - writer.configure(new HashMap<>()); + writer.configure(new HashMap<>(), buf, false); assertEquals(0, writer.getCount()); - assertEquals(ByzantineWriter.DEFAULT_BUFFER_INIT_SIZE, writer.getBuf().capacity()); assertEquals(0, writer.getDelta()); assertEquals(0, writer.getPrevTs()); - assertNotNull(writer.getRead()); - assertNotNull(writer.getWrite()); + assertNotNull(writer.getReadLock()); + assertNotNull(writer.getWriteLock()); long ts = System.currentTimeMillis(); writer = new ByzantineWriter(ts, new byte[1024]); @@ -57,15 +62,16 @@ public void testByzantineReaderInit() throws IOException { assertEquals(1024, writer.getBuf().capacity()); assertEquals(0, writer.getDelta()); assertEquals(ts, writer.getPrevTs()); - assertNotNull(writer.getRead()); - assertNotNull(writer.getWrite()); + assertNotNull(writer.getReadLock()); + assertNotNull(writer.getWriteLock()); } @Test public void testWriteDataPoint() throws IOException { + ByteBuffer buf = ByteBuffer.allocateDirect(1024); ByzantineWriter bwriter = new ByzantineWriter(); Writer writer = bwriter; - writer.configure(new HashMap<>()); + writer.configure(new HashMap<>(), buf, true); long ts = System.currentTimeMillis(); writer.setHeaderTimestamp(ts); @@ -75,7 +81,7 @@ public void testWriteDataPoint() throws IOException { assertEquals(10, bwriter.getCount()); assertEquals(bwriter.getPrevTs(), bwriter.getLastTs()); assertEquals(ts + 9, bwriter.getLastTs()); - ByteBuffer buf = bwriter.getBuf(); + buf = bwriter.getBuf(); buf.flip(); assertEquals(10, buf.getInt()); assertEquals(ts, buf.getLong()); @@ -83,8 +89,9 @@ public void testWriteDataPoint() throws IOException { @Test public void testReadWriteDataPoints() throws IOException { + ByteBuffer buf = ByteBuffer.allocateDirect(1024); Writer writer = new ByzantineWriter(); - writer.configure(new HashMap<>()); + writer.configure(new HashMap<>(), buf, true); long ts = System.currentTimeMillis(); writer.setHeaderTimestamp(ts); for (int i = 0; i < 100; i++) { @@ -113,26 +120,135 @@ public void testReadWriteDataPoints() throws IOException { @Test public void testWriteRead() throws IOException { + ByteBuffer buf = ByteBuffer.allocateDirect(1024 * 100); Writer writer = new ByzantineWriter(); - writer.configure(new HashMap<>()); + writer.configure(new HashMap<>(), buf, true); long ts = System.currentTimeMillis(); writer.setHeaderTimestamp(ts); - for (int i = 0; i < 10000; i++) { + int LIMIT = 10000; + for (int i = 0; i < LIMIT; i++) { writer.addValue(ts + i * 1000, i); } System.out.println("Compression Ratio:" + writer.getCompressionRatio()); + Reader reader = writer.getReader(); + for (int i = 0; i < LIMIT; i++) { + DataPoint dp = reader.readPair(); + assertEquals(ts + i * 1000, dp.getTimestamp()); + } + + buf.rewind(); + writer = new ByzantineWriter(); + writer.configure(new HashMap<>(), buf, true); + ts = System.currentTimeMillis(); + writer.setHeaderTimestamp(ts); + for (int i = 0; i < LIMIT; i++) { + writer.addValue(ts + i * 1000, i * 1.1); + } + reader = writer.getReader(); + for (int i = 0; i < LIMIT; i++) { + DataPoint dp = reader.readPair(); + assertEquals(ts + i * 1000, dp.getTimestamp()); + assertEquals(i * 1.1, dp.getValue(), 0); + } + + buf.rewind(); + writer = new ByzantineWriter(); + writer.configure(new HashMap<>(), buf, true); + ts = System.currentTimeMillis(); + writer.setHeaderTimestamp(ts); + for (int i = 0; i < LIMIT; i++) { + DataPoint dp = MiscUtils.buildDataPoint(ts + i * 1000, i); + writer.write(dp); + } + reader = writer.getReader(); + assertEquals(LIMIT, reader.getPairCount()); + for (int i = 0; i < LIMIT; i++) { + DataPoint dp = reader.readPair(); + assertEquals(ts + i * 1000, dp.getTimestamp()); + } + + buf.rewind(); + writer = new ByzantineWriter(); + writer.configure(new HashMap<>(), buf, true); + ts = System.currentTimeMillis(); + writer.setHeaderTimestamp(ts); + List dps = new ArrayList<>(); + for (int i = 0; i < LIMIT; i++) { + DataPoint dp = MiscUtils.buildDataPoint(ts + i * 1000, i); + dps.add(dp); + } + writer.write(dps); + reader = writer.getReader(); + assertEquals(LIMIT, reader.getPairCount()); + for (int i = 0; i < LIMIT; i++) { + DataPoint dp = reader.readPair(); + assertEquals(ts + i * 1000, dp.getTimestamp()); + } + } + + @Test + public void testWriteReadConcurrent() throws IOException, InterruptedException { + ByteBuffer buf = ByteBuffer.allocateDirect(1024 * 1024); + Writer writer = new ByzantineWriter(); + Map conf = new HashMap<>(); + writer.configure(conf, buf, true); + final long ts = System.currentTimeMillis(); + writer.setHeaderTimestamp(ts); + + int LIMIT = 10000; + final AtomicInteger wait = new AtomicInteger(0); + int THREAD_COUNT = 4; + ExecutorService es = Executors.newFixedThreadPool(THREAD_COUNT); + for (int j = 0; j < THREAD_COUNT; j++) { + final int o = j * LIMIT; + es.submit(() -> { + long t = ts + o; + for (int i = 0; i < LIMIT; i++) { + try { + writer.addValue(t + i * 100, i); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + wait.incrementAndGet(); + }); + } + es.shutdown(); + es.awaitTermination(100, TimeUnit.MILLISECONDS); + System.out.println("Compression Ratio:" + writer.getCompressionRatio()); + while (wait.get() != THREAD_COUNT) { + Thread.sleep(1000); + } + Reader reader = writer.getReader(); + assertEquals(LIMIT * THREAD_COUNT, reader.getPairCount()); + } + + @Test + public void testWriteReadNoLock() throws IOException { + ByteBuffer buf = ByteBuffer.allocateDirect(1024 * 100); + Writer writer = new ByzantineWriter(); + Map conf = new HashMap<>(); + conf.put("lock.enabled", "false"); + writer.configure(conf, buf, true); + long ts = System.currentTimeMillis(); + writer.setHeaderTimestamp(ts); + int LIMIT = 10000; + for (int i = 0; i < LIMIT; i++) { + writer.addValue(ts + i * 1000, i); + } + System.out.println("Compression Ratio:" + writer.getCompressionRatio()); + Reader reader = writer.getReader(); + for (int i = 0; i < LIMIT; i++) { + DataPoint dp = reader.readPair(); + assertEquals(ts + i * 1000, dp.getTimestamp()); + } } @Test public void testBootstrapDiskRecovery() throws IOException, InterruptedException { + ByteBuffer buf = ByteBuffer.allocateDirect(1024 * 1024 * 10); ByzantineWriter writer = new ByzantineWriter(); - HashMap conf = new HashMap<>(); - MiscUtils.delete(new File("target/diskTest")); - new File("target/diskTest").mkdirs(); - conf.put("data.dir", "target/diskTest"); - conf.put(StorageEngine.PERSISTENCE_DISK, "true"); - writer.setSeriesId("test_byzantine_disk_writes" + 2); - writer.configure(conf); + writer.configure(new HashMap<>(), buf, true); long ots = System.currentTimeMillis(); writer.setHeaderTimestamp(ots); int limit = 1_000_000; @@ -148,9 +264,7 @@ public void testBootstrapDiskRecovery() throws IOException, InterruptedException ByteBuffer rawBytes = writer.getRawBytes(); try { writer = new ByzantineWriter(); - conf.put(StorageEngine.PERSISTENCE_DISK, "false"); - writer.setSeriesId("test_byzantine_disk_writes" + 4); - writer.configure(conf); + writer.configure(new HashMap<>(), buf, false); writer.bootstrap(rawBytes); reader = writer.getReader(); for (int i = 0; i < limit; i++) { @@ -158,7 +272,6 @@ public void testBootstrapDiskRecovery() throws IOException, InterruptedException assertEquals(ots + i * 1000, pair.getTimestamp()); assertEquals(i, pair.getLongValue()); } - writer.close(); reader = writer.getReader(); for (int i = 0; i < limit; i++) { DataPoint pair = reader.readPair(); @@ -172,14 +285,9 @@ public void testBootstrapDiskRecovery() throws IOException, InterruptedException @Test public void testDiskRecovery() throws IOException, InterruptedException { + ByteBuffer buf = ByteBuffer.allocateDirect(1024 * 1024 * 10); ByzantineWriter writer = new ByzantineWriter(); - HashMap conf = new HashMap<>(); - MiscUtils.delete(new File("target/diskTest")); - new File("target/diskTest").mkdirs(); - conf.put("data.dir", "target/diskTest"); - conf.put(StorageEngine.PERSISTENCE_DISK, "true"); - writer.setSeriesId("test_byzantine_disk_writes" + 0); - writer.configure(conf); + writer.configure(new HashMap<>(), buf, true); long ots = System.currentTimeMillis(); writer.setHeaderTimestamp(ots); int limit = 1_000_000; @@ -188,7 +296,6 @@ public void testDiskRecovery() throws IOException, InterruptedException { } long ts = (System.currentTimeMillis() - ots); System.out.println("==>Byzantine Write time:" + ts + " data size:" + writer.getBuf().position()); - writer.close(); Reader reader = writer.getReader(); assertEquals(limit, reader.getPairCount()); try { @@ -202,10 +309,11 @@ public void testDiskRecovery() throws IOException, InterruptedException { throw e; } System.out.println("Completed phase 1 reads"); - writer.close(); writer = new ByzantineWriter(); - writer.setSeriesId("test_byzantine_disk_writes" + 0); - writer.configure(conf); + // writer.setSeriesId("test_byzantine_disk_writes" + 0); + buf.rewind(); + writer.configure(new HashMap<>(), buf, false); + assertEquals(1000000, writer.getCount()); writer.addValue(ts + 10000, 1); try { reader = writer.getReader(); @@ -234,13 +342,9 @@ public void testDiskRecovery() throws IOException, InterruptedException { */ @Test public void testDiskWrites() throws IOException, InterruptedException { + ByteBuffer buf = ByteBuffer.allocateDirect(1024 * 1024 * 10); ByzantineWriter writer = new ByzantineWriter(); - HashMap conf = new HashMap<>(); - new File("target/diskTest").mkdirs(); - conf.put("data.dir", "target/diskTest"); - conf.put(StorageEngine.PERSISTENCE_DISK, "true"); - writer.setSeriesId("test_1M_writes" + 0); - writer.configure(conf); + writer.configure(new HashMap<>(), buf, false); long ts = System.currentTimeMillis(); writer.setHeaderTimestamp(ts); int limit = 1_000_000; @@ -266,8 +370,10 @@ public void testDiskWrites() throws IOException, InterruptedException { } @Test - public void testDoDWritePerformance() { + public void testDoDWritePerformance() throws IOException { + ByteBuffer buf = ByteBuffer.allocate(1024 * 1024 * 100); DodWriter writer = new DodWriter(); + writer.configure(new HashMap<>(), buf, true); long ts = System.currentTimeMillis(); writer.setHeaderTimestamp(ts); for (int i = 0; i < 1_000_000; i++) { diff --git a/core/src/test/java/com/srotya/sidewinder/core/storage/disk/TestDiskStorageEngine.java b/core/src/test/java/com/srotya/sidewinder/core/storage/disk/TestDiskStorageEngine.java index 9b2d5cb..a40e87e 100644 --- a/core/src/test/java/com/srotya/sidewinder/core/storage/disk/TestDiskStorageEngine.java +++ b/core/src/test/java/com/srotya/sidewinder/core/storage/disk/TestDiskStorageEngine.java @@ -15,12 +15,11 @@ */ package com.srotya.sidewinder.core.storage.disk; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.Assert.*; import java.io.File; import java.io.IOException; +import java.nio.ByteBuffer; import java.nio.charset.Charset; import java.nio.file.Files; import java.util.ArrayList; @@ -53,14 +52,14 @@ import com.srotya.sidewinder.core.storage.DBMetadata; import com.srotya.sidewinder.core.storage.DataPoint; import com.srotya.sidewinder.core.storage.ItemNotFoundException; -import com.srotya.sidewinder.core.storage.Reader; +import com.srotya.sidewinder.core.storage.Measurement; import com.srotya.sidewinder.core.storage.RejectException; import com.srotya.sidewinder.core.storage.SeriesQueryOutput; import com.srotya.sidewinder.core.storage.StorageEngine; -import com.srotya.sidewinder.core.storage.TagIndex; +import com.srotya.sidewinder.core.storage.TimeSeries; import com.srotya.sidewinder.core.storage.TimeSeriesBucket; +import com.srotya.sidewinder.core.storage.compression.Reader; import com.srotya.sidewinder.core.storage.compression.byzantine.ByzantineWriter; -import com.srotya.sidewinder.core.storage.mem.TimeSeries; import com.srotya.sidewinder.core.utils.BackgrounThreadFactory; import com.srotya.sidewinder.core.utils.MiscUtils; import com.srotya.sidewinder.core.utils.TimeUtils; @@ -76,7 +75,7 @@ public class TestDiskStorageEngine { @BeforeClass public static void before() { - bgTasks = Executors.newScheduledThreadPool(1); + bgTasks = Executors.newScheduledThreadPool(1, new BackgrounThreadFactory("te1")); } @AfterClass @@ -84,6 +83,125 @@ public static void after() { bgTasks.shutdown(); } + @Test + public void testInvalidArchiver() throws IOException { + MiscUtils.delete(new File("target/dst-1/data")); + StorageEngine engine = new DiskStorageEngine(); + Map conf = new HashMap<>(); + conf.put("data.dir", "target/dst-1/data"); + conf.put("data.dir", "target/dst-1/index"); + conf.put(StorageEngine.ARCHIVER_CLASS, "asdasd"); + engine.configure(conf, bgTasks); + } + + @Test + public void testUpdateTimeSeriesRetention() throws IOException { + MiscUtils.delete(new File("target/dst-2/data")); + DiskStorageEngine engine = new DiskStorageEngine(); + Map conf = new HashMap<>(); + conf.put("data.dir", "target/dst-2/data"); + conf.put("data.dir", "target/dst-2/index"); + engine.configure(conf, bgTasks); + engine.getOrCreateMeasurement("db1", "m1"); + engine.updateDefaultTimeSeriesRetentionPolicy("db1", 10); + assertEquals(10, engine.getDbMetadataMap().get("db1").getRetentionHours()); + TimeSeries ts = engine.getOrCreateTimeSeries("db1", "m1", "vf1", Arrays.asList("t1"), 4096, false); + int buckets = ts.getRetentionBuckets(); + engine.updateDefaultTimeSeriesRetentionPolicy("db1", 30); + engine.updateTimeSeriesRetentionPolicy("db1", 30); + engine.updateTimeSeriesRetentionPolicy("db1", "m1", 40); + engine.updateTimeSeriesRetentionPolicy("db1", "m1", "vf1", Arrays.asList("t1"), 60); + assertTrue(buckets != ts.getRetentionBuckets()); + } + + @Test + public void testMetadataOperations() throws Exception { + MiscUtils.delete(new File("target/dst-3/data")); + StorageEngine engine = new DiskStorageEngine(); + Map conf = new HashMap<>(); + conf.put("data.dir", "target/dst-3/data"); + conf.put("data.dir", "target/dst-3/index"); + engine.configure(conf, bgTasks); + engine.getOrCreateTimeSeries("db1", "m1", "vf1", Arrays.asList("t1"), 4096, false); + assertEquals(1, engine.getAllMeasurementsForDb("db1").size()); + assertEquals(1, engine.getTagsForMeasurement("db1", "m1").size()); + assertEquals(1, engine.getTagsForMeasurement("db1", "m1", "vf1").size()); + try { + engine.getAllMeasurementsForDb("db2"); + fail("Exception must be thrown"); + } catch (ItemNotFoundException e) { + } + try { + engine.getTagsForMeasurement("db1", "m2"); + fail("Exception must be thrown"); + } catch (ItemNotFoundException e) { + } + assertEquals(0, engine.getTagsForMeasurement("db1", "m1", "vf2").size()); + } + + @Test + public void testMeasurementsLike() throws Exception { + MiscUtils.delete(new File("target/dst-4/data")); + StorageEngine engine = new DiskStorageEngine(); + Map conf = new HashMap<>(); + conf.put("data.dir", "target/dst-4/data"); + conf.put("index.dir", "target/dst-4/index"); + engine.configure(conf, bgTasks); + engine.getOrCreateTimeSeries("db1", "m1", "vf1", Arrays.asList("t1"), 4096, false); + engine.getOrCreateTimeSeries("db1", "t1", "vf1", Arrays.asList("t1"), 4096, false); + Set measurementsLike = engine.getMeasurementsLike("db1", "m"); + assertEquals(1, measurementsLike.size()); + assertEquals(2, engine.getAllMeasurementsForDb("db1").size()); + } + + @Test + public void testConcurrentOperations() throws Exception { + MiscUtils.delete(new File("target/dst-6/data")); + final StorageEngine engine = new DiskStorageEngine(); + Map conf = new HashMap<>(); + conf.put("data.dir", "target/dst-6/data"); + conf.put("index.dir", "target/dst-6/index"); + engine.configure(conf, bgTasks); + final long ts = System.currentTimeMillis(); + ExecutorService es = Executors.newFixedThreadPool(2, new BackgrounThreadFactory("wr1")); + String measurementName = "mmm2"; + String valueFieldName = "v1"; + String dbName = "db9"; + String tag = "h1"; + for (int k = 0; k < 2; k++) { + final int p = k; + es.submit(() -> { + long t = ts + p; + for (int i = 0; i < 100; i++) { + DataPoint dp = MiscUtils.buildDataPoint(dbName, measurementName, valueFieldName, + Arrays.asList(tag), t + i * 1000, i); + try { + engine.writeDataPoint(dp); + } catch (Exception e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + } + System.err.println("Completed writes:"+100+" data points"); + }); + } + es.shutdown(); + es.awaitTermination(100, TimeUnit.SECONDS); + assertEquals(1, engine.getAllMeasurementsForDb(dbName).size()); + assertEquals(1, engine.getMeasurementMap().size()); + try { + TimeSeries timeSeries = engine.getTimeSeries(dbName, measurementName, valueFieldName, Arrays.asList(tag)); + assertNotNull(timeSeries); + } catch (ItemNotFoundException e) { + fail("Time series must exist"); + } + Set queryDataPoints = engine.queryDataPoints(dbName, measurementName, valueFieldName, ts, + ts + 220 * 1000, Arrays.asList(tag), null); + assertEquals(1, queryDataPoints.size()); + SeriesQueryOutput next = queryDataPoints.iterator().next(); + assertEquals(200, next.getDataPoints().size()); + } + public void testWritePerformance() throws Exception { final StorageEngine engine = new DiskStorageEngine(); // FileUtils.forceDelete(new File("target/db3/")); @@ -150,13 +268,14 @@ public void run() { public void testMultipleDrives() throws ItemNotFoundException, IOException { StorageEngine engine = new DiskStorageEngine(); HashMap map = new HashMap<>(); - MiscUtils.delete(new File("targer/db102/")); - map.put("index.dir", "target/db102/index"); - map.put("data.dir", "target/db102/data1, target/db102/data2"); + MiscUtils.delete(new File("targer/db10221/")); + map.put("index.dir", "target/db10221/index"); + map.put("data.dir", "target/db10221/data1, target/db10221/data2"); map.put(StorageEngine.PERSISTENCE_DISK, "true"); try { engine.configure(map, bgTasks); } catch (IOException e) { + e.printStackTrace(); fail("No IOException should be thrown"); } long ts = System.currentTimeMillis(); @@ -169,8 +288,8 @@ public void testMultipleDrives() throws ItemNotFoundException, IOException { e.printStackTrace(); fail("Engine is initialized, no IO Exception should be thrown:" + e.getMessage()); } - assertEquals(10, new File("target/db102/data1").listFiles().length); - assertEquals(10, new File("target/db102/data2").listFiles().length); + assertEquals(5, new File("target/db10221/data1").listFiles().length); + assertEquals(5, new File("target/db10221/data2").listFiles().length); } @Test @@ -202,15 +321,6 @@ public void testConfigureTimeBuckets() throws ItemNotFoundException, IOException assertTrue(queryDataPoints.size() >= 1); } - @Test - public void testTagEncodeDecode() throws IOException { - DiskTagIndex table = new DiskTagIndex("target/test", "test", "test2"); - StorageEngine engine = new DiskStorageEngine(); - String encodedStr = engine.encodeTagsToString(table, Arrays.asList("host", "value", "test")); - List decodedStr = engine.decodeStringToTags(table, encodedStr); - assertEquals(Arrays.asList("host", "value", "test"), decodedStr); - } - @Test public void testConfigure() throws IOException { StorageEngine engine = new DiskStorageEngine(); @@ -237,7 +347,7 @@ public void testConfigure() throws IOException { try { engine.writeDataPoint(MiscUtils.buildDataPoint("test", "ss", "value", Arrays.asList("te"), System.currentTimeMillis(), 2.2)); - String md = new String(Files.readAllBytes(new File("target/db2/data/test.md").toPath()), + String md = new String(Files.readAllBytes(new File("target/db2/data/test/.md").toPath()), Charset.forName("utf8")); DBMetadata metadata = new Gson().fromJson(md, DBMetadata.class); assertEquals(32, metadata.getRetentionHours()); @@ -249,67 +359,52 @@ public void testConfigure() throws IOException { } @Test - public void testConstructRowKey() throws Exception { - StorageEngine engine = new DiskStorageEngine(); - MiscUtils.delete(new File("target/db131/")); - HashMap map = new HashMap<>(); - map.put("metadata.dir", "target/db131/mdq"); - map.put("index.dir", "target/db131/index"); - map.put("data.dir", "target/db131/data"); - map.put(StorageEngine.PERSISTENCE_DISK, "true"); - map.put("disk.compression.class", ByzantineWriter.class.getName()); - engine.configure(map, Executors.newScheduledThreadPool(1, new BackgrounThreadFactory("bg"))); - List tags = Arrays.asList("test1", "test2"); - TagIndex index = engine.getOrCreateTagIndex("asd", "bsd"); - String encodeTagsToString = engine.encodeTagsToString(index, tags); - String key = engine.constructRowKey("asd", "bsd", "csd", tags); - assertEquals("csd#" + encodeTagsToString, key); - } - - @Test - public void testQueryDataPointsRecovery() throws IOException, ItemNotFoundException { - StorageEngine engine = new DiskStorageEngine(); - MiscUtils.delete(new File("target/db1/")); - HashMap map = new HashMap<>(); - map.put("metadata.dir", "target/db1/mdq"); - map.put("index.dir", "target/db1/index"); - map.put("data.dir", "target/db1/data"); - map.put(StorageEngine.PERSISTENCE_DISK, "true"); - map.put("disk.compression.class", ByzantineWriter.class.getName()); - engine.configure(map, bgTasks); - long ts = System.currentTimeMillis(); - Map> db = engine.getOrCreateDatabase("test3", 24); - assertEquals(0, db.size()); - engine.writeDataPoint(MiscUtils.buildDataPoint("test3", "cpu", "value", Arrays.asList("test"), ts, 1)); - engine.writeDataPoint( - MiscUtils.buildDataPoint("test3", "cpu", "value", Arrays.asList("test"), ts + (400 * 60000), 4)); - assertEquals(1, engine.getOrCreateMeasurement("test3", "cpu").size()); - - engine = new DiskStorageEngine(); - engine.configure(map, bgTasks); - - Set queryDataPoints = engine.queryDataPoints("test3", "cpu", "value", ts, ts + (400 * 60000), - null, null); - assertTrue(!engine.isMeasurementFieldFP("test3", "cpu", "value")); - try { - engine.isMeasurementFieldFP("test3", "test", "test"); - fail("Measurement should not exist"); - } catch (Exception e) { - } - assertEquals(2, queryDataPoints.iterator().next().getDataPoints().size()); - assertEquals(ts, queryDataPoints.iterator().next().getDataPoints().get(0).getTimestamp()); - assertEquals(ts + (400 * 60000), queryDataPoints.iterator().next().getDataPoints().get(1).getTimestamp()); + public void testQueryDataPointsRecovery() throws Exception { try { - engine.dropDatabase("test3"); + DiskStorageEngine engine = new DiskStorageEngine(); + File file = new File("target/db201/"); + MiscUtils.delete(file); + MiscUtils.ls(file); + Map map = new HashMap<>(); + map.put("index.dir", "target/db201/index"); + map.put("data.dir", "target/db201/data"); + map.put("disk.compression.class", ByzantineWriter.class.getName()); + engine.configure(map, bgTasks); + long ts = System.currentTimeMillis(); + Map db = engine.getOrCreateDatabase("test3", 24); + assertEquals(0, db.size()); + engine.writeDataPoint(MiscUtils.buildDataPoint("test3", "cpu", "value", Arrays.asList("test"), ts, 1)); + engine.writeDataPoint( + MiscUtils.buildDataPoint("test3", "cpu", "value", Arrays.asList("test"), ts + (400 * 60000), 4)); + Measurement measurement = engine.getOrCreateMeasurement("test3", "cpu"); + assertEquals(1, measurement.getTimeSeriesMap().size()); + MiscUtils.ls(file); + engine = new DiskStorageEngine(); + engine.configure(map, bgTasks); + + assertTrue(!engine.isMeasurementFieldFP("test3", "cpu", "value")); + Set queryDataPoints = engine.queryDataPoints("test3", "cpu", "value", ts, + ts + (400 * 60000), null, null); + try { + engine.isMeasurementFieldFP("test3", "test", "test"); + fail("Measurement should not exist"); + } catch (Exception e) { + } + assertEquals(1, queryDataPoints.size()); + assertEquals(2, queryDataPoints.iterator().next().getDataPoints().size()); + assertEquals(ts, queryDataPoints.iterator().next().getDataPoints().get(0).getTimestamp()); + assertEquals(ts + (400 * 60000), queryDataPoints.iterator().next().getDataPoints().get(1).getTimestamp()); + try { + engine.dropDatabase("test3"); + } catch (Exception e) { + e.printStackTrace(); + fail("Database delete must succeed"); + } + assertEquals(0, engine.getOrCreateMeasurement("test3", "cpu").getTimeSeriesMap().size()); } catch (Exception e) { + e.printStackTrace(); + throw e; } - assertEquals(0, engine.getOrCreateMeasurement("test3", "cpu").size()); - - engine = new DiskStorageEngine(); - engine.configure(map, bgTasks); - - assertEquals(0, engine.getOrCreateMeasurement("test3", "cpu").size()); - engine.disconnect(); } @Test @@ -324,14 +419,22 @@ public void testQueryDataPoints() throws IOException, ItemNotFoundException { map.put("disk.compression.class", ByzantineWriter.class.getName()); engine.configure(map, bgTasks); long ts = System.currentTimeMillis(); - Map> db = engine.getOrCreateDatabase("test3", 24); + Map db = engine.getOrCreateDatabase("test3", 24); assertEquals(0, db.size()); engine.writeDataPoint(MiscUtils.buildDataPoint("test3", "cpu", "value", Arrays.asList("test"), ts, 1)); engine.writeDataPoint( MiscUtils.buildDataPoint("test3", "cpu", "value", Arrays.asList("test"), ts + (400 * 60000), 4)); - assertEquals(1, engine.getOrCreateMeasurement("test3", "cpu").size()); + assertEquals(1, engine.getOrCreateMeasurement("test3", "cpu").getTimeSeriesMap().size()); Set queryDataPoints = engine.queryDataPoints("test3", "cpu", "value", ts, ts + (400 * 60000), null, null); + try { + engine.queryDataPoints("test123", "cpu", "value", ts, ts + (400 * 60000), null, null); + } catch (ItemNotFoundException e) { + } + try { + engine.queryDataPoints("test3", "123cpu", "value", ts, ts + (400 * 60000), null, null); + } catch (ItemNotFoundException e) { + } assertTrue(!engine.isMeasurementFieldFP("test3", "cpu", "value")); try { engine.isMeasurementFieldFP("test3", "test", "test"); @@ -345,7 +448,7 @@ public void testQueryDataPoints() throws IOException, ItemNotFoundException { engine.dropDatabase("test3"); } catch (Exception e) { } - assertEquals(0, engine.getOrCreateMeasurement("test3", "cpu").size()); + assertEquals(0, engine.getOrCreateMeasurement("test3", "cpu").getTimeSeriesMap().size()); engine.disconnect(); } @@ -410,8 +513,9 @@ public void testSeriesToDataPointConversion() throws IOException { map.put("index.dir", "target/db1/index"); map.put("data.dir", "target/db1/data"); map.put(StorageEngine.PERSISTENCE_DISK, "true"); - TimeSeriesBucket timeSeries = new TimeSeriesBucket("seriesId", ByzantineWriter.class.getName(), headerTimestamp, - true, map); + ByteBuffer buf = ByteBuffer.allocate(100); + TimeSeriesBucket timeSeries = new TimeSeriesBucket(ByzantineWriter.class.getName(), headerTimestamp, map, buf, + true); timeSeries.addDataPoint(headerTimestamp, 1L); TimeSeries.seriesToDataPoints("value", Arrays.asList("test"), points, timeSeries, null, null, false); assertEquals(1, points.size()); @@ -501,16 +605,19 @@ public void testSeriesBucketLookups() throws IOException, ItemNotFoundException @Test public void testBaseTimeSeriesWrites() throws Exception { + String pathname = "target/bas-t-writer/"; + MiscUtils.delete(new File(pathname)); DiskStorageEngine engine = new DiskStorageEngine(); HashMap map = new HashMap<>(); - map.put(StorageEngine.PERSISTENCE_DISK, "true"); - map.put("disk.compression.class", ByzantineWriter.class.getName()); + map.put("compression.class", ByzantineWriter.class.getName()); + map.put("data.dir", pathname + "/data"); + map.put("index.dir", pathname + "/index"); engine.configure(map, bgTasks); engine.connect(); final long ts1 = System.currentTimeMillis(); ExecutorService es = Executors.newCachedThreadPool(); - for (int k = 0; k < 500; k++) { + for (int k = 0; k < 10; k++) { final int p = k; es.submit(() -> { long ts = System.currentTimeMillis(); @@ -588,11 +695,10 @@ public void testAddAndReaderDataPoints() throws Exception { @Test public void testTagFiltering() throws Exception { DiskStorageEngine engine = new DiskStorageEngine(); - MiscUtils.delete(new File("target/db1/")); + MiscUtils.delete(new File("target/db121/")); HashMap map = new HashMap<>(); - map.put("metadata.dir", "target/db1/mdq"); - map.put("index.dir", "target/db1/index"); - map.put("data.dir", "target/db1/data"); + map.put("index.dir", "target/db121/index"); + map.put("data.dir", "target/db121/data"); map.put(StorageEngine.PERSISTENCE_DISK, "true"); engine.configure(map, bgTasks); long curr = System.currentTimeMillis(); @@ -610,6 +716,7 @@ public void testTagFiltering() throws Exception { Arrays.asList(String.valueOf(i), String.valueOf(i + 12)), curr, 2 * i)); } Set tags = engine.getTagsForMeasurement(dbName, measurementName); + System.out.println("Tags:" + tags); assertEquals(9, tags.size()); Set series = engine.getSeriesIdsWhereTags(dbName, measurementName, Arrays.asList(String.valueOf(1))); assertEquals(2, series.size()); @@ -771,8 +878,8 @@ public void testAddAndReadDataPoints() throws Exception { /* * Test used for performance assessment of the old mechnism for data writes - * using more parameters public void testWritePerformance() throws - * IOException, InterruptedException { final MemStorageEngine engine = new + * using more parameters public void testWritePerformance() throws IOException, + * InterruptedException { final MemStorageEngine engine = new * MemStorageEngine(); engine.configure(new HashMap<>()); long timeMillis = * System.currentTimeMillis(); int tcount = 8; ExecutorService es = * Executors.newFixedThreadPool(tcount); int count = 1000000; final @@ -780,11 +887,11 @@ public void testAddAndReadDataPoints() throws Exception { * k++) { final int j = k; es.submit(() -> { long ts = * System.currentTimeMillis(); for (int i = 0; i < count; i++) { try { * engine.writeDataPoint("test", new DataPoint("test", j + "cpu" + (i % - * 1000000), "value", Arrays.asList("test", "test2"), ts + i, i * 1.1)); } - * catch (IOException e) { rejects.incrementAndGet(); } } }); } - * es.shutdown(); es.awaitTermination(10, TimeUnit.SECONDS); - * System.out.println("Write throughput object " + tcount + "x" + count + - * ":" + (System.currentTimeMillis() - timeMillis) + "ms with " + - * rejects.get() + " rejects using " + tcount); } + * 1000000), "value", Arrays.asList("test", "test2"), ts + i, i * 1.1)); } catch + * (IOException e) { rejects.incrementAndGet(); } } }); } es.shutdown(); + * es.awaitTermination(10, TimeUnit.SECONDS); + * System.out.println("Write throughput object " + tcount + "x" + count + ":" + + * (System.currentTimeMillis() - timeMillis) + "ms with " + rejects.get() + + * " rejects using " + tcount); } */ } diff --git a/core/src/test/java/com/srotya/sidewinder/core/storage/disk/TestDiskTagIndex.java b/core/src/test/java/com/srotya/sidewinder/core/storage/disk/TestDiskTagIndex.java index 78bc0a7..f758ac1 100644 --- a/core/src/test/java/com/srotya/sidewinder/core/storage/disk/TestDiskTagIndex.java +++ b/core/src/test/java/com/srotya/sidewinder/core/storage/disk/TestDiskTagIndex.java @@ -29,6 +29,7 @@ import org.junit.Test; +import com.srotya.sidewinder.core.storage.Measurement; import com.srotya.sidewinder.core.storage.mem.MemTagIndex; import com.srotya.sidewinder.core.utils.BackgrounThreadFactory; import com.srotya.sidewinder.core.utils.MiscUtils; @@ -84,19 +85,21 @@ public void testTagIndexPerformance() throws IOException, InterruptedException { es.shutdown(); es.awaitTermination(1000, TimeUnit.SECONDS); System.err.println("Index time:" + (System.currentTimeMillis() - ms)); - Map> index = engine.getTagLookupTable(); + Map> index = engine.getMeasurementMap(); assertEquals(1, index.size()); - Entry> next = index.entrySet().iterator().next(); + Entry> next = index.entrySet().iterator().next(); assertEquals("db1", next.getKey()); - Entry itr = next.getValue().entrySet().iterator().next(); + Entry itr = next.getValue().entrySet().iterator().next(); assertEquals("m1", itr.getKey()); - DiskTagIndex value = itr.getValue(); + DiskTagIndex value = (DiskTagIndex) itr.getValue().getTagIndex(); assertEquals(20000 + 10 + 1500, value.getTags().size()); } @Test public void testTagIndexThreaded() throws InterruptedException, IOException { - final DiskTagIndex index = new DiskTagIndex("target/index", "db2", "m2"); + String indexDir = "target/index"; + new File(indexDir).mkdirs(); + final DiskTagIndex index = new DiskTagIndex(indexDir, "m2"); ExecutorService es = Executors.newCachedThreadPool(); for (int k = 0; k < 10; k++) { es.submit(() -> { @@ -118,7 +121,7 @@ public void testTagIndexThreaded() throws InterruptedException, IOException { assertEquals("test212", index.searchRowKeysForTag(entry).iterator().next()); } - DiskTagIndex index2 = new DiskTagIndex("target/index", "db2", "m2"); + DiskTagIndex index2 = new DiskTagIndex(indexDir, "m2"); for (int i = 0; i < 1000; i++) { String entry = index2.createEntry("tag" + (i + 1)); assertEquals("tag" + (i + 1), index2.getEntry(entry)); diff --git a/core/src/test/java/com/srotya/sidewinder/core/storage/disk/TestLRUSortedMap.java b/core/src/test/java/com/srotya/sidewinder/core/storage/disk/TestLRUSortedMap.java deleted file mode 100644 index 801e0d7..0000000 --- a/core/src/test/java/com/srotya/sidewinder/core/storage/disk/TestLRUSortedMap.java +++ /dev/null @@ -1,56 +0,0 @@ -/** - * Copyright 2017 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.storage.disk; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -import java.util.SortedMap; - -import org.junit.Test; - -/** - * @author ambud - */ -public class TestLRUSortedMap { - - @Test - public void testBasicSortedMap() { - SortedMap map = new ConcurrentLRUSortedMap(10); - for (int i = 0; i < 100; i++) { - map.put(String.valueOf(i), new BucketEntry(String.valueOf(i), null)); - } - assertEquals(100, map.size()); - map.remove(String.valueOf(95)); - assertEquals(99, map.size()); - BucketEntry bucketEntry = map.get(String.valueOf(94)); - assertTrue(bucketEntry.getPrev() != null); - } - - @Test - public void testLRUBehaviroMap() { - SortedMap map = new ConcurrentLRUSortedMap(10); - for (int i = 0; i < 100; i++) { - map.put(String.valueOf(i), new BucketEntry(String.valueOf(i), null)); - } - assertEquals(100, map.size()); - map.remove(String.valueOf(95)); - assertEquals(99, map.size()); - BucketEntry bucketEntry = map.get(String.valueOf(94)); - assertTrue(bucketEntry.getPrev() != null); - } - -} diff --git a/core/src/test/java/com/srotya/sidewinder/core/storage/disk/TestPersistentMeasurement.java b/core/src/test/java/com/srotya/sidewinder/core/storage/disk/TestPersistentMeasurement.java new file mode 100644 index 0000000..7d7daf6 --- /dev/null +++ b/core/src/test/java/com/srotya/sidewinder/core/storage/disk/TestPersistentMeasurement.java @@ -0,0 +1,212 @@ +/** + * Copyright 2017 Ambud Sharma + * + * Licensed 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 com.srotya.sidewinder.core.storage.disk; + +import static org.junit.Assert.assertEquals; + +import java.io.File; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; + +import org.junit.Test; + +import com.srotya.sidewinder.core.filters.AnyFilter; +import com.srotya.sidewinder.core.storage.DBMetadata; +import com.srotya.sidewinder.core.storage.DataPoint; +import com.srotya.sidewinder.core.storage.Measurement; +import com.srotya.sidewinder.core.storage.SeriesQueryOutput; +import com.srotya.sidewinder.core.storage.StorageEngine; +import com.srotya.sidewinder.core.storage.TagIndex; +import com.srotya.sidewinder.core.storage.TimeSeries; +import com.srotya.sidewinder.core.storage.compression.Reader; +import com.srotya.sidewinder.core.utils.BackgrounThreadFactory; +import com.srotya.sidewinder.core.utils.MiscUtils; + +/** + * @author ambud + */ +public class TestPersistentMeasurement { + + private Map conf = new HashMap<>(); + private DBMetadata metadata = new DBMetadata(28); + private ScheduledExecutorService bgTaskPool = Executors.newScheduledThreadPool(1); + + @Test + public void test() throws IOException { + Measurement measurement = new PersistentMeasurement(); + measurement.configure(conf, "m1", "target/pmeasurement1.idx", "target/pmeasurement1", metadata, bgTaskPool); + // TimeSeries series = measurement.getOrCreateTimeSeries("v1", + // Arrays.asList("test1"), 4096, false, conf); + } + + @Test + public void testConstructRowKey() throws Exception { + StorageEngine engine = new DiskStorageEngine(); + MiscUtils.delete(new File("target/db131/")); + HashMap map = new HashMap<>(); + map.put("data.dir", "target/db131/data"); + map.put("index.dir", "target/db131/index"); + engine.configure(map, Executors.newScheduledThreadPool(1, new BackgrounThreadFactory("bg"))); + List tags = Arrays.asList("test1", "test2"); + Measurement m = new PersistentMeasurement(); + m.configure(conf, "m1", "target/db131/index", "target/db131/data", metadata, bgTaskPool); + TagIndex index = m.getTagIndex(); + String encodeTagsToString = m.encodeTagsToString(index, tags); + String key = m.constructSeriesId("csd", tags, index); + assertEquals("csd#" + encodeTagsToString, key); + } + + @Test + public void testMeasurementRecovery() throws IOException { + MiscUtils.delete(new File("target/db141/")); + Measurement m = new PersistentMeasurement(); + m.configure(conf, "m1", "target/db141/index", "target/db141/data", metadata, bgTaskPool); + TimeSeries ts = m.getOrCreateTimeSeries("vf1", Arrays.asList("t1", "t2"), 4096, false, conf); + long t = System.currentTimeMillis(); + for (int i = 0; i < 100; i++) { + ts.addDataPoint(TimeUnit.MILLISECONDS, t + i * 1000, i); + } + List dps = ts.queryDataPoints("vf1", Arrays.asList("t1", "t2"), t, t + 1000 * 100, null); + assertEquals(100, dps.size()); + for (int i = 0; i < 100; i++) { + DataPoint dp = dps.get(i); + assertEquals(t + i * 1000, dp.getTimestamp()); + assertEquals(i, dp.getLongValue()); + } + Set resultMap = new HashSet<>(); + m.queryDataPoints("vf1", t, t + 1000 * 100, Arrays.asList("t1", "t2"), new AnyFilter<>(), null, null, + resultMap); + assertEquals(1, resultMap.size()); + SeriesQueryOutput next = resultMap.iterator().next(); + for (int i = 0; i < next.getDataPoints().size(); i++) { + DataPoint dp = next.getDataPoints().get(i); + assertEquals(t + i * 1000, dp.getTimestamp()); + assertEquals(i, dp.getLongValue()); + } + LinkedHashMap readers = new LinkedHashMap<>(); + m.queryReaders("vf1", t, t + 1000 * 100, readers); + for (Reader reader : readers.keySet()) { + assertEquals(100, reader.getPairCount()); + } + } + + @Test + public void testLinearizability() throws IOException, InterruptedException { + for (int p = 0; p < 100; p++) { + MiscUtils.delete(new File("target/db134/")); + final long t1 = 1497720452566L; + Measurement m = new PersistentMeasurement(); + m.configure(conf, "m1", "target/db134/index", "target/db134/data", metadata, bgTaskPool); + ExecutorService es = Executors.newFixedThreadPool(2, new BackgrounThreadFactory("tlinear")); + AtomicBoolean wait = new AtomicBoolean(false); + for (int i = 0; i < 2; i++) { + final int th = i; + es.submit(() -> { + while (!wait.get()) { + try { + Thread.sleep(1); + } catch (InterruptedException e) { + } + } + long t = t1 + th * 3; + for (int j = 0; j < 100; j++) { + try { + TimeSeries ts = m.getOrCreateTimeSeries("vf1", Arrays.asList("t1", "t2"), 4096, false, + conf); + long timestamp = t + j * 1000; + ts.addDataPoint(TimeUnit.MILLISECONDS, timestamp, j); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + } + es.shutdown(); + wait.set(true); + es.awaitTermination(100, TimeUnit.SECONDS); + TimeSeries ts = m.getOrCreateTimeSeries("vf1", Arrays.asList("t1", "t2"), 4096, false, conf); + List dps = ts.queryDataPoints("vf1", Arrays.asList("t1"), t1 - 120, t1 + 1000_000, null); + assertEquals(200, dps.size()); + assertEquals(1, ts.getBucketCount()); + } + } + + @Test + public void testLinearizabilityWithRollOverBucket() throws IOException, InterruptedException { + for (int p = 0; p < 100; p++) { + final int LIMIT = 10000; + MiscUtils.delete(new File("target/db135/")); + final long t1 = 1497720452566L; + Measurement m = new PersistentMeasurement(); + m.configure(conf, "m1", "target/db135/index", "target/db135/data", metadata, bgTaskPool); + ExecutorService es = Executors.newFixedThreadPool(2, new BackgrounThreadFactory("tlinear2")); + AtomicBoolean wait = new AtomicBoolean(false); + for (int i = 0; i < 2; i++) { + final int th = i; + es.submit(() -> { + while (!wait.get()) { + try { + Thread.sleep(1); + } catch (InterruptedException e) { + } + } + long t = t1 + th * 3; + for (int j = 0; j < LIMIT; j++) { + try { + TimeSeries ts = m.getOrCreateTimeSeries("vf1", Arrays.asList("t1", "t2"), 4096, false, + conf); + long timestamp = t + j * 1000; + ts.addDataPoint(TimeUnit.MILLISECONDS, timestamp, j); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + } + es.shutdown(); + wait.set(true); + es.awaitTermination(10, TimeUnit.SECONDS); + TimeSeries ts = m.getOrCreateTimeSeries("vf1", Arrays.asList("t1", "t2"), 4096, false, conf); + List dps = ts.queryDataPoints("vf1", Arrays.asList("t1"), t1 - 100, t1 + 1000_0000, null); + assertEquals(LIMIT * 2, dps.size(), 10); + System.out.println("Bucket Count:" + ts.getBucketCount()); + } + } + + @Test + public void testTagEncodeDecode() throws IOException { + String indexDir = "target/test"; + MiscUtils.delete(new File(indexDir)); + new File(indexDir).mkdirs(); + DiskTagIndex table = new DiskTagIndex(indexDir, "test2"); + Measurement measurement = new PersistentMeasurement(); + String encodedStr = measurement.encodeTagsToString(table, Arrays.asList("host", "value", "test")); + List decodedStr = measurement.decodeStringToTags(table, encodedStr); + assertEquals(Arrays.asList("host", "value", "test"), decodedStr); + } + +} diff --git a/core/src/test/java/com/srotya/sidewinder/core/storage/disk/TestPersistentTimeSeries.java b/core/src/test/java/com/srotya/sidewinder/core/storage/disk/TestPersistentTimeSeries.java deleted file mode 100644 index aa7d9af..0000000 --- a/core/src/test/java/com/srotya/sidewinder/core/storage/disk/TestPersistentTimeSeries.java +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Copyright 2017 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.storage.disk; - -import static org.junit.Assert.*; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -import org.junit.Test; - -import com.srotya.sidewinder.core.storage.DBMetadata; -import com.srotya.sidewinder.core.storage.compression.byzantine.ByzantineWriter; - -/** - * @author ambud - */ -public class TestPersistentTimeSeries { - - @Test - public void testConstructor() throws IOException { - Map conf = new HashMap<>(); - DBMetadata metadata = new DBMetadata(121); - String measurementPath = "target/seriestest"; - String compressionFQCN = ByzantineWriter.class.getName(); - String seriesId = "series111"; - int timeBucketSize = 4096; - PersistentTimeSeries timeseries = new PersistentTimeSeries(measurementPath, compressionFQCN, seriesId, metadata, - timeBucketSize, false, conf, null); - timeseries.addDataPoint(TimeUnit.MILLISECONDS, 1497720452566L, 1L); - timeseries.addDataPoint(TimeUnit.MILLISECONDS, 1497720453566L, 1L); - assertEquals(1, timeseries.getSeriesBuckets(TimeUnit.MILLISECONDS, 1497720452566L).size()); - timeseries = new PersistentTimeSeries(measurementPath, compressionFQCN, seriesId, metadata, timeBucketSize, - false, conf, null); - } - -} diff --git a/core/src/test/java/com/srotya/sidewinder/core/storage/mem/TestMemStorageEngine.java b/core/src/test/java/com/srotya/sidewinder/core/storage/mem/TestMemStorageEngine.java index 5f11fab..dd5b3dc 100644 --- a/core/src/test/java/com/srotya/sidewinder/core/storage/mem/TestMemStorageEngine.java +++ b/core/src/test/java/com/srotya/sidewinder/core/storage/mem/TestMemStorageEngine.java @@ -20,6 +20,7 @@ import static org.junit.Assert.fail; import java.io.IOException; +import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.Arrays; import java.util.Date; @@ -48,11 +49,13 @@ import com.srotya.sidewinder.core.predicates.Predicate; import com.srotya.sidewinder.core.storage.DataPoint; import com.srotya.sidewinder.core.storage.ItemNotFoundException; -import com.srotya.sidewinder.core.storage.Reader; +import com.srotya.sidewinder.core.storage.Measurement; import com.srotya.sidewinder.core.storage.RejectException; import com.srotya.sidewinder.core.storage.SeriesQueryOutput; import com.srotya.sidewinder.core.storage.StorageEngine; +import com.srotya.sidewinder.core.storage.TimeSeries; import com.srotya.sidewinder.core.storage.TimeSeriesBucket; +import com.srotya.sidewinder.core.storage.compression.Reader; import com.srotya.sidewinder.core.storage.compression.byzantine.ByzantineWriter; import com.srotya.sidewinder.core.utils.MiscUtils; import com.srotya.sidewinder.core.utils.TimeUtils; @@ -180,14 +183,6 @@ public void run() { // + "\nWriting " + tcount + " each with " + (count/modulator) + " series"); // } - @Test - public void testTagEncodeDecode() throws IOException { - MemTagIndex table = new MemTagIndex(); - MemStorageEngine engine = new MemStorageEngine(); - String encodedStr = engine.encodeTagsToString(table, Arrays.asList("host", "value", "test")); - List decodedStr = engine.decodeStringToTags(table, encodedStr); - assertEquals(Arrays.asList("host", "value", "test"), decodedStr); - } @Test public void testConfigure() { @@ -243,12 +238,12 @@ public void testQueryDataPoints() throws IOException, ItemNotFoundException { StorageEngine engine = new MemStorageEngine(); engine.configure(conf, bgTasks); long ts = System.currentTimeMillis(); - Map> db = engine.getOrCreateDatabase("test", 24); + Map db = engine.getOrCreateDatabase("test", 24); assertEquals(0, db.size()); engine.writeDataPoint(MiscUtils.buildDataPoint("test", "cpu", "value", Arrays.asList("test"), ts, 1)); engine.writeDataPoint( MiscUtils.buildDataPoint("test", "cpu", "value", Arrays.asList("test"), ts + (400 * 60000), 4)); - assertEquals(1, engine.getOrCreateMeasurement("test", "cpu").size()); + assertEquals(1, engine.getOrCreateMeasurement("test", "cpu").getTimeSeriesMap().size()); Set queryDataPoints = engine.queryDataPoints("test", "cpu", "value", ts, ts + (400 * 60000), null, null); assertTrue(!engine.isMeasurementFieldFP("test", "cpu", "value")); @@ -264,7 +259,7 @@ public void testQueryDataPoints() throws IOException, ItemNotFoundException { engine.dropDatabase("test"); } catch (Exception e) { } - assertEquals(0, engine.getOrCreateMeasurement("test", "cpu").size()); + assertEquals(0, engine.getOrCreateMeasurement("test", "cpu").getTimeSeries().size()); } @Test @@ -291,8 +286,8 @@ public void testGetMeasurementsLike() throws Exception { public void testSeriesToDataPointConversion() throws IOException { List points = new ArrayList<>(); long headerTimestamp = System.currentTimeMillis(); - TimeSeriesBucket timeSeries = new TimeSeriesBucket("seriesId", ByzantineWriter.class.getName(), headerTimestamp, - false, new HashMap<>()); + ByteBuffer buf = ByteBuffer.allocate(1024); + TimeSeriesBucket timeSeries = new TimeSeriesBucket(ByzantineWriter.class.getName(), headerTimestamp, conf, buf, true); timeSeries.addDataPoint(headerTimestamp, 1L); TimeSeries.seriesToDataPoints("value", Arrays.asList("test"), points, timeSeries, null, null, false); assertEquals(1, points.size()); @@ -319,7 +314,7 @@ public void testSeriesBucketLookups() throws IOException, ItemNotFoundException engine.writeDataPoint( MiscUtils.buildDataPoint(dbName, measurementName, "value", tags, ts + (i * 60000), 2.2)); } - System.out.println("Buckets:" + engine.getSeriesMap(dbName, measurementName).size()); + System.out.println("Buckets:" + engine.getMeasurement(dbName, measurementName).getTimeSeries().size()); long endTs = ts + 99 * 60000; // validate all points are returned with a full range query diff --git a/core/src/test/java/com/srotya/sidewinder/core/storage/mem/TestMemTagIndex.java b/core/src/test/java/com/srotya/sidewinder/core/storage/mem/TestMemTagIndex.java index 0383892..e0be3b7 100644 --- a/core/src/test/java/com/srotya/sidewinder/core/storage/mem/TestMemTagIndex.java +++ b/core/src/test/java/com/srotya/sidewinder/core/storage/mem/TestMemTagIndex.java @@ -52,23 +52,24 @@ public void testTagIndexPerformance() throws IOException, InterruptedException { MemStorageEngine engine = new MemStorageEngine(); engine.configure(new HashMap<>(), null); long ms = System.currentTimeMillis(); - ExecutorService es = Executors.newFixedThreadPool(4); - for (int k = 0; k < 4; k++) { + ExecutorService es = Executors.newFixedThreadPool(7); + for (int k = 0; k < 7; k++) { es.submit(() -> { for (int i = 0; i < 30_000_000; i++) { try { engine.getOrCreateTimeSeries("db1", "m1", "v10", - Arrays.asList(String.valueOf(i % 10_000), "test=" + String.valueOf(i % 5), + Arrays.asList(String.valueOf(i % 1_000_000), "test=" + String.valueOf(i % 5), "goliath=" + String.valueOf(i % 1000), "goliath2=" + String.valueOf(i % 150)), 4096, true); } catch (IOException e) { e.printStackTrace(); } - if (i % 1000000 == 0) + if (i % 100000 == 0) System.out.println(i); } }); } + es.shutdownNow(); es.awaitTermination(1000, TimeUnit.SECONDS); ms = System.currentTimeMillis() - ms; System.err.println("Index time:" + ms); diff --git a/core/src/test/java/com/srotya/sidewinder/core/storage/mem/TestTimeSeries.java b/core/src/test/java/com/srotya/sidewinder/core/storage/mem/TestTimeSeries.java deleted file mode 100644 index 7a77482..0000000 --- a/core/src/test/java/com/srotya/sidewinder/core/storage/mem/TestTimeSeries.java +++ /dev/null @@ -1,123 +0,0 @@ -/** - * Copyright 2017 Ambud Sharma - * - * Licensed 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 com.srotya.sidewinder.core.storage.mem; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; - -import java.io.IOException; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.concurrent.TimeUnit; - -import org.junit.Test; - -import com.srotya.sidewinder.core.storage.DBMetadata; -import com.srotya.sidewinder.core.storage.DataPoint; -import com.srotya.sidewinder.core.storage.Reader; -import com.srotya.sidewinder.core.storage.TimeSeriesBucket; -import com.srotya.sidewinder.core.storage.compression.byzantine.ByzantineWriter; - -/** - * Unit tests for {@link TimeSeries} - * - * @author ambud - */ -public class TestTimeSeries { - - private String className = ByzantineWriter.class.getName(); - - @Test - public void testTimeSeriesConstruct() { - TimeSeries series = new TimeSeries(className, "2214abfa", new DBMetadata(24), 4096, true, new HashMap<>()); - assertEquals("2214abfa", series.getSeriesId()); - assertEquals(4096, series.getTimeBucketSize()); - assertEquals((24 * 3600) / 4096, series.getRetentionBuckets()); - } - - @Test - public void testAddAndReadDataPoints() throws IOException { - TimeSeries series = new TimeSeries(className, "43232", new DBMetadata(24), 4096, true, new HashMap<>()); - long curr = System.currentTimeMillis(); - for (int i = 1; i <= 3; i++) { - series.addDataPoint(TimeUnit.MILLISECONDS, curr + i, 2.2 * i); - } - assertEquals(1, series.getBucketMap().size()); - TimeSeriesBucket bucket = series.getBucketMap().values().iterator().next(); - assertEquals(3, bucket.getCount()); - - Reader reader = bucket.getReader(null, null, true, "value", Arrays.asList("test")); - for (int i = 0; i < 3; i++) { - reader.readPair(); - } - try { - reader.readPair(); - fail("The read shouldn't succeed"); - } catch (IOException e) { - } - - List values = series.queryDataPoints("value", Arrays.asList("test"), curr, curr + 3, null); - assertEquals(3, values.size()); - for (int i = 1; i <= 3; i++) { - DataPoint dp = values.get(i - 1); - assertEquals("Value mismatch:" + dp.getValue() + "\t" + (2.2 * i) + "\t" + i, dp.getValue(), 2.2 * i, 0.01); - assertEquals("value", dp.getValueFieldName()); - assertEquals(Arrays.asList("test"), dp.getTags()); - } - - List queryReaders = series.queryReader("value", Arrays.asList("test"), curr, curr + 3, null); - assertEquals(1, queryReaders.size()); - reader = queryReaders.get(0); - for (int i = 1; i <= 3; i++) { - DataPoint dp = reader.readPair(); - assertEquals("Value mismatch:" + dp.getValue() + "\t" + (2.2 * i) + "\t" + i, dp.getValue(), 2.2 * i, 0.01); - assertEquals("value", dp.getValueFieldName()); - assertEquals(Arrays.asList("test"), dp.getTags()); - } - - values = series.queryDataPoints("value", Arrays.asList("test"), curr - 1, curr - 1, null); - assertEquals(0, values.size()); - } - - @Test - public void testGarbageCollector() throws IOException { - TimeSeries series = new TimeSeries(className, "43232", new DBMetadata(24), 4096, true, new HashMap<>()); - long curr = 1484788896586L; - for (int i = 0; i <= 24; i++) { - series.addDataPoint(TimeUnit.MILLISECONDS, curr + (4096_000 * i), 2.2 * i); - } - List readers = series.queryReader("test", Arrays.asList("test"), curr, curr + (4096_000) * 23, null); - // should return 3 partitions - assertEquals(24, readers.size()); - series.collectGarbage(); - readers = series.queryReader("test", Arrays.asList("test"), curr, curr + (4096_000) * 26, null); - assertEquals(21, readers.size()); - - series = new TimeSeries(className, "43232", new DBMetadata(28), 4096, true, new HashMap<>()); - curr = 1484788896586L; - for (int i = 0; i <= 24; i++) { - series.addDataPoint(TimeUnit.MILLISECONDS, curr + (4096_000 * i), 2.2 * i); - } - readers = series.queryReader("test", Arrays.asList("test"), curr, curr + (4096_000) * 28, null); - // should return 25 partitions - assertEquals(25, readers.size()); - series.collectGarbage(); - readers = series.queryReader("test", Arrays.asList("test"), curr, curr + (4096_000) * 28, null); - assertEquals(24, readers.size()); - } - -} diff --git a/core/src/test/java/com/srotya/sidewinder/core/storage/mem/archival/TestDiskArchiver.java b/core/src/test/java/com/srotya/sidewinder/core/storage/mem/archival/TestDiskArchiver.java index 5d70f80..b8cd128 100644 --- a/core/src/test/java/com/srotya/sidewinder/core/storage/mem/archival/TestDiskArchiver.java +++ b/core/src/test/java/com/srotya/sidewinder/core/storage/mem/archival/TestDiskArchiver.java @@ -22,6 +22,7 @@ import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; +import java.nio.ByteBuffer; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -29,8 +30,8 @@ import com.srotya.sidewinder.core.storage.ArchiveException; import com.srotya.sidewinder.core.storage.Archiver; import com.srotya.sidewinder.core.storage.DataPoint; -import com.srotya.sidewinder.core.storage.Reader; import com.srotya.sidewinder.core.storage.TimeSeriesBucket; +import com.srotya.sidewinder.core.storage.compression.Reader; import com.srotya.sidewinder.core.storage.compression.byzantine.ByzantineWriter; /** @@ -44,7 +45,8 @@ public class TestDiskArchiver { // @Test public void testStreamSerDe() throws IOException { long ts = System.currentTimeMillis(); - TimeSeriesBucket bucket = new TimeSeriesBucket("seriesId", className, ts, false, new HashMap<>()); + ByteBuffer buf = ByteBuffer.allocate(1024); + TimeSeriesBucket bucket = new TimeSeriesBucket(className, ts, new HashMap<>(), buf, true); for (int i = 0; i < 1000; i++) { bucket.addDataPoint(ts + i * 1000, i); } @@ -97,7 +99,8 @@ public void testDiskArchiver() throws IOException, ArchiveException { conf.put(DiskArchiver.ARCHIVAL_DISK_DIRECTORY, "target/test-diskbackup-" + System.currentTimeMillis()); archiver.init(conf); long ts = System.currentTimeMillis(); - TimeSeriesBucket bucket = new TimeSeriesBucket("seriesId", className, ts, false, new HashMap<>()); + ByteBuffer buf = ByteBuffer.allocate(1024); + TimeSeriesBucket bucket = new TimeSeriesBucket(className, ts, conf, buf, true); for (int i = 0; i < 1000; i++) { bucket.addDataPoint(ts + i * 1000, i); } diff --git a/core/src/test/java/com/srotya/sidewinder/core/utils/TestMurmurHash.java b/core/src/test/java/com/srotya/sidewinder/core/utils/TestMurmurHash.java deleted file mode 100644 index 1192e79..0000000 --- a/core/src/test/java/com/srotya/sidewinder/core/utils/TestMurmurHash.java +++ /dev/null @@ -1,202 +0,0 @@ -package com.srotya.sidewinder.core.utils; - -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -import org.junit.Test; - -/** - * Test class for the Java Murmur hash implementation. - * - * @author Viliam Holub - */ -public class TestMurmurHash { - - /** Random input data with various length. */ - static final byte[][] input = { - { - (byte)0xed, (byte)0x53, (byte)0xc4, (byte)0xa5, - (byte)0x3b, (byte)0x1b, (byte)0xbd, (byte)0xc2, - (byte)0x52, (byte)0x7d, (byte)0xc3, (byte)0xef, - (byte)0x53, (byte)0x5f, (byte)0xae, (byte)0x3b - }, - { - (byte)0x21, (byte)0x65, (byte)0x59, (byte)0x4e, - (byte)0xd8, (byte)0x12, (byte)0xf9, (byte)0x05, - (byte)0x80, (byte)0xe9, (byte)0x1e, (byte)0xed, - (byte)0xe4, (byte)0x56, (byte)0xbb - }, - { - (byte)0x2b, (byte)0x02, (byte)0xb1, (byte)0xd0, - (byte)0x3d, (byte)0xce, (byte)0x31, (byte)0x3d, - (byte)0x97, (byte)0xc4, (byte)0x91, (byte)0x0d, - (byte)0xf7, (byte)0x17 - }, - { - (byte)0x8e, (byte)0xa7, (byte)0x9a, (byte)0x02, - (byte)0xe8, (byte)0xb9, (byte)0x6a, (byte)0xda, - (byte)0x92, (byte)0xad, (byte)0xe9, (byte)0x2d, - (byte)0x21 - }, - { - (byte)0xa9, (byte)0x6d, (byte)0xea, (byte)0x77, - (byte)0x06, (byte)0xce, (byte)0x1b, (byte)0x85, - (byte)0x48, (byte)0x27, (byte)0x4c, (byte)0xfe - }, - { - (byte)0xec, (byte)0x93, (byte)0xa0, (byte)0x12, - (byte)0x60, (byte)0xee, (byte)0xc8, (byte)0x0a, - (byte)0xc5, (byte)0x90, (byte)0x62 - }, - { - (byte)0x55, (byte)0x6d, (byte)0x93, (byte)0x66, - (byte)0x14, (byte)0x6d, (byte)0xdf, (byte)0x00, - (byte)0x58, (byte)0x99 - }, - { - (byte)0x3c, (byte)0x72, (byte)0x20, (byte)0x1f, - (byte)0xd2, (byte)0x59, (byte)0x19, (byte)0xdb, - (byte)0xa1 - }, - { - (byte)0x23, (byte)0xa8, (byte)0xb1, (byte)0x87, - (byte)0x55, (byte)0xf7, (byte)0x8a, (byte)0x4b, - - }, - { - (byte)0xe2, (byte)0x42, (byte)0x1c, (byte)0x2d, - (byte)0xc1, (byte)0xe4, (byte)0x3e - }, - { - (byte)0x66, (byte)0xa6, (byte)0xb5, (byte)0x5a, - (byte)0x74, (byte)0xd9 - }, - { - (byte)0xe8, (byte)0x76, (byte)0xa8, (byte)0x90, - (byte)0x76 - }, - { - (byte)0xeb, (byte)0x25, (byte)0x3f, (byte)0x87 - }, - { - (byte)0x37, (byte)0xa0, (byte)0xa9 - }, - { - (byte)0x5b, (byte)0x5d - }, - { - (byte)0x7e - }, - {} - }; - - /* - * Expected results - from the original C implementation. - */ - - /** Murmur 32bit hash results, default library seed. */ - static final int[] results32_standard = { - 0x96814fb3, 0x485dcaba, 0x331dc4ae, 0xc6a7bf2f, - 0xcdf35de0, 0xd9dec7cc, 0x63a7318a, 0xd0d3c2de, - 0x90923aef, 0xaf35c1e2, 0x735377b2, 0x366c98f3, - 0x9c48ee29, 0x0b615790, 0xb4308ac1, 0xec98125a, - 0x106e08d9}; - /** Murmur 32bit hash results, special test seed. */ - static final int[] results32_seed = { - 0xd92e493e, 0x8b50903b, 0xc3372a7b, 0x48f07e9e, - 0x8a5e4a6e, 0x57916df4, 0xa346171f, 0x1e319c86, - 0x9e1a03cd, 0x9f973e6c, 0x2d8c77f5, 0xabed8751, - 0x296708b6, 0x24f8078b, 0x111b1553, 0xa7da1996, - 0xfe776c70}; - /** Murmur 64bit hash results, default library seed. */ - static final long[] results64_standard = { - 0x4987cb15118a83d9l, 0x28e2a79e3f0394d9l, 0x8f4600d786fc5c05l, - 0xa09b27fea4b54af3l, 0x25f34447525bfd1el, 0x32fad4c21379c7bfl, - 0x4b30b99a9d931921l, 0x4e5dab004f936cdbl, 0x06825c27bc96cf40l, - 0xff4bf2f8a4823905l, 0x7f7e950c064e6367l, 0x821ade90caaa5889l, - 0x6d28c915d791686al, 0x9c32649372163ba2l, 0xd66ae956c14d5212l, - 0x38ed30ee5161200fl, 0x9bfae0a4e613fc3cl, - }; - /** Murmur 64bit hash results, special test seed. */ - static final long[] results64_seed = { - 0x0822b1481a92e97bl, 0xf8a9223fef0822ddl, 0x4b49e56affae3a89l, - 0xc970296e32e1d1c1l, 0xe2f9f88789f1b08fl, 0x2b0459d9b4c10c61l, - 0x377e97ea9197ee89l, 0xd2ccad460751e0e7l, 0xff162ca8d6da8c47l, - 0xf12e051405769857l, 0xdabba41293d5b035l, 0xacf326b0bb690d0el, - 0x0617f431bc1a8e04l, 0x15b81f28d576e1b2l, 0x28c1fe59e4f8e5bal, - 0x694dd315c9354ca9l, 0xa97052a8f088ae6cl - }; - - - /** Dummy test text. */ - static final String text = "Lorem ipsum dolor sit amet, consectetur adipisicing elit"; - - - @Test - public void testHash32ByteArrayIntInt() { - for (int i=0; i + + org.apache.rat + apache-rat-plugin + 0.12 + + + **/*.txt + **/*.json + **/.gitignore + **/*.yaml + **/*.yml + **/*.md + **/*.enc + **/*.xml + **/*.sh + **/*.properties + **/*.props + **/Dockerfile + **/control + **/postinst + **/preinst + **/*.jar + **/*.rpm + **/*.spec + **/*.html + **/*.config + **/*.conf + **/*.j2 + **/*Murmur* + **/sidewinder + + + org.jacoco jacoco-maven-plugin