yujun777 commented on code in PR #62453:
URL: https://github.com/apache/doris/pull/62453#discussion_r3115967801


##########
fe/fe-core/src/main/java/org/apache/doris/catalog/stream/OlapTableStreamWrapper.java:
##########
@@ -0,0 +1,137 @@
+// 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.catalog.stream;
+
+import org.apache.doris.catalog.Column;
+import org.apache.doris.catalog.MaterializedIndexMeta;
+import org.apache.doris.catalog.OlapTable;
+import org.apache.doris.catalog.Partition;
+import org.apache.doris.common.util.Util;
+import org.apache.doris.thrift.TColumn;
+import org.apache.doris.thrift.TPrimitiveType;
+
+import java.util.List;
+
+// runtime-only class for unified query/insert experience, created when bind 
relation with OlapTableStream
+public class OlapTableStreamWrapper extends OlapTable {
+    private OlapTableStream stream;
+    private OlapTable baseTable;
+
+    public OlapTableStreamWrapper(OlapTableStream stream, OlapTable baseTable) 
{
+        super(stream.getId(), stream.getName(), stream.getFullSchema(), 
baseTable.getKeysType(),
+                baseTable.getPartitionInfo(), 
baseTable.getDefaultDistributionInfo());
+        this.stream = stream;
+        this.baseTable = baseTable;
+        this.getOrCreatTableProperty().setEnableUniqueKeyMergeOnWrite(false);
+    }
+
+    @Override
+    public List<Column> getBaseSchema(boolean full) {
+        return baseTable.getBaseSchema(full);
+    }
+
+    @Override
+    public List<Column> getBaseSchema() {
+        return baseTable.getBaseSchema();
+    }
+
+    // for display
+    public String getIndexNameById(long indexId) {
+        // always returns base index name
+        return baseTable.getName();
+    }
+
+    // for olap table to thrift
+    @Override
+    public void getColumnDesc(long selectedIndexId, List<TColumn> columnsDesc, 
List<String> keyColumnNames,
+                              List<TPrimitiveType> keyColumnTypes) {
+        baseTable.getColumnDesc(selectedIndexId, columnsDesc, keyColumnNames, 
keyColumnTypes);
+    }
+
+    @Override
+    public int getIndexSchemaVersion(long indexId) {
+        return baseTable.getIndexSchemaVersion(indexId);
+    }
+
+    // no need for pre agg on olap table stream
+    @Override
+    public boolean isDupKeysOrMergeOnWrite() {
+        return false;
+    }
+
+    @Override
+    public long getBaseIndexId() {
+        return baseTable.getBaseIndexId();
+    }
+
+    @Override
+    public MaterializedIndexMeta getIndexMetaByIndexId(long indexId) {
+        return baseTable.getIndexMetaByIndexId(indexId);
+    }
+
+    @Override
+    public List<Column> getSchemaByIndexId(Long indexId) {
+        // here is base table indexId, we can ignore it and use olap table 
stream schema
+        return getBaseSchema(Util.showHiddenColumns());

Review Comment:
   it may seem a little strange for pass a showHidden flag for the GET 
function,  especial for a wrapper.  it may easily introduce bug for caller.  
can we remove the showHidden flag, and let the caller responsible for deciding 
show it or not ?



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