morningman commented on code in PR #69867:
URL: https://github.com/apache/doris/pull/69867#discussion_r4420287876


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/insert/WarmupSelectCommand.java:
##########
@@ -216,6 +216,12 @@ public void sendAggregatedBlackholeResults(Map<Long, 
TQueryStatisticsResult> sta
         executor.sendResultSet(resultSet);
     }
 
+    @Override
+    public ShowResultSetMetaData getResultSetMetaData() {
+        // Unlike ordinary INSERT, warmup returns per-backend statistics 
rather than OK.
+        return metaData;

Review Comment:
   Fixed in `7c7393c8c18`. Confirmed, and the case is wider than `WHERE FALSE`. 
Planning replaces the source with an empty relation whenever it proves the 
source empty: a predicate that folds to false, partition pruning that leaves no 
partition, or selected partitions without data (`PruneEmptyPartition`). Warming 
up a table that has no data yet is enough. The sink is then 
`BlackholeSink(EmptyRelation)` and `requiresTransaction()` is false. 
`InsertIntoTableCommand.runInternal` returns before the statistics listener is 
registered, and Flight answers its synthesized `StatusResult`. So the result 
header of WARM UP SELECT depends on what planning finds, which is the kind of 
statement this PR already keeps on the placeholder. WARM UP SELECT now joins 
that list in `FlightSqlQuerySchema.commandMetadata`: Prepare advertises the 
placeholder, its executions are not compared, and GetSchema answers 
UNIMPLEMENTED, as on master before this PR. The `getResultSetMetaData()` 
override is removed, so My
 SQL `COM_STMT_PREPARE` describes the statement as it does on master. Another 
fix would have been to make the command answer its statistics, with an all-zero 
TOTAL row, on the empty path as well. That changes what MySQL clients get for 
an empty warmup, so it is not part of this PR. `DorisFlightSqlSchemaTest` now 
lists WARM UP SELECT among the placeholder statements. 
`warmupSelectRunsUncheckedWhateverItsSourceHolds` runs one prepared warmup 
whose execution answers OK and one that answers statistics; both checks fail if 
WARM UP SELECT gets an advertised header again. `test_schema_only` prepares a 
WARM UP SELECT on an empty table and, in cloud mode (the only mode that warms 
up internal tables), runs it.
   



-- 
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]

Reply via email to