Repository: phoenix Updated Branches: refs/heads/calcite d5c868209 -> 65ec1bf1b
PHOENIX-1706 Create skeleton for parsing DDL (Julian Hyde) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/65ec1bf1 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/65ec1bf1 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/65ec1bf1 Branch: refs/heads/calcite Commit: 65ec1bf1bf7939c34d44dab2935f9998fc17c92b Parents: d5c8682 Author: James Taylor <[email protected]> Authored: Thu Aug 20 12:59:25 2015 -0700 Committer: James Taylor <[email protected]> Committed: Thu Aug 20 12:59:25 2015 -0700 ---------------------------------------------------------------------- phoenix-core/pom.xml | 91 ++++++++++++ .../org/apache/phoenix/calcite/CalciteTest.java | 140 ++++++++++++------- phoenix-core/src/main/codegen/config.fmpp | 22 +++ phoenix-core/src/main/codegen/data/Parser.tdd | 58 ++++++++ .../src/main/codegen/includes/license.ftl | 18 +++ .../src/main/codegen/includes/parserImpls.ftl | 36 +++++ .../calcite/jdbc/PhoenixPrepareImpl.java | 8 ++ .../apache/phoenix/calcite/parse/SqlCommit.java | 44 ++++++ 8 files changed, 369 insertions(+), 48 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/phoenix/blob/65ec1bf1/phoenix-core/pom.xml ---------------------------------------------------------------------- diff --git a/phoenix-core/pom.xml b/phoenix-core/pom.xml index b5d3cbf..0bf2f3d 100644 --- a/phoenix-core/pom.xml +++ b/phoenix-core/pom.xml @@ -90,6 +90,53 @@ </executions> </plugin> <plugin> + <artifactId>maven-resources-plugin</artifactId> + <executions> + <execution> + <id>copy-fmpp-resources</id> + <phase>initialize</phase> + <goals> + <goal>copy-resources</goal> + </goals> + <configuration> + <outputDirectory>${project.build.directory}/codegen</outputDirectory> + <resources> + <resource> + <directory>src/main/codegen</directory> + <filtering>false</filtering> + </resource> + </resources> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>com.googlecode.fmpp-maven-plugin</groupId> + <artifactId>fmpp-maven-plugin</artifactId> + <version>1.0</version> + <dependencies> + <dependency> + <groupId>org.freemarker</groupId> + <artifactId>freemarker</artifactId> + <version>2.3.19</version> + </dependency> + </dependencies> + <executions> + <execution> + <id>generate-fmpp-sources</id> + <phase>generate-sources</phase> + <goals> + <goal>generate</goal> + </goals> + <configuration> + <cfgFile>${project.build.directory}/codegen/config.fmpp</cfgFile> + <outputDirectory>target/generated-sources</outputDirectory> + <templateDirectory>${project.build.directory}/codegen/templates</templateDirectory> + </configuration> + </execution> + </executions> + </plugin> + <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>build-helper-maven-plugin</artifactId> <executions> @@ -108,6 +155,29 @@ </execution> </executions> </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>javacc-maven-plugin</artifactId> + <version>2.4</version> + <executions> + <execution> + <phase>generate-sources</phase> + <id>javacc</id> + <goals> + <goal>javacc</goal> + </goals> + <configuration> + <sourceDirectory>${project.build.directory}/generated-sources/</sourceDirectory> + <includes> + <include>**/Parser.jj</include> + </includes> + <lookAhead>2</lookAhead> + <isStatic>false</isStatic> + <outputDirectory>${project.build.directory}/generated-sources/</outputDirectory> + </configuration> + </execution> + </executions> + </plugin> <!-- Compile the antlr sources --> <plugin> <groupId>org.antlr</groupId> @@ -209,6 +279,27 @@ <artifactId>maven-dependency-plugin</artifactId> <executions> <execution> + <!-- Extract parser grammar template from optiq-core.jar and put + it under ${project.build.directory} where all freemarker templates are. --> + <id>unpack-parser-template</id> + <phase>initialize</phase> + <goals> + <goal>unpack</goal> + </goals> + <configuration> + <artifactItems> + <artifactItem> + <groupId>org.apache.calcite</groupId> + <artifactId>calcite-core</artifactId> + <type>jar</type> + <overWrite>true</overWrite> + <outputDirectory>${project.build.directory}/</outputDirectory> + <includes>**/Parser.jj</includes> + </artifactItem> + </artifactItems> + </configuration> + </execution> + <execution> <!-- generates the file that will be used by the sandbox script in the dev env --> <id>create-phoenix-generated-classpath</id> <goals> http://git-wip-us.apache.org/repos/asf/phoenix/blob/65ec1bf1/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java b/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java index b96c2a2..8e01241 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/calcite/CalciteTest.java @@ -1,3 +1,20 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.apache.phoenix.calcite; import com.google.common.collect.Lists; @@ -10,6 +27,7 @@ import org.apache.phoenix.end2end.BaseClientManagedTimeIT; import org.apache.phoenix.schema.TableAlreadyExistsException; import org.apache.phoenix.util.PropertiesUtil; import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; import java.io.File; @@ -120,6 +138,18 @@ public class CalciteTest extends BaseClientManagedTimeIT { return this; } + + public boolean execute() { + try { + final Statement statement = start.getConnection().createStatement(); + final boolean execute = statement.execute(sql); + statement.close(); + return execute; + } catch (SQLException e) { + throw new RuntimeException(e); + } + } + public List<Object[]> getResult(String sql) { try { final Statement statement = start.getConnection().createStatement(); @@ -423,25 +453,29 @@ public class CalciteTest extends BaseClientManagedTimeIT { {"invalid001", "INVALID-1", null, null}}) .close(); - start().sql("select t1.entity_id, t2.a_string, t1.organization_id from aTable t1 join aTable t2 on t1.organization_id = t2.organization_id and t1.entity_id = t2.entity_id") + start().sql("select t1.entity_id, t2.a_string, t1.organization_id from aTable t1 join aTable t2 on t1.organization_id = t2.organization_id and t1.entity_id = t2.entity_id") .explainIs("PhoenixToEnumerableConverter\n" + - " PhoenixClientProject(ENTITY_ID=[$1], A_STRING=[$4], ORGANIZATION_ID=[$0])\n" + - " PhoenixClientJoin(condition=[AND(=($0, $2), =($1, $3))], joinType=[inner])\n" + - " PhoenixToClientConverter\n" + - " PhoenixServerProject(ORGANIZATION_ID=[$0], ENTITY_ID=[$1])\n" + - " PhoenixTableScan(table=[[phoenix, ATABLE]])\n" + - " PhoenixToClientConverter\n" + - " PhoenixServerProject(ORGANIZATION_ID=[$0], ENTITY_ID=[$1], A_STRING=[$2])\n" + - " PhoenixTableScan(table=[[phoenix, ATABLE]])\n") + " PhoenixClientProject(ENTITY_ID=[$1], A_STRING=[$4], ORGANIZATION_ID=[$0])\n" + + + " PhoenixClientJoin(condition=[AND(=($0, $2), =($1, $3))], joinType=[inner])\n" + + + " PhoenixToClientConverter\n" + + " PhoenixServerProject(ORGANIZATION_ID=[$0], ENTITY_ID=[$1])\n" + + + " PhoenixTableScan(table=[[phoenix, ATABLE]])\n" + + " PhoenixToClientConverter\n" + + " PhoenixServerProject(ORGANIZATION_ID=[$0], ENTITY_ID=[$1], A_STRING=[$2])\n" + + + " PhoenixTableScan(table=[[phoenix, ATABLE]])\n") .resultIs(new Object[][] { - {"00A123122312312", "a", "00D300000000XHP"}, - {"00A223122312312", "a", "00D300000000XHP"}, - {"00A323122312312", "a", "00D300000000XHP"}, - {"00A423122312312", "a", "00D300000000XHP"}, - {"00B523122312312", "b", "00D300000000XHP"}, - {"00B623122312312", "b", "00D300000000XHP"}, - {"00B723122312312", "b", "00D300000000XHP"}, - {"00B823122312312", "b", "00D300000000XHP"}, + {"00A123122312312", "a", "00D300000000XHP"}, + {"00A223122312312", "a", "00D300000000XHP"}, + {"00A323122312312", "a", "00D300000000XHP"}, + {"00A423122312312", "a", "00D300000000XHP"}, + {"00B523122312312", "b", "00D300000000XHP"}, + {"00B623122312312", "b", "00D300000000XHP"}, + {"00B723122312312", "b", "00D300000000XHP"}, + {"00B823122312312", "b", "00D300000000XHP"}, {"00C923122312312", "c", "00D300000000XHP"}}) .close(); } @@ -494,26 +528,30 @@ public class CalciteTest extends BaseClientManagedTimeIT { {"00A423122312312", "a", "00D300000000XHP"}}) .close(); - start().sql("select t1.entity_id, t2.a_string, t3.organization_id from aTable t1 join aTable t2 on t1.entity_id = t2.entity_id and t1.organization_id = t2.organization_id join atable t3 on t1.entity_id = t3.entity_id and t1.organization_id = t3.organization_id") + start().sql("select t1.entity_id, t2.a_string, t3.organization_id from aTable t1 join aTable t2 on t1.entity_id = t2.entity_id and t1.organization_id = t2.organization_id join atable t3 on t1.entity_id = t3.entity_id and t1.organization_id = t3.organization_id") .explainIs("PhoenixToEnumerableConverter\n" + - " PhoenixClientProject(ENTITY_ID=[$19], A_STRING=[$2], ORGANIZATION_ID=[$36])\n" + - " PhoenixToClientConverter\n" + - " PhoenixServerJoin(condition=[AND(=($19, $1), =($18, $0))], joinType=[inner])\n" + - " PhoenixTableScan(table=[[phoenix, ATABLE]])\n" + - " PhoenixToClientConverter\n" + - " PhoenixServerJoin(condition=[AND(=($1, $19), =($0, $18))], joinType=[inner])\n" + - " PhoenixTableScan(table=[[phoenix, ATABLE]])\n" + - " PhoenixToClientConverter\n" + - " PhoenixTableScan(table=[[phoenix, ATABLE]])\n") + " PhoenixClientProject(ENTITY_ID=[$19], A_STRING=[$2], ORGANIZATION_ID=[$36])\n" + + + " PhoenixToClientConverter\n" + + " PhoenixServerJoin(condition=[AND(=($19, $1), =($18, $0))], joinType=[inner])\n" + + + " PhoenixTableScan(table=[[phoenix, ATABLE]])\n" + + " PhoenixToClientConverter\n" + + " PhoenixServerJoin(condition=[AND(=($1, $19), =($0, $18))], joinType=[inner])\n" + + + " PhoenixTableScan(table=[[phoenix, ATABLE]])\n" + + + " PhoenixToClientConverter\n" + + " PhoenixTableScan(table=[[phoenix, ATABLE]])\n") .resultIs(new Object[][] { - {"00A123122312312", "a", "00D300000000XHP"}, - {"00A223122312312", "a", "00D300000000XHP"}, - {"00A323122312312", "a", "00D300000000XHP"}, - {"00A423122312312", "a", "00D300000000XHP"}, - {"00B523122312312", "b", "00D300000000XHP"}, - {"00B623122312312", "b", "00D300000000XHP"}, - {"00B723122312312", "b", "00D300000000XHP"}, - {"00B823122312312", "b", "00D300000000XHP"}, + {"00A123122312312", "a", "00D300000000XHP"}, + {"00A223122312312", "a", "00D300000000XHP"}, + {"00A323122312312", "a", "00D300000000XHP"}, + {"00A423122312312", "a", "00D300000000XHP"}, + {"00B523122312312", "b", "00D300000000XHP"}, + {"00B623122312312", "b", "00D300000000XHP"}, + {"00B723122312312", "b", "00D300000000XHP"}, + {"00B823122312312", "b", "00D300000000XHP"}, {"00C923122312312", "c", "00D300000000XHP"}}) .close(); } @@ -816,7 +854,7 @@ public class CalciteTest extends BaseClientManagedTimeIT { {"000000000000005", 5000}}) .close(); } - + @Test public void testScalarSubquery() { start().sql("select \"item_id\", name, (select max(quantity) sq \n" + "from " + JOIN_ORDER_TABLE_FULL_NAME + " o where o.\"item_id\" = i.\"item_id\")\n" @@ -833,12 +871,12 @@ public class CalciteTest extends BaseClientManagedTimeIT { " PhoenixServerProject(item_id=[$0])\n" + " PhoenixTableScan(table=[[phoenix, Join, ItemTable]])\n") .resultIs(new Object[][] { - new Object[] {"0000000001", "T1", 1000}, - new Object[] {"0000000002", "T2", 3000}, - new Object[] {"0000000003", "T3", 5000}, - new Object[] {"0000000004", "T4", null}, - new Object[] {"0000000005", "T5", null}, - new Object[] {"0000000006", "T6", 4000}, + new Object[] {"0000000001", "T1", 1000}, + new Object[] {"0000000002", "T2", 3000}, + new Object[] {"0000000003", "T3", 5000}, + new Object[] {"0000000004", "T4", null}, + new Object[] {"0000000005", "T5", null}, + new Object[] {"0000000006", "T6", 4000}, new Object[] {"invalid001", "INVALID-1", null}}) .close(); @@ -857,10 +895,10 @@ public class CalciteTest extends BaseClientManagedTimeIT { " PhoenixServerAggregate(group=[{0}])\n" + " PhoenixTableScan(table=[[phoenix, Join, ItemTable]], filter=[<($0, '0000000006')])\n") .resultIs(new Object[][] { - new Object[] {"0000000001", "T1", 1000}, - new Object[] {"0000000002", "T2", 3000}, - new Object[] {"0000000003", "T3", 5000}, - new Object[] {"0000000004", "T4", null}, + new Object[] {"0000000001", "T1", 1000}, + new Object[] {"0000000002", "T2", 3000}, + new Object[] {"0000000003", "T3", 5000}, + new Object[] {"0000000004", "T4", null}, new Object[] {"0000000005", "T5", null}}) .close();; } @@ -961,10 +999,16 @@ public class CalciteTest extends BaseClientManagedTimeIT { .resultIs(new Object[][] { {"00C923122312312", "c"}, {"00A423122312312", "a"}, - {"00A323122312312", "a"}}) + {"00A323122312312", "a"}}) .close(); } - + + /** Tests a simple command that is defined in Phoenix's extended SQL parser. */ + @Ignore + @Test public void testCommit() { + start().sql("commit").execute(); + } + @Test public void testConnectJoinHsqldb() { final Start start = new Start(new Properties(), false) { @Override http://git-wip-us.apache.org/repos/asf/phoenix/blob/65ec1bf1/phoenix-core/src/main/codegen/config.fmpp ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/codegen/config.fmpp b/phoenix-core/src/main/codegen/config.fmpp new file mode 100644 index 0000000..283a824 --- /dev/null +++ b/phoenix-core/src/main/codegen/config.fmpp @@ -0,0 +1,22 @@ +# 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. + +data: { + parser: tdd(../data/Parser.tdd) +} +freemarkerLinks: { + includes: includes/ +} http://git-wip-us.apache.org/repos/asf/phoenix/blob/65ec1bf1/phoenix-core/src/main/codegen/data/Parser.tdd ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/codegen/data/Parser.tdd b/phoenix-core/src/main/codegen/data/Parser.tdd new file mode 100644 index 0000000..90d592f --- /dev/null +++ b/phoenix-core/src/main/codegen/data/Parser.tdd @@ -0,0 +1,58 @@ +# 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. + +{ + # Generated parser implementation class package and name + package: "org.apache.phoenix.calcite.parser", + class: "PhoenixParserImpl", + + # List of import statements. + imports: [ + "org.apache.phoenix.calcite.parse.*", + "java.util.*" + ] + + # List of keywords. + keywords: [ + ] + + # List of methods for parsing custom SQL statements. + statementParserMethods: [ + "SqlCommit()" + ] + + # List of methods for parsing custom literals. + # Example: ParseJsonLiteral(). + literalParserMethods: [ + ] + + # List of methods for parsing custom data types. + dataTypeParserMethods: [ + ] + + # List of files in @includes directory that have parser method + # implementations for custom SQL statements, literals or types + # given as part of "statementParserMethods", "literalParserMethods" or + # "dataTypeParserMethods". + implementationFiles: [ + "parserImpls.ftl" + ] + + includeCompoundIdentifier: true + includeBraces: true + includeAdditionalDeclarations: false + +} http://git-wip-us.apache.org/repos/asf/phoenix/blob/65ec1bf1/phoenix-core/src/main/codegen/includes/license.ftl ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/codegen/includes/license.ftl b/phoenix-core/src/main/codegen/includes/license.ftl new file mode 100644 index 0000000..0455fd8 --- /dev/null +++ b/phoenix-core/src/main/codegen/includes/license.ftl @@ -0,0 +1,18 @@ +/******************************************************************************* + + * 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. + ******************************************************************************/ \ No newline at end of file http://git-wip-us.apache.org/repos/asf/phoenix/blob/65ec1bf1/phoenix-core/src/main/codegen/includes/parserImpls.ftl ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/codegen/includes/parserImpls.ftl b/phoenix-core/src/main/codegen/includes/parserImpls.ftl new file mode 100644 index 0000000..42aa48c --- /dev/null +++ b/phoenix-core/src/main/codegen/includes/parserImpls.ftl @@ -0,0 +1,36 @@ +<#-- +// 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. +--> + +<#-- + Add implementations of additional parser statements here. + Each implementation should return an object of SqlNode type. +--> + +/** + * Parses statement + * COMMIT + */ +SqlNode SqlCommit() : +{ + SqlParserPos pos; +} +{ + <COMMIT> { pos = getPos(); } + { + return new SqlCommit(pos); + } +} http://git-wip-us.apache.org/repos/asf/phoenix/blob/65ec1bf1/phoenix-core/src/main/java/org/apache/phoenix/calcite/jdbc/PhoenixPrepareImpl.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/calcite/jdbc/PhoenixPrepareImpl.java b/phoenix-core/src/main/java/org/apache/phoenix/calcite/jdbc/PhoenixPrepareImpl.java index 0c3ced9..22d5d04 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/calcite/jdbc/PhoenixPrepareImpl.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/calcite/jdbc/PhoenixPrepareImpl.java @@ -7,7 +7,9 @@ import org.apache.calcite.plan.RelOptPlanner; import org.apache.calcite.plan.RelOptRule; import org.apache.calcite.prepare.CalcitePrepareImpl; import org.apache.calcite.rel.rules.JoinCommuteRule; +import org.apache.calcite.sql.parser.SqlParser; import org.apache.phoenix.calcite.PhoenixSchema; +import org.apache.phoenix.calcite.parser.PhoenixParserImpl; import org.apache.phoenix.calcite.rules.PhoenixAddScanLimitRule; import org.apache.phoenix.calcite.rules.PhoenixCompactClientSortRule; import org.apache.phoenix.calcite.rules.PhoenixFilterScanMergeRule; @@ -23,6 +25,12 @@ public class PhoenixPrepareImpl extends CalcitePrepareImpl { } @Override + protected SqlParser.ConfigBuilder createParserConfig() { + return super.createParserConfig() + .setParserFactory(PhoenixParserImpl.FACTORY); + } + + @Override protected RelOptPlanner createPlanner( final CalcitePrepare.Context prepareContext, org.apache.calcite.plan.Context externalContext, http://git-wip-us.apache.org/repos/asf/phoenix/blob/65ec1bf1/phoenix-core/src/main/java/org/apache/phoenix/calcite/parse/SqlCommit.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/calcite/parse/SqlCommit.java b/phoenix-core/src/main/java/org/apache/phoenix/calcite/parse/SqlCommit.java new file mode 100644 index 0000000..a7d206e --- /dev/null +++ b/phoenix-core/src/main/java/org/apache/phoenix/calcite/parse/SqlCommit.java @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.phoenix.calcite.parse; + +import com.google.common.collect.ImmutableList; + +import org.apache.calcite.sql.SqlCall; +import org.apache.calcite.sql.SqlNode; +import org.apache.calcite.sql.SqlOperator; +import org.apache.calcite.sql.parser.SqlParserPos; + +import java.util.List; + +/** + * Parse tree node for SQL {@code COMMIT} command. + */ +public class SqlCommit extends SqlCall { + public SqlCommit(SqlParserPos pos) { + super(pos); + } + + public SqlOperator getOperator() { + throw new UnsupportedOperationException(); + } + + public List<SqlNode> getOperandList() { + return ImmutableList.of(); + } +}
