vldpyatkov commented on code in PR #13366: URL: https://github.com/apache/ignite/pull/13366#discussion_r3758660314
########## modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/sql/SqlSelectForUpdateParserTest.java: ########## @@ -0,0 +1,206 @@ +/* + * 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.ignite.internal.processors.query.calcite.sql; + +import org.apache.calcite.sql.SqlExplain; +import org.apache.calcite.sql.SqlIdentifier; +import org.apache.calcite.sql.SqlNode; +import org.apache.calcite.sql.SqlNodeList; +import org.apache.calcite.sql.SqlSelect; +import org.apache.calcite.sql.parser.SqlParseException; +import org.apache.calcite.sql.parser.SqlParser; +import org.apache.ignite.internal.processors.query.calcite.sql.generated.IgniteSqlParserImpl; +import org.apache.ignite.testframework.GridTestUtils; +import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; +import org.junit.Test; + +import static org.hamcrest.CoreMatchers.instanceOf; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.nullValue; +import static org.hamcrest.MatcherAssert.assertThat; + +/** Tests for parsing {@code SELECT ... FOR UPDATE} syntax. */ +public class SqlSelectForUpdateParserTest extends GridCommonAbstractTest { + /** Regular SELECT is returned as-is (no wrapping). */ + @Test + public void regularSelectIsNotWrapped() throws SqlParseException { + SqlNode node = parse("SELECT name FROM Person"); + + assertThat(node, instanceOf(SqlSelect.class)); + } + + /** Minimal FOR UPDATE with no options. */ + @Test + public void forUpdateNoOptions() throws SqlParseException { + SqlNode node = parse("SELECT name FROM Person FOR UPDATE"); Review Comment: We cannot move it to the parserImpls.ftl, because there we have only SqlNode it could be SqlSelect UNION VALUES e.t.c. If we try to move it there, we ought to switch between several types of SqlNode's. The code looks like a semantics check rather than parsing. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
