public void copyOnlyForQuery(OlapTable olapTable) {
        olapTable.id = this.id;
        olapTable.name = this.name;
        olapTable.type = this.type;
        olapTable.fullSchema = Lists.newArrayList(this.fullSchema);
        olapTable.nameToColumn = new CaseInsensitiveMap(this.nameToColumn);
        olapTable.idToColumn = new CaseInsensitiveMap(this.idToColumn);
        olapTable.state = this.state;
        olapTable.indexNameToId = Maps.newHashMap(this.indexNameToId);
        olapTable.indexIdToMeta = Maps.newHashMap(this.indexIdToMeta);
        olapTable.indexes = indexes == null ? null : indexes.shallowCopy();
        if (bfColumns != null) {
            olapTable.bfColumns = Sets.newTreeSet(ColumnId.CASE_INSENSITIVE_ORDER);
            olapTable.bfColumns.addAll(bfColumns);
        } else {
            olapTable.bfColumns = null;
        }

        olapTable.keysType = this.keysType;
        if (this.relatedMaterializedViews != null) {
            olapTable.relatedMaterializedViews = Sets.newHashSet(this.relatedMaterializedViews);
        }
        if (this.uniqueConstraints != null) {
            olapTable.uniqueConstraints = Lists.newArrayList(this.uniqueConstraints);
        }
        if (this.foreignKeyConstraints != null) {
            olapTable.foreignKeyConstraints = Lists.newArrayList(this.foreignKeyConstraints);
        }
        if (this.partitionInfo != null) {
            olapTable.partitionInfo = (PartitionInfo) this.partitionInfo.clone();
        }
        if (this.defaultDistributionInfo != null) {
            olapTable.defaultDistributionInfo = this.defaultDistributionInfo.copy();
        }
        Map<Long, Partition> idToPartitions = new HashMap<>(this.idToPartition.size());
        Map<String, Partition> nameToPartitions = Maps.newLinkedHashMap();
        for (Map.Entry<Long, Partition> kv : this.idToPartition.entrySet()) {
            Partition copiedPartition = kv.getValue().shallowCopy();
            idToPartitions.put(kv.getKey(), copiedPartition);
            nameToPartitions.put(kv.getValue().getName(), copiedPartition);
        }
        olapTable.idToPartition = idToPartitions;
        olapTable.nameToPartition = nameToPartitions;
        olapTable.physicalPartitionIdToPartitionId = this.physicalPartitionIdToPartitionId;
        olapTable.physicalPartitionNameToPartitionId = this.physicalPartitionNameToPartitionId;
        olapTable.tempPartitions = new TempPartitions();
        for (Partition tempPartition : this.getTempPartitions()) {
            olapTable.tempPartitions.addPartition(tempPartition.shallowCopy());
        }
        olapTable.baseIndexId = this.baseIndexId;
        if (this.tableProperty != null) {
            olapTable.tableProperty = this.tableProperty.copy();
        }

        // Shallow copy shared data to check whether the copied table has changed or not.
        olapTable.lastSchemaUpdateTime = this.lastSchemaUpdateTime;
        olapTable.sessionId = this.sessionId;

        if (this.bfColumns != null) {
            olapTable.bfColumns = Sets.newHashSet(this.bfColumns);
        }
        olapTable.bfFpp = this.bfFpp;
        if (this.curBinlogConfig != null) {
            olapTable.curBinlogConfig = new BinlogConfig(this.curBinlogConfig);
        }
    }
@Test
    public void testCopyOnlyForQuery() {
        OlapTable olapTable = new OlapTable();
        olapTable.setHasDelete();

        OlapTable copied = new OlapTable();
        olapTable.copyOnlyForQuery(copied);

        Assert.assertEquals(olapTable.hasDelete(), copied.hasDelete());
        Assert.assertEquals(olapTable.hasForbiddenGlobalDict(), copied.hasForbiddenGlobalDict());
        Assert.assertEquals(olapTable, copied);
    }