zyp-V commented on code in PR #67582:
URL: https://github.com/apache/doris/pull/67582#discussion_r3953824036
##########
fe/fe-core/src/main/java/org/apache/doris/planner/OlapScanNode.java:
##########
@@ -1198,6 +1199,95 @@ static void validateRequiredQuerySelection(boolean
skipMissingVersion, int useFi
}
}
+ /** Immutable routing result for one expanded multi-key lookup tuple. */
+ public static final class PointQueryRoute {
+ private final long tabletId;
+ private final List<Long> candidateBackendIds;
+ private final boolean backendOrderBySelection;
+
+ private PointQueryRoute(long tabletId, List<Long> candidateBackendIds,
+ boolean backendOrderBySelection) {
+ this.tabletId = tabletId;
+ this.candidateBackendIds = candidateBackendIds;
+ this.backendOrderBySelection = backendOrderBySelection;
+ }
+
+ public long getTabletId() {
+ return tabletId;
+ }
+
+ public List<Long> getCandidateBackendIds() {
+ return candidateBackendIds;
+ }
+
+ public boolean isBackendOrderBySelection() {
+ return backendOrderBySelection;
+ }
+ }
+
+ /**
+ * Resolve one complete primary-key tuple for the multi-key point-query
coordinator. Routing is
+ * serial because the reusable scan node owns mutable pruning state. The
original predicates are
+ * restored before returning; only the copied route escapes this method.
+ *
+ * @return null when the tuple does not map to an existing non-empty
partition or selected bucket
+ */
+ public PointQueryRoute routePointQueryKeyTuple(List<LiteralExpr>
keyValues) throws UserException {
+ List<Column> keyColumns = olapTable.getBaseSchemaKeyColumns();
+ Preconditions.checkState(keyValues.size() == keyColumns.size(),
+ "Point-query key tuple has %s values but table requires %s",
+ keyValues.size(), keyColumns.size());
+
+ List<Expr> originalConjuncts = conjuncts;
+ List<Expr> routingConjuncts = new ArrayList<>(keyColumns.size());
+ for (int i = 0; i < keyColumns.size(); ++i) {
+ LiteralExpr value = keyValues.get(i);
+ Preconditions.checkState(value != null && !(value instanceof
NullLiteral),
+ "Multi-key point query cannot route a NULL key value");
+ SlotRef slot = Preconditions.checkNotNull(
+ findPointQueryKeySlot(originalConjuncts,
keyColumns.get(i).getName()),
+ "Missing point-query predicate for key column %s",
keyColumns.get(i).getName());
+ routingConjuncts.add(new
BinaryPredicate(BinaryPredicate.Operator.EQ, slot, value));
+ }
+
+ try {
+ conjuncts = routingConjuncts;
+ // Unlike the ordinary point-query path, multi-get evaluates this
mutable scan node
+ // repeatedly with different key tuples.
+ columnFilters.clear();
+ columnNameToRange.clear();
+ totalTabletsNum = 0;
+ selectedSplitNum = 0;
+ totalBytes = 0;
+ tabletBytes.clear();
+ lazyEvaluateRangeLocations();
Review Comment:
multi get 点查路径拦截 tablesample , 回退到原来的执行路径
--
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]