Skip to content

Commit f04c185

Browse files
iszhangpchzhangpeicheng
authored andcommitted
[Refactor](meta) Delete useless classes and write methods (apache#36894)
Co-authored-by: zhangpeicheng <[email protected]>
1 parent fef6c7d commit f04c185

30 files changed

+74
-373
lines changed

fe/fe-common/src/main/java/org/apache/doris/common/io/DeepCopy.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public class DeepCopy {
3939
// deep copy orig to dest.
4040
// the param "c" is the implementation class of "dest".
4141
// And the "dest" class must has method "readFields(DataInput)"
42+
@Deprecated
4243
public static boolean copy(Writable orig, Writable dest, Class c, int metaVersion) {
4344
MetaContext metaContext = new MetaContext();
4445
metaContext.setMetaVersion(metaVersion);

fe/fe-core/src/main/java/org/apache/doris/backup/BackupMeta.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ public void write(DataOutput out) throws IOException {
140140
Text.writeString(out, GsonUtils.GSON.toJson(this));
141141
}
142142

143+
@Deprecated
143144
public void readFields(DataInput in) throws IOException {
144145
int size = in.readInt();
145146
for (int i = 0; i < size; i++) {

fe/fe-core/src/main/java/org/apache/doris/catalog/CatalogRecycleBin.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1305,6 +1305,7 @@ public void gsonPostProcess() throws IOException {
13051305
updateDbInfoForLowerVersion();
13061306
}
13071307

1308+
@Deprecated
13081309
public void readFields(DataInput in) throws IOException {
13091310
int count = in.readInt();
13101311
for (int i = 0; i < count; i++) {
@@ -1439,6 +1440,7 @@ public Table getTable() {
14391440
return table;
14401441
}
14411442

1443+
@Deprecated
14421444
public void readFields(DataInput in) throws IOException {
14431445
dbId = in.readLong();
14441446
table = Table.read(in);

fe/fe-core/src/main/java/org/apache/doris/catalog/Column.java

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import org.apache.doris.common.Config;
3030
import org.apache.doris.common.DdlException;
3131
import org.apache.doris.common.io.Text;
32-
import org.apache.doris.common.io.Writable;
3332
import org.apache.doris.common.util.SqlUtils;
3433
import org.apache.doris.persist.gson.GsonPostProcessable;
3534
import org.apache.doris.persist.gson.GsonUtils;
@@ -48,7 +47,6 @@
4847
import org.apache.logging.log4j.Logger;
4948

5049
import java.io.DataInput;
51-
import java.io.DataOutput;
5250
import java.io.IOException;
5351
import java.util.ArrayList;
5452
import java.util.HashSet;
@@ -60,7 +58,7 @@
6058
/**
6159
* This class represents the column-related metadata.
6260
*/
63-
public class Column implements Writable, GsonPostProcessable {
61+
public class Column implements GsonPostProcessable {
6462
private static final Logger LOG = LogManager.getLogger(Column.class);
6563
public static final String DELETE_SIGN = "__DORIS_DELETE_SIGN__";
6664
public static final String WHERE_SIGN = "__DORIS_WHERE_SIGN__";
@@ -1065,33 +1063,7 @@ name, getDefaultValue(), aggregationType, isAggregationTypeImplicit, isKey, isAl
10651063
return ok;
10661064
}
10671065

1068-
@Override
1069-
public void write(DataOutput out) throws IOException {
1070-
String json = GsonUtils.GSON.toJson(this);
1071-
Text.writeString(out, json);
1072-
}
1073-
10741066
@Deprecated
1075-
private void readFields(DataInput in) throws IOException {
1076-
name = Text.readString(in);
1077-
type = ColumnType.read(in);
1078-
boolean notNull = in.readBoolean();
1079-
if (notNull) {
1080-
aggregationType = AggregateType.valueOf(Text.readString(in));
1081-
isAggregationTypeImplicit = in.readBoolean();
1082-
}
1083-
isKey = in.readBoolean();
1084-
isAllowNull = in.readBoolean();
1085-
notNull = in.readBoolean();
1086-
if (notNull) {
1087-
defaultValue = Text.readString(in);
1088-
realDefaultValue = defaultValue;
1089-
}
1090-
stats = ColumnStats.read(in);
1091-
1092-
comment = Text.readString(in);
1093-
}
1094-
10951067
public static Column read(DataInput in) throws IOException {
10961068
String json = Text.readString(in);
10971069
return GsonUtils.GSON.fromJson(json, Column.class);

fe/fe-core/src/main/java/org/apache/doris/catalog/ColumnStats.java

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,19 @@
1919

2020
import org.apache.doris.analysis.Expr;
2121
import org.apache.doris.analysis.SlotRef;
22-
import org.apache.doris.common.io.Writable;
2322

2423
import com.google.common.base.MoreObjects;
2524
import com.google.common.base.Preconditions;
2625
import com.google.gson.annotations.SerializedName;
2726
import org.apache.logging.log4j.LogManager;
2827
import org.apache.logging.log4j.Logger;
2928

30-
import java.io.DataInput;
31-
import java.io.DataOutput;
32-
import java.io.IOException;
3329
import java.util.Objects;
3430

3531
/**
3632
* Statistics for a single column.
3733
*/
38-
public class ColumnStats implements Writable {
34+
public class ColumnStats {
3935
private static final Logger LOG = LogManager.getLogger(ColumnStats.class);
4036

4137
@SerializedName(value = "avgSerializedSize")
@@ -120,26 +116,6 @@ public String toString() {
120116
"numNulls", numNulls).toString();
121117
}
122118

123-
public void write(DataOutput out) throws IOException {
124-
out.writeLong(numDistinctValues);
125-
out.writeFloat(avgSerializedSize);
126-
out.writeLong(maxSize);
127-
out.writeLong(numNulls);
128-
}
129-
130-
public void readFields(DataInput in) throws IOException {
131-
numDistinctValues = in.readLong();
132-
avgSerializedSize = in.readFloat();
133-
maxSize = in.readLong();
134-
numNulls = in.readLong();
135-
}
136-
137-
public static ColumnStats read(DataInput in) throws IOException {
138-
ColumnStats columnStats = new ColumnStats();
139-
columnStats.readFields(in);
140-
return columnStats;
141-
}
142-
143119
@Override
144120
public int hashCode() {
145121
return Objects.hash(avgSerializedSize, maxSize, numDistinctValues, numNulls);

fe/fe-core/src/main/java/org/apache/doris/catalog/DistributionInfo.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ public DistributionDesc toDistributionDesc() {
8484
throw new NotImplementedException("toDistributionDesc not implemented");
8585
}
8686

87+
@Deprecated
8788
public void readFields(DataInput in) throws IOException {
8889
type = DistributionInfoType.valueOf(Text.readString(in));
8990
}

fe/fe-core/src/main/java/org/apache/doris/catalog/HashDistributionInfo.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ public void setBucketNum(int bucketNum) {
6666
this.bucketNum = bucketNum;
6767
}
6868

69+
@Deprecated
6970
@Override
7071
public void readFields(DataInput in) throws IOException {
7172
super.readFields(in);

fe/fe-core/src/main/java/org/apache/doris/catalog/ListPartitionInfo.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ public ListPartitionInfo(boolean isAutoCreatePartitions, ArrayList<Expr> exprs,
6767
}
6868
}
6969

70+
@Deprecated
7071
public static PartitionInfo read(DataInput in) throws IOException {
7172
if (Env.getCurrentEnvJournalVersion() >= FeMetaVersion.VERSION_136) {
7273
return GsonUtils.GSON.fromJson(Text.readString(in), ListPartitionInfo.class);

fe/fe-core/src/main/java/org/apache/doris/catalog/MaterializedIndex.java

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,13 @@
1919

2020
import org.apache.doris.common.FeMetaVersion;
2121
import org.apache.doris.common.io.Text;
22-
import org.apache.doris.common.io.Writable;
2322
import org.apache.doris.persist.gson.GsonPostProcessable;
2423
import org.apache.doris.persist.gson.GsonUtils;
2524

2625
import com.google.common.collect.Lists;
2726
import com.google.gson.annotations.SerializedName;
2827

2928
import java.io.DataInput;
30-
import java.io.DataOutput;
3129
import java.io.IOException;
3230
import java.util.ArrayList;
3331
import java.util.HashMap;
@@ -37,7 +35,7 @@
3735
/**
3836
* The OlapTraditional table is a materialized table which stored as rowcolumnar file or columnar file
3937
*/
40-
public class MaterializedIndex extends MetaObject implements Writable, GsonPostProcessable {
38+
public class MaterializedIndex extends MetaObject implements GsonPostProcessable {
4139
public enum IndexState {
4240
NORMAL,
4341
@Deprecated
@@ -208,11 +206,7 @@ public int getTabletOrderIdx(long tabletId) {
208206
return -1;
209207
}
210208

211-
@Override
212-
public void write(DataOutput out) throws IOException {
213-
Text.writeString(out, GsonUtils.GSON.toJson(this));
214-
}
215-
209+
@Deprecated
216210
public void readFields(DataInput in) throws IOException {
217211
super.readFields(in);
218212

@@ -232,6 +226,7 @@ public void readFields(DataInput in) throws IOException {
232226
rollupFinishedVersion = in.readLong();
233227
}
234228

229+
@Deprecated
235230
public static MaterializedIndex read(DataInput in) throws IOException {
236231
if (Env.getCurrentEnvJournalVersion() < FeMetaVersion.VERSION_136) {
237232
MaterializedIndex mi = new MaterializedIndex();

fe/fe-core/src/main/java/org/apache/doris/catalog/OlapTable.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1559,6 +1559,7 @@ public void write(DataOutput out) throws IOException {
15591559
Text.writeString(out, GsonUtils.GSON.toJson(this));
15601560
}
15611561

1562+
@Deprecated
15621563
@Override
15631564
public void readFields(DataInput in) throws IOException {
15641565
super.readFields(in);
@@ -1796,7 +1797,7 @@ public static OlapTable read(DataInput in) throws IOException {
17961797
t.readFields(in);
17971798
return t;
17981799
}
1799-
return (OlapTable) GsonUtils.GSON.fromJson(Text.readString(in), OlapTable.class);
1800+
return GsonUtils.GSON.fromJson(Text.readString(in), OlapTable.class);
18001801
}
18011802

18021803
/*

0 commit comments

Comments
 (0)