github-actions[bot] commented on code in PR #69277:
URL: https://github.com/apache/doris/pull/69277#discussion_r4312669354
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java:
##########
@@ -9583,6 +9583,28 @@ public LogicalPlan
visitWarmUpSelect(DorisParser.WarmUpSelectContext ctx) {
}
LogicalProject project = new LogicalProject(projectList, filter);
+ Map<String, String> properties = visitPropertyClause(ctx.properties);
+ for (String key : properties.keySet()) {
+ if (!"read_index_only".equals(key)) {
+ throw new AnalysisException("Unknown WARM UP SELECT property:
" + key);
+ }
+ }
+ String indexOnly = properties.getOrDefault("read_index_only", "false");
+ if (!"true".equalsIgnoreCase(indexOnly) &&
!"false".equalsIgnoreCase(indexOnly)) {
+ throw new AnalysisException("read_index_only must be true or
false");
+ }
+ if (Boolean.parseBoolean(indexOnly)) {
+ if (ctx.whereClause() != null || ctx.explain() != null) {
+ throw new AnalysisException("Index-only WARM UP SELECT does
not support WHERE or EXPLAIN");
+ }
+ // Index cache fills must not execute the data scan or require the
data-file cache.
+ List<String> columns = indexWarmupColumns(ctx, projectList);
+ UnboundBlackholeSink<?> sink = new UnboundBlackholeSink<>(project,
+ new UnboundBlackholeSinkContext(true));
+ return new WarmupSelectCommand(sink,
+ new
TableNameInfo(visitMultipartIdentifier(ctx.warmUpSingleTableRef().multipartIdentifier())),
Review Comment:
[P2] Preserve table spelling until the catalog applies its case policy
With global `lower_case_table_names=1`, create a Lance catalog `lake` with
its supported `lower_case_table_names=0` override and a table named `Items`.
`WARM UP SELECT * FROM lake.db.Items PROPERTIES (read_index_only=true)`
constructs this `TableNameInfo`, whose list constructor immediately lowercases
the table using the global setting. The later lookup honors the catalog's
case-sensitive policy but receives `items`, so warmup fails if only `Items`
exists, or silently warms the different `items` table if both exist. Ordinary
SELECT and data warmup retain the original `UnboundRelation` spelling and apply
the catalog policy. Preserve the original identifier until the selected catalog
resolves it, rather than applying the global case setting here.
##########
fe/fe-core/src/main/java/org/apache/doris/datasource/lance/LanceIndexPrewarm.java:
##########
@@ -0,0 +1,274 @@
+// 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.doris.datasource.lance;
+
+import org.apache.doris.analysis.ResourceTypeEnum;
+import org.apache.doris.analysis.TableName;
+import org.apache.doris.catalog.Column;
+import org.apache.doris.catalog.Env;
+import org.apache.doris.catalog.ScalarType;
+import org.apache.doris.catalog.TableIf;
+import org.apache.doris.common.AnalysisException;
+import org.apache.doris.common.Config;
+import org.apache.doris.common.UserException;
+import org.apache.doris.datasource.CatalogIf;
+import org.apache.doris.datasource.lance.index.LanceIndexInspectionExecutor;
+import org.apache.doris.datasource.lance.index.LanceIndexSegmentGroup;
+import org.apache.doris.datasource.lance.metadata.LanceTableMetadata;
+import org.apache.doris.info.TableNameInfo;
+import org.apache.doris.mysql.privilege.PrivPredicate;
+import org.apache.doris.proto.InternalService.PLanceIndexPrewarmRequest;
+import org.apache.doris.proto.InternalService.PLanceIndexPrewarmResponse;
+import org.apache.doris.qe.ConnectContext;
+import org.apache.doris.qe.ShowResultSet;
+import org.apache.doris.qe.ShowResultSetMetaData;
+import org.apache.doris.qe.StmtExecutor;
+import org.apache.doris.resource.computegroup.ComputeGroup;
+import org.apache.doris.rpc.BackendServiceProxy;
+import org.apache.doris.system.Backend;
+import org.apache.doris.system.BeSelectionPolicy;
+import org.apache.doris.thrift.TNetworkAddress;
+import org.apache.doris.thrift.TStatusCode;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.OptionalInt;
+import java.util.Set;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import java.util.function.BooleanSupplier;
+
+/** Pins table access and coordinates bounded synchronous prewarm RPCs. */
+public final class LanceIndexPrewarm {
+ static final int MAX_IN_FLIGHT = 8;
+ private static final ShowResultSetMetaData RESULT_META =
ShowResultSetMetaData.builder()
+ .addColumn(new Column("Table", ScalarType.createStringType()))
+ .addColumn(new Column("Index", ScalarType.createStringType()))
+ .addColumn(new Column("DatasetVersion", ScalarType.BIGINT))
+ .addColumn(new Column("BackendCount", ScalarType.INT))
+ .addColumn(new Column("ElapsedMs", ScalarType.BIGINT)).build();
+
+ private LanceIndexPrewarm() {
+ }
+
+ public static ShowResultSetMetaData getResultSetMetaData() {
+ return RESULT_META;
+ }
+
+ public static void run(ConnectContext ctx, StmtExecutor executor,
TableNameInfo tableName,
+ List<String> columns, BooleanSupplier cancelled) throws Exception {
+ long started = System.nanoTime();
+ long elapsedMs = ctx.getStartTime() > 0 ? Math.max(0,
System.currentTimeMillis() - ctx.getStartTime()) : 0;
+ long remainingMs = TimeUnit.SECONDS.toMillis(ctx.getQueryTimeoutS()) -
elapsedMs;
+ long deadline = started + TimeUnit.MILLISECONDS.toNanos(Math.max(0,
remainingMs));
+ tableName.analyze(ctx);
Review Comment:
[P2] Validate projection qualifiers against the execution-time table
With current database `A` and indexed `items` tables in `A` and `B`, send
one multi-statement request: `USE B; WARM UP SELECT A.items.embedding FROM
items PROPERTIES (read_index_only=true)`. `ConnectProcessor` parses the entire
request before executing `USE`, so `indexWarmupColumns` accepts the `A.items`
qualifier against database A and then retains only `embedding`. This later
`analyze(ctx)` resolves `FROM items` against B, so the command succeeds and
warms B despite the explicit A-qualified projection. Conversely, the valid
B-qualified form is rejected during parsing. Resolve the table and validate its
projection qualifiers together at execution, preserving the qualifier
constraint until then. This differs from the existing direct-qualification
thread: it requires session context to change between parsing and execution,
including PREPARE/EXECUTE.
--
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]