weizhengte commented on code in PR #10170:
URL: https://github.com/apache/doris/pull/10170#discussion_r991830292


##########
fe/fe-core/src/main/java/org/apache/doris/planner/OlapScanNode.java:
##########
@@ -756,6 +764,82 @@ private void getScanRangeLocations() throws UserException {
         LOG.debug("distribution prune cost: {} ms", 
(System.currentTimeMillis() - start));
     }
 
+    /**
+     * First, determine how many rows to sample from each partition according 
to the number of partitions.
+     * Then determine the number of Tablets to be selected for each partition 
according to the average number
+     * of rows of Tablet,
+     * If seek is not specified, the specified number of Tablets are 
pseudo-randomly selected from each partition.
+     * If seek is specified, it will be selected sequentially from the seek 
tablet of the partition.
+     * And add the manually specified Tablet id to the selected Tablet.
+     * simpleTabletNums = simpleRows / partitionNums / (partitionRows / 
partitionTabletNums)
+     */
+    public void computeSampleTabletIds() throws UserException {
+        if (desc.getTable().getType() != TableIf.TableType.OLAP) {
+            throw new AnalysisException("Sample table type " + 
desc.getTable().getType() + " is not OLAP");

Review Comment:
   It would be better to check the table type when analyzing the statement.
   
   Also, if `computeSampleTabletIds()` throws an exception here, will it affect 
normal queries? For example, for normal queries, when querying non-OLAP tables, 
will `init()` have exceptions? I think it would be better for non-sampling 
queries or non-OLAP tables to return directly, or to judge whether it is a 
sampling query first.
   
   



-- 
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: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to