vldpyatkov commented on code in PR #13366: URL: https://github.com/apache/ignite/pull/13366#discussion_r3734230469
########## modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/sql/IgniteSqlSelectForUpdate.java: ########## @@ -0,0 +1,131 @@ +/* + * 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 java.util.List; +import org.apache.calcite.sql.SqlCall; +import org.apache.calcite.sql.SqlKind; +import org.apache.calcite.sql.SqlNode; +import org.apache.calcite.sql.SqlNodeList; +import org.apache.calcite.sql.SqlOperator; +import org.apache.calcite.sql.SqlSpecialOperator; +import org.apache.calcite.sql.SqlWriter; +import org.apache.calcite.sql.parser.SqlParserPos; +import org.apache.calcite.util.ImmutableNullableList; +import org.jetbrains.annotations.Nullable; + +/** + * Parse tree for {@code SELECT ... FOR UPDATE [OF col [, col ...]] [WAIT n | NOWAIT]} statement. + * + * <p>The {@code FOR UPDATE} clause requests pessimistic row-level locks on rows returned by the query. + * When {@code OF} is specified, only tables owning the listed columns are locked. + * + * <p>Fields: + * <ul> + * <li>{@code query} — the underlying SELECT/WITH/VALUES query</li> + * <li>{@code ofList} — optional list of column references identifying which tables to lock; + * {@code null} means all tables referenced in FROM</li> + * <li>{@code waitSeconds} — {@code null} = use transaction timeout, + * {@code 0} = NOWAIT, positive = WAIT n seconds</li> + * </ul> + */ +public class IgniteSqlSelectForUpdate extends SqlCall { + /** */ + private static final SqlOperator OPERATOR = + new SqlSpecialOperator("SELECT FOR UPDATE", SqlKind.OTHER); + + /** The wrapped SELECT / WITH / VALUES query. */ + private final SqlNode query; + + /** + * Columns from the {@code OF} list, or {@code null} when not specified (lock all tables). + * Each element is a {@link org.apache.calcite.sql.SqlIdentifier} referencing a table column. + */ + @Nullable private final SqlNodeList ofList; Review Comment: They are not a lock column for 2 reasons: - We are locking the entire row, not a specific column. - These columns are written down after the "OF" keyword (SELECT ... FOR UPDATE OF col1, col2...;) -- 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]
