eldenmoon commented on code in PR #15491:
URL: https://github.com/apache/doris/pull/15491#discussion_r1071705397


##########
fe/fe-core/src/main/java/org/apache/doris/qe/PointQueryExec.java:
##########
@@ -0,0 +1,221 @@
+// 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.qe;
+
+import org.apache.doris.analysis.DescriptorTable;
+import org.apache.doris.analysis.Expr;
+import org.apache.doris.analysis.LiteralExpr;
+import org.apache.doris.analysis.SlotRef;
+import org.apache.doris.common.Status;
+import org.apache.doris.proto.InternalService;
+import org.apache.doris.proto.InternalService.KeyTuple;
+import org.apache.doris.rpc.BackendServiceProxy;
+import org.apache.doris.rpc.RpcException;
+import org.apache.doris.thrift.TExpr;
+import org.apache.doris.thrift.TExprList;
+import org.apache.doris.thrift.TNetworkAddress;
+import org.apache.doris.thrift.TResultBatch;
+import org.apache.doris.thrift.TStatusCode;
+
+import com.google.protobuf.ByteString;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.apache.thrift.TDeserializer;
+import org.apache.thrift.TException;
+import org.apache.thrift.TSerializer;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
+public class PointQueryExec {
+    private static final Logger LOG = 
LogManager.getLogger(PointQueryExec.class);
+    private TNetworkAddress address;
+    // SlotRef sorted by column id
+    private Map<SlotRef, Expr> equalPredicats;
+    // ByteString serialized for prepared statement
+    private ByteString serializedDescTable;
+    private ByteString serializedOutputExpr;
+    private ArrayList<Expr> outputExprs;
+    private DescriptorTable descriptorTable;
+    private long tabletID = 0;
+    private long timeoutMs = 1000; // default 1s
+
+    private boolean isCancel = false;
+    private boolean isBinaryProtocol = false;
+    private long backendID;
+    // For parepared statement cached structure,
+    // there are some pre caculated structure in Backend TabletFetch service
+    // using this ID to find for this prepared statement
+    private UUID cacheID;
+
+    public PointQueryExec(Map<SlotRef, Expr> equalPredicats, DescriptorTable 
descTable,
+                    ArrayList<Expr> outputExprs) {
+        this.equalPredicats = equalPredicats;
+        this.descriptorTable = descTable;
+        this.outputExprs = outputExprs;
+    }
+
+    void setAddressAndBackendID(TNetworkAddress addr, long backendID) {
+        this.address = addr;
+        this.backendID = backendID;
+    }
+
+    public void setSerializedDescTable(ByteString serializedDescTable) {
+        this.serializedDescTable = serializedDescTable;
+    }
+
+    public void setSerializedOutputExpr(ByteString serializedOutputExpr) {
+        this.serializedOutputExpr = serializedOutputExpr;
+    }
+
+    public void setCacheID(UUID cacheID) {
+        this.cacheID = cacheID;
+    }
+
+    public void setTabletId(long tabletID) {
+        this.tabletID = tabletID;
+    }
+
+    public void setTimeout(long timeoutMs) {
+        this.timeoutMs = timeoutMs;
+    }
+
+    public void setBinaryProtocol(boolean isBinaryProtocol) {
+        this.isBinaryProtocol = isBinaryProtocol;
+    }
+
+    void addKeyTuples(
+                InternalService.PTabletKeyLookupRequest.Builder 
requestBuilder) {
+        // TODO handle IN predicates
+        KeyTuple.Builder kBuilder = KeyTuple.newBuilder();
+        for (Expr expr : equalPredicats.values()) {
+            LiteralExpr lexpr = (LiteralExpr) expr;
+            kBuilder.addKeyColumnRep(lexpr.getStringValue());
+        }
+        requestBuilder.addKeyTuples(kBuilder);
+    }
+
+    public RowBatch getNext(Status status) throws TException {
+        long timeoutTs = System.currentTimeMillis() + timeoutMs;
+        RowBatch rowBatch = new RowBatch();
+        InternalService.PTabletKeyLookupResponse pResult = null;
+        try {
+            if (serializedDescTable == null) {

Review Comment:
   No,for prepared statement it's only serialized once and will be reused later 
on 



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