Jackie-Jiang commented on code in PR #20169: URL: https://github.com/apache/pinot/pull/20169#discussion_r4498323074
########## pinot-common/src/main/java/org/apache/pinot/common/function/CrossTableFunction.java: ########## @@ -0,0 +1,73 @@ +/** + * 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.pinot.common.function; + +import javax.annotation.Nullable; +import org.apache.commons.lang3.StringUtils; + + +/// The SQL functions that read rows from somewhere other than the FROM clause of the query that calls them, which the +/// access checks keyed on that FROM clause do not cover: table-level authorization, row-level security and the DELETE +/// predicate rules each decide how to treat every one of them. +/// +/// Nothing derives this list from the function registries, so a function that reads another table or runs a nested +/// query must be added here when it is defined. The single-stage broker then rejects it for a principal with row +/// filters on the queried table, and DELETE rejects it in its WHERE clause, with no further decision. +/// +/// [#matches(String)] is the one spelling check every caller shares: underscores dropped and case folded per +/// character, as [String#equalsIgnoreCase(String)] does, so that the broker's checks and the server's resolver agree on +/// every spelling, including a look-alike such as a dotless `ı` (U+0131) for the `i`, which a `toLowerCase()` +/// comparison leaves apart, and a name lower-cased under a Turkish locale. +public enum CrossTableFunction { Review Comment: Could we simplify this to a utility method `boolean isCrossTableFunction(String functionName)` in `RequestUtils`, alongside its existing function-name canonicalization helpers, backed by a set of canonical names (`lookup`, `insubquery`, `inpartitionedsubquery`)? Document that the input must already be canonical and use `Set.contains()` directly. The broker and DELETE checks only need membership, so the enum and per-function `matches()` API aren't necessary. The broker can retain a boolean collected before subquery rewriting and use a generic rejection message. Existing normalization inconsistencies can be handled separately. -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
